Files
@ 79bc84310e80
Branch filter:
Location: light9/light8/Fader.py
79bc84310e80
7.3 KiB
text/x-python
changes from tonight's rehearsal:
changes from tonight's rehearsal:
- CueFader is closer to actually running the show, computes DMX levels
to send.
- KeyboardComposer is not a dummy. Use DMXDUMMY=1 to disable it.
- Submaster: subs can now be "temporary" -- i.e. they shouldn't be saved
or loaded. to save a temporary sub, make a copy of it with a proper name
since the computed name will be ugly.
Also, get_normalized_copy() and crossfade() methods added.
linear_fade helper (shouldn't be in Submaster, probably) added too.
- dmxchanedit: longer labels
- cuelist1 now has some bogus data in it and some crap removed
- dmxclient: now listens to the $DMXHOST and $DMXDUMMY env variables.
- patchdata: now up to date with this year's show
- danshow subs song{01..19}: removed. maybe we'll re-add them in an
archive directory.
changes from tonight's rehearsal:
- CueFader is closer to actually running the show, computes DMX levels
to send.
- KeyboardComposer is not a dummy. Use DMXDUMMY=1 to disable it.
- Submaster: subs can now be "temporary" -- i.e. they shouldn't be saved
or loaded. to save a temporary sub, make a copy of it with a proper name
since the computed name will be ugly.
Also, get_normalized_copy() and crossfade() methods added.
linear_fade helper (shouldn't be in Submaster, probably) added too.
- dmxchanedit: longer labels
- cuelist1 now has some bogus data in it and some crap removed
- dmxclient: now listens to the $DMXHOST and $DMXDUMMY env variables.
- patchdata: now up to date with this year's show
- danshow subs song{01..19}: removed. maybe we'll re-add them in an
archive directory.
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 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 | from Tix import *
from time import time # time is on my side
from util import subsetdict
from FlyingFader import FlyingFader
from uihelpers import get_selection
# statuses are:
# stopped - no cue is loaded or cue is stopped
# running - cue is running, not complete
# finished - cue is finished, next is loaded
stdfont = ('Arial', 10)
class Fader(Frame):
'User interface for cue fader'
def __init__(self, master, cues, scalelevels):
self.master = master
self.cues = cues
self.scalelevels = scalelevels
self.time_start = 0
self.init_layout()
self.stop()
def init_layout(self):
Frame.__init__(self, self.master)
# info variables
self.cuename = StringVar()
self.cuelength = DoubleVar()
self.cuetarget = StringVar()
# info about a running cue
self.cuestatus = StringVar() # text description
self.cuestatus.set("stopped")
self.cuepercent = DoubleVar() # percent complete
self.cuepercent.set(0)
self.cuepercent.trace('w', self.update_percent)
self.cuetimeelapse = StringVar() # time elapsed
self.cuetimeelapse.set('0s')
self.cuetimeleft = StringVar() # time left
self.cuetimeleft.set('0s')
buttonframe = Frame(self)
topframe = Frame(self) # to contain cue list and infoframe
infoframe = Frame(topframe)
topframe.pack()
self.listbox = ScrolledListBox(topframe,
command=self.update_selection)
self.listbox.listbox.configure({'exportselection' : 0,
'selectmode' : EXTENDED})
for c in self.cues:
self.listbox.listbox.insert(END, c.name)
self.listbox.pack(side=LEFT)
self.listbox.listbox.bind("<<ListboxSelect>>", self.update_selection,
add=1)
Button(buttonframe, text="Go", command=self.go, font=stdfont,
bg='green').pack(side=LEFT)
Button(buttonframe, text="Stop", command=self.stop, font=stdfont,
bg='red').pack(side=LEFT)
Button(buttonframe, text="Prev", command=self.prev,
font=stdfont).pack(side=LEFT)
nextbutton = Button(buttonframe, text="Next", command=self.next,
font=stdfont)
# Button(buttonframe, text="Load", command=self.mark_start, bg='grey80',
# font=stdfont).pack(side=LEFT)
Label(infoframe, textvariable=self.cuename,
font=('Arial', 12), bg='lightBlue').grid(columnspan=4, sticky=NE+SW)
Label(infoframe, text="Length", font=stdfont,
bg='lightPink').grid(row=1, sticky=NE+SW)
Label(infoframe, textvariable=self.cuelength,
font=stdfont).grid(row=1, column=1, columnspan=3, sticky=NE+SW)
Label(infoframe, text="Target", font=stdfont,
bg='lightPink').grid(row=2, sticky=NE+SW)
Label(infoframe, textvariable=self.cuetarget,
font=stdfont, wraplength=250).grid(row=2, column=1, columnspan=3,
sticky=NE+SW)
Label(infoframe, text="Status", font=stdfont,
bg='lightPink').grid(row=3, sticky=NE+SW)
Label(infoframe, textvariable=self.cuestatus,
font=stdfont).grid(row=3, column=1, columnspan=3, sticky=NE+SW)
Label(infoframe, text="Time Elapsed", font=stdfont,
bg='lightPink').grid(row=4, sticky=NE+SW)
Label(infoframe, textvariable=self.cuetimeelapse,
font=stdfont).grid(row=4, column=1, sticky=NE+SW)
Label(infoframe, text="Time Remain", font=stdfont,
bg='lightPink').grid(row=4, column=2, sticky=NE+SW)
Label(infoframe, textvariable=self.cuetimeleft,
font=stdfont).grid(row=4, column=3, sticky=NE+SW)
Label(infoframe, text="Percent Complete", font=stdfont,
bg='lightPink').grid(row=5, column=0, sticky=NE+SW)
self.percentlabel = Label(infoframe,
font=stdfont)
self.percentlabel.grid(row=5, column=1, columnspan=3, sticky=NE+SW)
# s = Scale(infoframe, variable=self.cuepercent,
s = Scale(buttonframe, variable=self.cuepercent,
showvalue=0, length=220,
width=18, sliderlength=30,
to=100,res=.1,from_=0,bd=1, font=stdfont,
orient='horiz')
# s.grid(row=6, columnspan=4, sticky='ew')
nextbutton.pack(side=RIGHT)
s.pack(side=RIGHT, expand=1, fill=X)
infoframe.pack(side=RIGHT, fill=BOTH, expand=1)
buttonframe.pack(side=BOTTOM, expand=1, fill=X)
self.listbox.listbox.select_set(0)
self.update_selection()
def mark_start(self):
self.time_start = time()
startlevels = dict([(k, v.get()) for k, v in self.scalelevels.items()])
# print "going to mark with", startlevels
self.current.start(startlevels, self.time_start)
def update_percent(self, *args):
if self.cuestatus.get() != 'running':
self.cuestatus.set("running")
self.mark_start()
percent = self.cuepercent.get()
self.percentlabel.config(text='%.1f%%' % percent)
percent /= 100
elapsed = percent * self.current.dur
self.cuetimeelapse.set('%.1fs' % elapsed)
self.cuetimeleft.set('%.1fs' % (self.current.dur - elapsed))
newlevels = self.current.get_levels(self.time_start + elapsed)
# print "newlevels", newlevels
for ch, lev in newlevels.items():
try:
self.scalelevels[ch].set(lev)
except KeyError:
pass
def update_selection(self, *args):
self.cuestatus.set('stopped')
selection = get_selection(self.listbox.listbox)
self.current = self.cues[selection]
self.cuename.set(self.current.name)
self.cuelength.set(self.current.dur)
target = ', '.join(['%s -> %.2f' % (n, lev)
for n, lev in self.current.get_end_levels().items()])
self.cuetarget.set(target)
self.cuetimeelapse.set('0s')
self.cuetimeleft.set('%.1fs' % self.current.dur)
self.cuepercent.set(0)
def go(self):
self.update_selection()
self.cuestatus.set("running")
self.mark_start()
self.running_loop()
def stop(self):
self.cuestatus.set('stopped')
def prev(self):
self.stop()
selection = get_selection(self.listbox.listbox)
if selection != 0:
self.listbox.listbox.select_clear(selection)
self.listbox.listbox.select_set(selection - 1)
self.update_selection()
self.mark_start()
def next(self):
self.stop()
selection = get_selection(self.listbox.listbox)
if selection != self.listbox.listbox.size() - 1:
self.listbox.listbox.select_clear(selection)
self.listbox.listbox.select_set(selection + 1)
self.update_selection()
self.mark_start()
def running_loop(self):
if self.cuestatus.get() == 'stopped':
return
curtime = time()
elapsed = (curtime - self.time_start)
if elapsed > self.current.dur:
self.cuestatus.set('stopped')
self.cuepercent.set(100)
# advance cues if okay
self.next()
return
self.cuepercent.set(100 * elapsed / self.current.dur)
self.after(30, self.running_loop)
|