Mercurial > code > home > repos > light9
annotate light8/panels.py @ 38:0ce56c4dd355
small ui enhancements
author | drewp |
---|---|
date | Sun, 07 Jul 2002 12:16:27 +0000 |
parents | 411de8b46aef |
children | 2cd759c2b3c7 |
rev | line source |
---|---|
0 | 1 """some of the panels""" |
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 | 4 from uihelpers import * |
5 import Patch | |
19 | 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 | 8 |
9 stdfont = ('Arial', 8) | |
10 monofont = ('Courier', 8) | |
11 | |
12 class Controlpanel(Frame): | |
26 | 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 | 15 controlpanel = self |
0 | 16 for txt,cmd in ( |
17 ('Quit', quit_cb), | |
18 ('Refresh', refresh_cb), | |
19 ('Clear all', xfader.clearallbuttons), | |
20 ('On -> X', lambda: xfader.grab('x')), | |
21 ('Clear X', lambda: xfader.clearallbuttons('x')), | |
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 | 24 Button(controlpanel, text=txt, command=cmd).pack(side='top', |
25 fill='x') | |
0 | 26 |
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 | 33 self.entry.pack(expand=1, fill='x') |
26 | 34 self.entry.bind('<Return>', lambda evt: self.execute(evt, |
35 self.entry.get())) | |
0 | 36 self.frame.pack(fill=BOTH, expand=1) |
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 | 41 else: |
42 print '>>>', str | |
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 | 45 |
46 class Leveldisplay: | |
26 | 47 def __init__(self, parent, channel_levels, num_channels=68): |
0 | 48 frames = (make_frame(parent), make_frame(parent)) |
16 | 49 channel_levels[:]=[] |
34
411de8b46aef
the famous you-are-in-the-process-of-changing-this-light indicator.
dmcc
parents:
32
diff
changeset
|
50 self.number_labels = [] |
26 | 51 for channel in range(1, num_channels+1): |
52 | |
53 # frame for this channel | |
54 f = Frame(frames[channel > (num_channels/2)]) | |
55 # channel number -- will turn yellow when being altered | |
56 num_lab = Label(f, text=str(channel), width=3, bg='lightPink', | |
57 font=stdfont, padx=0, pady=0, bd=0, height=1) | |
58 num_lab.pack(side='left') | |
34
411de8b46aef
the famous you-are-in-the-process-of-changing-this-light indicator.
dmcc
parents:
32
diff
changeset
|
59 self.number_labels.append(num_lab) |
26 | 60 |
61 # text description of channel | |
62 Label(f, text=Patch.get_channel_name(channel), width=8, | |
63 font=stdfont, anchor='w', padx=0, pady=0, bd=0, | |
64 height=1).pack(side='left') | |
65 | |
66 # current level of channel, shows intensity with color | |
67 l = Label(f, width=3, bg='lightBlue', font=stdfont, anchor='e', | |
68 padx=1, pady=0, bd=0, height=1) | |
0 | 69 l.pack(side='left') |
70 colorlabel(l) | |
71 channel_levels.append(l) | |
72 f.pack(side='top') | |
26 | 73 |
74 self.channel_levels = channel_levels | |
75 # channel_levels is an output - changelevel will use it to access | |
76 # these labels | |
0 | 77 |
78 class Subpanels: | |
19 | 79 def __init__(self, scenesparent, effectsparent, scalelevels, Subs, xfader, |
38 | 80 changelevel, subediting, longestname): |
0 | 81 |
82 sublist = Subs.subs.items() | |
83 sublist.sort() | |
84 | |
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 | 87 if sub.is_effect: |
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' |
38 | 90 orient1='vert' |
32 | 91 end1=0 |
92 end2=1 | |
38 | 93 width1=len(name) |
0 | 94 else: |
95 parent=scenesparent | |
30
e9d2e7754fd9
sideways subs, new x/y buttons (which don't draw right, but they work)
drewp
parents:
26
diff
changeset
|
96 side1='right' |
38 | 97 orient1='horiz' |
32 | 98 end1=1 |
99 end2=0 | |
38 | 100 width1=longestname |
0 | 101 |
30
e9d2e7754fd9
sideways subs, new x/y buttons (which don't draw right, but they work)
drewp
parents:
26
diff
changeset
|
102 # 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
|
103 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
|
104 f.pack(fill='both',exp=1,side=('top','left')[sub.is_effect]) |
0 | 105 |
30
e9d2e7754fd9
sideways subs, new x/y buttons (which don't draw right, but they work)
drewp
parents:
26
diff
changeset
|
106 # make DoubleVar (there might be one left around from before a refresh) |
0 | 107 if name not in scalelevels: |
108 scalelevels[name]=DoubleVar() | |
109 | |
110 sub.set_slider_var(scalelevels[name]) | |
111 | |
12
7adc65771676
big restructuring - moved lots of things (including most panels) to other files
drewp
parents:
0
diff
changeset
|
112 scaleopts = {} |
0 | 113 if sub.color: |
114 scaleopts['troughcolor'] = sub.color | |
19 | 115 |
116 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
|
117 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
|
118 width=18, sliderlength=18, |
32 | 119 to=end1,res=.001,from_=end2,bd=0, font=stdfont, |
38 | 120 orient=orient1, |
121 labelwidth=width1, | |
30
e9d2e7754fd9
sideways subs, new x/y buttons (which don't draw right, but they work)
drewp
parents:
26
diff
changeset
|
122 **scaleopts) |
0 | 123 |
38 | 124 eb = Button(f,text="E",font=stdfont,padx=0,pady=0,bd=1,command=lambda subediting=subediting,sub=sub: subediting.setsub(sub)) |
125 eb.pack(side=side1,fill='both',padx=0,pady=0) | |
126 | |
12
7adc65771676
big restructuring - moved lots of things (including most panels) to other files
drewp
parents:
0
diff
changeset
|
127 for axis in ('y','x'): |
7adc65771676
big restructuring - moved lots of things (including most panels) to other files
drewp
parents:
0
diff
changeset
|
128 cvar=IntVar() |
30
e9d2e7754fd9
sideways subs, new x/y buttons (which don't draw right, but they work)
drewp
parents:
26
diff
changeset
|
129 cb=Togglebutton(f,text=axis.upper(),variable=cvar,font=stdfont, padx=0, |
19 | 130 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
|
131 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
|
132 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
|
133 xfader.registerbutton(name,axis,cvar) |
0 | 134 |
23 | 135 s.pack(side='left', fill=BOTH) |
0 | 136 |
137 # effects frame? | |
138 sframe = Frame(f,bd=2,relief='groove') | |
139 sub.draw_tk(sframe) | |
140 sframe.pack(side='left',fill='y') |