Mercurial > code > home > repos > light9
annotate light8/panels.py @ 53:032b2b67bc10
result of July 7th on-site editing
author | dmcc |
---|---|
date | Mon, 08 Jul 2002 14:31:20 +0000 |
parents | 065896b0913c |
children | f177a2ff34f5 |
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 |
30
e9d2e7754fd9
sideways subs, new x/y buttons (which don't draw right, but they work)
drewp
parents:
26
diff
changeset
|
8 import Pmw |
0 | 9 |
10 stdfont = ('Arial', 8) | |
11 monofont = ('Courier', 8) | |
12 | |
13 class Controlpanel(Frame): | |
26 | 14 def __init__(self, parent, xfader, refresh_cb, quit_cb): |
12
7adc65771676
big restructuring - moved lots of things (including most panels) to other files
drewp
parents:
0
diff
changeset
|
15 Frame.__init__(self,parent) |
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')), | |
12
7adc65771676
big restructuring - moved lots of things (including most panels) to other files
drewp
parents:
0
diff
changeset
|
24 ('Clear Y', lambda: xfader.clearallbuttons('y'))): |
26 | 25 Button(controlpanel, text=txt, command=cmd).pack(side='top', |
26 fill='x') | |
0 | 27 |
28 class Console: | |
53 | 29 def __init__(self,lightboard): |
12
7adc65771676
big restructuring - moved lots of things (including most panels) to other files
drewp
parents:
0
diff
changeset
|
30 print "Light 8: Everything's under control" |
7adc65771676
big restructuring - moved lots of things (including most panels) to other files
drewp
parents:
0
diff
changeset
|
31 t=toplevelat(267,717,w=599,h=19) |
7adc65771676
big restructuring - moved lots of things (including most panels) to other files
drewp
parents:
0
diff
changeset
|
32 self.frame = Frame(t) |
7adc65771676
big restructuring - moved lots of things (including most panels) to other files
drewp
parents:
0
diff
changeset
|
33 self.entry=Entry(self.frame) |
0 | 34 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
|
35 self.entry.bind('<Return>', |
2ef72bb3a707
finished the re-class of Console so it can make new subs again
drewp
parents:
43
diff
changeset
|
36 lambda evt: self.execute(evt, self.entry.get())) |
0 | 37 self.frame.pack(fill=BOTH, expand=1) |
53 | 38 self.lightboard=lightboard |
0 | 39 |
48
2ef72bb3a707
finished the re-class of Console so it can make new subs again
drewp
parents:
43
diff
changeset
|
40 def execute(self, evt, str): |
53 | 41 if str[0] == '*': # make a new sub from the current levels |
42 self.lightboard.save_sub(str,self.lightboard.stageassub()) | |
0 | 43 else: |
44 print '>>>', str | |
45 print eval(str) | |
53 | 46 self.frame.focus() |
48
2ef72bb3a707
finished the re-class of Console so it can make new subs again
drewp
parents:
43
diff
changeset
|
47 |
0 | 48 class Leveldisplay: |
26 | 49 def __init__(self, parent, channel_levels, num_channels=68): |
0 | 50 frames = (make_frame(parent), make_frame(parent)) |
16 | 51 channel_levels[:]=[] |
34
411de8b46aef
the famous you-are-in-the-process-of-changing-this-light indicator.
dmcc
parents:
32
diff
changeset
|
52 self.number_labels = [] |
26 | 53 for channel in range(1, num_channels+1): |
54 | |
55 # frame for this channel | |
56 f = Frame(frames[channel > (num_channels/2)]) | |
57 # channel number -- will turn yellow when being altered | |
58 num_lab = Label(f, text=str(channel), width=3, bg='lightPink', | |
59 font=stdfont, padx=0, pady=0, bd=0, height=1) | |
60 num_lab.pack(side='left') | |
34
411de8b46aef
the famous you-are-in-the-process-of-changing-this-light indicator.
dmcc
parents:
32
diff
changeset
|
61 self.number_labels.append(num_lab) |
26 | 62 |
63 # text description of channel | |
64 Label(f, text=Patch.get_channel_name(channel), width=8, | |
65 font=stdfont, anchor='w', padx=0, pady=0, bd=0, | |
66 height=1).pack(side='left') | |
67 | |
68 # current level of channel, shows intensity with color | |
69 l = Label(f, width=3, bg='lightBlue', font=stdfont, anchor='e', | |
70 padx=1, pady=0, bd=0, height=1) | |
0 | 71 l.pack(side='left') |
72 colorlabel(l) | |
73 channel_levels.append(l) | |
74 f.pack(side='top') | |
26 | 75 |
76 self.channel_levels = channel_levels | |
77 # channel_levels is an output - changelevel will use it to access | |
78 # these labels | |
0 | 79 |
80 class Subpanels: | |
53 | 81 def __init__(self, scenesparent, effectsparent, lightboard, |
82 scalelevels, Subs, xfader, | |
83 changelevel, subediting, longestname): | |
0 | 84 |
85 sublist = Subs.subs.items() | |
86 sublist.sort() | |
87 | |
88 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
|
89 # choose one of the sub panels to add to |
0 | 90 if sub.is_effect: |
91 parent=effectsparent | |
30
e9d2e7754fd9
sideways subs, new x/y buttons (which don't draw right, but they work)
drewp
parents:
26
diff
changeset
|
92 side1='bottom' |
48
2ef72bb3a707
finished the re-class of Console so it can make new subs again
drewp
parents:
43
diff
changeset
|
93 side2='left' |
38 | 94 orient1='vert' |
32 | 95 end1=0 |
96 end2=1 | |
38 | 97 width1=len(name) |
0 | 98 else: |
99 parent=scenesparent | |
30
e9d2e7754fd9
sideways subs, new x/y buttons (which don't draw right, but they work)
drewp
parents:
26
diff
changeset
|
100 side1='right' |
48
2ef72bb3a707
finished the re-class of Console so it can make new subs again
drewp
parents:
43
diff
changeset
|
101 side2='top' |
38 | 102 orient1='horiz' |
32 | 103 end1=1 |
104 end2=0 | |
38 | 105 width1=longestname |
0 | 106 |
30
e9d2e7754fd9
sideways subs, new x/y buttons (which don't draw right, but they work)
drewp
parents:
26
diff
changeset
|
107 # make frame that surrounds the whole submaster |
12
7adc65771676
big restructuring - moved lots of things (including most panels) to other files
drewp
parents:
0
diff
changeset
|
108 f=Frame(parent, bd=1, relief='raised') |
48
2ef72bb3a707
finished the re-class of Console so it can make new subs again
drewp
parents:
43
diff
changeset
|
109 f.pack(fill='both',exp=1,side=side2) |
0 | 110 |
53 | 111 # make DoubleVar (there might be one left around from |
112 # before a refresh) | |
0 | 113 if name not in scalelevels: |
114 scalelevels[name]=DoubleVar() | |
115 | |
116 sub.set_slider_var(scalelevels[name]) | |
117 | |
53 | 118 scaleopts = {'troughcolor' : 'grey70'} |
0 | 119 if sub.color: |
120 scaleopts['troughcolor'] = sub.color | |
19 | 121 |
122 s = FlyingFader(f, label=str(name), variable=scalelevels[name], | |
30
e9d2e7754fd9
sideways subs, new x/y buttons (which don't draw right, but they work)
drewp
parents:
26
diff
changeset
|
123 showvalue=0, length=300-17, |
53 | 124 width=14, sliderlength=14, |
125 to=end1,res=.001,from_=end2,bd=1, font=stdfont, | |
38 | 126 orient=orient1, |
127 labelwidth=width1, | |
30
e9d2e7754fd9
sideways subs, new x/y buttons (which don't draw right, but they work)
drewp
parents:
26
diff
changeset
|
128 **scaleopts) |
0 | 129 |
53 | 130 # tell subediting what widget to highlight when it's |
131 # editing a sub | |
132 for w in (s,s.label,s.vlabel, s.scale): | |
133 subediting.register(subname=name,widget=w) | |
38 | 134 |
53 | 135 if not sub.is_effect: |
136 self.subeditingbuttons(f,side1,sub,name,lightboard,subediting) | |
137 | |
138 self.axisbuttons(f,s,xfader,stdfont,side1,name) | |
0 | 139 |
23 | 140 s.pack(side='left', fill=BOTH) |
0 | 141 |
142 # effects frame? | |
143 sframe = Frame(f,bd=2,relief='groove') | |
144 sub.draw_tk(sframe) | |
145 sframe.pack(side='left',fill='y') | |
53 | 146 |
147 def subediting_edit(self,subediting,sub): | |
148 subediting.setsub(sub) | |
149 | |
150 def subediting_save(self,name,sub,lightboard): | |
151 lightboard.save_sub(name,sub.getlevels()) | |
152 | |
153 def subeditingbuttons(self,f,side1,sub,name,lightboard,subediting): | |
154 for txt,cmd in (("Edit",lambda subediting=subediting,sub=sub: self.subediting_edit(subediting,sub)), | |
155 ("Save",lambda sub=sub,name=name,lightboard=lightboard: self.subediting_save(name,sub,lightboard))): | |
156 eb = Button(f,text=txt,font=stdfont,padx=0,pady=0, | |
157 bd=1,command=cmd) | |
158 eb.pack(side=side1,fill='both',padx=0,pady=0) | |
159 | |
160 def axisbuttons(self,f,s,xfader,stdfont,side1,name): | |
161 for axis in ('y','x'): | |
162 cvar=IntVar() | |
163 eb_color = ('red', 'green')[axis == 'y'] | |
164 cb=Togglebutton(f,text=axis.upper(),variable=cvar,font=stdfont, | |
165 padx=3, pady=0, bd=1, downcolor=eb_color) | |
166 cb.pack(side=side1,fill='both', padx=0, pady=0) | |
167 s.bind('<Key-%s>'%axis, lambda ev,cb=cb: cb.invoke) | |
168 xfader.registerbutton(name,axis,cvar) | |
169 | |
170 |