Mercurial > code > home > repos > light9
annotate light8/panels.py @ 19:6284a812da50
makefile - add link to ../Widgets/FlyingFader.py
makefile - add link to ../Widgets/FlyingFader.py
panels.py - use above link, incorporate FlyingFaders. some layout issues,
nothing too borked
rsn.py - focus follows mouse so that FFaders get keystrokes
author | dmcc |
---|---|
date | Sun, 07 Jul 2002 06:53:32 +0000 |
parents | 7dbe8067acea |
children | 768442c7d023 |
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 |
0 | 7 |
8 stdfont = ('Arial', 8) | |
9 monofont = ('Courier', 8) | |
10 | |
12
7adc65771676
big restructuring - moved lots of things (including most panels) to other files
drewp
parents:
0
diff
changeset
|
11 |
7adc65771676
big restructuring - moved lots of things (including most panels) to other files
drewp
parents:
0
diff
changeset
|
12 |
0 | 13 class Controlpanel(Frame): |
12
7adc65771676
big restructuring - moved lots of things (including most panels) to other files
drewp
parents:
0
diff
changeset
|
14 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
|
15 Frame.__init__(self,parent) |
7adc65771676
big restructuring - moved lots of things (including most panels) to other files
drewp
parents:
0
diff
changeset
|
16 controlpanel=self |
0 | 17 for txt,cmd in ( |
18 ('Quit', quit_cb), | |
19 ('Refresh', refresh_cb), | |
20 ('Clear all', xfader.clearallbuttons), | |
21 ('On -> X', lambda: xfader.grab('x')), | |
22 ('Clear X', lambda: xfader.clearallbuttons('x')), | |
23 ('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
|
24 ('Clear Y', lambda: xfader.clearallbuttons('y'))): |
7adc65771676
big restructuring - moved lots of things (including most panels) to other files
drewp
parents:
0
diff
changeset
|
25 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
|
26 |
0 | 27 |
28 class Console: | |
12
7adc65771676
big restructuring - moved lots of things (including most panels) to other files
drewp
parents:
0
diff
changeset
|
29 def __init__(self): |
7adc65771676
big restructuring - moved lots of things (including most panels) to other files
drewp
parents:
0
diff
changeset
|
30 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
|
31 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
|
32 self.frame = Frame(t) |
7adc65771676
big restructuring - moved lots of things (including most panels) to other files
drewp
parents:
0
diff
changeset
|
33 self.entry=Entry(self.frame) |
0 | 34 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
|
35 self.entry.bind('<Return>', lambda evt: self.execute(evt, 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: | |
16 | 47 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
|
48 |
0 | 49 frames = (make_frame(parent), make_frame(parent)) |
16 | 50 channel_levels[:]=[] |
12
7adc65771676
big restructuring - moved lots of things (including most panels) to other files
drewp
parents:
0
diff
changeset
|
51 for channel in range(1, 69): |
7adc65771676
big restructuring - moved lots of things (including most panels) to other files
drewp
parents:
0
diff
changeset
|
52 f=Frame(frames[channel > 34]) |
7adc65771676
big restructuring - moved lots of things (including most panels) to other files
drewp
parents:
0
diff
changeset
|
53 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
|
54 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
|
55 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
|
56 font=stdfont, anchor='w', padx=0, pady=0, bd=0, height=1).pack(side='left') |
16 | 57 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
|
58 font=stdfont, anchor='e', padx=1, pady=0, bd=0, height=1) |
0 | 59 l.pack(side='left') |
60 colorlabel(l) | |
61 channel_levels.append(l) | |
62 f.pack(side='top') | |
16 | 63 # channel_levels is an output - changelevel will use it to access these labels |
0 | 64 |
65 class Subpanels: | |
19 | 66 def __init__(self, scenesparent, effectsparent, scalelevels, Subs, xfader, |
67 changelevel): | |
0 | 68 |
69 sublist = Subs.subs.items() | |
70 sublist.sort() | |
71 | |
72 for name, sub in sublist: | |
73 if sub.is_effect: | |
74 parent=effectsparent | |
75 else: | |
76 parent=scenesparent | |
77 | |
12
7adc65771676
big restructuring - moved lots of things (including most panels) to other files
drewp
parents:
0
diff
changeset
|
78 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
|
79 f.pack(fill='both',exp=1,side='left') |
0 | 80 |
81 if name not in scalelevels: | |
82 scalelevels[name]=DoubleVar() | |
83 | |
84 sub.set_slider_var(scalelevels[name]) | |
85 | |
12
7adc65771676
big restructuring - moved lots of things (including most panels) to other files
drewp
parents:
0
diff
changeset
|
86 scaleopts = {} |
0 | 87 if sub.color: |
88 scaleopts['troughcolor'] = sub.color | |
19 | 89 |
90 s = FlyingFader(f, label=str(name), variable=scalelevels[name], | |
91 showvalue=0, length=300-17, | |
92 width=20, to=0,res=.001,from_=1,bd=1, font=stdfont, | |
93 **scaleopts) | |
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() |
19 | 97 cb=Checkbutton(f,text=axis,variable=cvar,font=stdfont, padx=0, |
98 pady=0, bd=1) | |
12
7adc65771676
big restructuring - moved lots of things (including most panels) to other files
drewp
parents:
0
diff
changeset
|
99 button = ('Alt','Control')[axis=='y'] # unused? |
19 | 100 # 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
|
101 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
|
102 xfader.registerbutton(name,axis,cvar) |
0 | 103 |
12
7adc65771676
big restructuring - moved lots of things (including most panels) to other files
drewp
parents:
0
diff
changeset
|
104 s.pack(side='left') |
19 | 105 s.bind('<3>', |
106 lambda evt, v=scalelevels[name]: toggle_slider(v)) | |
0 | 107 |
108 # effects frame? | |
109 sframe = Frame(f,bd=2,relief='groove') | |
110 sub.draw_tk(sframe) | |
111 sframe.pack(side='left',fill='y') |