comparison 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
comparison
equal deleted inserted replaced
25:f0e1dde35aec 26:219d6fcbc28d
6 from FlyingFader import FlyingFader 6 from FlyingFader import FlyingFader
7 7
8 stdfont = ('Arial', 8) 8 stdfont = ('Arial', 8)
9 monofont = ('Courier', 8) 9 monofont = ('Courier', 8)
10 10
11
12
13 class Controlpanel(Frame): 11 class Controlpanel(Frame):
14 def __init__(self,parent,xfader,refresh_cb,quit_cb): 12 def __init__(self, parent, xfader, refresh_cb, quit_cb):
15 Frame.__init__(self,parent) 13 Frame.__init__(self,parent)
16 controlpanel=self 14 controlpanel = self
17 for txt,cmd in ( 15 for txt,cmd in (
18 ('Quit', quit_cb), 16 ('Quit', quit_cb),
19 ('Refresh', refresh_cb), 17 ('Refresh', refresh_cb),
20 ('Clear all', xfader.clearallbuttons), 18 ('Clear all', xfader.clearallbuttons),
21 ('On -> X', lambda: xfader.grab('x')), 19 ('On -> X', lambda: xfader.grab('x')),
22 ('Clear X', lambda: xfader.clearallbuttons('x')), 20 ('Clear X', lambda: xfader.clearallbuttons('x')),
23 ('On -> Y', lambda: xfader.grab('y')), 21 ('On -> Y', lambda: xfader.grab('y')),
24 ('Clear Y', lambda: xfader.clearallbuttons('y'))): 22 ('Clear Y', lambda: xfader.clearallbuttons('y'))):
25 Button(controlpanel, text=txt, command=cmd).pack(side='top', fill='x') 23 Button(controlpanel, text=txt, command=cmd).pack(side='top',
26 24 fill='x')
27 25
28 class Console: 26 class Console:
29 def __init__(self): 27 def __init__(self):
30 print "Light 8: Everything's under control" 28 print "Light 8: Everything's under control"
31 t=toplevelat(267,717,w=599,h=19) 29 t=toplevelat(267,717,w=599,h=19)
32 self.frame = Frame(t) 30 self.frame = Frame(t)
33 self.entry=Entry(self.frame) 31 self.entry=Entry(self.frame)
34 self.entry.pack(expand=1, fill='x') 32 self.entry.pack(expand=1, fill='x')
35 self.entry.bind('<Return>', lambda evt: self.execute(evt, self.entry.get())) 33 self.entry.bind('<Return>', lambda evt: self.execute(evt,
34 self.entry.get()))
36 self.frame.pack(fill=BOTH, expand=1) 35 self.frame.pack(fill=BOTH, expand=1)
37 36
38 def execute(evt, str): 37 def execute(evt, str):
39 if str[0] == '*': # make a new sub 38 if str[0] == '*': # make a new sub
40 make_sub(str) 39 make_sub(str)
42 print '>>>', str 41 print '>>>', str
43 print eval(str) 42 print eval(str)
44 self.frame.focus() 43 self.frame.focus()
45 44
46 class Leveldisplay: 45 class Leveldisplay:
47 def __init__(self,parent,_oldlevels,channel_levels): 46 def __init__(self, parent, channel_levels, num_channels=68):
48
49 frames = (make_frame(parent), make_frame(parent)) 47 frames = (make_frame(parent), make_frame(parent))
50 channel_levels[:]=[] 48 channel_levels[:]=[]
51 for channel in range(1, 69): 49 self.number_labels = {}
52 f=Frame(frames[channel > 34]) 50 for channel in range(1, num_channels+1):
53 Label(f,text=str(channel), width=3, bg='lightPink', 51
54 font=stdfont, padx=0, pady=0, bd=0, height=1).pack(side='left') 52 # frame for this channel
55 Label(f,text=Patch.get_channel_name(channel), width=8, 53 f = Frame(frames[channel > (num_channels/2)])
56 font=stdfont, anchor='w', padx=0, pady=0, bd=0, height=1).pack(side='left') 54 # channel number -- will turn yellow when being altered
57 l=Label(f, width=3, bg='lightBlue', #text=_oldlevels[channel-1], 55 num_lab = Label(f, text=str(channel), width=3, bg='lightPink',
58 font=stdfont, anchor='e', padx=1, pady=0, bd=0, height=1) 56 font=stdfont, padx=0, pady=0, bd=0, height=1)
57 num_lab.pack(side='left')
58 self.number_labels[channel] = num_lab
59
60 # text description of channel
61 Label(f, text=Patch.get_channel_name(channel), width=8,
62 font=stdfont, anchor='w', padx=0, pady=0, bd=0,
63 height=1).pack(side='left')
64
65 # current level of channel, shows intensity with color
66 l = Label(f, width=3, bg='lightBlue', font=stdfont, anchor='e',
67 padx=1, pady=0, bd=0, height=1)
59 l.pack(side='left') 68 l.pack(side='left')
60 colorlabel(l) 69 colorlabel(l)
61 channel_levels.append(l) 70 channel_levels.append(l)
62 f.pack(side='top') 71 f.pack(side='top')
63 # channel_levels is an output - changelevel will use it to access these labels 72
73 self.channel_levels = channel_levels
74 # channel_levels is an output - changelevel will use it to access
75 # these labels
64 76
65 class Subpanels: 77 class Subpanels:
66 def __init__(self, scenesparent, effectsparent, scalelevels, Subs, xfader, 78 def __init__(self, scenesparent, effectsparent, scalelevels, Subs, xfader,
67 changelevel): 79 changelevel):
68 80