Files
@ 94b58da02abc
Branch filter:
Location: light9/flax/TimelineDMX.py-merge - annotation
94b58da02abc
4.3 KiB
text/plain
switch to udmx
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 | 851cf44cea40 851cf44cea40 851cf44cea40 851cf44cea40 851cf44cea40 851cf44cea40 851cf44cea40 851cf44cea40 851cf44cea40 851cf44cea40 851cf44cea40 851cf44cea40 851cf44cea40 851cf44cea40 851cf44cea40 851cf44cea40 851cf44cea40 851cf44cea40 851cf44cea40 851cf44cea40 851cf44cea40 851cf44cea40 851cf44cea40 851cf44cea40 851cf44cea40 851cf44cea40 851cf44cea40 851cf44cea40 851cf44cea40 851cf44cea40 851cf44cea40 851cf44cea40 851cf44cea40 851cf44cea40 851cf44cea40 851cf44cea40 851cf44cea40 851cf44cea40 851cf44cea40 851cf44cea40 851cf44cea40 851cf44cea40 851cf44cea40 851cf44cea40 851cf44cea40 851cf44cea40 851cf44cea40 851cf44cea40 851cf44cea40 851cf44cea40 851cf44cea40 851cf44cea40 851cf44cea40 851cf44cea40 851cf44cea40 851cf44cea40 851cf44cea40 851cf44cea40 851cf44cea40 851cf44cea40 851cf44cea40 851cf44cea40 851cf44cea40 851cf44cea40 851cf44cea40 851cf44cea40 851cf44cea40 851cf44cea40 851cf44cea40 851cf44cea40 851cf44cea40 851cf44cea40 851cf44cea40 851cf44cea40 851cf44cea40 851cf44cea40 851cf44cea40 851cf44cea40 851cf44cea40 851cf44cea40 851cf44cea40 851cf44cea40 851cf44cea40 851cf44cea40 851cf44cea40 851cf44cea40 851cf44cea40 851cf44cea40 851cf44cea40 851cf44cea40 851cf44cea40 851cf44cea40 851cf44cea40 851cf44cea40 851cf44cea40 851cf44cea40 851cf44cea40 851cf44cea40 851cf44cea40 851cf44cea40 851cf44cea40 851cf44cea40 851cf44cea40 851cf44cea40 851cf44cea40 851cf44cea40 851cf44cea40 851cf44cea40 851cf44cea40 851cf44cea40 851cf44cea40 851cf44cea40 851cf44cea40 851cf44cea40 851cf44cea40 851cf44cea40 851cf44cea40 851cf44cea40 851cf44cea40 851cf44cea40 851cf44cea40 851cf44cea40 851cf44cea40 851cf44cea40 851cf44cea40 851cf44cea40 851cf44cea40 851cf44cea40 851cf44cea40 851cf44cea40 851cf44cea40 851cf44cea40 851cf44cea40 851cf44cea40 851cf44cea40 851cf44cea40 851cf44cea40 851cf44cea40 851cf44cea40 851cf44cea40 851cf44cea40 851cf44cea40 851cf44cea40 851cf44cea40 851cf44cea40 | import sys, time, socket
sys.path.append("../light8")
import Tix as tk
import Patch, Timeline, dmxclient, xmlrpclib
import TheShow
Patch.reload_data()
<<<<<<< TimelineDMX.py
class ShowRunner(tk.Frame):
def __init__(self, master):
tk.Frame.__init__(self, master)
self.master = master
self.lastsenttime=0 # time of last send to dmx server
self.lastsentlevels=None # levels last sent to dmx server
self.show = TheShow.show
=======
class ShowRunner(tk.Frame):
def __init__(self, master, show):
tk.Frame.__init__(self, master)
self.master = master
self.show = show
>>>>>>> 1.2
self.find_player()
<<<<<<< TimelineDMX.py
self.draw_ui()
def draw_ui(self):
self.build_timeline_list()
self.draw_buttons()
def draw_buttons(self):
self.buttonframe = tk.Frame(self, bd=2, relief='raised')
self.refreshbutton = tk.Button(self.buttonframe, command=self.refresh,
text="Refresh", bg='blue')
self.refreshbutton.pack()
self.nothing = tk.Button(self.buttonframe, \
command=lambda: self.set_timeline(None), text="Nothing", \
bg='red')
self.nothing.pack()
self.buttonframe.pack()
def build_timeline_list(self):
self.tl_list = tk.Frame(self)
timelines = self.show.get_timelines()
timelines.sort()
for tl in 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)
=======
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)
>>>>>>> 1.2
def find_player(self):
self.player = xmlrpclib.Server("http://dash:8040")
def send_levels(self):
<<<<<<< TimelineDMX.py
try:
# avoid sending the same levels too often (send only
# when there's a change, or if a second has passed)
levels = self.show.calc_active_submaster().get_dmx_list()
if levels!=self.lastsentlevels or time.time()>self.lastsenttime+1:
dmxclient.outputlevels(levels)
self.lastsentlevels=levels[:]
self.lastsenttime=time.time()
except AttributeError: # hackified!
pass
=======
levels = self.show.calc_active_submaster().get_dmx_list()
dmxclient.outputlevels(levels)
>>>>>>> 1.2
def sync_times(self):
try:
playtime = self.player.gettime()
self.show.set_time(playtime)
except socket.error, e:
print "Server error %s, waiting"%e
time.sleep(2)
def mainloop(self):
try:
while 1:
self.sync_times()
self.send_levels()
time.sleep(0.01)
self.master.update()
except KeyboardInterrupt:
sys.exit(0)
def refresh(self):
print "refresh..."
# :)
# print "reserved for future feature"
import TheShow
self.show = TheShow.show
self.tl_list.destroy()
self.buttonframe.destroy()
self.draw_ui()
if __name__ == "__main__":
<<<<<<< TimelineDMX.py
root = tk.Tk()
s = ShowRunner(root)
# s.show.set_timeline('song01')
s.pack()
import atexit
def stop_sending_levels():
s.set_timeline(None)
dmxclient.outputlevels([])
atexit.register(stop_sending_levels)
import sys
try:
timelinename = sys.argv[1]
s.set_timeline(timelinename)
root.withdraw()
except: # uh oh
pass
=======
root = tk.Tk()
s = ShowRunner(root, TheShow.show)
s.show.set_timeline('strobe test')
s.pack()
>>>>>>> 1.2
s.mainloop()
|