Mercurial > code > home > repos > light9
annotate flax/dmxchanedit.py @ 167:79bc84310e80
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.
author | dmcc |
---|---|
date | Tue, 08 Jul 2003 16:19:55 +0000 |
parents | 6dfe10a54fc4 |
children | e4a711d9a338 |
rev | line source |
---|---|
0 | 1 """ |
2 | |
3 widget to show all dmx channel levels and allow editing. levels might | |
4 not actually match what dmxserver is outputting. | |
5 | |
6 """ | |
7 from __future__ import nested_scopes,division | |
8 import Tkinter as tk | |
9 import sys | |
10 sys.path.append("../light8") | |
11 import Patch | |
12 from uihelpers import make_frame, colorlabel, eventtoparent | |
128
6dfe10a54fc4
new program to adjust indiv dmx channels and save the settings as new submasters
drewp
parents:
0
diff
changeset
|
13 import dispatcher |
0 | 14 |
15 stdfont = ('Arial', 10) | |
16 | |
17 class Onelevel(tk.Frame): | |
18 """a name/level pair""" | |
19 def __init__(self, parent, channelnum): | |
20 """channelnum is 1..68, like the real dmx""" | |
21 tk.Frame.__init__(self,parent) | |
22 | |
23 self.channelnum=channelnum | |
24 self.currentlevel=0 # the level we're displaying, 0..1 | |
25 | |
26 # 3 widgets, left-to-right: | |
27 | |
28 # channel number -- will turn yellow when being altered | |
29 self.num_lab = tk.Label(self, text=str(channelnum), | |
30 width=3, bg='grey40', | |
31 fg='white', font=stdfont, | |
32 padx=0, pady=0, bd=0, height=1) | |
33 self.num_lab.pack(side='left') | |
34 | |
35 # text description of channel | |
36 self.desc_lab=tk.Label(self, text=Patch.get_channel_name(channelnum), | |
167 | 37 width=14, font=stdfont, anchor='w', |
0 | 38 padx=0, pady=0, bd=0, |
39 height=1, bg='black', fg='white') | |
40 self.desc_lab.pack(side='left') | |
41 | |
42 # current level of channel, shows intensity with color | |
43 self.level_lab = tk.Label(self, width=3, bg='lightBlue', | |
44 font=stdfont, anchor='e', | |
45 padx=1, pady=0, bd=0, height=1) | |
46 self.level_lab.pack(side='left') | |
47 | |
48 self.setlevel(0) | |
49 self.setupmousebindings() | |
50 | |
51 def setupmousebindings(self): | |
52 def b1down(ev): | |
53 self.desc_lab.config(bg='cyan') | |
54 self._start_y=ev.y | |
55 self._start_lev=self.currentlevel | |
56 # self.bind("<ButtonPress-1>",b1down) | |
57 def b1motion(ev): | |
58 delta=self._start_y-ev.y | |
59 self.changelevel(self._start_lev+delta*.005) | |
60 # self.bind("<B1-Motion>",b1motion) | |
61 def b1up(ev): | |
62 self.desc_lab.config(bg='black') | |
63 # self.bind("<B1-ButtonRelease>",b1up) | |
64 | |
65 # make the buttons work in the child windows | |
66 for w in self.winfo_children(): | |
67 for e,func in (('<ButtonPress-1>',b1down), | |
68 ('<B1-Motion>',b1motion), | |
69 ('<ButtonRelease-1>',b1up)): | |
70 w.bind(e,func) | |
71 # w.bind(e,lambda ev,e=e: eventtoparent(ev,e)) | |
72 | |
73 def colorlabel(self): | |
74 """color the level label based on its own text (which is 0..100)""" | |
75 txt=self.level_lab['text'] or "0" | |
76 lev=float(txt)/100 | |
77 low=(80,80,180) | |
78 high=(255,55,050) | |
79 out = [int(l+lev*(h-l)) for h,l in zip(high,low)] | |
80 col="#%02X%02X%02X" % tuple(out) | |
81 self.level_lab.config(bg=col) | |
82 | |
83 def setlevel(self,newlev): | |
84 """the main program is telling us to change our | |
85 display. newlev is 0..1""" | |
86 self.currentlevel=newlev | |
87 newlev="%d"%(newlev*100) | |
88 olddisplay=self.level_lab.cget('text') | |
89 if newlev!=olddisplay: | |
90 self.level_lab.config(text=newlev) | |
91 self.colorlabel() | |
92 | |
93 def getlevel(self): | |
94 """returns currently displayed level, 0..1""" | |
95 return self.currentlevel | |
96 | |
97 def changelevel(self,newlev): | |
98 | |
99 """the user is adjusting the level on this widget. the main | |
100 program needs to hear about it. then the main program will | |
101 call setlevel()""" | |
102 | |
103 dispatcher.send("levelchanged",channel=self.channelnum,newlevel=newlev) | |
104 | |
105 class Levelbox(tk.Frame): | |
106 def __init__(self, parent, num_channels=68): | |
107 tk.Frame.__init__(self,parent) | |
108 | |
109 self.levels = [] # Onelevel objects | |
110 | |
111 frames = (make_frame(self), make_frame(self)) | |
112 | |
113 for channel in range(1, num_channels+1): | |
114 | |
115 # frame for this channel | |
116 f = Onelevel(frames[channel > (num_channels/2)],channel) | |
117 | |
118 self.levels.append(f) | |
119 f.pack(side='top') | |
120 | |
121 #dispatcher.connect(setalevel,"setlevel") | |
122 | |
123 def setlevels(self,newlevels): | |
124 """sets levels to the new list of dmx levels (0..1). list can | |
125 be any length""" | |
126 for l,newlev in zip(self.levels,newlevels): | |
127 l.setlevel(newlev) |