Files
@ 56e435ac7a41
Branch filter:
Location: light9/bin/bumppad - annotation
56e435ac7a41
2.5 KiB
text/plain
start the ui work for multiselect on /live
Ignore-this: 9cfd22eac4d49b093643027e387f4f5e
Ignore-this: 9cfd22eac4d49b093643027e387f4f5e
88110cd58caa 079cc244a59e 079cc244a59e 079cc244a59e 079cc244a59e 079cc244a59e 079cc244a59e 079cc244a59e 079cc244a59e 079cc244a59e 079cc244a59e 079cc244a59e 079cc244a59e 079cc244a59e 079cc244a59e 079cc244a59e 079cc244a59e 079cc244a59e 34db49e1bc20 34db49e1bc20 34db49e1bc20 34db49e1bc20 079cc244a59e 5104e5e2380f 5104e5e2380f 079cc244a59e 079cc244a59e 34db49e1bc20 079cc244a59e 34db49e1bc20 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 | #!bin/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','centered'),
((1,3),"KP_Down",'third-c'),
((0,2),'KP_Left','scoop-l'),
((2,2),'KP_Right','scoop-r'),
((1,0),'KP_Divide','cyc'),
((0,3),"KP_End",'hottest'),
((2,3),'KP_Next','deepblues'),
((0,4),'KP_Insert',"zip_red"),
((2,4),'KP_Delete',"zip_orange"),
((3,1),'KP_Add','strobedim'),
((3,3),'KP_Enter','zip_blue'),
((1,2),'KP_Begin','scoop-c'),
]:
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()
|