annotate light8/panels.py @ 33:d9a0f6c88b39

Fix bad refs to quit
author dmcc
date Sun, 07 Jul 2002 10:55:05 +0000
parents 925382e7cdc8
children 411de8b46aef
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
45b12307c695 Initial revision
drewp
parents:
diff changeset
1 """some of the panels"""
45b12307c695 Initial revision
drewp
parents:
diff changeset
2
12
7adc65771676 big restructuring - moved lots of things (including most panels) to other files
drewp
parents: 0
diff changeset
3 from Tkinter import *
0
45b12307c695 Initial revision
drewp
parents:
diff changeset
4 from uihelpers import *
45b12307c695 Initial revision
drewp
parents:
diff changeset
5 import Patch
19
6284a812da50 makefile - add link to ../Widgets/FlyingFader.py
dmcc
parents: 16
diff changeset
6 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
7 import Pmw
0
45b12307c695 Initial revision
drewp
parents:
diff changeset
8
45b12307c695 Initial revision
drewp
parents:
diff changeset
9 stdfont = ('Arial', 8)
45b12307c695 Initial revision
drewp
parents:
diff changeset
10 monofont = ('Courier', 8)
45b12307c695 Initial revision
drewp
parents:
diff changeset
11
45b12307c695 Initial revision
drewp
parents:
diff changeset
12 class Controlpanel(Frame):
26
219d6fcbc28d Reclassification, minor cleanups
dmcc
parents: 23
diff changeset
13 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
14 Frame.__init__(self,parent)
26
219d6fcbc28d Reclassification, minor cleanups
dmcc
parents: 23
diff changeset
15 controlpanel = self
0
45b12307c695 Initial revision
drewp
parents:
diff changeset
16 for txt,cmd in (
45b12307c695 Initial revision
drewp
parents:
diff changeset
17 ('Quit', quit_cb),
45b12307c695 Initial revision
drewp
parents:
diff changeset
18 ('Refresh', refresh_cb),
45b12307c695 Initial revision
drewp
parents:
diff changeset
19 ('Clear all', xfader.clearallbuttons),
45b12307c695 Initial revision
drewp
parents:
diff changeset
20 ('On -> X', lambda: xfader.grab('x')),
45b12307c695 Initial revision
drewp
parents:
diff changeset
21 ('Clear X', lambda: xfader.clearallbuttons('x')),
45b12307c695 Initial revision
drewp
parents:
diff changeset
22 ('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
23 ('Clear Y', lambda: xfader.clearallbuttons('y'))):
26
219d6fcbc28d Reclassification, minor cleanups
dmcc
parents: 23
diff changeset
24 Button(controlpanel, text=txt, command=cmd).pack(side='top',
219d6fcbc28d Reclassification, minor cleanups
dmcc
parents: 23
diff changeset
25 fill='x')
0
45b12307c695 Initial revision
drewp
parents:
diff changeset
26
45b12307c695 Initial revision
drewp
parents:
diff changeset
27 class Console:
12
7adc65771676 big restructuring - moved lots of things (including most panels) to other files
drewp
parents: 0
diff changeset
28 def __init__(self):
7adc65771676 big restructuring - moved lots of things (including most panels) to other files
drewp
parents: 0
diff changeset
29 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
30 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
31 self.frame = Frame(t)
7adc65771676 big restructuring - moved lots of things (including most panels) to other files
drewp
parents: 0
diff changeset
32 self.entry=Entry(self.frame)
0
45b12307c695 Initial revision
drewp
parents:
diff changeset
33 self.entry.pack(expand=1, fill='x')
26
219d6fcbc28d Reclassification, minor cleanups
dmcc
parents: 23
diff changeset
34 self.entry.bind('<Return>', lambda evt: self.execute(evt,
219d6fcbc28d Reclassification, minor cleanups
dmcc
parents: 23
diff changeset
35 self.entry.get()))
0
45b12307c695 Initial revision
drewp
parents:
diff changeset
36 self.frame.pack(fill=BOTH, expand=1)
45b12307c695 Initial revision
drewp
parents:
diff changeset
37
12
7adc65771676 big restructuring - moved lots of things (including most panels) to other files
drewp
parents: 0
diff changeset
38 def execute(evt, str):
7adc65771676 big restructuring - moved lots of things (including most panels) to other files
drewp
parents: 0
diff changeset
39 if str[0] == '*': # make a new sub
7adc65771676 big restructuring - moved lots of things (including most panels) to other files
drewp
parents: 0
diff changeset
40 make_sub(str)
0
45b12307c695 Initial revision
drewp
parents:
diff changeset
41 else:
45b12307c695 Initial revision
drewp
parents:
diff changeset
42 print '>>>', str
45b12307c695 Initial revision
drewp
parents:
diff changeset
43 print eval(str)
12
7adc65771676 big restructuring - moved lots of things (including most panels) to other files
drewp
parents: 0
diff changeset
44 self.frame.focus()
0
45b12307c695 Initial revision
drewp
parents:
diff changeset
45
45b12307c695 Initial revision
drewp
parents:
diff changeset
46 class Leveldisplay:
26
219d6fcbc28d Reclassification, minor cleanups
dmcc
parents: 23
diff changeset
47 def __init__(self, parent, channel_levels, num_channels=68):
0
45b12307c695 Initial revision
drewp
parents:
diff changeset
48 frames = (make_frame(parent), make_frame(parent))
16
7dbe8067acea fixed bug with channel levels not displaying
drewp
parents: 12
diff changeset
49 channel_levels[:]=[]
26
219d6fcbc28d Reclassification, minor cleanups
dmcc
parents: 23
diff changeset
50 self.number_labels = {}
219d6fcbc28d Reclassification, minor cleanups
dmcc
parents: 23
diff changeset
51 for channel in range(1, num_channels+1):
219d6fcbc28d Reclassification, minor cleanups
dmcc
parents: 23
diff changeset
52
219d6fcbc28d Reclassification, minor cleanups
dmcc
parents: 23
diff changeset
53 # frame for this channel
219d6fcbc28d Reclassification, minor cleanups
dmcc
parents: 23
diff changeset
54 f = Frame(frames[channel > (num_channels/2)])
219d6fcbc28d Reclassification, minor cleanups
dmcc
parents: 23
diff changeset
55 # channel number -- will turn yellow when being altered
219d6fcbc28d Reclassification, minor cleanups
dmcc
parents: 23
diff changeset
56 num_lab = Label(f, text=str(channel), width=3, bg='lightPink',
219d6fcbc28d Reclassification, minor cleanups
dmcc
parents: 23
diff changeset
57 font=stdfont, padx=0, pady=0, bd=0, height=1)
219d6fcbc28d Reclassification, minor cleanups
dmcc
parents: 23
diff changeset
58 num_lab.pack(side='left')
219d6fcbc28d Reclassification, minor cleanups
dmcc
parents: 23
diff changeset
59 self.number_labels[channel] = num_lab
219d6fcbc28d Reclassification, minor cleanups
dmcc
parents: 23
diff changeset
60
219d6fcbc28d Reclassification, minor cleanups
dmcc
parents: 23
diff changeset
61 # text description of channel
219d6fcbc28d Reclassification, minor cleanups
dmcc
parents: 23
diff changeset
62 Label(f, text=Patch.get_channel_name(channel), width=8,
219d6fcbc28d Reclassification, minor cleanups
dmcc
parents: 23
diff changeset
63 font=stdfont, anchor='w', padx=0, pady=0, bd=0,
219d6fcbc28d Reclassification, minor cleanups
dmcc
parents: 23
diff changeset
64 height=1).pack(side='left')
219d6fcbc28d Reclassification, minor cleanups
dmcc
parents: 23
diff changeset
65
219d6fcbc28d Reclassification, minor cleanups
dmcc
parents: 23
diff changeset
66 # current level of channel, shows intensity with color
219d6fcbc28d Reclassification, minor cleanups
dmcc
parents: 23
diff changeset
67 l = Label(f, width=3, bg='lightBlue', font=stdfont, anchor='e',
219d6fcbc28d Reclassification, minor cleanups
dmcc
parents: 23
diff changeset
68 padx=1, pady=0, bd=0, height=1)
0
45b12307c695 Initial revision
drewp
parents:
diff changeset
69 l.pack(side='left')
45b12307c695 Initial revision
drewp
parents:
diff changeset
70 colorlabel(l)
45b12307c695 Initial revision
drewp
parents:
diff changeset
71 channel_levels.append(l)
45b12307c695 Initial revision
drewp
parents:
diff changeset
72 f.pack(side='top')
26
219d6fcbc28d Reclassification, minor cleanups
dmcc
parents: 23
diff changeset
73
219d6fcbc28d Reclassification, minor cleanups
dmcc
parents: 23
diff changeset
74 self.channel_levels = channel_levels
219d6fcbc28d Reclassification, minor cleanups
dmcc
parents: 23
diff changeset
75 # channel_levels is an output - changelevel will use it to access
219d6fcbc28d Reclassification, minor cleanups
dmcc
parents: 23
diff changeset
76 # these labels
0
45b12307c695 Initial revision
drewp
parents:
diff changeset
77
45b12307c695 Initial revision
drewp
parents:
diff changeset
78 class Subpanels:
19
6284a812da50 makefile - add link to ../Widgets/FlyingFader.py
dmcc
parents: 16
diff changeset
79 def __init__(self, scenesparent, effectsparent, scalelevels, Subs, xfader,
6284a812da50 makefile - add link to ../Widgets/FlyingFader.py
dmcc
parents: 16
diff changeset
80 changelevel):
0
45b12307c695 Initial revision
drewp
parents:
diff changeset
81
45b12307c695 Initial revision
drewp
parents:
diff changeset
82 sublist = Subs.subs.items()
45b12307c695 Initial revision
drewp
parents:
diff changeset
83 sublist.sort()
45b12307c695 Initial revision
drewp
parents:
diff changeset
84
45b12307c695 Initial revision
drewp
parents:
diff changeset
85 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
86 # choose one of the sub panels to add to
0
45b12307c695 Initial revision
drewp
parents:
diff changeset
87 if sub.is_effect:
45b12307c695 Initial revision
drewp
parents:
diff changeset
88 parent=effectsparent
30
e9d2e7754fd9 sideways subs, new x/y buttons (which don't draw right, but they work)
drewp
parents: 26
diff changeset
89 side1='bottom'
e9d2e7754fd9 sideways subs, new x/y buttons (which don't draw right, but they work)
drewp
parents: 26
diff changeset
90 orient='vert'
32
925382e7cdc8 fixed small bug with orientable
drewp
parents: 30
diff changeset
91 end1=0
925382e7cdc8 fixed small bug with orientable
drewp
parents: 30
diff changeset
92 end2=1
0
45b12307c695 Initial revision
drewp
parents:
diff changeset
93 else:
45b12307c695 Initial revision
drewp
parents:
diff changeset
94 parent=scenesparent
30
e9d2e7754fd9 sideways subs, new x/y buttons (which don't draw right, but they work)
drewp
parents: 26
diff changeset
95 side1='right'
e9d2e7754fd9 sideways subs, new x/y buttons (which don't draw right, but they work)
drewp
parents: 26
diff changeset
96 orient='horiz'
32
925382e7cdc8 fixed small bug with orientable
drewp
parents: 30
diff changeset
97 end1=1
925382e7cdc8 fixed small bug with orientable
drewp
parents: 30
diff changeset
98 end2=0
0
45b12307c695 Initial revision
drewp
parents:
diff changeset
99
30
e9d2e7754fd9 sideways subs, new x/y buttons (which don't draw right, but they work)
drewp
parents: 26
diff changeset
100 # 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
101 f=Frame(parent, bd=1, relief='raised')
30
e9d2e7754fd9 sideways subs, new x/y buttons (which don't draw right, but they work)
drewp
parents: 26
diff changeset
102 f.pack(fill='both',exp=1,side=('top','left')[sub.is_effect])
0
45b12307c695 Initial revision
drewp
parents:
diff changeset
103
30
e9d2e7754fd9 sideways subs, new x/y buttons (which don't draw right, but they work)
drewp
parents: 26
diff changeset
104 # make DoubleVar (there might be one left around from before a refresh)
0
45b12307c695 Initial revision
drewp
parents:
diff changeset
105 if name not in scalelevels:
45b12307c695 Initial revision
drewp
parents:
diff changeset
106 scalelevels[name]=DoubleVar()
45b12307c695 Initial revision
drewp
parents:
diff changeset
107
45b12307c695 Initial revision
drewp
parents:
diff changeset
108 sub.set_slider_var(scalelevels[name])
45b12307c695 Initial revision
drewp
parents:
diff changeset
109
12
7adc65771676 big restructuring - moved lots of things (including most panels) to other files
drewp
parents: 0
diff changeset
110 scaleopts = {}
0
45b12307c695 Initial revision
drewp
parents:
diff changeset
111 if sub.color:
45b12307c695 Initial revision
drewp
parents:
diff changeset
112 scaleopts['troughcolor'] = sub.color
19
6284a812da50 makefile - add link to ../Widgets/FlyingFader.py
dmcc
parents: 16
diff changeset
113
6284a812da50 makefile - add link to ../Widgets/FlyingFader.py
dmcc
parents: 16
diff changeset
114 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
115 showvalue=0, length=300-17,
e9d2e7754fd9 sideways subs, new x/y buttons (which don't draw right, but they work)
drewp
parents: 26
diff changeset
116 width=18, sliderlength=18,
32
925382e7cdc8 fixed small bug with orientable
drewp
parents: 30
diff changeset
117 to=end1,res=.001,from_=end2,bd=0, font=stdfont,
30
e9d2e7754fd9 sideways subs, new x/y buttons (which don't draw right, but they work)
drewp
parents: 26
diff changeset
118 orient=orient,
e9d2e7754fd9 sideways subs, new x/y buttons (which don't draw right, but they work)
drewp
parents: 26
diff changeset
119 labelwidth=12, # this should be equal to the longest label name
e9d2e7754fd9 sideways subs, new x/y buttons (which don't draw right, but they work)
drewp
parents: 26
diff changeset
120 **scaleopts)
0
45b12307c695 Initial revision
drewp
parents:
diff changeset
121
12
7adc65771676 big restructuring - moved lots of things (including most panels) to other files
drewp
parents: 0
diff changeset
122 for axis in ('y','x'):
7adc65771676 big restructuring - moved lots of things (including most panels) to other files
drewp
parents: 0
diff changeset
123 cvar=IntVar()
30
e9d2e7754fd9 sideways subs, new x/y buttons (which don't draw right, but they work)
drewp
parents: 26
diff changeset
124 cb=Togglebutton(f,text=axis.upper(),variable=cvar,font=stdfont, padx=0,
19
6284a812da50 makefile - add link to ../Widgets/FlyingFader.py
dmcc
parents: 16
diff changeset
125 pady=0, bd=1)
30
e9d2e7754fd9 sideways subs, new x/y buttons (which don't draw right, but they work)
drewp
parents: 26
diff changeset
126 cb.pack(side=side1,fill='both', padx=0, pady=0)
e9d2e7754fd9 sideways subs, new x/y buttons (which don't draw right, but they work)
drewp
parents: 26
diff changeset
127 s.bind('<Key-%s>'%axis, lambda ev,cb=cb: cb.invoke)
12
7adc65771676 big restructuring - moved lots of things (including most panels) to other files
drewp
parents: 0
diff changeset
128 xfader.registerbutton(name,axis,cvar)
0
45b12307c695 Initial revision
drewp
parents:
diff changeset
129
23
768442c7d023 layout fixen
dmcc
parents: 19
diff changeset
130 s.pack(side='left', fill=BOTH)
0
45b12307c695 Initial revision
drewp
parents:
diff changeset
131
45b12307c695 Initial revision
drewp
parents:
diff changeset
132 # effects frame?
45b12307c695 Initial revision
drewp
parents:
diff changeset
133 sframe = Frame(f,bd=2,relief='groove')
45b12307c695 Initial revision
drewp
parents:
diff changeset
134 sub.draw_tk(sframe)
45b12307c695 Initial revision
drewp
parents:
diff changeset
135 sframe.pack(side='left',fill='y')