Mercurial > code > home > repos > light9
annotate bin/curvecalc @ 290:50ba9ec2b17e
you can now delete curve points
author | drewp@bigasterisk.com |
---|---|
date | Sat, 18 Jun 2005 06:09:28 +0000 |
parents | 22529016c4f2 |
children | 1c590824dd14 |
rev | line source |
---|---|
0 | 1 #!/usr/bin/python |
2 | |
197
ba2677823b35
zoom control and other cleanups. also reads song length now
drewp
parents:
196
diff
changeset
|
3 """ |
ba2677823b35
zoom control and other cleanups. also reads song length now
drewp
parents:
196
diff
changeset
|
4 todo: curveview should preserve more objects, for speed maybe |
ba2677823b35
zoom control and other cleanups. also reads song length now
drewp
parents:
196
diff
changeset
|
5 |
ba2677823b35
zoom control and other cleanups. also reads song length now
drewp
parents:
196
diff
changeset
|
6 """ |
0 | 7 from __future__ import division |
236
63601fe0c3b0
curvecalc cmdline checking, connection status now in gui
drewp@bigasterisk.com
parents:
230
diff
changeset
|
8 import xmlrpclib,time,socket,sys,textwrap,math,glob,random,os,optparse |
197
ba2677823b35
zoom control and other cleanups. also reads song length now
drewp
parents:
196
diff
changeset
|
9 from bisect import bisect_left,bisect,bisect_right |
0 | 10 import Tkinter as tk |
11 from dispatch import dispatcher | |
12 from twisted.internet import reactor,tksupport | |
205
3905d3c92aaa
twisted mainloop, more row-change keys, xmlrpc fadesub command on port 8050
drewp
parents:
202
diff
changeset
|
13 import twisted |
0 | 14 from twisted.web.xmlrpc import Proxy |
15 | |
210
f41004d5a507
factored out some networking, new show/ layout, curvecalc works
drewp@bigasterisk.com
parents:
205
diff
changeset
|
16 import run_local |
215 | 17 from light9 import Submaster, dmxclient, networking, showconfig |
210
f41004d5a507
factored out some networking, new show/ layout, curvecalc works
drewp@bigasterisk.com
parents:
205
diff
changeset
|
18 from light9.TLUtility import make_attributes_from_args |
f41004d5a507
factored out some networking, new show/ layout, curvecalc works
drewp@bigasterisk.com
parents:
205
diff
changeset
|
19 from light9.zoomcontrol import Zoomcontrol |
211
9b360ee8636e
move patchdata into show/, pull out curve.py from curvecalc, more networking.py unification
drewp@bigasterisk.com
parents:
210
diff
changeset
|
20 from light9.curve import Curve, Curveview, Curveset, Curvesetview |
264
0f112a7dd6b3
fix window positoins for subcomposer and curvecalc. now saves geometry continuously
drewp@bigasterisk.com
parents:
248
diff
changeset
|
21 from light9.wavelength import wavelength |
0f112a7dd6b3
fix window positoins for subcomposer and curvecalc. now saves geometry continuously
drewp@bigasterisk.com
parents:
248
diff
changeset
|
22 from light9.uihelpers import toplevelat |
0 | 23 |
24 class Music: | |
25 def __init__(self): | |
26 self.player=None # xmlrpc Proxy to player | |
27 self.recenttime=0 | |
287
5322639d61e9
refactoring and little fixes in curvecalc and keyboardcomposer
Drew Perttula <drewp@bigasterisk.com>
parents:
284
diff
changeset
|
28 |
5322639d61e9
refactoring and little fixes in curvecalc and keyboardcomposer
Drew Perttula <drewp@bigasterisk.com>
parents:
284
diff
changeset
|
29 dispatcher.connect(self.seekplay_or_pause,"music seek") |
5322639d61e9
refactoring and little fixes in curvecalc and keyboardcomposer
Drew Perttula <drewp@bigasterisk.com>
parents:
284
diff
changeset
|
30 |
5322639d61e9
refactoring and little fixes in curvecalc and keyboardcomposer
Drew Perttula <drewp@bigasterisk.com>
parents:
284
diff
changeset
|
31 def seekplay_or_pause(self,t): |
5322639d61e9
refactoring and little fixes in curvecalc and keyboardcomposer
Drew Perttula <drewp@bigasterisk.com>
parents:
284
diff
changeset
|
32 self.music.seekplay_or_pause(t) |
197
ba2677823b35
zoom control and other cleanups. also reads song length now
drewp
parents:
196
diff
changeset
|
33 |
0 | 34 def current_time(self): |
35 """return deferred which gets called with the current time""" | |
36 if self.player is None: | |
211
9b360ee8636e
move patchdata into show/, pull out curve.py from curvecalc, more networking.py unification
drewp@bigasterisk.com
parents:
210
diff
changeset
|
37 self.player = Proxy(networking.musicUrl()) |
205
3905d3c92aaa
twisted mainloop, more row-change keys, xmlrpc fadesub command on port 8050
drewp
parents:
202
diff
changeset
|
38 # d = self.player.callRemote("songlength") |
3905d3c92aaa
twisted mainloop, more row-change keys, xmlrpc fadesub command on port 8050
drewp
parents:
202
diff
changeset
|
39 # d.addCallback(lambda l: dispatcher.send("max time",maxtime=l)) |
3905d3c92aaa
twisted mainloop, more row-change keys, xmlrpc fadesub command on port 8050
drewp
parents:
202
diff
changeset
|
40 # d = self.player.callRemote("songname") |
3905d3c92aaa
twisted mainloop, more row-change keys, xmlrpc fadesub command on port 8050
drewp
parents:
202
diff
changeset
|
41 # d.addCallback(lambda n: dispatcher.send("songname",name=n)) |
0 | 42 d = self.player.callRemote('gettime') |
43 def sendtime(t): | |
44 dispatcher.send("input time",val=t) | |
45 return t # pass along to the real receiver | |
46 def error(e): | |
47 pass#self.player=None | |
48 d.addCallback(sendtime) | |
49 return d | |
277
e7630a2072bd
awesome curvecalc control of ascoltami
drewp@bigasterisk.com
parents:
274
diff
changeset
|
50 |
e7630a2072bd
awesome curvecalc control of ascoltami
drewp@bigasterisk.com
parents:
274
diff
changeset
|
51 def seekplay_or_pause(self,t): |
e7630a2072bd
awesome curvecalc control of ascoltami
drewp@bigasterisk.com
parents:
274
diff
changeset
|
52 self.player.callRemote('seekplay_or_pause',t) |
0 | 53 |
54 class Subexpr: | |
55 curveset = None | |
205
3905d3c92aaa
twisted mainloop, more row-change keys, xmlrpc fadesub command on port 8050
drewp
parents:
202
diff
changeset
|
56 def __init__(self,curveset,expr=""): |
0 | 57 self.curveset = curveset |
58 self.lasteval = None | |
205
3905d3c92aaa
twisted mainloop, more row-change keys, xmlrpc fadesub command on port 8050
drewp
parents:
202
diff
changeset
|
59 self.expr=expr |
3905d3c92aaa
twisted mainloop, more row-change keys, xmlrpc fadesub command on port 8050
drewp
parents:
202
diff
changeset
|
60 self._smooth_random_items = [random.random() for x in range(100)] |
0 | 61 def eval(self,t): |
62 if self.expr=="": | |
63 dispatcher.send("expr_error",sender=self,exc="no expr, using 0") | |
64 return 0 | |
65 glo = self.curveset.globalsdict() | |
66 glo['t'] = t | |
205
3905d3c92aaa
twisted mainloop, more row-change keys, xmlrpc fadesub command on port 8050
drewp
parents:
202
diff
changeset
|
67 |
3905d3c92aaa
twisted mainloop, more row-change keys, xmlrpc fadesub command on port 8050
drewp
parents:
202
diff
changeset
|
68 glo['nsin'] = lambda x: (math.sin(x * (2 * math.pi)) + 1) / 2 |
3905d3c92aaa
twisted mainloop, more row-change keys, xmlrpc fadesub command on port 8050
drewp
parents:
202
diff
changeset
|
69 glo['ncos'] = lambda x: (math.cos(x * (2 * math.pi)) + 1) / 2 |
3905d3c92aaa
twisted mainloop, more row-change keys, xmlrpc fadesub command on port 8050
drewp
parents:
202
diff
changeset
|
70 glo['within'] = lambda a, b: a < t < b |
3905d3c92aaa
twisted mainloop, more row-change keys, xmlrpc fadesub command on port 8050
drewp
parents:
202
diff
changeset
|
71 glo['bef'] = lambda x: t < x |
3905d3c92aaa
twisted mainloop, more row-change keys, xmlrpc fadesub command on port 8050
drewp
parents:
202
diff
changeset
|
72 glo['aft'] = lambda x: x < t |
3905d3c92aaa
twisted mainloop, more row-change keys, xmlrpc fadesub command on port 8050
drewp
parents:
202
diff
changeset
|
73 glo['smoove'] = lambda x: -2 * (x ** 3) + 3 * (x ** 2) |
3905d3c92aaa
twisted mainloop, more row-change keys, xmlrpc fadesub command on port 8050
drewp
parents:
202
diff
changeset
|
74 |
3905d3c92aaa
twisted mainloop, more row-change keys, xmlrpc fadesub command on port 8050
drewp
parents:
202
diff
changeset
|
75 def smooth_random(speed=1): |
3905d3c92aaa
twisted mainloop, more row-change keys, xmlrpc fadesub command on port 8050
drewp
parents:
202
diff
changeset
|
76 """1 = new stuff each second, <1 is slower, fade-ier""" |
3905d3c92aaa
twisted mainloop, more row-change keys, xmlrpc fadesub command on port 8050
drewp
parents:
202
diff
changeset
|
77 x = (t * speed) % len(self._smooth_random_items) |
3905d3c92aaa
twisted mainloop, more row-change keys, xmlrpc fadesub command on port 8050
drewp
parents:
202
diff
changeset
|
78 x1 = int(x) |
3905d3c92aaa
twisted mainloop, more row-change keys, xmlrpc fadesub command on port 8050
drewp
parents:
202
diff
changeset
|
79 x2 = (int(x) + 1) % len(self._smooth_random_items) |
3905d3c92aaa
twisted mainloop, more row-change keys, xmlrpc fadesub command on port 8050
drewp
parents:
202
diff
changeset
|
80 y1 = self._smooth_random_items[x1] |
3905d3c92aaa
twisted mainloop, more row-change keys, xmlrpc fadesub command on port 8050
drewp
parents:
202
diff
changeset
|
81 y2 = self._smooth_random_items[x2] |
3905d3c92aaa
twisted mainloop, more row-change keys, xmlrpc fadesub command on port 8050
drewp
parents:
202
diff
changeset
|
82 return y1 + (y2 - y1) * ((x - x1)) |
3905d3c92aaa
twisted mainloop, more row-change keys, xmlrpc fadesub command on port 8050
drewp
parents:
202
diff
changeset
|
83 |
3905d3c92aaa
twisted mainloop, more row-change keys, xmlrpc fadesub command on port 8050
drewp
parents:
202
diff
changeset
|
84 def notch_random(speed=1): |
3905d3c92aaa
twisted mainloop, more row-change keys, xmlrpc fadesub command on port 8050
drewp
parents:
202
diff
changeset
|
85 """1 = new stuff each second, <1 is slower, notch-ier""" |
3905d3c92aaa
twisted mainloop, more row-change keys, xmlrpc fadesub command on port 8050
drewp
parents:
202
diff
changeset
|
86 x = (t * speed) % len(self._smooth_random_items) |
3905d3c92aaa
twisted mainloop, more row-change keys, xmlrpc fadesub command on port 8050
drewp
parents:
202
diff
changeset
|
87 x1 = int(x) |
3905d3c92aaa
twisted mainloop, more row-change keys, xmlrpc fadesub command on port 8050
drewp
parents:
202
diff
changeset
|
88 y1 = self._smooth_random_items[x1] |
3905d3c92aaa
twisted mainloop, more row-change keys, xmlrpc fadesub command on port 8050
drewp
parents:
202
diff
changeset
|
89 return y1 |
3905d3c92aaa
twisted mainloop, more row-change keys, xmlrpc fadesub command on port 8050
drewp
parents:
202
diff
changeset
|
90 |
3905d3c92aaa
twisted mainloop, more row-change keys, xmlrpc fadesub command on port 8050
drewp
parents:
202
diff
changeset
|
91 glo['noise'] = smooth_random |
3905d3c92aaa
twisted mainloop, more row-change keys, xmlrpc fadesub command on port 8050
drewp
parents:
202
diff
changeset
|
92 glo['notch'] = notch_random |
3905d3c92aaa
twisted mainloop, more row-change keys, xmlrpc fadesub command on port 8050
drewp
parents:
202
diff
changeset
|
93 |
0 | 94 try: |
95 self.lasteval = eval(self.expr,glo) | |
96 except Exception,e: | |
97 dispatcher.send("expr_error",sender=self,exc=e) | |
98 else: | |
205
3905d3c92aaa
twisted mainloop, more row-change keys, xmlrpc fadesub command on port 8050
drewp
parents:
202
diff
changeset
|
99 dispatcher.send("expr_error",sender=self,exc="ok") |
0 | 100 return self.lasteval |
101 | |
102 def expr(): | |
103 doc = "python expression for level as a function of t, using curves" | |
104 def fget(self): | |
105 return self._expr | |
106 def fset(self, value): | |
107 self._expr = value | |
108 dispatcher("expr_changed",sender=self) | |
109 return locals() | |
110 expr = property(**expr()) | |
111 | |
112 class Subexprview(tk.Frame): | |
113 def __init__(self,master,se,**kw): | |
114 self.subexpr=se | |
115 tk.Frame.__init__(self,master,**kw) | |
116 self.evar = tk.StringVar() | |
212 | 117 e = self.ent = tk.Entry(self,textvariable=self.evar) |
118 e.pack(side='left',fill='x',exp=1) | |
0 | 119 self.expr_changed() |
120 self.evar.trace_variable('w',self.evar_changed) | |
121 dispatcher.connect(self.expr_changed,"expr_changed", | |
122 sender=self.subexpr) | |
212 | 123 self.error = tk.Label(self) |
0 | 124 self.error.pack(side='left') |
125 dispatcher.connect(lambda exc: self.error.config(text=str(exc)), | |
126 "expr_error",sender=self.subexpr,weak=0) | |
127 def expr_changed(self): | |
128 if self.subexpr.expr!=self.evar.get(): | |
129 self.evar.set(self.subexpr.expr) | |
130 def evar_changed(self,*args): | |
131 self.subexpr.expr = self.evar.get() | |
132 | |
133 class Subterm: | |
134 """one Submaster and its Subexpr""" | |
274
9bf9685f5aae
curvecalc exprs can return a whole Submaster now
David McClosky <dmcc@bigasterisk.com>
parents:
267
diff
changeset
|
135 def __init__(self, submaster, subexpr): |
9bf9685f5aae
curvecalc exprs can return a whole Submaster now
David McClosky <dmcc@bigasterisk.com>
parents:
267
diff
changeset
|
136 make_attributes_from_args('submaster', 'subexpr') |
9bf9685f5aae
curvecalc exprs can return a whole Submaster now
David McClosky <dmcc@bigasterisk.com>
parents:
267
diff
changeset
|
137 def scaled(self, t): |
9bf9685f5aae
curvecalc exprs can return a whole Submaster now
David McClosky <dmcc@bigasterisk.com>
parents:
267
diff
changeset
|
138 subexpr_eval = self.subexpr.eval(t) |
283
e76b112c837e
fix empty-subexpr bug
Drew Perttula <drewp@bigasterisk.com>
parents:
282
diff
changeset
|
139 # this stops an error that didn't used to happen. i think when |
e76b112c837e
fix empty-subexpr bug
Drew Perttula <drewp@bigasterisk.com>
parents:
282
diff
changeset
|
140 # the expr is empty, subexpr_eval becomes None, so this zero |
e76b112c837e
fix empty-subexpr bug
Drew Perttula <drewp@bigasterisk.com>
parents:
282
diff
changeset
|
141 # is ok |
e76b112c837e
fix empty-subexpr bug
Drew Perttula <drewp@bigasterisk.com>
parents:
282
diff
changeset
|
142 if subexpr_eval is None: |
e76b112c837e
fix empty-subexpr bug
Drew Perttula <drewp@bigasterisk.com>
parents:
282
diff
changeset
|
143 subexpr_eval = 0 |
274
9bf9685f5aae
curvecalc exprs can return a whole Submaster now
David McClosky <dmcc@bigasterisk.com>
parents:
267
diff
changeset
|
144 if isinstance(subexpr_eval, Submaster.Submaster): |
9bf9685f5aae
curvecalc exprs can return a whole Submaster now
David McClosky <dmcc@bigasterisk.com>
parents:
267
diff
changeset
|
145 # if the expression returns a submaster, just return it |
9bf9685f5aae
curvecalc exprs can return a whole Submaster now
David McClosky <dmcc@bigasterisk.com>
parents:
267
diff
changeset
|
146 return subexpr_eval |
9bf9685f5aae
curvecalc exprs can return a whole Submaster now
David McClosky <dmcc@bigasterisk.com>
parents:
267
diff
changeset
|
147 else: |
9bf9685f5aae
curvecalc exprs can return a whole Submaster now
David McClosky <dmcc@bigasterisk.com>
parents:
267
diff
changeset
|
148 # otherwise, return our submaster multiplied by the value returned |
9bf9685f5aae
curvecalc exprs can return a whole Submaster now
David McClosky <dmcc@bigasterisk.com>
parents:
267
diff
changeset
|
149 return self.submaster * subexpr_eval |
0 | 150 |
151 class Subtermview(tk.Frame): | |
152 def __init__(self,master,st,**kw): | |
153 self.subterm = st | |
154 tk.Frame.__init__(self,master,bd=1,relief='raised',**kw) | |
205
3905d3c92aaa
twisted mainloop, more row-change keys, xmlrpc fadesub command on port 8050
drewp
parents:
202
diff
changeset
|
155 l = tk.Label(self,text="sub %r" % self.subterm.submaster.name) |
3905d3c92aaa
twisted mainloop, more row-change keys, xmlrpc fadesub command on port 8050
drewp
parents:
202
diff
changeset
|
156 l.pack(side='left') |
0 | 157 sev=Subexprview(self,self.subterm.subexpr) |
158 sev.pack(side='left',fill='both',exp=1) | |
159 | |
160 class Output: | |
205
3905d3c92aaa
twisted mainloop, more row-change keys, xmlrpc fadesub command on port 8050
drewp
parents:
202
diff
changeset
|
161 lastsendtime=0 |
3905d3c92aaa
twisted mainloop, more row-change keys, xmlrpc fadesub command on port 8050
drewp
parents:
202
diff
changeset
|
162 lastsendlevs=None |
287
5322639d61e9
refactoring and little fixes in curvecalc and keyboardcomposer
Drew Perttula <drewp@bigasterisk.com>
parents:
284
diff
changeset
|
163 def __init__(self,subterms,music): |
5322639d61e9
refactoring and little fixes in curvecalc and keyboardcomposer
Drew Perttula <drewp@bigasterisk.com>
parents:
284
diff
changeset
|
164 make_attributes_from_args('subterms','music') |
5322639d61e9
refactoring and little fixes in curvecalc and keyboardcomposer
Drew Perttula <drewp@bigasterisk.com>
parents:
284
diff
changeset
|
165 |
5322639d61e9
refactoring and little fixes in curvecalc and keyboardcomposer
Drew Perttula <drewp@bigasterisk.com>
parents:
284
diff
changeset
|
166 self.recent_t=[] |
5322639d61e9
refactoring and little fixes in curvecalc and keyboardcomposer
Drew Perttula <drewp@bigasterisk.com>
parents:
284
diff
changeset
|
167 self.later = None |
5322639d61e9
refactoring and little fixes in curvecalc and keyboardcomposer
Drew Perttula <drewp@bigasterisk.com>
parents:
284
diff
changeset
|
168 |
5322639d61e9
refactoring and little fixes in curvecalc and keyboardcomposer
Drew Perttula <drewp@bigasterisk.com>
parents:
284
diff
changeset
|
169 self.update() |
5322639d61e9
refactoring and little fixes in curvecalc and keyboardcomposer
Drew Perttula <drewp@bigasterisk.com>
parents:
284
diff
changeset
|
170 |
5322639d61e9
refactoring and little fixes in curvecalc and keyboardcomposer
Drew Perttula <drewp@bigasterisk.com>
parents:
284
diff
changeset
|
171 def update(self): |
5322639d61e9
refactoring and little fixes in curvecalc and keyboardcomposer
Drew Perttula <drewp@bigasterisk.com>
parents:
284
diff
changeset
|
172 d = music.current_time() |
5322639d61e9
refactoring and little fixes in curvecalc and keyboardcomposer
Drew Perttula <drewp@bigasterisk.com>
parents:
284
diff
changeset
|
173 d.addCallback(self.update2) |
5322639d61e9
refactoring and little fixes in curvecalc and keyboardcomposer
Drew Perttula <drewp@bigasterisk.com>
parents:
284
diff
changeset
|
174 d.addErrback(self.updateerr) |
5322639d61e9
refactoring and little fixes in curvecalc and keyboardcomposer
Drew Perttula <drewp@bigasterisk.com>
parents:
284
diff
changeset
|
175 |
5322639d61e9
refactoring and little fixes in curvecalc and keyboardcomposer
Drew Perttula <drewp@bigasterisk.com>
parents:
284
diff
changeset
|
176 def updateerr(self,e): |
5322639d61e9
refactoring and little fixes in curvecalc and keyboardcomposer
Drew Perttula <drewp@bigasterisk.com>
parents:
284
diff
changeset
|
177 |
5322639d61e9
refactoring and little fixes in curvecalc and keyboardcomposer
Drew Perttula <drewp@bigasterisk.com>
parents:
284
diff
changeset
|
178 print e.getTraceback() |
5322639d61e9
refactoring and little fixes in curvecalc and keyboardcomposer
Drew Perttula <drewp@bigasterisk.com>
parents:
284
diff
changeset
|
179 dispatcher.send("update status",val=e.getErrorMessage()) |
5322639d61e9
refactoring and little fixes in curvecalc and keyboardcomposer
Drew Perttula <drewp@bigasterisk.com>
parents:
284
diff
changeset
|
180 if self.later and not self.later.cancelled and not self.later.called: |
5322639d61e9
refactoring and little fixes in curvecalc and keyboardcomposer
Drew Perttula <drewp@bigasterisk.com>
parents:
284
diff
changeset
|
181 self.later.cancel() |
5322639d61e9
refactoring and little fixes in curvecalc and keyboardcomposer
Drew Perttula <drewp@bigasterisk.com>
parents:
284
diff
changeset
|
182 self.later = reactor.callLater(1,self.update) |
5322639d61e9
refactoring and little fixes in curvecalc and keyboardcomposer
Drew Perttula <drewp@bigasterisk.com>
parents:
284
diff
changeset
|
183 |
5322639d61e9
refactoring and little fixes in curvecalc and keyboardcomposer
Drew Perttula <drewp@bigasterisk.com>
parents:
284
diff
changeset
|
184 def update2(self,t): |
5322639d61e9
refactoring and little fixes in curvecalc and keyboardcomposer
Drew Perttula <drewp@bigasterisk.com>
parents:
284
diff
changeset
|
185 dispatcher.send("update status", |
5322639d61e9
refactoring and little fixes in curvecalc and keyboardcomposer
Drew Perttula <drewp@bigasterisk.com>
parents:
284
diff
changeset
|
186 val="ok: receiving time from music player") |
5322639d61e9
refactoring and little fixes in curvecalc and keyboardcomposer
Drew Perttula <drewp@bigasterisk.com>
parents:
284
diff
changeset
|
187 if self.later and not self.later.cancelled and not self.later.called: |
5322639d61e9
refactoring and little fixes in curvecalc and keyboardcomposer
Drew Perttula <drewp@bigasterisk.com>
parents:
284
diff
changeset
|
188 self.later.cancel() |
5322639d61e9
refactoring and little fixes in curvecalc and keyboardcomposer
Drew Perttula <drewp@bigasterisk.com>
parents:
284
diff
changeset
|
189 |
5322639d61e9
refactoring and little fixes in curvecalc and keyboardcomposer
Drew Perttula <drewp@bigasterisk.com>
parents:
284
diff
changeset
|
190 self.later = reactor.callLater(.05, self.update) |
5322639d61e9
refactoring and little fixes in curvecalc and keyboardcomposer
Drew Perttula <drewp@bigasterisk.com>
parents:
284
diff
changeset
|
191 |
5322639d61e9
refactoring and little fixes in curvecalc and keyboardcomposer
Drew Perttula <drewp@bigasterisk.com>
parents:
284
diff
changeset
|
192 self.recent_t = self.recent_t[-50:]+[t] |
5322639d61e9
refactoring and little fixes in curvecalc and keyboardcomposer
Drew Perttula <drewp@bigasterisk.com>
parents:
284
diff
changeset
|
193 period = (self.recent_t[-1] - self.recent_t[0]) / len(self.recent_t) |
5322639d61e9
refactoring and little fixes in curvecalc and keyboardcomposer
Drew Perttula <drewp@bigasterisk.com>
parents:
284
diff
changeset
|
194 dispatcher.send("update period", val=period) |
5322639d61e9
refactoring and little fixes in curvecalc and keyboardcomposer
Drew Perttula <drewp@bigasterisk.com>
parents:
284
diff
changeset
|
195 self.send_dmx(t) |
5322639d61e9
refactoring and little fixes in curvecalc and keyboardcomposer
Drew Perttula <drewp@bigasterisk.com>
parents:
284
diff
changeset
|
196 |
0 | 197 def send_dmx(self,t): |
198 scaledsubs=[] | |
199 for st in self.subterms: | |
200 scl = st.scaled(t) | |
201 scaledsubs.append(scl) | |
202 out = Submaster.sub_maxes(*scaledsubs) | |
205
3905d3c92aaa
twisted mainloop, more row-change keys, xmlrpc fadesub command on port 8050
drewp
parents:
202
diff
changeset
|
203 levs = out.get_levels() |
3905d3c92aaa
twisted mainloop, more row-change keys, xmlrpc fadesub command on port 8050
drewp
parents:
202
diff
changeset
|
204 now=time.time() |
3905d3c92aaa
twisted mainloop, more row-change keys, xmlrpc fadesub command on port 8050
drewp
parents:
202
diff
changeset
|
205 if now-self.lastsendtime>5 or levs!=self.lastsendlevs: |
3905d3c92aaa
twisted mainloop, more row-change keys, xmlrpc fadesub command on port 8050
drewp
parents:
202
diff
changeset
|
206 dispatcher.send("output levels",val=levs) |
3905d3c92aaa
twisted mainloop, more row-change keys, xmlrpc fadesub command on port 8050
drewp
parents:
202
diff
changeset
|
207 dmxclient.outputlevels(out.get_dmx_list(), |
3905d3c92aaa
twisted mainloop, more row-change keys, xmlrpc fadesub command on port 8050
drewp
parents:
202
diff
changeset
|
208 twisted=1,clientid='curvecalc') |
3905d3c92aaa
twisted mainloop, more row-change keys, xmlrpc fadesub command on port 8050
drewp
parents:
202
diff
changeset
|
209 self.lastsendtime = now |
3905d3c92aaa
twisted mainloop, more row-change keys, xmlrpc fadesub command on port 8050
drewp
parents:
202
diff
changeset
|
210 self.lastsendlevs = levs |
0 | 211 |
202 | 212 def create_status_lines(master): |
197
ba2677823b35
zoom control and other cleanups. also reads song length now
drewp
parents:
196
diff
changeset
|
213 for signame,textfilter in [ |
ba2677823b35
zoom control and other cleanups. also reads song length now
drewp
parents:
196
diff
changeset
|
214 ('input time',lambda t: "%.2fs"%t), |
ba2677823b35
zoom control and other cleanups. also reads song length now
drewp
parents:
196
diff
changeset
|
215 ('output levels', |
ba2677823b35
zoom control and other cleanups. also reads song length now
drewp
parents:
196
diff
changeset
|
216 lambda levels: textwrap.fill("; ".join(["%s:%.2f"%(n,v) |
ba2677823b35
zoom control and other cleanups. also reads song length now
drewp
parents:
196
diff
changeset
|
217 for n,v in |
205
3905d3c92aaa
twisted mainloop, more row-change keys, xmlrpc fadesub command on port 8050
drewp
parents:
202
diff
changeset
|
218 levels.items()[:5] |
3905d3c92aaa
twisted mainloop, more row-change keys, xmlrpc fadesub command on port 8050
drewp
parents:
202
diff
changeset
|
219 if v>0]),70)), |
197
ba2677823b35
zoom control and other cleanups. also reads song length now
drewp
parents:
196
diff
changeset
|
220 ('update period',lambda t: "%.1fms"%(t*1000)), |
236
63601fe0c3b0
curvecalc cmdline checking, connection status now in gui
drewp@bigasterisk.com
parents:
230
diff
changeset
|
221 ('update status',lambda t: str(t)), |
197
ba2677823b35
zoom control and other cleanups. also reads song length now
drewp
parents:
196
diff
changeset
|
222 ]: |
ba2677823b35
zoom control and other cleanups. also reads song length now
drewp
parents:
196
diff
changeset
|
223 l = tk.Label(master,anchor='w',justify='left') |
ba2677823b35
zoom control and other cleanups. also reads song length now
drewp
parents:
196
diff
changeset
|
224 l.pack(side='top',fill='x') |
ba2677823b35
zoom control and other cleanups. also reads song length now
drewp
parents:
196
diff
changeset
|
225 dispatcher.connect(lambda val,l=l,sn=signame,tf=textfilter: |
ba2677823b35
zoom control and other cleanups. also reads song length now
drewp
parents:
196
diff
changeset
|
226 l.config(text=sn+": "+tf(val)), |
ba2677823b35
zoom control and other cleanups. also reads song length now
drewp
parents:
196
diff
changeset
|
227 signame,weak=0) |
ba2677823b35
zoom control and other cleanups. also reads song length now
drewp
parents:
196
diff
changeset
|
228 |
202 | 229 def savesubterms(filename,subterms): |
205
3905d3c92aaa
twisted mainloop, more row-change keys, xmlrpc fadesub command on port 8050
drewp
parents:
202
diff
changeset
|
230 s="" |
202 | 231 for st in subterms: |
229 | 232 s=s+"%s %s\n" % (st.submaster.name, st.subexpr.expr) |
205
3905d3c92aaa
twisted mainloop, more row-change keys, xmlrpc fadesub command on port 8050
drewp
parents:
202
diff
changeset
|
233 |
3905d3c92aaa
twisted mainloop, more row-change keys, xmlrpc fadesub command on port 8050
drewp
parents:
202
diff
changeset
|
234 file(filename,'w').write(s) |
3905d3c92aaa
twisted mainloop, more row-change keys, xmlrpc fadesub command on port 8050
drewp
parents:
202
diff
changeset
|
235 |
3905d3c92aaa
twisted mainloop, more row-change keys, xmlrpc fadesub command on port 8050
drewp
parents:
202
diff
changeset
|
236 class SubtermSetView(tk.Frame): |
3905d3c92aaa
twisted mainloop, more row-change keys, xmlrpc fadesub command on port 8050
drewp
parents:
202
diff
changeset
|
237 def __init__(self, master, *args, **kw): |
3905d3c92aaa
twisted mainloop, more row-change keys, xmlrpc fadesub command on port 8050
drewp
parents:
202
diff
changeset
|
238 tk.Frame.__init__(self, master, *args, **kw) |
3905d3c92aaa
twisted mainloop, more row-change keys, xmlrpc fadesub command on port 8050
drewp
parents:
202
diff
changeset
|
239 self.cur_row = 0 |
3905d3c92aaa
twisted mainloop, more row-change keys, xmlrpc fadesub command on port 8050
drewp
parents:
202
diff
changeset
|
240 self.cur_col = 0 |
3905d3c92aaa
twisted mainloop, more row-change keys, xmlrpc fadesub command on port 8050
drewp
parents:
202
diff
changeset
|
241 self.ncols = 2 |
3905d3c92aaa
twisted mainloop, more row-change keys, xmlrpc fadesub command on port 8050
drewp
parents:
202
diff
changeset
|
242 def add_subtermview(self, stv): |
3905d3c92aaa
twisted mainloop, more row-change keys, xmlrpc fadesub command on port 8050
drewp
parents:
202
diff
changeset
|
243 stv.grid(row=self.cur_row, column=self.cur_col, sticky='news') |
3905d3c92aaa
twisted mainloop, more row-change keys, xmlrpc fadesub command on port 8050
drewp
parents:
202
diff
changeset
|
244 self.columnconfigure(self.cur_col, weight=1) |
3905d3c92aaa
twisted mainloop, more row-change keys, xmlrpc fadesub command on port 8050
drewp
parents:
202
diff
changeset
|
245 |
3905d3c92aaa
twisted mainloop, more row-change keys, xmlrpc fadesub command on port 8050
drewp
parents:
202
diff
changeset
|
246 self.cur_col += 1 |
3905d3c92aaa
twisted mainloop, more row-change keys, xmlrpc fadesub command on port 8050
drewp
parents:
202
diff
changeset
|
247 self.cur_col %= self.ncols |
3905d3c92aaa
twisted mainloop, more row-change keys, xmlrpc fadesub command on port 8050
drewp
parents:
202
diff
changeset
|
248 if self.cur_col == 0: |
3905d3c92aaa
twisted mainloop, more row-change keys, xmlrpc fadesub command on port 8050
drewp
parents:
202
diff
changeset
|
249 self.cur_row += 1 |
202 | 250 |
287
5322639d61e9
refactoring and little fixes in curvecalc and keyboardcomposer
Drew Perttula <drewp@bigasterisk.com>
parents:
284
diff
changeset
|
251 def add_one_subterm(subname, curveset, subterms, root, ssv, expr=None): |
5322639d61e9
refactoring and little fixes in curvecalc and keyboardcomposer
Drew Perttula <drewp@bigasterisk.com>
parents:
284
diff
changeset
|
252 if expr is None: |
5322639d61e9
refactoring and little fixes in curvecalc and keyboardcomposer
Drew Perttula <drewp@bigasterisk.com>
parents:
284
diff
changeset
|
253 expr = '%s(t)' % subname |
5322639d61e9
refactoring and little fixes in curvecalc and keyboardcomposer
Drew Perttula <drewp@bigasterisk.com>
parents:
284
diff
changeset
|
254 |
205
3905d3c92aaa
twisted mainloop, more row-change keys, xmlrpc fadesub command on port 8050
drewp
parents:
202
diff
changeset
|
255 term = Subterm(Submaster.Submaster(subname), Subexpr(curveset,expr)) |
3905d3c92aaa
twisted mainloop, more row-change keys, xmlrpc fadesub command on port 8050
drewp
parents:
202
diff
changeset
|
256 subterms.append(term) |
3905d3c92aaa
twisted mainloop, more row-change keys, xmlrpc fadesub command on port 8050
drewp
parents:
202
diff
changeset
|
257 |
3905d3c92aaa
twisted mainloop, more row-change keys, xmlrpc fadesub command on port 8050
drewp
parents:
202
diff
changeset
|
258 stv=Subtermview(ssv,term) |
3905d3c92aaa
twisted mainloop, more row-change keys, xmlrpc fadesub command on port 8050
drewp
parents:
202
diff
changeset
|
259 # stv.pack(side='top',fill='x') |
210
f41004d5a507
factored out some networking, new show/ layout, curvecalc works
drewp@bigasterisk.com
parents:
205
diff
changeset
|
260 |
205
3905d3c92aaa
twisted mainloop, more row-change keys, xmlrpc fadesub command on port 8050
drewp
parents:
202
diff
changeset
|
261 ssv.add_subtermview(stv) |
3905d3c92aaa
twisted mainloop, more row-change keys, xmlrpc fadesub command on port 8050
drewp
parents:
202
diff
changeset
|
262 |
3905d3c92aaa
twisted mainloop, more row-change keys, xmlrpc fadesub command on port 8050
drewp
parents:
202
diff
changeset
|
263 return term |
0 | 264 |
279
5bfcf309e1ad
Submaster objects listen for a signal to reload, curvecalc can broadcast it
David McClosky <dmcc@bigasterisk.com>
parents:
277
diff
changeset
|
265 def sub_commands_tk(master, curveset, subterms, root, ssv): |
205
3905d3c92aaa
twisted mainloop, more row-change keys, xmlrpc fadesub command on port 8050
drewp
parents:
202
diff
changeset
|
266 f=tk.Frame(master,relief='raised',bd=1) |
3905d3c92aaa
twisted mainloop, more row-change keys, xmlrpc fadesub command on port 8050
drewp
parents:
202
diff
changeset
|
267 newname = tk.StringVar() |
3905d3c92aaa
twisted mainloop, more row-change keys, xmlrpc fadesub command on port 8050
drewp
parents:
202
diff
changeset
|
268 |
3905d3c92aaa
twisted mainloop, more row-change keys, xmlrpc fadesub command on port 8050
drewp
parents:
202
diff
changeset
|
269 def add_cmd(): |
210
f41004d5a507
factored out some networking, new show/ layout, curvecalc works
drewp@bigasterisk.com
parents:
205
diff
changeset
|
270 add_one_subterm(newname.get(), curveset, subterms, root, ssv, '') |
281
e3362ad9a123
curvecalc gets "see time until end", C-r for reload, doc updates
David McClosky <dmcc@bigasterisk.com>
parents:
280
diff
changeset
|
271 newname.set('') |
205
3905d3c92aaa
twisted mainloop, more row-change keys, xmlrpc fadesub command on port 8050
drewp
parents:
202
diff
changeset
|
272 |
279
5bfcf309e1ad
Submaster objects listen for a signal to reload, curvecalc can broadcast it
David McClosky <dmcc@bigasterisk.com>
parents:
277
diff
changeset
|
273 def reload_subs(): |
5bfcf309e1ad
Submaster objects listen for a signal to reload, curvecalc can broadcast it
David McClosky <dmcc@bigasterisk.com>
parents:
277
diff
changeset
|
274 dispatcher.send('reload all subs') |
5bfcf309e1ad
Submaster objects listen for a signal to reload, curvecalc can broadcast it
David McClosky <dmcc@bigasterisk.com>
parents:
277
diff
changeset
|
275 |
281
e3362ad9a123
curvecalc gets "see time until end", C-r for reload, doc updates
David McClosky <dmcc@bigasterisk.com>
parents:
280
diff
changeset
|
276 tk.Button(f, text="reload subs (C-r)", |
e3362ad9a123
curvecalc gets "see time until end", C-r for reload, doc updates
David McClosky <dmcc@bigasterisk.com>
parents:
280
diff
changeset
|
277 command=reload_subs).pack(side='left') |
284
304a918e7488
curvecalc: make a new curve by pressing 'enter' in entry, no more buttons for these
David McClosky <dmcc@bigasterisk.com>
parents:
283
diff
changeset
|
278 tk.Label(f, text="new subterm named:").pack(side='left') |
282
d482699decbd
curvecalc: "Enter" in the new term entry creates new term
David McClosky <dmcc@bigasterisk.com>
parents:
281
diff
changeset
|
279 entry = tk.Entry(f, textvariable=newname) |
d482699decbd
curvecalc: "Enter" in the new term entry creates new term
David McClosky <dmcc@bigasterisk.com>
parents:
281
diff
changeset
|
280 entry.pack(side='left', fill='x', exp=1) |
d482699decbd
curvecalc: "Enter" in the new term entry creates new term
David McClosky <dmcc@bigasterisk.com>
parents:
281
diff
changeset
|
281 entry.bind("<Key-Return>", lambda evt: add_cmd()) |
d482699decbd
curvecalc: "Enter" in the new term entry creates new term
David McClosky <dmcc@bigasterisk.com>
parents:
281
diff
changeset
|
282 |
205
3905d3c92aaa
twisted mainloop, more row-change keys, xmlrpc fadesub command on port 8050
drewp
parents:
202
diff
changeset
|
283 return f |
287
5322639d61e9
refactoring and little fixes in curvecalc and keyboardcomposer
Drew Perttula <drewp@bigasterisk.com>
parents:
284
diff
changeset
|
284 |
5322639d61e9
refactoring and little fixes in curvecalc and keyboardcomposer
Drew Perttula <drewp@bigasterisk.com>
parents:
284
diff
changeset
|
285 def add_subterms_from_file(filename, curveset, subterms, root, ssv): |
5322639d61e9
refactoring and little fixes in curvecalc and keyboardcomposer
Drew Perttula <drewp@bigasterisk.com>
parents:
284
diff
changeset
|
286 for line in file(filename): |
5322639d61e9
refactoring and little fixes in curvecalc and keyboardcomposer
Drew Perttula <drewp@bigasterisk.com>
parents:
284
diff
changeset
|
287 try: |
5322639d61e9
refactoring and little fixes in curvecalc and keyboardcomposer
Drew Perttula <drewp@bigasterisk.com>
parents:
284
diff
changeset
|
288 subname,expr = line.strip().split(" ",1) |
5322639d61e9
refactoring and little fixes in curvecalc and keyboardcomposer
Drew Perttula <drewp@bigasterisk.com>
parents:
284
diff
changeset
|
289 except ValueError: |
5322639d61e9
refactoring and little fixes in curvecalc and keyboardcomposer
Drew Perttula <drewp@bigasterisk.com>
parents:
284
diff
changeset
|
290 subname = line.strip() |
5322639d61e9
refactoring and little fixes in curvecalc and keyboardcomposer
Drew Perttula <drewp@bigasterisk.com>
parents:
284
diff
changeset
|
291 expr = "" |
5322639d61e9
refactoring and little fixes in curvecalc and keyboardcomposer
Drew Perttula <drewp@bigasterisk.com>
parents:
284
diff
changeset
|
292 |
5322639d61e9
refactoring and little fixes in curvecalc and keyboardcomposer
Drew Perttula <drewp@bigasterisk.com>
parents:
284
diff
changeset
|
293 term = add_one_subterm(subname, curveset, subterms, root, ssv, expr) |
5322639d61e9
refactoring and little fixes in curvecalc and keyboardcomposer
Drew Perttula <drewp@bigasterisk.com>
parents:
284
diff
changeset
|
294 |
5322639d61e9
refactoring and little fixes in curvecalc and keyboardcomposer
Drew Perttula <drewp@bigasterisk.com>
parents:
284
diff
changeset
|
295 # stv=Subtermview(root,term) |
5322639d61e9
refactoring and little fixes in curvecalc and keyboardcomposer
Drew Perttula <drewp@bigasterisk.com>
parents:
284
diff
changeset
|
296 # stv.pack(side='top',fill='x') |
5322639d61e9
refactoring and little fixes in curvecalc and keyboardcomposer
Drew Perttula <drewp@bigasterisk.com>
parents:
284
diff
changeset
|
297 |
0 | 298 ####################################################################### |
299 root=tk.Tk() | |
205
3905d3c92aaa
twisted mainloop, more row-change keys, xmlrpc fadesub command on port 8050
drewp
parents:
202
diff
changeset
|
300 root.tk_setPalette("gray50") |
264
0f112a7dd6b3
fix window positoins for subcomposer and curvecalc. now saves geometry continuously
drewp@bigasterisk.com
parents:
248
diff
changeset
|
301 toplevelat("curvecalc",root) |
205
3905d3c92aaa
twisted mainloop, more row-change keys, xmlrpc fadesub command on port 8050
drewp
parents:
202
diff
changeset
|
302 root.tk_focusFollowsMouse() |
0 | 303 |
236
63601fe0c3b0
curvecalc cmdline checking, connection status now in gui
drewp@bigasterisk.com
parents:
230
diff
changeset
|
304 parser = optparse.OptionParser() |
63601fe0c3b0
curvecalc cmdline checking, connection status now in gui
drewp@bigasterisk.com
parents:
230
diff
changeset
|
305 options,args = parser.parse_args() |
63601fe0c3b0
curvecalc cmdline checking, connection status now in gui
drewp@bigasterisk.com
parents:
230
diff
changeset
|
306 |
63601fe0c3b0
curvecalc cmdline checking, connection status now in gui
drewp@bigasterisk.com
parents:
230
diff
changeset
|
307 try: |
63601fe0c3b0
curvecalc cmdline checking, connection status now in gui
drewp@bigasterisk.com
parents:
230
diff
changeset
|
308 song = args[0] |
63601fe0c3b0
curvecalc cmdline checking, connection status now in gui
drewp@bigasterisk.com
parents:
230
diff
changeset
|
309 except IndexError: |
63601fe0c3b0
curvecalc cmdline checking, connection status now in gui
drewp@bigasterisk.com
parents:
230
diff
changeset
|
310 raise SystemExit("song name is required, e.g. '05-mix'") |
63601fe0c3b0
curvecalc cmdline checking, connection status now in gui
drewp@bigasterisk.com
parents:
230
diff
changeset
|
311 |
202 | 312 music=Music() |
0 | 313 |
197
ba2677823b35
zoom control and other cleanups. also reads song length now
drewp
parents:
196
diff
changeset
|
314 zc = Zoomcontrol(root) |
ba2677823b35
zoom control and other cleanups. also reads song length now
drewp
parents:
196
diff
changeset
|
315 zc.pack(side='top',fill='x') |
ba2677823b35
zoom control and other cleanups. also reads song length now
drewp
parents:
196
diff
changeset
|
316 |
202 | 317 curveset = Curveset() |
318 csv = Curvesetview(root,curveset) | |
197
ba2677823b35
zoom control and other cleanups. also reads song length now
drewp
parents:
196
diff
changeset
|
319 csv.pack(side='top',fill='both',exp=1) |
0 | 320 |
205
3905d3c92aaa
twisted mainloop, more row-change keys, xmlrpc fadesub command on port 8050
drewp
parents:
202
diff
changeset
|
321 ssv = SubtermSetView(root) |
3905d3c92aaa
twisted mainloop, more row-change keys, xmlrpc fadesub command on port 8050
drewp
parents:
202
diff
changeset
|
322 ssv.pack(side='top', fill='x') |
202 | 323 |
279
5bfcf309e1ad
Submaster objects listen for a signal to reload, curvecalc can broadcast it
David McClosky <dmcc@bigasterisk.com>
parents:
277
diff
changeset
|
324 root.title("Curvemaster 3000MX - %s" % song) |
205
3905d3c92aaa
twisted mainloop, more row-change keys, xmlrpc fadesub command on port 8050
drewp
parents:
202
diff
changeset
|
325 |
215 | 326 musicfilename = showconfig.songFilename(song) |
205
3905d3c92aaa
twisted mainloop, more row-change keys, xmlrpc fadesub command on port 8050
drewp
parents:
202
diff
changeset
|
327 maxtime = wavelength(musicfilename) |
3905d3c92aaa
twisted mainloop, more row-change keys, xmlrpc fadesub command on port 8050
drewp
parents:
202
diff
changeset
|
328 dispatcher.send("max time",maxtime=maxtime) |
3905d3c92aaa
twisted mainloop, more row-change keys, xmlrpc fadesub command on port 8050
drewp
parents:
202
diff
changeset
|
329 dispatcher.connect(lambda: maxtime, "get max time",weak=0) |
215 | 330 curveset.load(basename=os.path.join(showconfig.curvesDir(),song)) |
0 | 331 |
332 subterms = [] | |
279
5bfcf309e1ad
Submaster objects listen for a signal to reload, curvecalc can broadcast it
David McClosky <dmcc@bigasterisk.com>
parents:
277
diff
changeset
|
333 sub_commands_tk(root, curveset, subterms, root, ssv).pack(side='top',fill='x') |
5bfcf309e1ad
Submaster objects listen for a signal to reload, curvecalc can broadcast it
David McClosky <dmcc@bigasterisk.com>
parents:
277
diff
changeset
|
334 |
287
5322639d61e9
refactoring and little fixes in curvecalc and keyboardcomposer
Drew Perttula <drewp@bigasterisk.com>
parents:
284
diff
changeset
|
335 add_subterms_from_file(showconfig.subtermsForSong(song), |
5322639d61e9
refactoring and little fixes in curvecalc and keyboardcomposer
Drew Perttula <drewp@bigasterisk.com>
parents:
284
diff
changeset
|
336 curveset, subterms, root, ssv) |
0 | 337 |
287
5322639d61e9
refactoring and little fixes in curvecalc and keyboardcomposer
Drew Perttula <drewp@bigasterisk.com>
parents:
284
diff
changeset
|
338 out = Output(subterms, music) |
0 | 339 |
205
3905d3c92aaa
twisted mainloop, more row-change keys, xmlrpc fadesub command on port 8050
drewp
parents:
202
diff
changeset
|
340 def savekey(*args): |
3905d3c92aaa
twisted mainloop, more row-change keys, xmlrpc fadesub command on port 8050
drewp
parents:
202
diff
changeset
|
341 print "saving",song |
215 | 342 savesubterms(showconfig.subtermsForSong(song),subterms) |
230
b7095e4a6c43
curvecalc fixes: curve paths, empty function strings
drewp@bigasterisk.com
parents:
229
diff
changeset
|
343 curveset.save(basename=os.path.join(showconfig.curvesDir(),song)) |
205
3905d3c92aaa
twisted mainloop, more row-change keys, xmlrpc fadesub command on port 8050
drewp
parents:
202
diff
changeset
|
344 print "saved" |
3905d3c92aaa
twisted mainloop, more row-change keys, xmlrpc fadesub command on port 8050
drewp
parents:
202
diff
changeset
|
345 |
3905d3c92aaa
twisted mainloop, more row-change keys, xmlrpc fadesub command on port 8050
drewp
parents:
202
diff
changeset
|
346 root.bind("<Control-Key-s>",savekey) |
281
e3362ad9a123
curvecalc gets "see time until end", C-r for reload, doc updates
David McClosky <dmcc@bigasterisk.com>
parents:
280
diff
changeset
|
347 root.bind("<Control-Key-r>", lambda evt: dispatcher.send('reload all subs')) |
202 | 348 |
349 create_status_lines(root) | |
290 | 350 for helpline in ["Bindings: C-s save subterms; B1 drag point; C-B1 curve add point; S-B1 sketch points; Del point under mouse; 1..5 add point at time; Esc see current time; S-Esc see curtime to end; Mousewheel zoom; C-p play/pause music at mouse", |
228
9827df597f86
added help texts to subcomposer, curvecalc
drewp@bigasterisk.com
parents:
216
diff
changeset
|
351 "Available in functions: nsin/ncos period=amp=1; within(a,b) bef(x) aft(x) compare to time; smoove(x) cubic smoothstep; curvename(t) eval curve"]: |
9827df597f86
added help texts to subcomposer, curvecalc
drewp@bigasterisk.com
parents:
216
diff
changeset
|
352 tk.Label(root,text=helpline, font="Helvetica -12 italic", |
9827df597f86
added help texts to subcomposer, curvecalc
drewp@bigasterisk.com
parents:
216
diff
changeset
|
353 anchor='w').pack(side='top',fill='x') |
9827df597f86
added help texts to subcomposer, curvecalc
drewp@bigasterisk.com
parents:
216
diff
changeset
|
354 |
205
3905d3c92aaa
twisted mainloop, more row-change keys, xmlrpc fadesub command on port 8050
drewp
parents:
202
diff
changeset
|
355 #def logprint(msg): |
3905d3c92aaa
twisted mainloop, more row-change keys, xmlrpc fadesub command on port 8050
drewp
parents:
202
diff
changeset
|
356 # print "log",msg |
3905d3c92aaa
twisted mainloop, more row-change keys, xmlrpc fadesub command on port 8050
drewp
parents:
202
diff
changeset
|
357 #twisted.python.log.addObserver(logprint) |
3905d3c92aaa
twisted mainloop, more row-change keys, xmlrpc fadesub command on port 8050
drewp
parents:
202
diff
changeset
|
358 |
3905d3c92aaa
twisted mainloop, more row-change keys, xmlrpc fadesub command on port 8050
drewp
parents:
202
diff
changeset
|
359 root.bind("<Control-Key-q>",lambda ev: reactor.stop) |
3905d3c92aaa
twisted mainloop, more row-change keys, xmlrpc fadesub command on port 8050
drewp
parents:
202
diff
changeset
|
360 root.bind("<Destroy>",lambda ev: reactor.stop) |
3905d3c92aaa
twisted mainloop, more row-change keys, xmlrpc fadesub command on port 8050
drewp
parents:
202
diff
changeset
|
361 root.protocol('WM_DELETE_WINDOW', reactor.stop) |
267
9de7bbf50267
curvecalc fixes, especially a slowdown of the updates that's working better
drewp@bigasterisk.com
parents:
264
diff
changeset
|
362 tksupport.install(root,ms=20) |
0 | 363 if 0: |
267
9de7bbf50267
curvecalc fixes, especially a slowdown of the updates that's working better
drewp@bigasterisk.com
parents:
264
diff
changeset
|
364 sys.path.append("/home/drewp/projects/cuisine/pour") |
0 | 365 from utils import runstats |
366 runstats("reactor.run()") | |
367 else: | |
368 reactor.run() |