Mercurial > code > home > repos > light9
annotate bin/bumppad @ 1407:f766f82b8513
checkpoint show data
Ignore-this: 55fda887863be2f89db5a7db88404f41
author | drewp@bigasterisk.com |
---|---|
date | Mon, 15 Jun 2015 22:34:59 +0000 |
parents | 88110cd58caa |
children | 7772cc48e016 |
rev | line source |
---|---|
1012 | 1 #!bin/python |
204 | 2 from __future__ import division,nested_scopes |
3 import sys, time, math | |
4 import Tkinter as tk | |
5 | |
234
079cc244a59e
port bumppad to new package system, small gui fixes
drewp@bigasterisk.com
parents:
204
diff
changeset
|
6 import run_local |
079cc244a59e
port bumppad to new package system, small gui fixes
drewp@bigasterisk.com
parents:
204
diff
changeset
|
7 import light9.dmxclient as dmxclient |
079cc244a59e
port bumppad to new package system, small gui fixes
drewp@bigasterisk.com
parents:
204
diff
changeset
|
8 from light9.TLUtility import make_attributes_from_args |
204 | 9 |
234
079cc244a59e
port bumppad to new package system, small gui fixes
drewp@bigasterisk.com
parents:
204
diff
changeset
|
10 from light9.Submaster import Submaster,sub_maxes |
204 | 11 |
12 class pad(tk.Frame): | |
13 levs = None # Submaster : level | |
14 def __init__(self,master,root,mag): | |
15 make_attributes_from_args('master','mag') | |
16 tk.Frame.__init__(self,master) | |
17 self.levs={} | |
18 for xy,key,subname in [ | |
269
34db49e1bc20
new bumppad subs for 2005 show
Drew Perttula <drewp@bigasterisk.com>
parents:
234
diff
changeset
|
19 ((1,1),'KP_Up','centered'), |
34db49e1bc20
new bumppad subs for 2005 show
Drew Perttula <drewp@bigasterisk.com>
parents:
234
diff
changeset
|
20 ((1,3),"KP_Down",'third-c'), |
34db49e1bc20
new bumppad subs for 2005 show
Drew Perttula <drewp@bigasterisk.com>
parents:
234
diff
changeset
|
21 ((0,2),'KP_Left','scoop-l'), |
34db49e1bc20
new bumppad subs for 2005 show
Drew Perttula <drewp@bigasterisk.com>
parents:
234
diff
changeset
|
22 ((2,2),'KP_Right','scoop-r'), |
204 | 23 ((1,0),'KP_Divide','cyc'), |
325
5104e5e2380f
edit bumppad channels
Drew Perttula <drewp@bigasterisk.com>
parents:
269
diff
changeset
|
24 ((0,3),"KP_End",'hottest'), |
5104e5e2380f
edit bumppad channels
Drew Perttula <drewp@bigasterisk.com>
parents:
269
diff
changeset
|
25 ((2,3),'KP_Next','deepblues'), |
204 | 26 ((0,4),'KP_Insert',"zip_red"), |
27 ((2,4),'KP_Delete',"zip_orange"), | |
269
34db49e1bc20
new bumppad subs for 2005 show
Drew Perttula <drewp@bigasterisk.com>
parents:
234
diff
changeset
|
28 ((3,1),'KP_Add','strobedim'), |
204 | 29 ((3,3),'KP_Enter','zip_blue'), |
269
34db49e1bc20
new bumppad subs for 2005 show
Drew Perttula <drewp@bigasterisk.com>
parents:
234
diff
changeset
|
30 ((1,2),'KP_Begin','scoop-c'), |
204 | 31 ]: |
32 | |
33 sub = Submaster(subname) | |
34 self.levs[sub]=0 | |
35 | |
36 l = tk.Label(self,font="arial 12 bold",anchor='w',height=2, | |
37 relief='groove',bd=5, | |
38 text="%s\n%s" % (key.replace('KP_',''),sub.name)) | |
39 l.grid(column=xy[0],row=xy[1],sticky='news') | |
40 | |
41 root.bind("<KeyPress-%s>"%key, | |
42 lambda ev,sub=sub: self.bumpto(sub,1)) | |
43 root.bind("<KeyRelease-%s>"%key, | |
44 lambda ev,sub=sub: self.bumpto(sub,0)) | |
45 def bumpto(self,sub,lev): | |
46 now=time.time() | |
47 self.levs[sub]=lev*self.mag.get() | |
48 self.master.after_idle(self.output) | |
49 def output(self): | |
50 dmx = sub_maxes(*[s*l for s,l in self.levs.items()]).get_dmx_list() | |
51 dmxclient.outputlevels(dmx,clientid="bumppad") | |
52 | |
53 root=tk.Tk() | |
54 root.tk_setPalette("maroon4") | |
234
079cc244a59e
port bumppad to new package system, small gui fixes
drewp@bigasterisk.com
parents:
204
diff
changeset
|
55 root.wm_title("bumppad") |
079cc244a59e
port bumppad to new package system, small gui fixes
drewp@bigasterisk.com
parents:
204
diff
changeset
|
56 mag = tk.DoubleVar() |
204 | 57 |
234
079cc244a59e
port bumppad to new package system, small gui fixes
drewp@bigasterisk.com
parents:
204
diff
changeset
|
58 tk.Label(root,text="Keypad press/release activate sub; 1..5 set mag", |
079cc244a59e
port bumppad to new package system, small gui fixes
drewp@bigasterisk.com
parents:
204
diff
changeset
|
59 font="Helvetica -12 italic",anchor='w').pack(side='bottom',fill='x') |
204 | 60 |
61 pad(root,root,mag).pack(side='left',fill='both',exp=1) | |
62 | |
63 magscl = tk.Scale(root,orient='vertical',from_=1,to=0,res=.01, | |
64 showval=1,variable=mag,label='mag',relief='raised',bd=1) | |
65 for i in range(1,6): | |
66 root.bind("<Key-%s>"%i,lambda ev,i=i: mag.set(math.sqrt((i )/5))) | |
67 magscl.pack(side='left',fill='y') | |
234
079cc244a59e
port bumppad to new package system, small gui fixes
drewp@bigasterisk.com
parents:
204
diff
changeset
|
68 |
079cc244a59e
port bumppad to new package system, small gui fixes
drewp@bigasterisk.com
parents:
204
diff
changeset
|
69 |
204 | 70 root.mainloop() |