annotate light8/panels.py @ 26:219d6fcbc28d

Reclassification, minor cleanups Reclassification, minor cleanups No more global variables in rsn! They are all in a class called LightBoard.
author dmcc
date Sun, 07 Jul 2002 08:33:52 +0000
parents 768442c7d023
children e9d2e7754fd9
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
0
45b12307c695 Initial revision
drewp
parents:
diff changeset
7
45b12307c695 Initial revision
drewp
parents:
diff changeset
8 stdfont = ('Arial', 8)
45b12307c695 Initial revision
drewp
parents:
diff changeset
9 monofont = ('Courier', 8)
45b12307c695 Initial revision
drewp
parents:
diff changeset
10
45b12307c695 Initial revision
drewp
parents:
diff changeset
11 class Controlpanel(Frame):
26
219d6fcbc28d Reclassification, minor cleanups
dmcc
parents: 23
diff changeset
12 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
13 Frame.__init__(self,parent)
26
219d6fcbc28d Reclassification, minor cleanups
dmcc
parents: 23
diff changeset
14 controlpanel = self
0
45b12307c695 Initial revision
drewp
parents:
diff changeset
15 for txt,cmd in (
45b12307c695 Initial revision
drewp
parents:
diff changeset
16 ('Quit', quit_cb),
45b12307c695 Initial revision
drewp
parents:
diff changeset
17 ('Refresh', refresh_cb),
45b12307c695 Initial revision
drewp
parents:
diff changeset
18 ('Clear all', xfader.clearallbuttons),
45b12307c695 Initial revision
drewp
parents:
diff changeset
19 ('On -> X', lambda: xfader.grab('x')),
45b12307c695 Initial revision
drewp
parents:
diff changeset
20 ('Clear X', lambda: xfader.clearallbuttons('x')),
45b12307c695 Initial revision
drewp
parents:
diff changeset
21 ('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
22 ('Clear Y', lambda: xfader.clearallbuttons('y'))):
26
219d6fcbc28d Reclassification, minor cleanups
dmcc
parents: 23
diff changeset
23 Button(controlpanel, text=txt, command=cmd).pack(side='top',
219d6fcbc28d Reclassification, minor cleanups
dmcc
parents: 23
diff changeset
24 fill='x')
0
45b12307c695 Initial revision
drewp
parents:
diff changeset
25
45b12307c695 Initial revision
drewp
parents:
diff changeset
26 class Console:
12
7adc65771676 big restructuring - moved lots of things (including most panels) to other files
drewp
parents: 0
diff changeset
27 def __init__(self):
7adc65771676 big restructuring - moved lots of things (including most panels) to other files
drewp
parents: 0
diff changeset
28 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
29 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
30 self.frame = Frame(t)
7adc65771676 big restructuring - moved lots of things (including most panels) to other files
drewp
parents: 0
diff changeset
31 self.entry=Entry(self.frame)
0
45b12307c695 Initial revision
drewp
parents:
diff changeset
32 self.entry.pack(expand=1, fill='x')
26
219d6fcbc28d Reclassification, minor cleanups
dmcc
parents: 23
diff changeset
33 self.entry.bind('<Return>', lambda evt: self.execute(evt,
219d6fcbc28d Reclassification, minor cleanups
dmcc
parents: 23
diff changeset
34 self.entry.get()))
0
45b12307c695 Initial revision
drewp
parents:
diff changeset
35 self.frame.pack(fill=BOTH, expand=1)
45b12307c695 Initial revision
drewp
parents:
diff changeset
36
12
7adc65771676 big restructuring - moved lots of things (including most panels) to other files
drewp
parents: 0
diff changeset
37 def execute(evt, str):
7adc65771676 big restructuring - moved lots of things (including most panels) to other files
drewp
parents: 0
diff changeset
38 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
39 make_sub(str)
0
45b12307c695 Initial revision
drewp
parents:
diff changeset
40 else:
45b12307c695 Initial revision
drewp
parents:
diff changeset
41 print '>>>', str
45b12307c695 Initial revision
drewp
parents:
diff changeset
42 print eval(str)
12
7adc65771676 big restructuring - moved lots of things (including most panels) to other files
drewp
parents: 0
diff changeset
43 self.frame.focus()
0
45b12307c695 Initial revision
drewp
parents:
diff changeset
44
45b12307c695 Initial revision
drewp
parents:
diff changeset
45 class Leveldisplay:
26
219d6fcbc28d Reclassification, minor cleanups
dmcc
parents: 23
diff changeset
46 def __init__(self, parent, channel_levels, num_channels=68):
0
45b12307c695 Initial revision
drewp
parents:
diff changeset
47 frames = (make_frame(parent), make_frame(parent))
16
7dbe8067acea fixed bug with channel levels not displaying
drewp
parents: 12
diff changeset
48 channel_levels[:]=[]
26
219d6fcbc28d Reclassification, minor cleanups
dmcc
parents: 23
diff changeset
49 self.number_labels = {}
219d6fcbc28d Reclassification, minor cleanups
dmcc
parents: 23
diff changeset
50 for channel in range(1, num_channels+1):
219d6fcbc28d Reclassification, minor cleanups
dmcc
parents: 23
diff changeset
51
219d6fcbc28d Reclassification, minor cleanups
dmcc
parents: 23
diff changeset
52 # frame for this channel
219d6fcbc28d Reclassification, minor cleanups
dmcc
parents: 23
diff changeset
53 f = Frame(frames[channel > (num_channels/2)])
219d6fcbc28d Reclassification, minor cleanups
dmcc
parents: 23
diff changeset
54 # channel number -- will turn yellow when being altered
219d6fcbc28d Reclassification, minor cleanups
dmcc
parents: 23
diff changeset
55 num_lab = Label(f, text=str(channel), width=3, bg='lightPink',
219d6fcbc28d Reclassification, minor cleanups
dmcc
parents: 23
diff changeset
56 font=stdfont, padx=0, pady=0, bd=0, height=1)
219d6fcbc28d Reclassification, minor cleanups
dmcc
parents: 23
diff changeset
57 num_lab.pack(side='left')
219d6fcbc28d Reclassification, minor cleanups
dmcc
parents: 23
diff changeset
58 self.number_labels[channel] = num_lab
219d6fcbc28d Reclassification, minor cleanups
dmcc
parents: 23
diff changeset
59
219d6fcbc28d Reclassification, minor cleanups
dmcc
parents: 23
diff changeset
60 # text description of channel
219d6fcbc28d Reclassification, minor cleanups
dmcc
parents: 23
diff changeset
61 Label(f, text=Patch.get_channel_name(channel), width=8,
219d6fcbc28d Reclassification, minor cleanups
dmcc
parents: 23
diff changeset
62 font=stdfont, anchor='w', padx=0, pady=0, bd=0,
219d6fcbc28d Reclassification, minor cleanups
dmcc
parents: 23
diff changeset
63 height=1).pack(side='left')
219d6fcbc28d Reclassification, minor cleanups
dmcc
parents: 23
diff changeset
64
219d6fcbc28d Reclassification, minor cleanups
dmcc
parents: 23
diff changeset
65 # current level of channel, shows intensity with color
219d6fcbc28d Reclassification, minor cleanups
dmcc
parents: 23
diff changeset
66 l = Label(f, width=3, bg='lightBlue', font=stdfont, anchor='e',
219d6fcbc28d Reclassification, minor cleanups
dmcc
parents: 23
diff changeset
67 padx=1, pady=0, bd=0, height=1)
0
45b12307c695 Initial revision
drewp
parents:
diff changeset
68 l.pack(side='left')
45b12307c695 Initial revision
drewp
parents:
diff changeset
69 colorlabel(l)
45b12307c695 Initial revision
drewp
parents:
diff changeset
70 channel_levels.append(l)
45b12307c695 Initial revision
drewp
parents:
diff changeset
71 f.pack(side='top')
26
219d6fcbc28d Reclassification, minor cleanups
dmcc
parents: 23
diff changeset
72
219d6fcbc28d Reclassification, minor cleanups
dmcc
parents: 23
diff changeset
73 self.channel_levels = channel_levels
219d6fcbc28d Reclassification, minor cleanups
dmcc
parents: 23
diff changeset
74 # channel_levels is an output - changelevel will use it to access
219d6fcbc28d Reclassification, minor cleanups
dmcc
parents: 23
diff changeset
75 # these labels
0
45b12307c695 Initial revision
drewp
parents:
diff changeset
76
45b12307c695 Initial revision
drewp
parents:
diff changeset
77 class Subpanels:
19
6284a812da50 makefile - add link to ../Widgets/FlyingFader.py
dmcc
parents: 16
diff changeset
78 def __init__(self, scenesparent, effectsparent, scalelevels, Subs, xfader,
6284a812da50 makefile - add link to ../Widgets/FlyingFader.py
dmcc
parents: 16
diff changeset
79 changelevel):
0
45b12307c695 Initial revision
drewp
parents:
diff changeset
80
45b12307c695 Initial revision
drewp
parents:
diff changeset
81 sublist = Subs.subs.items()
45b12307c695 Initial revision
drewp
parents:
diff changeset
82 sublist.sort()
45b12307c695 Initial revision
drewp
parents:
diff changeset
83
45b12307c695 Initial revision
drewp
parents:
diff changeset
84 for name, sub in sublist:
45b12307c695 Initial revision
drewp
parents:
diff changeset
85 if sub.is_effect:
45b12307c695 Initial revision
drewp
parents:
diff changeset
86 parent=effectsparent
45b12307c695 Initial revision
drewp
parents:
diff changeset
87 else:
45b12307c695 Initial revision
drewp
parents:
diff changeset
88 parent=scenesparent
45b12307c695 Initial revision
drewp
parents:
diff changeset
89
12
7adc65771676 big restructuring - moved lots of things (including most panels) to other files
drewp
parents: 0
diff changeset
90 f=Frame(parent, bd=1, relief='raised')
7adc65771676 big restructuring - moved lots of things (including most panels) to other files
drewp
parents: 0
diff changeset
91 f.pack(fill='both',exp=1,side='left')
0
45b12307c695 Initial revision
drewp
parents:
diff changeset
92
45b12307c695 Initial revision
drewp
parents:
diff changeset
93 if name not in scalelevels:
45b12307c695 Initial revision
drewp
parents:
diff changeset
94 scalelevels[name]=DoubleVar()
45b12307c695 Initial revision
drewp
parents:
diff changeset
95
45b12307c695 Initial revision
drewp
parents:
diff changeset
96 sub.set_slider_var(scalelevels[name])
45b12307c695 Initial revision
drewp
parents:
diff changeset
97
12
7adc65771676 big restructuring - moved lots of things (including most panels) to other files
drewp
parents: 0
diff changeset
98 scaleopts = {}
0
45b12307c695 Initial revision
drewp
parents:
diff changeset
99 if sub.color:
45b12307c695 Initial revision
drewp
parents:
diff changeset
100 scaleopts['troughcolor'] = sub.color
19
6284a812da50 makefile - add link to ../Widgets/FlyingFader.py
dmcc
parents: 16
diff changeset
101
6284a812da50 makefile - add link to ../Widgets/FlyingFader.py
dmcc
parents: 16
diff changeset
102 s = FlyingFader(f, label=str(name), variable=scalelevels[name],
6284a812da50 makefile - add link to ../Widgets/FlyingFader.py
dmcc
parents: 16
diff changeset
103 showvalue=0, length=300-17,
6284a812da50 makefile - add link to ../Widgets/FlyingFader.py
dmcc
parents: 16
diff changeset
104 width=20, to=0,res=.001,from_=1,bd=1, font=stdfont,
6284a812da50 makefile - add link to ../Widgets/FlyingFader.py
dmcc
parents: 16
diff changeset
105 **scaleopts)
0
45b12307c695 Initial revision
drewp
parents:
diff changeset
106
12
7adc65771676 big restructuring - moved lots of things (including most panels) to other files
drewp
parents: 0
diff changeset
107 for axis in ('y','x'):
7adc65771676 big restructuring - moved lots of things (including most panels) to other files
drewp
parents: 0
diff changeset
108 cvar=IntVar()
19
6284a812da50 makefile - add link to ../Widgets/FlyingFader.py
dmcc
parents: 16
diff changeset
109 cb=Checkbutton(f,text=axis,variable=cvar,font=stdfont, padx=0,
6284a812da50 makefile - add link to ../Widgets/FlyingFader.py
dmcc
parents: 16
diff changeset
110 pady=0, bd=1)
12
7adc65771676 big restructuring - moved lots of things (including most panels) to other files
drewp
parents: 0
diff changeset
111 button = ('Alt','Control')[axis=='y'] # unused?
19
6284a812da50 makefile - add link to ../Widgets/FlyingFader.py
dmcc
parents: 16
diff changeset
112 # 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
113 cb.pack(side='bottom',fill='both', padx=0, pady=0)
7adc65771676 big restructuring - moved lots of things (including most panels) to other files
drewp
parents: 0
diff changeset
114 xfader.registerbutton(name,axis,cvar)
0
45b12307c695 Initial revision
drewp
parents:
diff changeset
115
23
768442c7d023 layout fixen
dmcc
parents: 19
diff changeset
116 s.pack(side='left', fill=BOTH)
0
45b12307c695 Initial revision
drewp
parents:
diff changeset
117
45b12307c695 Initial revision
drewp
parents:
diff changeset
118 # effects frame?
45b12307c695 Initial revision
drewp
parents:
diff changeset
119 sframe = Frame(f,bd=2,relief='groove')
45b12307c695 Initial revision
drewp
parents:
diff changeset
120 sub.draw_tk(sframe)
45b12307c695 Initial revision
drewp
parents:
diff changeset
121 sframe.pack(side='left',fill='y')