changeset 139:83e2c4ceb79a

KeyboardComposer: let's get it working again KeyboardComposer: let's get it working again TheShow: get_timelines method Timeline: it's late, okay? TimelineDMX: timeline selector, basically copied from that music player thing
author dmcc
date Sat, 14 Jun 2003 16:19:40 +0000
parents 304152488ed7
children 8e6165bc1ca5
files flax/KeyboardComposer.py flax/TheShow.py flax/Timeline.py flax/TimelineDMX.py
diffstat 4 files changed, 28 insertions(+), 17 deletions(-) [+]
line wrap: on
line diff
--- a/flax/KeyboardComposer.py	Sat Jun 14 16:01:31 2003 +0000
+++ b/flax/KeyboardComposer.py	Sat Jun 14 16:19:40 2003 +0000
@@ -189,7 +189,7 @@
             self.after(10, self.send_frequent_updates)
     def send_levels(self):
         levels = self.get_dmx_list()
-        # dmxclient.outputlevels(levels)
+        dmxclient.outputlevels(levels)
         # print "sending levels", levels
     def send_levels_loop(self):
         self.send_levels()
--- a/flax/TheShow.py	Sat Jun 14 16:01:31 2003 +0000
+++ b/flax/TheShow.py	Sat Jun 14 16:19:40 2003 +0000
@@ -1,5 +1,3 @@
-
-
 from Timeline import *
 from Submaster import Submasters, sub_maxes
 
@@ -36,6 +34,9 @@
         "set time of current timeline"
         self.current_time = time
         self.current_timeline.set_time(time)
+    def get_timelines(self):
+        "Get names of all timelines"
+        return self.timelines.keys()
 
 # this is the default blender
 linear = LinearBlender()
--- a/flax/Timeline.py	Sat Jun 14 16:01:31 2003 +0000
+++ b/flax/Timeline.py	Sat Jun 14 16:19:40 2003 +0000
@@ -168,7 +168,7 @@
         """This makes sure all events are in the right order and have defaults
         filled in if they have missing frames."""
         self.events.sort()
-        self.fill_in_missing frames()
+        self.fill_in_missing_frames()
     def add_event(self, event):
         """Add a TimedEvent object to this TimelineTrack"""
         self.events.append(event)
@@ -188,7 +188,7 @@
         self.events = [e for e in self.events
             if e.time >= starttime and e.time <= endtime]
         self._cleaup_events(self.events)
-    def fill_in_missing frames(self):
+    def fill_in_missing_frames(self):
         """Runs through all events and sets TimedEvent with missing frames to
         the default frame."""
         for event in self.events:
--- a/flax/TimelineDMX.py	Sat Jun 14 16:01:31 2003 +0000
+++ b/flax/TimelineDMX.py	Sat Jun 14 16:19:40 2003 +0000
@@ -1,27 +1,34 @@
 import sys, time, socket
 sys.path.append("../light8")
+import Tix as tk
 
 import Patch, Timeline, dmxclient, xmlrpclib
 import TheShow
 
 Patch.reload_data()
 
-class ShowRunner:
-    def __init__(self, show):
+class ShowRunner(tk.Frame):
+    def __init__(self, master, show):
+        tk.Frame.__init__(self, master)
+        self.master = master
+
         self.show = show
         self.find_player()
+        self.build_timeline_list()
+    def build_timeline_list(self):
+        self.tl_list = tk.Frame(self)
+        for tl in self.show.get_timelines():
+            b=tk.Button(self.tl_list,text=tl,
+                        anchor='w',pady=1)
+            b.config(command=lambda tl=tl: self.set_timeline(tl))
+            b.pack(side='top',fill='x')
+        self.tl_list.pack()
+    def set_timeline(self, tlname):
+        print "TimelineDMX: set timeline to", tlname
+        self.show.set_timeline(tlname)
     def find_player(self):
         self.player = xmlrpclib.Server("http://localhost:8040")
     def send_levels(self):
-        """
-        sub = self.show.get_levels() # gets levels of subs
-        leveldict = sub.get_levels() # gets levels of sub contents
-        print 'resolved levels', leveldict
-
-        levels = [0] * 68
-        for k, v in leveldict.items():
-            levels[Patch.get_dmx_channel(k)] = v
-        """
         levels = self.show.calc_active_submaster().get_dmx_list()
         
         dmxclient.outputlevels(levels)
@@ -38,10 +45,13 @@
                 self.sync_times()
                 self.send_levels()
                 time.sleep(0.01)
+                self.master.update()
         except KeyboardInterrupt:
             sys.exit(0)
 
 if __name__ == "__main__":
-    s = ShowRunner(TheShow.show)
+    root = tk.Tk()
+    s = ShowRunner(root, TheShow.show)
     s.show.set_timeline('strobe test')
+    s.pack()
     s.mainloop()