Mercurial > code > home > repos > light9
annotate light8/panels.py @ 16:7dbe8067acea
fixed bug with channel levels not displaying
fixed bug with channel levels not displaying
moved an import from rsn to io
author | drewp |
---|---|
date | Sun, 07 Jul 2002 06:33:29 +0000 |
parents | 7adc65771676 |
children | 6284a812da50 |
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 | |
6 | |
7 stdfont = ('Arial', 8) | |
8 monofont = ('Courier', 8) | |
9 | |
12
7adc65771676
big restructuring - moved lots of things (including most panels) to other files
drewp
parents:
0
diff
changeset
|
10 |
7adc65771676
big restructuring - moved lots of things (including most panels) to other files
drewp
parents:
0
diff
changeset
|
11 |
0 | 12 class Controlpanel(Frame): |
12
7adc65771676
big restructuring - moved lots of things (including most panels) to other files
drewp
parents:
0
diff
changeset
|
13 def __init__(self,parent,xfader,refresh_cb,quit_cb): |
7adc65771676
big restructuring - moved lots of things (including most panels) to other files
drewp
parents:
0
diff
changeset
|
14 Frame.__init__(self,parent) |
7adc65771676
big restructuring - moved lots of things (including most panels) to other files
drewp
parents:
0
diff
changeset
|
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'))): |
7adc65771676
big restructuring - moved lots of things (including most panels) to other files
drewp
parents:
0
diff
changeset
|
24 Button(controlpanel, text=txt, command=cmd).pack(side='top', fill='x') |
7adc65771676
big restructuring - moved lots of things (including most panels) to other files
drewp
parents:
0
diff
changeset
|
25 |
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') |
12
7adc65771676
big restructuring - moved lots of things (including most panels) to other files
drewp
parents:
0
diff
changeset
|
34 self.entry.bind('<Return>', lambda evt: self.execute(evt, self.entry.get())) |
0 | 35 self.frame.pack(fill=BOTH, expand=1) |
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 | 40 else: |
41 print '>>>', str | |
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 | 44 |
45 class Leveldisplay: | |
16 | 46 def __init__(self,parent,_oldlevels,channel_levels): |
12
7adc65771676
big restructuring - moved lots of things (including most panels) to other files
drewp
parents:
0
diff
changeset
|
47 |
0 | 48 frames = (make_frame(parent), make_frame(parent)) |
16 | 49 channel_levels[:]=[] |
12
7adc65771676
big restructuring - moved lots of things (including most panels) to other files
drewp
parents:
0
diff
changeset
|
50 for channel in range(1, 69): |
7adc65771676
big restructuring - moved lots of things (including most panels) to other files
drewp
parents:
0
diff
changeset
|
51 f=Frame(frames[channel > 34]) |
7adc65771676
big restructuring - moved lots of things (including most panels) to other files
drewp
parents:
0
diff
changeset
|
52 Label(f,text=str(channel), width=3, bg='lightPink', |
7adc65771676
big restructuring - moved lots of things (including most panels) to other files
drewp
parents:
0
diff
changeset
|
53 font=stdfont, padx=0, pady=0, bd=0, height=1).pack(side='left') |
7adc65771676
big restructuring - moved lots of things (including most panels) to other files
drewp
parents:
0
diff
changeset
|
54 Label(f,text=Patch.get_channel_name(channel), width=8, |
7adc65771676
big restructuring - moved lots of things (including most panels) to other files
drewp
parents:
0
diff
changeset
|
55 font=stdfont, anchor='w', padx=0, pady=0, bd=0, height=1).pack(side='left') |
16 | 56 l=Label(f, width=3, bg='lightBlue', #text=_oldlevels[channel-1], |
12
7adc65771676
big restructuring - moved lots of things (including most panels) to other files
drewp
parents:
0
diff
changeset
|
57 font=stdfont, anchor='e', padx=1, pady=0, bd=0, height=1) |
0 | 58 l.pack(side='left') |
59 colorlabel(l) | |
60 channel_levels.append(l) | |
61 f.pack(side='top') | |
16 | 62 # channel_levels is an output - changelevel will use it to access these labels |
0 | 63 |
64 class Subpanels: | |
12
7adc65771676
big restructuring - moved lots of things (including most panels) to other files
drewp
parents:
0
diff
changeset
|
65 def __init__(self,scenesparent,effectsparent,scalelevels,Subs,xfader,changelevel): |
0 | 66 |
67 sublist = Subs.subs.items() | |
68 sublist.sort() | |
69 | |
70 for name, sub in sublist: | |
71 if sub.is_effect: | |
72 parent=effectsparent | |
73 else: | |
74 parent=scenesparent | |
75 | |
12
7adc65771676
big restructuring - moved lots of things (including most panels) to other files
drewp
parents:
0
diff
changeset
|
76 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
|
77 f.pack(fill='both',exp=1,side='left') |
0 | 78 |
79 if name not in scalelevels: | |
80 scalelevels[name]=DoubleVar() | |
81 | |
82 sub.set_slider_var(scalelevels[name]) | |
83 | |
12
7adc65771676
big restructuring - moved lots of things (including most panels) to other files
drewp
parents:
0
diff
changeset
|
84 scaleopts = {} |
0 | 85 if sub.color: |
86 scaleopts['troughcolor'] = sub.color | |
12
7adc65771676
big restructuring - moved lots of things (including most panels) to other files
drewp
parents:
0
diff
changeset
|
87 s=Scale(f,command=lambda l,name=name: changelevel(name,l),showvalue=0, |
7adc65771676
big restructuring - moved lots of things (including most panels) to other files
drewp
parents:
0
diff
changeset
|
88 length=300-17,variable=scalelevels[name],width=20, |
7adc65771676
big restructuring - moved lots of things (including most panels) to other files
drewp
parents:
0
diff
changeset
|
89 to=0,res=.001,from_=1,bd=1, **scaleopts) |
7adc65771676
big restructuring - moved lots of things (including most panels) to other files
drewp
parents:
0
diff
changeset
|
90 l=Label(f,text=str(name), font=stdfont, padx=0, pady=0) |
7adc65771676
big restructuring - moved lots of things (including most panels) to other files
drewp
parents:
0
diff
changeset
|
91 v=Label(f,textvariable=scalelevels[name], font=stdfont, padx=0, pady=0) |
7adc65771676
big restructuring - moved lots of things (including most panels) to other files
drewp
parents:
0
diff
changeset
|
92 l.pack(side='bottom') |
7adc65771676
big restructuring - moved lots of things (including most panels) to other files
drewp
parents:
0
diff
changeset
|
93 v.pack(side='bottom') |
0 | 94 |
12
7adc65771676
big restructuring - moved lots of things (including most panels) to other files
drewp
parents:
0
diff
changeset
|
95 for axis in ('y','x'): |
7adc65771676
big restructuring - moved lots of things (including most panels) to other files
drewp
parents:
0
diff
changeset
|
96 cvar=IntVar() |
7adc65771676
big restructuring - moved lots of things (including most panels) to other files
drewp
parents:
0
diff
changeset
|
97 cb=Checkbutton(f,text=axis,variable=cvar,font=stdfont, padx=0, pady=0, bd=1) |
7adc65771676
big restructuring - moved lots of things (including most panels) to other files
drewp
parents:
0
diff
changeset
|
98 button = ('Alt','Control')[axis=='y'] # unused? |
7adc65771676
big restructuring - moved lots of things (including most panels) to other files
drewp
parents:
0
diff
changeset
|
99 # s.bind('<Key-%s>'%axis, lambda ev,cb=cb: cb.invoke) |
7adc65771676
big restructuring - moved lots of things (including most panels) to other files
drewp
parents:
0
diff
changeset
|
100 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
|
101 xfader.registerbutton(name,axis,cvar) |
0 | 102 |
12
7adc65771676
big restructuring - moved lots of things (including most panels) to other files
drewp
parents:
0
diff
changeset
|
103 s.pack(side='left') |
7adc65771676
big restructuring - moved lots of things (including most panels) to other files
drewp
parents:
0
diff
changeset
|
104 s.bind('<3>', lambda evt, v=scalelevels[name]: toggle_slider(v))\ |
0 | 105 |
106 # effects frame? | |
107 sframe = Frame(f,bd=2,relief='groove') | |
108 sub.draw_tk(sframe) | |
109 sframe.pack(side='left',fill='y') | |
110 | |
12
7adc65771676
big restructuring - moved lots of things (including most panels) to other files
drewp
parents:
0
diff
changeset
|
111 |