Files
@ f066d6e874db
Branch filter:
Location: light9/bin/bumppad - annotation
f066d6e874db
2.7 KiB
text/plain
2to3 with these fixers: all idioms set_literal
Ignore-this: cbd28518218c2f0ddce8c4f92d3b8b33
Ignore-this: cbd28518218c2f0ddce8c4f92d3b8b33
88110cd58caa f066d6e874db 079cc244a59e f066d6e874db 079cc244a59e 079cc244a59e 079cc244a59e 079cc244a59e 079cc244a59e 7772cc48e016 7772cc48e016 079cc244a59e 079cc244a59e 7772cc48e016 7772cc48e016 7772cc48e016 7772cc48e016 7772cc48e016 7772cc48e016 7772cc48e016 7772cc48e016 7772cc48e016 7772cc48e016 7772cc48e016 7772cc48e016 7772cc48e016 7772cc48e016 7772cc48e016 7772cc48e016 7772cc48e016 7772cc48e016 7772cc48e016 7772cc48e016 7772cc48e016 079cc244a59e 7772cc48e016 7772cc48e016 7772cc48e016 7772cc48e016 7772cc48e016 7772cc48e016 7772cc48e016 7772cc48e016 7772cc48e016 7772cc48e016 7772cc48e016 7772cc48e016 7772cc48e016 7772cc48e016 7772cc48e016 7772cc48e016 7772cc48e016 7772cc48e016 7772cc48e016 079cc244a59e 7772cc48e016 079cc244a59e f066d6e874db 7772cc48e016 7772cc48e016 7772cc48e016 7772cc48e016 079cc244a59e 079cc244a59e 079cc244a59e 079cc244a59e 7772cc48e016 7772cc48e016 7772cc48e016 7772cc48e016 7772cc48e016 7772cc48e016 079cc244a59e 7772cc48e016 7772cc48e016 7772cc48e016 7772cc48e016 7772cc48e016 7772cc48e016 7772cc48e016 7772cc48e016 7772cc48e016 7772cc48e016 7772cc48e016 7772cc48e016 7772cc48e016 079cc244a59e 079cc244a59e | #!bin/python
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 list(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()
|