Mercurial > code > home > repos > light9
annotate light8/panels.py @ 151:990a9474d0e7
early cue stuff. the CueList will supply the CueFader with the cues to
early cue stuff. the CueList will supply the CueFader with the cues to
work with, and will do crossfading sooner or later. the format of cues
is still very open. cuelist1 is a bogus cuelist for testing.
author | dmcc |
---|---|
date | Sun, 06 Jul 2003 16:33:06 +0000 |
parents | 115dd48e15a9 |
children |
rev | line source |
---|---|
0 | 1 """some of the panels""" |
48
2ef72bb3a707
finished the re-class of Console so it can make new subs again
drewp
parents:
43
diff
changeset
|
2 from __future__ import nested_scopes |
0 | 3 |
51
71489bb71528
- Meet Fader. He is going to grow up and be a crossfader some day
dmcc
parents:
48
diff
changeset
|
4 from Tix import * |
0 | 5 from uihelpers import * |
6 import Patch | |
19 | 7 from FlyingFader import FlyingFader |
0 | 8 |
9 stdfont = ('Arial', 8) | |
10 monofont = ('Courier', 8) | |
11 | |
12 class Controlpanel(Frame): | |
107 | 13 def __init__(self, parent, xfader, refresh_cb, quit_cb, jostle_cb, |
108
115dd48e15a9
latest changes. couldn't commit lightboard for some reason
dmcc
parents:
107
diff
changeset
|
14 whatsup_cb=None): |
102 | 15 Frame.__init__(self,parent, bg='black') |
26 | 16 controlpanel = self |
0 | 17 for txt,cmd in ( |
18 ('Quit', quit_cb), | |
19 ('Refresh', refresh_cb), | |
20 ('Clear all', xfader.clearallbuttons), | |
21 ('On -> X', lambda: xfader.grab('x')), | |
22 ('Clear X', lambda: xfader.clearallbuttons('x')), | |
23 ('On -> Y', lambda: xfader.grab('y')), | |
107 | 24 ('Clear Y', lambda: xfader.clearallbuttons('y')), |
25 ("What's up?", whatsup_cb)): | |
102 | 26 Button(controlpanel, text=txt, command=cmd, bg='black', |
108
115dd48e15a9
latest changes. couldn't commit lightboard for some reason
dmcc
parents:
107
diff
changeset
|
27 fg='white',font=stdfont, padx=0, pady=0).pack(side='top', fill='x') |
78
0969d8a6729d
support for external sliders. fill in ExternalInput with real IO
dmcc
parents:
74
diff
changeset
|
28 # jostle button |
102 | 29 Checkbutton(controlpanel, text="Jostle", bg='black', fg='white', |
74 | 30 command=jostle_cb).pack(side=TOP, fill=X) |
0 | 31 |
32 class Console: | |
53 | 33 def __init__(self,lightboard): |
78
0969d8a6729d
support for external sliders. fill in ExternalInput with real IO
dmcc
parents:
74
diff
changeset
|
34 t=toplevelat('console') |
102 | 35 self.frame = Frame(t, bg='black') |
36 self.entry=Entry(self.frame, bg='black', fg='white') | |
0 | 37 self.entry.pack(expand=1, fill='x') |
48
2ef72bb3a707
finished the re-class of Console so it can make new subs again
drewp
parents:
43
diff
changeset
|
38 self.entry.bind('<Return>', |
2ef72bb3a707
finished the re-class of Console so it can make new subs again
drewp
parents:
43
diff
changeset
|
39 lambda evt: self.execute(evt, self.entry.get())) |
0 | 40 self.frame.pack(fill=BOTH, expand=1) |
53 | 41 self.lightboard=lightboard |
0 | 42 |
48
2ef72bb3a707
finished the re-class of Console so it can make new subs again
drewp
parents:
43
diff
changeset
|
43 def execute(self, evt, str): |
53 | 44 if str[0] == '*': # make a new sub from the current levels |
45 self.lightboard.save_sub(str,self.lightboard.stageassub()) | |
0 | 46 else: |
47 print '>>>', str | |
48 print eval(str) | |
53 | 49 self.frame.focus() |
48
2ef72bb3a707
finished the re-class of Console so it can make new subs again
drewp
parents:
43
diff
changeset
|
50 |
0 | 51 class Leveldisplay: |
26 | 52 def __init__(self, parent, channel_levels, num_channels=68): |
0 | 53 frames = (make_frame(parent), make_frame(parent)) |
16 | 54 channel_levels[:]=[] |
34
411de8b46aef
the famous you-are-in-the-process-of-changing-this-light indicator.
dmcc
parents:
32
diff
changeset
|
55 self.number_labels = [] |
26 | 56 for channel in range(1, num_channels+1): |
57 | |
58 # frame for this channel | |
59 f = Frame(frames[channel > (num_channels/2)]) | |
60 # channel number -- will turn yellow when being altered | |
102 | 61 num_lab = Label(f, text=str(channel), width=3, bg='grey40', |
62 fg='white', font=stdfont, padx=0, pady=0, bd=0, height=1) | |
26 | 63 num_lab.pack(side='left') |
34
411de8b46aef
the famous you-are-in-the-process-of-changing-this-light indicator.
dmcc
parents:
32
diff
changeset
|
64 self.number_labels.append(num_lab) |
26 | 65 |
66 # text description of channel | |
67 Label(f, text=Patch.get_channel_name(channel), width=8, | |
68 font=stdfont, anchor='w', padx=0, pady=0, bd=0, | |
102 | 69 height=1, bg='black', fg='white').pack(side='left') |
26 | 70 |
71 # current level of channel, shows intensity with color | |
72 l = Label(f, width=3, bg='lightBlue', font=stdfont, anchor='e', | |
73 padx=1, pady=0, bd=0, height=1) | |
0 | 74 l.pack(side='left') |
75 colorlabel(l) | |
76 channel_levels.append(l) | |
77 f.pack(side='top') | |
26 | 78 |
79 self.channel_levels = channel_levels | |
80 # channel_levels is an output - changelevel will use it to access | |
81 # these labels | |
0 | 82 |
83 class Subpanels: | |
69 | 84 def __init__(self, scenesparent, effectsparent, scenes, lightboard, |
53 | 85 scalelevels, Subs, xfader, |
86 changelevel, subediting, longestname): | |
0 | 87 |
88 sublist = Subs.subs.items() | |
89 sublist.sort() | |
90 | |
69 | 91 for p in scenesparent,effectsparent,scenes: |
102 | 92 sw = ScrolledWindow(p, bg='black') |
61 | 93 for but,units in ( (4,-4),(5,4) ): |
94 sw.window.bind("<ButtonPress-%s>"%but,lambda ev,s=sw.vsb,u=units: s.tk.call('tkScrollByUnits',s,'hv',u)) | |
95 | |
60 | 96 sw.pack(expand=1,fill=BOTH) |
97 if p==scenesparent: | |
98 scenesparent = sw.window | |
69 | 99 elif p==effectsparent: |
100 effectsparent = sw.window | |
60 | 101 else: |
69 | 102 scenes=sw.window |
60 | 103 |
0 | 104 for name, sub in sublist: |
30
e9d2e7754fd9
sideways subs, new x/y buttons (which don't draw right, but they work)
drewp
parents:
26
diff
changeset
|
105 # choose one of the sub panels to add to |
0 | 106 if sub.is_effect: |
107 parent=effectsparent | |
30
e9d2e7754fd9
sideways subs, new x/y buttons (which don't draw right, but they work)
drewp
parents:
26
diff
changeset
|
108 side1='bottom' |
48
2ef72bb3a707
finished the re-class of Console so it can make new subs again
drewp
parents:
43
diff
changeset
|
109 side2='left' |
38 | 110 orient1='vert' |
32 | 111 end1=0 |
112 end2=1 | |
38 | 113 width1=len(name) |
69 | 114 elif name.startswith("*") and name[1].isdigit(): |
115 parent=scenes | |
116 side1='right' | |
117 side2='top' | |
118 orient1='horiz' | |
119 end1=1 | |
120 end2=0 | |
121 width1=longestname | |
0 | 122 else: |
123 parent=scenesparent | |
30
e9d2e7754fd9
sideways subs, new x/y buttons (which don't draw right, but they work)
drewp
parents:
26
diff
changeset
|
124 side1='right' |
48
2ef72bb3a707
finished the re-class of Console so it can make new subs again
drewp
parents:
43
diff
changeset
|
125 side2='top' |
38 | 126 orient1='horiz' |
32 | 127 end1=1 |
128 end2=0 | |
38 | 129 width1=longestname |
0 | 130 |
30
e9d2e7754fd9
sideways subs, new x/y buttons (which don't draw right, but they work)
drewp
parents:
26
diff
changeset
|
131 # make frame that surrounds the whole submaster |
102 | 132 f=Frame(parent, bd=1, relief='raised', bg='black') |
48
2ef72bb3a707
finished the re-class of Console so it can make new subs again
drewp
parents:
43
diff
changeset
|
133 f.pack(fill='both',exp=1,side=side2) |
60 | 134 |
0 | 135 |
53 | 136 # make DoubleVar (there might be one left around from |
137 # before a refresh) | |
0 | 138 if name not in scalelevels: |
101 | 139 # scalelevels[name]=FancyDoubleVar() |
140 scalelevels[name]=DoubleVar() | |
0 | 141 |
142 sub.set_slider_var(scalelevels[name]) | |
143 | |
53 | 144 scaleopts = {'troughcolor' : 'grey70'} |
0 | 145 if sub.color: |
146 scaleopts['troughcolor'] = sub.color | |
19 | 147 |
148 s = FlyingFader(f, label=str(name), variable=scalelevels[name], | |
60 | 149 showvalue=0, length=100, |
53 | 150 width=14, sliderlength=14, |
151 to=end1,res=.001,from_=end2,bd=1, font=stdfont, | |
38 | 152 orient=orient1, |
153 labelwidth=width1, | |
30
e9d2e7754fd9
sideways subs, new x/y buttons (which don't draw right, but they work)
drewp
parents:
26
diff
changeset
|
154 **scaleopts) |
102 | 155 s.configure(bg='black') |
156 s.label.configure(bg='black', fg='white') | |
157 s.vlabel.configure(bg='black', fg='white') | |
158 s.scale.configure(bg='black', fg='white') | |
0 | 159 |
60 | 160 # tell subediting what widgets to highlight when it's |
53 | 161 # editing a sub |
162 for w in (s,s.label,s.vlabel, s.scale): | |
163 subediting.register(subname=name,widget=w) | |
38 | 164 |
53 | 165 if not sub.is_effect: |
166 self.subeditingbuttons(f,side1,sub,name,lightboard,subediting) | |
167 | |
168 self.axisbuttons(f,s,xfader,stdfont,side1,name) | |
0 | 169 |
60 | 170 s.pack(side='left', fill=BOTH, expand=1) |
0 | 171 |
172 # effects frame? | |
173 sframe = Frame(f,bd=2,relief='groove') | |
174 sub.draw_tk(sframe) | |
175 sframe.pack(side='left',fill='y') | |
53 | 176 |
177 def subediting_edit(self,subediting,sub): | |
178 subediting.setsub(sub) | |
179 | |
180 def subediting_save(self,name,sub,lightboard): | |
68 | 181 lightboard.save_sub(name,sub.getlevels(),refresh=0) |
53 | 182 |
183 def subeditingbuttons(self,f,side1,sub,name,lightboard,subediting): | |
184 for txt,cmd in (("Edit",lambda subediting=subediting,sub=sub: self.subediting_edit(subediting,sub)), | |
66
8b6befd8b97e
new 'save stage' button which saves a new copy of the sub with whatever's visible on the stage (!)
drewp
parents:
61
diff
changeset
|
185 ("Save",lambda sub=sub,name=name,lightboard=lightboard: self.subediting_save(name,sub,lightboard)), |
68 | 186 ("SaveStg",lambda l=lightboard,name=name: l.save_sub(name,l.stageassub(),refresh=1)), |
66
8b6befd8b97e
new 'save stage' button which saves a new copy of the sub with whatever's visible on the stage (!)
drewp
parents:
61
diff
changeset
|
187 ): |
53 | 188 eb = Button(f,text=txt,font=stdfont,padx=0,pady=0, |
102 | 189 bd=1,command=cmd, bg='black', fg='white') |
53 | 190 eb.pack(side=side1,fill='both',padx=0,pady=0) |
191 | |
192 def axisbuttons(self,f,s,xfader,stdfont,side1,name): | |
193 for axis in ('y','x'): | |
194 cvar=IntVar() | |
195 eb_color = ('red', 'green')[axis == 'y'] | |
196 cb=Togglebutton(f,text=axis.upper(),variable=cvar,font=stdfont, | |
102 | 197 padx=3, pady=0, bd=1, downcolor=eb_color, |
198 bg='black', fg='white') | |
53 | 199 cb.pack(side=side1,fill='both', padx=0, pady=0) |
200 s.bind('<Key-%s>'%axis, lambda ev,cb=cb: cb.invoke) | |
201 xfader.registerbutton(name,axis,cvar) |