Files
@ d5858e9fa689
Branch filter:
Location: light9/bin/bumppad - annotation
d5858e9fa689
2.5 KiB
text/plain
keyboardcomposer destroy fix and cleanups
- We were destroying KeyboardComposer a little too much. Fortunately,
we weren't passing the right number of arguments, so this was merely
an error.
- About the TODO comment removed: we don't need to use combine_dict
since Submaster logic will be changed entirely when we/if we move
to a SubServer world and keyboard composer will not be the wiser.
- We were destroying KeyboardComposer a little too much. Fortunately,
we weren't passing the right number of arguments, so this was merely
an error.
- About the TODO comment removed: we don't need to use combine_dict
since Submaster logic will be changed entirely when we/if we move
to a SubServer world and keyboard composer will not be the wiser.
079cc244a59e 079cc244a59e 079cc244a59e 079cc244a59e 079cc244a59e 079cc244a59e 079cc244a59e 079cc244a59e 079cc244a59e 079cc244a59e 079cc244a59e 079cc244a59e 079cc244a59e 079cc244a59e 079cc244a59e 079cc244a59e 079cc244a59e 079cc244a59e 079cc244a59e 079cc244a59e 079cc244a59e 079cc244a59e 079cc244a59e 079cc244a59e 079cc244a59e 079cc244a59e 079cc244a59e 079cc244a59e 079cc244a59e 079cc244a59e 079cc244a59e 079cc244a59e 079cc244a59e 079cc244a59e 079cc244a59e 079cc244a59e 079cc244a59e 079cc244a59e 079cc244a59e 079cc244a59e 079cc244a59e 079cc244a59e 079cc244a59e 079cc244a59e 079cc244a59e 079cc244a59e 079cc244a59e 079cc244a59e 079cc244a59e 079cc244a59e 079cc244a59e 079cc244a59e 079cc244a59e 079cc244a59e 079cc244a59e 079cc244a59e 079cc244a59e 079cc244a59e 079cc244a59e 079cc244a59e 079cc244a59e 079cc244a59e 079cc244a59e 079cc244a59e 079cc244a59e 079cc244a59e 079cc244a59e 079cc244a59e 079cc244a59e 079cc244a59e | #!/usr/bin/env python
from __future__ import division,nested_scopes
import sys, time, math
import Tkinter as tk
import run_local
import light9.dmxclient as dmxclient
from light9.TLUtility import make_attributes_from_args
from light9.Submaster import Submaster,sub_maxes
class pad(tk.Frame):
levs = None # Submaster : level
def __init__(self,master,root,mag):
make_attributes_from_args('master','mag')
tk.Frame.__init__(self,master)
self.levs={}
for xy,key,subname in [
((1,1),'KP_Up','upstage'),
((1,3),"KP_Down",'narrow-c'),
((0,2),'KP_Left','left1'),
((2,2),'KP_Right','right1'),
((1,0),'KP_Divide','cyc'),
((0,3),"KP_End",'edge-l'),
((2,3),'KP_Next','edge-r'),
((0,4),'KP_Insert',"zip_red"),
((2,4),'KP_Delete',"zip_orange"),
((3,1),'KP_Add','zip_green'),
((3,3),'KP_Enter','zip_blue'),
((1,2),'KP_Begin','downfront'),
]:
sub = Submaster(subname)
self.levs[sub]=0
l = tk.Label(self,font="arial 12 bold",anchor='w',height=2,
relief='groove',bd=5,
text="%s\n%s" % (key.replace('KP_',''),sub.name))
l.grid(column=xy[0],row=xy[1],sticky='news')
root.bind("<KeyPress-%s>"%key,
lambda ev,sub=sub: self.bumpto(sub,1))
root.bind("<KeyRelease-%s>"%key,
lambda ev,sub=sub: self.bumpto(sub,0))
def bumpto(self,sub,lev):
now=time.time()
self.levs[sub]=lev*self.mag.get()
self.master.after_idle(self.output)
def output(self):
dmx = sub_maxes(*[s*l for s,l in self.levs.items()]).get_dmx_list()
dmxclient.outputlevels(dmx,clientid="bumppad")
root=tk.Tk()
root.tk_setPalette("maroon4")
root.wm_title("bumppad")
mag = tk.DoubleVar()
tk.Label(root,text="Keypad press/release activate sub; 1..5 set mag",
font="Helvetica -12 italic",anchor='w').pack(side='bottom',fill='x')
pad(root,root,mag).pack(side='left',fill='both',exp=1)
magscl = tk.Scale(root,orient='vertical',from_=1,to=0,res=.01,
showval=1,variable=mag,label='mag',relief='raised',bd=1)
for i in range(1,6):
root.bind("<Key-%s>"%i,lambda ev,i=i: mag.set(math.sqrt((i )/5)))
magscl.pack(side='left',fill='y')
root.mainloop()
|