Mercurial > code > home > repos > light9
annotate bin/curvecalc @ 516:73b181155555
curvecalc ui touchups, adjustable pane, curve draw speedup, restructured main layout code
Ignore-this: b0468548ef9f276dea4a8689dc425b24
author | drewp@bigasterisk.com |
---|---|
date | Mon, 29 Jun 2009 04:06:17 +0000 |
parents | cbc98de2ab06 |
children | f15ffbfc5cd6 |
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 """ |
351
a6662d61ebcd
SC, KC, CC now run and seem to load and save ok. CC does not have any rdf for its data files
Drew Perttula <drewp@bigasterisk.com>
parents:
335
diff
changeset
|
4 now launches like this: |
a6662d61ebcd
SC, KC, CC now run and seem to load and save ok. CC does not have any rdf for its data files
Drew Perttula <drewp@bigasterisk.com>
parents:
335
diff
changeset
|
5 % bin/curvecalc http://light9.bigasterisk.com/show/dance2007/song1 |
a6662d61ebcd
SC, KC, CC now run and seem to load and save ok. CC does not have any rdf for its data files
Drew Perttula <drewp@bigasterisk.com>
parents:
335
diff
changeset
|
6 |
a6662d61ebcd
SC, KC, CC now run and seem to load and save ok. CC does not have any rdf for its data files
Drew Perttula <drewp@bigasterisk.com>
parents:
335
diff
changeset
|
7 |
a6662d61ebcd
SC, KC, CC now run and seem to load and save ok. CC does not have any rdf for its data files
Drew Perttula <drewp@bigasterisk.com>
parents:
335
diff
changeset
|
8 |
197
ba2677823b35
zoom control and other cleanups. also reads song length now
drewp
parents:
196
diff
changeset
|
9 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
|
10 |
ba2677823b35
zoom control and other cleanups. also reads song length now
drewp
parents:
196
diff
changeset
|
11 """ |
0 | 12 from __future__ import division |
505 | 13 import time,textwrap,math,random,os,optparse |
14 import Tix as tk | |
332
d4aff817a304
add compatibility with louie.dispatcher
drewp@bigasterisk.com
parents:
326
diff
changeset
|
15 try: |
d4aff817a304
add compatibility with louie.dispatcher
drewp@bigasterisk.com
parents:
326
diff
changeset
|
16 from dispatch import dispatcher |
d4aff817a304
add compatibility with louie.dispatcher
drewp@bigasterisk.com
parents:
326
diff
changeset
|
17 except ImportError: |
d4aff817a304
add compatibility with louie.dispatcher
drewp@bigasterisk.com
parents:
326
diff
changeset
|
18 import louie as dispatcher |
0 | 19 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
|
20 import twisted |
0 | 21 from twisted.web.xmlrpc import Proxy |
473
9ed6c40b3d6a
new subterms get a good uri and label
drewp@bigasterisk.com
parents:
454
diff
changeset
|
22 from rdflib import Literal, URIRef, RDF, RDFS |
357
7771f37252da
curvecalc persistence, wavecurve -a option
Drew Perttula <drewp@bigasterisk.com>
parents:
351
diff
changeset
|
23 from rdflib.Graph import Graph |
400
b2858c2d4a4d
aft() has smooth arg; workaround for CC writing poor subterms
Drew Perttula <drewp@bigasterisk.com>
parents:
399
diff
changeset
|
24 import rdflib |
319
2193eab0650b
add startup logging to curvecalc
Drew Perttula <drewp@bigasterisk.com>
parents:
296
diff
changeset
|
25 import logging |
2193eab0650b
add startup logging to curvecalc
Drew Perttula <drewp@bigasterisk.com>
parents:
296
diff
changeset
|
26 log = logging.getLogger() |
2193eab0650b
add startup logging to curvecalc
Drew Perttula <drewp@bigasterisk.com>
parents:
296
diff
changeset
|
27 logging.basicConfig(format="%(asctime)s %(levelname)-5s %(name)s %(filename)s:%(lineno)d: %(message)s") |
2193eab0650b
add startup logging to curvecalc
Drew Perttula <drewp@bigasterisk.com>
parents:
296
diff
changeset
|
28 log.setLevel(logging.DEBUG) |
0 | 29 |
210
f41004d5a507
factored out some networking, new show/ layout, curvecalc works
drewp@bigasterisk.com
parents:
205
diff
changeset
|
30 import run_local |
399
40b6a06bd090
rework Effects.py to fix chase(). now uses chase lists from config.n3
Drew Perttula <drewp@bigasterisk.com>
parents:
398
diff
changeset
|
31 from light9 import Submaster, dmxclient, networking, showconfig, prof, Patch |
505 | 32 from light9.TLUtility import make_attributes_from_args |
210
f41004d5a507
factored out some networking, new show/ layout, curvecalc works
drewp@bigasterisk.com
parents:
205
diff
changeset
|
33 from light9.zoomcontrol import Zoomcontrol |
505 | 34 from light9.curve import Curveset, Curvesetview |
264
0f112a7dd6b3
fix window positoins for subcomposer and curvecalc. now saves geometry continuously
drewp@bigasterisk.com
parents:
248
diff
changeset
|
35 from light9.wavelength import wavelength |
0f112a7dd6b3
fix window positoins for subcomposer and curvecalc. now saves geometry continuously
drewp@bigasterisk.com
parents:
248
diff
changeset
|
36 from light9.uihelpers import toplevelat |
335 | 37 from light9.namespaces import L9 |
293
1c590824dd14
chase logic is (mostly) fixed, integrate with curvecalc
David McClosky <dmcc@bigasterisk.com>
parents:
290
diff
changeset
|
38 import light9.Effects |
1c590824dd14
chase logic is (mostly) fixed, integrate with curvecalc
David McClosky <dmcc@bigasterisk.com>
parents:
290
diff
changeset
|
39 |
0 | 40 class Music: |
41 def __init__(self): | |
42 self.player=None # xmlrpc Proxy to player | |
43 self.recenttime=0 | |
287
5322639d61e9
refactoring and little fixes in curvecalc and keyboardcomposer
Drew Perttula <drewp@bigasterisk.com>
parents:
284
diff
changeset
|
44 |
5322639d61e9
refactoring and little fixes in curvecalc and keyboardcomposer
Drew Perttula <drewp@bigasterisk.com>
parents:
284
diff
changeset
|
45 dispatcher.connect(self.seekplay_or_pause,"music seek") |
197
ba2677823b35
zoom control and other cleanups. also reads song length now
drewp
parents:
196
diff
changeset
|
46 |
0 | 47 def current_time(self): |
48 """return deferred which gets called with the current time""" | |
49 if self.player is None: | |
402 | 50 print "connect to player" |
211
9b360ee8636e
move patchdata into show/, pull out curve.py from curvecalc, more networking.py unification
drewp@bigasterisk.com
parents:
210
diff
changeset
|
51 self.player = Proxy(networking.musicUrl()) |
205
3905d3c92aaa
twisted mainloop, more row-change keys, xmlrpc fadesub command on port 8050
drewp
parents:
202
diff
changeset
|
52 # d = self.player.callRemote("songlength") |
3905d3c92aaa
twisted mainloop, more row-change keys, xmlrpc fadesub command on port 8050
drewp
parents:
202
diff
changeset
|
53 # 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
|
54 # d = self.player.callRemote("songname") |
3905d3c92aaa
twisted mainloop, more row-change keys, xmlrpc fadesub command on port 8050
drewp
parents:
202
diff
changeset
|
55 # d.addCallback(lambda n: dispatcher.send("songname",name=n)) |
0 | 56 d = self.player.callRemote('gettime') |
57 def sendtime(t): | |
58 dispatcher.send("input time",val=t) | |
59 return t # pass along to the real receiver | |
60 def error(e): | |
61 pass#self.player=None | |
62 d.addCallback(sendtime) | |
63 return d | |
277
e7630a2072bd
awesome curvecalc control of ascoltami
drewp@bigasterisk.com
parents:
274
diff
changeset
|
64 |
e7630a2072bd
awesome curvecalc control of ascoltami
drewp@bigasterisk.com
parents:
274
diff
changeset
|
65 def seekplay_or_pause(self,t): |
e7630a2072bd
awesome curvecalc control of ascoltami
drewp@bigasterisk.com
parents:
274
diff
changeset
|
66 self.player.callRemote('seekplay_or_pause',t) |
399
40b6a06bd090
rework Effects.py to fix chase(). now uses chase lists from config.n3
Drew Perttula <drewp@bigasterisk.com>
parents:
398
diff
changeset
|
67 |
40b6a06bd090
rework Effects.py to fix chase(). now uses chase lists from config.n3
Drew Perttula <drewp@bigasterisk.com>
parents:
398
diff
changeset
|
68 class Expr(object): |
40b6a06bd090
rework Effects.py to fix chase(). now uses chase lists from config.n3
Drew Perttula <drewp@bigasterisk.com>
parents:
398
diff
changeset
|
69 """singleton, provides functions for use in subterm expressions, |
40b6a06bd090
rework Effects.py to fix chase(). now uses chase lists from config.n3
Drew Perttula <drewp@bigasterisk.com>
parents:
398
diff
changeset
|
70 e.g. chases""" |
40b6a06bd090
rework Effects.py to fix chase(). now uses chase lists from config.n3
Drew Perttula <drewp@bigasterisk.com>
parents:
398
diff
changeset
|
71 def __init__(self): |
40b6a06bd090
rework Effects.py to fix chase(). now uses chase lists from config.n3
Drew Perttula <drewp@bigasterisk.com>
parents:
398
diff
changeset
|
72 self.effectGlobals = light9.Effects.configExprGlobals() |
40b6a06bd090
rework Effects.py to fix chase(). now uses chase lists from config.n3
Drew Perttula <drewp@bigasterisk.com>
parents:
398
diff
changeset
|
73 |
40b6a06bd090
rework Effects.py to fix chase(). now uses chase lists from config.n3
Drew Perttula <drewp@bigasterisk.com>
parents:
398
diff
changeset
|
74 def exprGlobals(self, startDict, t): |
40b6a06bd090
rework Effects.py to fix chase(). now uses chase lists from config.n3
Drew Perttula <drewp@bigasterisk.com>
parents:
398
diff
changeset
|
75 """globals dict for use by expressions""" |
40b6a06bd090
rework Effects.py to fix chase(). now uses chase lists from config.n3
Drew Perttula <drewp@bigasterisk.com>
parents:
398
diff
changeset
|
76 |
40b6a06bd090
rework Effects.py to fix chase(). now uses chase lists from config.n3
Drew Perttula <drewp@bigasterisk.com>
parents:
398
diff
changeset
|
77 glo = startDict.copy() |
0 | 78 |
293
1c590824dd14
chase logic is (mostly) fixed, integrate with curvecalc
David McClosky <dmcc@bigasterisk.com>
parents:
290
diff
changeset
|
79 # add in functions from Effects |
399
40b6a06bd090
rework Effects.py to fix chase(). now uses chase lists from config.n3
Drew Perttula <drewp@bigasterisk.com>
parents:
398
diff
changeset
|
80 glo.update(self.effectGlobals) |
293
1c590824dd14
chase logic is (mostly) fixed, integrate with curvecalc
David McClosky <dmcc@bigasterisk.com>
parents:
290
diff
changeset
|
81 |
205
3905d3c92aaa
twisted mainloop, more row-change keys, xmlrpc fadesub command on port 8050
drewp
parents:
202
diff
changeset
|
82 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
|
83 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
|
84 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
|
85 glo['bef'] = lambda x: t < x |
400
b2858c2d4a4d
aft() has smooth arg; workaround for CC writing poor subterms
Drew Perttula <drewp@bigasterisk.com>
parents:
399
diff
changeset
|
86 |
b2858c2d4a4d
aft() has smooth arg; workaround for CC writing poor subterms
Drew Perttula <drewp@bigasterisk.com>
parents:
399
diff
changeset
|
87 |
b2858c2d4a4d
aft() has smooth arg; workaround for CC writing poor subterms
Drew Perttula <drewp@bigasterisk.com>
parents:
399
diff
changeset
|
88 def smoove(x): |
b2858c2d4a4d
aft() has smooth arg; workaround for CC writing poor subterms
Drew Perttula <drewp@bigasterisk.com>
parents:
399
diff
changeset
|
89 return -2 * (x ** 3) + 3 * (x ** 2) |
b2858c2d4a4d
aft() has smooth arg; workaround for CC writing poor subterms
Drew Perttula <drewp@bigasterisk.com>
parents:
399
diff
changeset
|
90 glo['smoove'] = smoove |
b2858c2d4a4d
aft() has smooth arg; workaround for CC writing poor subterms
Drew Perttula <drewp@bigasterisk.com>
parents:
399
diff
changeset
|
91 |
b2858c2d4a4d
aft() has smooth arg; workaround for CC writing poor subterms
Drew Perttula <drewp@bigasterisk.com>
parents:
399
diff
changeset
|
92 def aft(t, x, smooth=0): |
b2858c2d4a4d
aft() has smooth arg; workaround for CC writing poor subterms
Drew Perttula <drewp@bigasterisk.com>
parents:
399
diff
changeset
|
93 left = x - smooth / 2 |
b2858c2d4a4d
aft() has smooth arg; workaround for CC writing poor subterms
Drew Perttula <drewp@bigasterisk.com>
parents:
399
diff
changeset
|
94 right = x + smooth / 2 |
b2858c2d4a4d
aft() has smooth arg; workaround for CC writing poor subterms
Drew Perttula <drewp@bigasterisk.com>
parents:
399
diff
changeset
|
95 if left < t < right: |
b2858c2d4a4d
aft() has smooth arg; workaround for CC writing poor subterms
Drew Perttula <drewp@bigasterisk.com>
parents:
399
diff
changeset
|
96 return smoove((t - left) / (right - left)) |
b2858c2d4a4d
aft() has smooth arg; workaround for CC writing poor subterms
Drew Perttula <drewp@bigasterisk.com>
parents:
399
diff
changeset
|
97 return t > x |
b2858c2d4a4d
aft() has smooth arg; workaround for CC writing poor subterms
Drew Perttula <drewp@bigasterisk.com>
parents:
399
diff
changeset
|
98 glo['aft'] = lambda x, smooth=0: aft(t, x, smooth) |
205
3905d3c92aaa
twisted mainloop, more row-change keys, xmlrpc fadesub command on port 8050
drewp
parents:
202
diff
changeset
|
99 |
399
40b6a06bd090
rework Effects.py to fix chase(). now uses chase lists from config.n3
Drew Perttula <drewp@bigasterisk.com>
parents:
398
diff
changeset
|
100 def chan(name): |
40b6a06bd090
rework Effects.py to fix chase(). now uses chase lists from config.n3
Drew Perttula <drewp@bigasterisk.com>
parents:
398
diff
changeset
|
101 return Submaster.Submaster( |
40b6a06bd090
rework Effects.py to fix chase(). now uses chase lists from config.n3
Drew Perttula <drewp@bigasterisk.com>
parents:
398
diff
changeset
|
102 leveldict={Patch.get_dmx_channel(name) : 1.0}, |
40b6a06bd090
rework Effects.py to fix chase(). now uses chase lists from config.n3
Drew Perttula <drewp@bigasterisk.com>
parents:
398
diff
changeset
|
103 temporary=True) |
40b6a06bd090
rework Effects.py to fix chase(). now uses chase lists from config.n3
Drew Perttula <drewp@bigasterisk.com>
parents:
398
diff
changeset
|
104 glo['chan'] = chan |
40b6a06bd090
rework Effects.py to fix chase(). now uses chase lists from config.n3
Drew Perttula <drewp@bigasterisk.com>
parents:
398
diff
changeset
|
105 |
205
3905d3c92aaa
twisted mainloop, more row-change keys, xmlrpc fadesub command on port 8050
drewp
parents:
202
diff
changeset
|
106 def smooth_random(speed=1): |
3905d3c92aaa
twisted mainloop, more row-change keys, xmlrpc fadesub command on port 8050
drewp
parents:
202
diff
changeset
|
107 """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
|
108 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
|
109 x1 = int(x) |
3905d3c92aaa
twisted mainloop, more row-change keys, xmlrpc fadesub command on port 8050
drewp
parents:
202
diff
changeset
|
110 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
|
111 y1 = self._smooth_random_items[x1] |
3905d3c92aaa
twisted mainloop, more row-change keys, xmlrpc fadesub command on port 8050
drewp
parents:
202
diff
changeset
|
112 y2 = self._smooth_random_items[x2] |
3905d3c92aaa
twisted mainloop, more row-change keys, xmlrpc fadesub command on port 8050
drewp
parents:
202
diff
changeset
|
113 return y1 + (y2 - y1) * ((x - x1)) |
3905d3c92aaa
twisted mainloop, more row-change keys, xmlrpc fadesub command on port 8050
drewp
parents:
202
diff
changeset
|
114 |
3905d3c92aaa
twisted mainloop, more row-change keys, xmlrpc fadesub command on port 8050
drewp
parents:
202
diff
changeset
|
115 def notch_random(speed=1): |
3905d3c92aaa
twisted mainloop, more row-change keys, xmlrpc fadesub command on port 8050
drewp
parents:
202
diff
changeset
|
116 """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
|
117 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
|
118 x1 = int(x) |
3905d3c92aaa
twisted mainloop, more row-change keys, xmlrpc fadesub command on port 8050
drewp
parents:
202
diff
changeset
|
119 y1 = self._smooth_random_items[x1] |
3905d3c92aaa
twisted mainloop, more row-change keys, xmlrpc fadesub command on port 8050
drewp
parents:
202
diff
changeset
|
120 return y1 |
3905d3c92aaa
twisted mainloop, more row-change keys, xmlrpc fadesub command on port 8050
drewp
parents:
202
diff
changeset
|
121 |
3905d3c92aaa
twisted mainloop, more row-change keys, xmlrpc fadesub command on port 8050
drewp
parents:
202
diff
changeset
|
122 glo['noise'] = smooth_random |
3905d3c92aaa
twisted mainloop, more row-change keys, xmlrpc fadesub command on port 8050
drewp
parents:
202
diff
changeset
|
123 glo['notch'] = notch_random |
3905d3c92aaa
twisted mainloop, more row-change keys, xmlrpc fadesub command on port 8050
drewp
parents:
202
diff
changeset
|
124 |
400
b2858c2d4a4d
aft() has smooth arg; workaround for CC writing poor subterms
Drew Perttula <drewp@bigasterisk.com>
parents:
399
diff
changeset
|
125 |
b2858c2d4a4d
aft() has smooth arg; workaround for CC writing poor subterms
Drew Perttula <drewp@bigasterisk.com>
parents:
399
diff
changeset
|
126 |
399
40b6a06bd090
rework Effects.py to fix chase(). now uses chase lists from config.n3
Drew Perttula <drewp@bigasterisk.com>
parents:
398
diff
changeset
|
127 return glo |
40b6a06bd090
rework Effects.py to fix chase(). now uses chase lists from config.n3
Drew Perttula <drewp@bigasterisk.com>
parents:
398
diff
changeset
|
128 |
40b6a06bd090
rework Effects.py to fix chase(). now uses chase lists from config.n3
Drew Perttula <drewp@bigasterisk.com>
parents:
398
diff
changeset
|
129 exprglo = Expr() |
40b6a06bd090
rework Effects.py to fix chase(). now uses chase lists from config.n3
Drew Perttula <drewp@bigasterisk.com>
parents:
398
diff
changeset
|
130 |
40b6a06bd090
rework Effects.py to fix chase(). now uses chase lists from config.n3
Drew Perttula <drewp@bigasterisk.com>
parents:
398
diff
changeset
|
131 class Subexpr: |
40b6a06bd090
rework Effects.py to fix chase(). now uses chase lists from config.n3
Drew Perttula <drewp@bigasterisk.com>
parents:
398
diff
changeset
|
132 curveset = None |
40b6a06bd090
rework Effects.py to fix chase(). now uses chase lists from config.n3
Drew Perttula <drewp@bigasterisk.com>
parents:
398
diff
changeset
|
133 def __init__(self,curveset,expr=""): |
40b6a06bd090
rework Effects.py to fix chase(). now uses chase lists from config.n3
Drew Perttula <drewp@bigasterisk.com>
parents:
398
diff
changeset
|
134 self.curveset = curveset |
40b6a06bd090
rework Effects.py to fix chase(). now uses chase lists from config.n3
Drew Perttula <drewp@bigasterisk.com>
parents:
398
diff
changeset
|
135 self.lasteval = None |
40b6a06bd090
rework Effects.py to fix chase(). now uses chase lists from config.n3
Drew Perttula <drewp@bigasterisk.com>
parents:
398
diff
changeset
|
136 self.expr=expr |
40b6a06bd090
rework Effects.py to fix chase(). now uses chase lists from config.n3
Drew Perttula <drewp@bigasterisk.com>
parents:
398
diff
changeset
|
137 self._smooth_random_items = [random.random() for x in range(100)] |
40b6a06bd090
rework Effects.py to fix chase(). now uses chase lists from config.n3
Drew Perttula <drewp@bigasterisk.com>
parents:
398
diff
changeset
|
138 def eval(self,t): |
40b6a06bd090
rework Effects.py to fix chase(). now uses chase lists from config.n3
Drew Perttula <drewp@bigasterisk.com>
parents:
398
diff
changeset
|
139 if self.expr=="": |
40b6a06bd090
rework Effects.py to fix chase(). now uses chase lists from config.n3
Drew Perttula <drewp@bigasterisk.com>
parents:
398
diff
changeset
|
140 dispatcher.send("expr_error",sender=self,exc="no expr, using 0") |
40b6a06bd090
rework Effects.py to fix chase(). now uses chase lists from config.n3
Drew Perttula <drewp@bigasterisk.com>
parents:
398
diff
changeset
|
141 return 0 |
40b6a06bd090
rework Effects.py to fix chase(). now uses chase lists from config.n3
Drew Perttula <drewp@bigasterisk.com>
parents:
398
diff
changeset
|
142 glo = self.curveset.globalsdict() |
40b6a06bd090
rework Effects.py to fix chase(). now uses chase lists from config.n3
Drew Perttula <drewp@bigasterisk.com>
parents:
398
diff
changeset
|
143 glo['t'] = t |
40b6a06bd090
rework Effects.py to fix chase(). now uses chase lists from config.n3
Drew Perttula <drewp@bigasterisk.com>
parents:
398
diff
changeset
|
144 |
40b6a06bd090
rework Effects.py to fix chase(). now uses chase lists from config.n3
Drew Perttula <drewp@bigasterisk.com>
parents:
398
diff
changeset
|
145 glo = exprglo.exprGlobals(glo, t) |
40b6a06bd090
rework Effects.py to fix chase(). now uses chase lists from config.n3
Drew Perttula <drewp@bigasterisk.com>
parents:
398
diff
changeset
|
146 |
0 | 147 try: |
148 self.lasteval = eval(self.expr,glo) | |
149 except Exception,e: | |
150 dispatcher.send("expr_error",sender=self,exc=e) | |
151 else: | |
205
3905d3c92aaa
twisted mainloop, more row-change keys, xmlrpc fadesub command on port 8050
drewp
parents:
202
diff
changeset
|
152 dispatcher.send("expr_error",sender=self,exc="ok") |
0 | 153 return self.lasteval |
154 | |
155 def expr(): | |
156 doc = "python expression for level as a function of t, using curves" | |
157 def fget(self): | |
158 return self._expr | |
159 def fset(self, value): | |
160 self._expr = value | |
161 dispatcher("expr_changed",sender=self) | |
162 return locals() | |
163 expr = property(**expr()) | |
164 | |
165 class Subexprview(tk.Frame): | |
166 def __init__(self,master,se,**kw): | |
167 self.subexpr=se | |
168 tk.Frame.__init__(self,master,**kw) | |
169 self.evar = tk.StringVar() | |
212 | 170 e = self.ent = tk.Entry(self,textvariable=self.evar) |
171 e.pack(side='left',fill='x',exp=1) | |
0 | 172 self.expr_changed() |
173 self.evar.trace_variable('w',self.evar_changed) | |
174 dispatcher.connect(self.expr_changed,"expr_changed", | |
175 sender=self.subexpr) | |
212 | 176 self.error = tk.Label(self) |
0 | 177 self.error.pack(side='left') |
178 dispatcher.connect(lambda exc: self.error.config(text=str(exc)), | |
179 "expr_error",sender=self.subexpr,weak=0) | |
180 def expr_changed(self): | |
181 if self.subexpr.expr!=self.evar.get(): | |
182 self.evar.set(self.subexpr.expr) | |
183 def evar_changed(self,*args): | |
184 self.subexpr.expr = self.evar.get() | |
185 | |
186 class Subterm: | |
187 """one Submaster and its Subexpr""" | |
274
9bf9685f5aae
curvecalc exprs can return a whole Submaster now
David McClosky <dmcc@bigasterisk.com>
parents:
267
diff
changeset
|
188 def __init__(self, submaster, subexpr): |
9bf9685f5aae
curvecalc exprs can return a whole Submaster now
David McClosky <dmcc@bigasterisk.com>
parents:
267
diff
changeset
|
189 make_attributes_from_args('submaster', 'subexpr') |
9bf9685f5aae
curvecalc exprs can return a whole Submaster now
David McClosky <dmcc@bigasterisk.com>
parents:
267
diff
changeset
|
190 def scaled(self, t): |
9bf9685f5aae
curvecalc exprs can return a whole Submaster now
David McClosky <dmcc@bigasterisk.com>
parents:
267
diff
changeset
|
191 subexpr_eval = self.subexpr.eval(t) |
296
e99bd20dad85
curvecalc: fully catch and display errors in expr eval
David McClosky <dmcc@bigasterisk.com>
parents:
294
diff
changeset
|
192 # we prevent any exceptions from escaping, since they cause us to |
e99bd20dad85
curvecalc: fully catch and display errors in expr eval
David McClosky <dmcc@bigasterisk.com>
parents:
294
diff
changeset
|
193 # stop sending levels |
e99bd20dad85
curvecalc: fully catch and display errors in expr eval
David McClosky <dmcc@bigasterisk.com>
parents:
294
diff
changeset
|
194 try: |
e99bd20dad85
curvecalc: fully catch and display errors in expr eval
David McClosky <dmcc@bigasterisk.com>
parents:
294
diff
changeset
|
195 if isinstance(subexpr_eval, Submaster.Submaster): |
e99bd20dad85
curvecalc: fully catch and display errors in expr eval
David McClosky <dmcc@bigasterisk.com>
parents:
294
diff
changeset
|
196 # if the expression returns a submaster, just return it |
e99bd20dad85
curvecalc: fully catch and display errors in expr eval
David McClosky <dmcc@bigasterisk.com>
parents:
294
diff
changeset
|
197 return subexpr_eval |
e99bd20dad85
curvecalc: fully catch and display errors in expr eval
David McClosky <dmcc@bigasterisk.com>
parents:
294
diff
changeset
|
198 else: |
e99bd20dad85
curvecalc: fully catch and display errors in expr eval
David McClosky <dmcc@bigasterisk.com>
parents:
294
diff
changeset
|
199 # otherwise, return our submaster multiplied by the value |
e99bd20dad85
curvecalc: fully catch and display errors in expr eval
David McClosky <dmcc@bigasterisk.com>
parents:
294
diff
changeset
|
200 # returned |
e99bd20dad85
curvecalc: fully catch and display errors in expr eval
David McClosky <dmcc@bigasterisk.com>
parents:
294
diff
changeset
|
201 return self.submaster * subexpr_eval |
e99bd20dad85
curvecalc: fully catch and display errors in expr eval
David McClosky <dmcc@bigasterisk.com>
parents:
294
diff
changeset
|
202 except Exception, e: |
e99bd20dad85
curvecalc: fully catch and display errors in expr eval
David McClosky <dmcc@bigasterisk.com>
parents:
294
diff
changeset
|
203 dispatcher.send("expr_error", sender=self.subexpr, exc=str(e)) |
e99bd20dad85
curvecalc: fully catch and display errors in expr eval
David McClosky <dmcc@bigasterisk.com>
parents:
294
diff
changeset
|
204 return Submaster.Submaster('Error: %s' % str(e), temporary=True) |
0 | 205 |
516
73b181155555
curvecalc ui touchups, adjustable pane, curve draw speedup, restructured main layout code
drewp@bigasterisk.com
parents:
505
diff
changeset
|
206 def __repr__(self): |
73b181155555
curvecalc ui touchups, adjustable pane, curve draw speedup, restructured main layout code
drewp@bigasterisk.com
parents:
505
diff
changeset
|
207 return "<Subterm %s %s>" % (self.submaster, self.subexpr) |
73b181155555
curvecalc ui touchups, adjustable pane, curve draw speedup, restructured main layout code
drewp@bigasterisk.com
parents:
505
diff
changeset
|
208 |
0 | 209 class Subtermview(tk.Frame): |
360
415c206f7534
fix sub loading and reloading in CC
Drew Perttula <drewp@bigasterisk.com>
parents:
357
diff
changeset
|
210 def __init__(self, master, graph, st, **kw): |
0 | 211 self.subterm = st |
212 tk.Frame.__init__(self,master,bd=1,relief='raised',**kw) | |
360
415c206f7534
fix sub loading and reloading in CC
Drew Perttula <drewp@bigasterisk.com>
parents:
357
diff
changeset
|
213 l = tk.Label(self, |
415c206f7534
fix sub loading and reloading in CC
Drew Perttula <drewp@bigasterisk.com>
parents:
357
diff
changeset
|
214 text="sub %s" % graph.label(self.subterm.submaster.uri)) |
205
3905d3c92aaa
twisted mainloop, more row-change keys, xmlrpc fadesub command on port 8050
drewp
parents:
202
diff
changeset
|
215 l.pack(side='left') |
0 | 216 sev=Subexprview(self,self.subterm.subexpr) |
217 sev.pack(side='left',fill='both',exp=1) | |
218 | |
219 class Output: | |
205
3905d3c92aaa
twisted mainloop, more row-change keys, xmlrpc fadesub command on port 8050
drewp
parents:
202
diff
changeset
|
220 lastsendtime=0 |
3905d3c92aaa
twisted mainloop, more row-change keys, xmlrpc fadesub command on port 8050
drewp
parents:
202
diff
changeset
|
221 lastsendlevs=None |
505 | 222 def __init__(self, subterms, music): |
287
5322639d61e9
refactoring and little fixes in curvecalc and keyboardcomposer
Drew Perttula <drewp@bigasterisk.com>
parents:
284
diff
changeset
|
223 make_attributes_from_args('subterms','music') |
5322639d61e9
refactoring and little fixes in curvecalc and keyboardcomposer
Drew Perttula <drewp@bigasterisk.com>
parents:
284
diff
changeset
|
224 |
5322639d61e9
refactoring and little fixes in curvecalc and keyboardcomposer
Drew Perttula <drewp@bigasterisk.com>
parents:
284
diff
changeset
|
225 self.recent_t=[] |
5322639d61e9
refactoring and little fixes in curvecalc and keyboardcomposer
Drew Perttula <drewp@bigasterisk.com>
parents:
284
diff
changeset
|
226 self.later = None |
5322639d61e9
refactoring and little fixes in curvecalc and keyboardcomposer
Drew Perttula <drewp@bigasterisk.com>
parents:
284
diff
changeset
|
227 |
5322639d61e9
refactoring and little fixes in curvecalc and keyboardcomposer
Drew Perttula <drewp@bigasterisk.com>
parents:
284
diff
changeset
|
228 self.update() |
5322639d61e9
refactoring and little fixes in curvecalc and keyboardcomposer
Drew Perttula <drewp@bigasterisk.com>
parents:
284
diff
changeset
|
229 |
5322639d61e9
refactoring and little fixes in curvecalc and keyboardcomposer
Drew Perttula <drewp@bigasterisk.com>
parents:
284
diff
changeset
|
230 def update(self): |
505 | 231 d = self.music.current_time() |
287
5322639d61e9
refactoring and little fixes in curvecalc and keyboardcomposer
Drew Perttula <drewp@bigasterisk.com>
parents:
284
diff
changeset
|
232 d.addCallback(self.update2) |
5322639d61e9
refactoring and little fixes in curvecalc and keyboardcomposer
Drew Perttula <drewp@bigasterisk.com>
parents:
284
diff
changeset
|
233 d.addErrback(self.updateerr) |
5322639d61e9
refactoring and little fixes in curvecalc and keyboardcomposer
Drew Perttula <drewp@bigasterisk.com>
parents:
284
diff
changeset
|
234 |
5322639d61e9
refactoring and little fixes in curvecalc and keyboardcomposer
Drew Perttula <drewp@bigasterisk.com>
parents:
284
diff
changeset
|
235 def updateerr(self,e): |
5322639d61e9
refactoring and little fixes in curvecalc and keyboardcomposer
Drew Perttula <drewp@bigasterisk.com>
parents:
284
diff
changeset
|
236 |
5322639d61e9
refactoring and little fixes in curvecalc and keyboardcomposer
Drew Perttula <drewp@bigasterisk.com>
parents:
284
diff
changeset
|
237 print e.getTraceback() |
5322639d61e9
refactoring and little fixes in curvecalc and keyboardcomposer
Drew Perttula <drewp@bigasterisk.com>
parents:
284
diff
changeset
|
238 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
|
239 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
|
240 self.later.cancel() |
5322639d61e9
refactoring and little fixes in curvecalc and keyboardcomposer
Drew Perttula <drewp@bigasterisk.com>
parents:
284
diff
changeset
|
241 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
|
242 |
5322639d61e9
refactoring and little fixes in curvecalc and keyboardcomposer
Drew Perttula <drewp@bigasterisk.com>
parents:
284
diff
changeset
|
243 def update2(self,t): |
326
a3267d8c498e
leave in a comment about how to offset the audio time in case your sound card is lying
Drew Perttula <drewp@bigasterisk.com>
parents:
319
diff
changeset
|
244 |
a3267d8c498e
leave in a comment about how to offset the audio time in case your sound card is lying
Drew Perttula <drewp@bigasterisk.com>
parents:
319
diff
changeset
|
245 # spot alsa soundcard offset is always 0, we get times about a |
a3267d8c498e
leave in a comment about how to offset the audio time in case your sound card is lying
Drew Perttula <drewp@bigasterisk.com>
parents:
319
diff
changeset
|
246 # second ahead of what's really getting played |
a3267d8c498e
leave in a comment about how to offset the audio time in case your sound card is lying
Drew Perttula <drewp@bigasterisk.com>
parents:
319
diff
changeset
|
247 #t = t - .7 |
a3267d8c498e
leave in a comment about how to offset the audio time in case your sound card is lying
Drew Perttula <drewp@bigasterisk.com>
parents:
319
diff
changeset
|
248 |
287
5322639d61e9
refactoring and little fixes in curvecalc and keyboardcomposer
Drew Perttula <drewp@bigasterisk.com>
parents:
284
diff
changeset
|
249 dispatcher.send("update status", |
5322639d61e9
refactoring and little fixes in curvecalc and keyboardcomposer
Drew Perttula <drewp@bigasterisk.com>
parents:
284
diff
changeset
|
250 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
|
251 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
|
252 self.later.cancel() |
5322639d61e9
refactoring and little fixes in curvecalc and keyboardcomposer
Drew Perttula <drewp@bigasterisk.com>
parents:
284
diff
changeset
|
253 |
493
b8012dcb714b
increase curvecalc update frequency 50ms to 20ms
drewp@bigasterisk.com
parents:
476
diff
changeset
|
254 self.later = reactor.callLater(.02, self.update) |
287
5322639d61e9
refactoring and little fixes in curvecalc and keyboardcomposer
Drew Perttula <drewp@bigasterisk.com>
parents:
284
diff
changeset
|
255 |
5322639d61e9
refactoring and little fixes in curvecalc and keyboardcomposer
Drew Perttula <drewp@bigasterisk.com>
parents:
284
diff
changeset
|
256 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
|
257 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
|
258 dispatcher.send("update period", val=period) |
5322639d61e9
refactoring and little fixes in curvecalc and keyboardcomposer
Drew Perttula <drewp@bigasterisk.com>
parents:
284
diff
changeset
|
259 self.send_dmx(t) |
5322639d61e9
refactoring and little fixes in curvecalc and keyboardcomposer
Drew Perttula <drewp@bigasterisk.com>
parents:
284
diff
changeset
|
260 |
0 | 261 def send_dmx(self,t): |
362
fc87327e29c4
CC now attaches to hardware sliders and knobs. tres cool. KC gets a --sliders option to enable the sliders
Drew Perttula <drewp@bigasterisk.com>
parents:
361
diff
changeset
|
262 dispatcher.send("curves to sliders", t=t) |
0 | 263 scaledsubs=[] |
264 for st in self.subterms: | |
265 scl = st.scaled(t) | |
266 scaledsubs.append(scl) | |
267 out = Submaster.sub_maxes(*scaledsubs) | |
205
3905d3c92aaa
twisted mainloop, more row-change keys, xmlrpc fadesub command on port 8050
drewp
parents:
202
diff
changeset
|
268 levs = out.get_levels() |
3905d3c92aaa
twisted mainloop, more row-change keys, xmlrpc fadesub command on port 8050
drewp
parents:
202
diff
changeset
|
269 now=time.time() |
3905d3c92aaa
twisted mainloop, more row-change keys, xmlrpc fadesub command on port 8050
drewp
parents:
202
diff
changeset
|
270 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
|
271 dispatcher.send("output levels",val=levs) |
3905d3c92aaa
twisted mainloop, more row-change keys, xmlrpc fadesub command on port 8050
drewp
parents:
202
diff
changeset
|
272 dmxclient.outputlevels(out.get_dmx_list(), |
3905d3c92aaa
twisted mainloop, more row-change keys, xmlrpc fadesub command on port 8050
drewp
parents:
202
diff
changeset
|
273 twisted=1,clientid='curvecalc') |
3905d3c92aaa
twisted mainloop, more row-change keys, xmlrpc fadesub command on port 8050
drewp
parents:
202
diff
changeset
|
274 self.lastsendtime = now |
3905d3c92aaa
twisted mainloop, more row-change keys, xmlrpc fadesub command on port 8050
drewp
parents:
202
diff
changeset
|
275 self.lastsendlevs = levs |
0 | 276 |
516
73b181155555
curvecalc ui touchups, adjustable pane, curve draw speedup, restructured main layout code
drewp@bigasterisk.com
parents:
505
diff
changeset
|
277 def makeStatusLines(master): |
73b181155555
curvecalc ui touchups, adjustable pane, curve draw speedup, restructured main layout code
drewp@bigasterisk.com
parents:
505
diff
changeset
|
278 """various labels that listen for dispatcher signals""" |
197
ba2677823b35
zoom control and other cleanups. also reads song length now
drewp
parents:
196
diff
changeset
|
279 for signame,textfilter in [ |
ba2677823b35
zoom control and other cleanups. also reads song length now
drewp
parents:
196
diff
changeset
|
280 ('input time',lambda t: "%.2fs"%t), |
ba2677823b35
zoom control and other cleanups. also reads song length now
drewp
parents:
196
diff
changeset
|
281 ('output levels', |
ba2677823b35
zoom control and other cleanups. also reads song length now
drewp
parents:
196
diff
changeset
|
282 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
|
283 for n,v in |
205
3905d3c92aaa
twisted mainloop, more row-change keys, xmlrpc fadesub command on port 8050
drewp
parents:
202
diff
changeset
|
284 levels.items()[:5] |
3905d3c92aaa
twisted mainloop, more row-change keys, xmlrpc fadesub command on port 8050
drewp
parents:
202
diff
changeset
|
285 if v>0]),70)), |
197
ba2677823b35
zoom control and other cleanups. also reads song length now
drewp
parents:
196
diff
changeset
|
286 ('update period',lambda t: "%.1fms"%(t*1000)), |
236
63601fe0c3b0
curvecalc cmdline checking, connection status now in gui
drewp@bigasterisk.com
parents:
230
diff
changeset
|
287 ('update status',lambda t: str(t)), |
197
ba2677823b35
zoom control and other cleanups. also reads song length now
drewp
parents:
196
diff
changeset
|
288 ]: |
516
73b181155555
curvecalc ui touchups, adjustable pane, curve draw speedup, restructured main layout code
drewp@bigasterisk.com
parents:
505
diff
changeset
|
289 l = tk.Label(master, anchor='w', justify='left', text='%s:' % signame) |
197
ba2677823b35
zoom control and other cleanups. also reads song length now
drewp
parents:
196
diff
changeset
|
290 l.pack(side='top',fill='x') |
ba2677823b35
zoom control and other cleanups. also reads song length now
drewp
parents:
196
diff
changeset
|
291 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
|
292 l.config(text=sn+": "+tf(val)), |
516
73b181155555
curvecalc ui touchups, adjustable pane, curve draw speedup, restructured main layout code
drewp@bigasterisk.com
parents:
505
diff
changeset
|
293 signame, weak=False) |
197
ba2677823b35
zoom control and other cleanups. also reads song length now
drewp
parents:
196
diff
changeset
|
294 |
516
73b181155555
curvecalc ui touchups, adjustable pane, curve draw speedup, restructured main layout code
drewp@bigasterisk.com
parents:
505
diff
changeset
|
295 def add_one_subterm(graph, subUri, curveset, subterms, master, expr=None): |
360
415c206f7534
fix sub loading and reloading in CC
Drew Perttula <drewp@bigasterisk.com>
parents:
357
diff
changeset
|
296 subname = graph.label(subUri) |
287
5322639d61e9
refactoring and little fixes in curvecalc and keyboardcomposer
Drew Perttula <drewp@bigasterisk.com>
parents:
284
diff
changeset
|
297 if expr is None: |
5322639d61e9
refactoring and little fixes in curvecalc and keyboardcomposer
Drew Perttula <drewp@bigasterisk.com>
parents:
284
diff
changeset
|
298 expr = '%s(t)' % subname |
5322639d61e9
refactoring and little fixes in curvecalc and keyboardcomposer
Drew Perttula <drewp@bigasterisk.com>
parents:
284
diff
changeset
|
299 |
360
415c206f7534
fix sub loading and reloading in CC
Drew Perttula <drewp@bigasterisk.com>
parents:
357
diff
changeset
|
300 term = Subterm(Submaster.Submaster(graph=graph, sub=subUri), |
415c206f7534
fix sub loading and reloading in CC
Drew Perttula <drewp@bigasterisk.com>
parents:
357
diff
changeset
|
301 Subexpr(curveset,expr)) |
205
3905d3c92aaa
twisted mainloop, more row-change keys, xmlrpc fadesub command on port 8050
drewp
parents:
202
diff
changeset
|
302 subterms.append(term) |
3905d3c92aaa
twisted mainloop, more row-change keys, xmlrpc fadesub command on port 8050
drewp
parents:
202
diff
changeset
|
303 |
505 | 304 stv=Subtermview(master, graph, term) |
305 stv.pack(side='top',fill='x') | |
205
3905d3c92aaa
twisted mainloop, more row-change keys, xmlrpc fadesub command on port 8050
drewp
parents:
202
diff
changeset
|
306 |
3905d3c92aaa
twisted mainloop, more row-change keys, xmlrpc fadesub command on port 8050
drewp
parents:
202
diff
changeset
|
307 return term |
0 | 308 |
516
73b181155555
curvecalc ui touchups, adjustable pane, curve draw speedup, restructured main layout code
drewp@bigasterisk.com
parents:
505
diff
changeset
|
309 def makeSubtermCommandRow(master, curveset, subterms, root, ssv, graph): |
505 | 310 """ |
311 the row that starts with 'reload subs' button | |
312 """ | |
205
3905d3c92aaa
twisted mainloop, more row-change keys, xmlrpc fadesub command on port 8050
drewp
parents:
202
diff
changeset
|
313 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
|
314 newname = tk.StringVar() |
3905d3c92aaa
twisted mainloop, more row-change keys, xmlrpc fadesub command on port 8050
drewp
parents:
202
diff
changeset
|
315 |
398
c5f0b530ade5
curvecalc: easy curve+sub creation
David McClosky <dmcc@bigasterisk.com>
parents:
397
diff
changeset
|
316 def add_cmd(evt): |
473
9ed6c40b3d6a
new subterms get a good uri and label
drewp@bigasterisk.com
parents:
454
diff
changeset
|
317 uri = L9['sub/%s' % newname.get()] |
9ed6c40b3d6a
new subterms get a good uri and label
drewp@bigasterisk.com
parents:
454
diff
changeset
|
318 graph.add((uri, RDF.type, L9.Subterm)) |
9ed6c40b3d6a
new subterms get a good uri and label
drewp@bigasterisk.com
parents:
454
diff
changeset
|
319 graph.add((uri, RDFS.label, Literal(newname.get()))) |
9ed6c40b3d6a
new subterms get a good uri and label
drewp@bigasterisk.com
parents:
454
diff
changeset
|
320 add_one_subterm(graph, uri, |
516
73b181155555
curvecalc ui touchups, adjustable pane, curve draw speedup, restructured main layout code
drewp@bigasterisk.com
parents:
505
diff
changeset
|
321 curveset, subterms, ssv, None) |
398
c5f0b530ade5
curvecalc: easy curve+sub creation
David McClosky <dmcc@bigasterisk.com>
parents:
397
diff
changeset
|
322 if evt.state & 4: # control key modifier |
c5f0b530ade5
curvecalc: easy curve+sub creation
David McClosky <dmcc@bigasterisk.com>
parents:
397
diff
changeset
|
323 curveset.new_curve(newname.get()) |
281
e3362ad9a123
curvecalc gets "see time until end", C-r for reload, doc updates
David McClosky <dmcc@bigasterisk.com>
parents:
280
diff
changeset
|
324 newname.set('') |
205
3905d3c92aaa
twisted mainloop, more row-change keys, xmlrpc fadesub command on port 8050
drewp
parents:
202
diff
changeset
|
325 |
279
5bfcf309e1ad
Submaster objects listen for a signal to reload, curvecalc can broadcast it
David McClosky <dmcc@bigasterisk.com>
parents:
277
diff
changeset
|
326 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
|
327 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
|
328 |
281
e3362ad9a123
curvecalc gets "see time until end", C-r for reload, doc updates
David McClosky <dmcc@bigasterisk.com>
parents:
280
diff
changeset
|
329 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
|
330 command=reload_subs).pack(side='left') |
476
0e3743492eae
curvecalc: new keyboard shortcut hotness
drewp@bigasterisk.com
parents:
473
diff
changeset
|
331 tk.Label(f, text="new subterm named (C-Enter for curve too, C-n for focus):").pack(side='left') |
282
d482699decbd
curvecalc: "Enter" in the new term entry creates new term
David McClosky <dmcc@bigasterisk.com>
parents:
281
diff
changeset
|
332 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
|
333 entry.pack(side='left', fill='x', exp=1) |
398
c5f0b530ade5
curvecalc: easy curve+sub creation
David McClosky <dmcc@bigasterisk.com>
parents:
397
diff
changeset
|
334 entry.bind("<Key-Return>", add_cmd) |
282
d482699decbd
curvecalc: "Enter" in the new term entry creates new term
David McClosky <dmcc@bigasterisk.com>
parents:
281
diff
changeset
|
335 |
476
0e3743492eae
curvecalc: new keyboard shortcut hotness
drewp@bigasterisk.com
parents:
473
diff
changeset
|
336 def focus_entry(): |
0e3743492eae
curvecalc: new keyboard shortcut hotness
drewp@bigasterisk.com
parents:
473
diff
changeset
|
337 entry.focus() |
0e3743492eae
curvecalc: new keyboard shortcut hotness
drewp@bigasterisk.com
parents:
473
diff
changeset
|
338 |
0e3743492eae
curvecalc: new keyboard shortcut hotness
drewp@bigasterisk.com
parents:
473
diff
changeset
|
339 dispatcher.connect(focus_entry, "focus new subterm", weak=False) |
0e3743492eae
curvecalc: new keyboard shortcut hotness
drewp@bigasterisk.com
parents:
473
diff
changeset
|
340 |
205
3905d3c92aaa
twisted mainloop, more row-change keys, xmlrpc fadesub command on port 8050
drewp
parents:
202
diff
changeset
|
341 return f |
287
5322639d61e9
refactoring and little fixes in curvecalc and keyboardcomposer
Drew Perttula <drewp@bigasterisk.com>
parents:
284
diff
changeset
|
342 |
357
7771f37252da
curvecalc persistence, wavecurve -a option
Drew Perttula <drewp@bigasterisk.com>
parents:
351
diff
changeset
|
343 def savesubterms(filename,subterms): |
7771f37252da
curvecalc persistence, wavecurve -a option
Drew Perttula <drewp@bigasterisk.com>
parents:
351
diff
changeset
|
344 raise NotImplementedError |
7771f37252da
curvecalc persistence, wavecurve -a option
Drew Perttula <drewp@bigasterisk.com>
parents:
351
diff
changeset
|
345 s="" |
7771f37252da
curvecalc persistence, wavecurve -a option
Drew Perttula <drewp@bigasterisk.com>
parents:
351
diff
changeset
|
346 for st in subterms: |
7771f37252da
curvecalc persistence, wavecurve -a option
Drew Perttula <drewp@bigasterisk.com>
parents:
351
diff
changeset
|
347 s=s+"%s %s\n" % (st.submaster.name, st.subexpr.expr) |
7771f37252da
curvecalc persistence, wavecurve -a option
Drew Perttula <drewp@bigasterisk.com>
parents:
351
diff
changeset
|
348 |
7771f37252da
curvecalc persistence, wavecurve -a option
Drew Perttula <drewp@bigasterisk.com>
parents:
351
diff
changeset
|
349 file(filename,'w').write(s) |
7771f37252da
curvecalc persistence, wavecurve -a option
Drew Perttula <drewp@bigasterisk.com>
parents:
351
diff
changeset
|
350 |
7771f37252da
curvecalc persistence, wavecurve -a option
Drew Perttula <drewp@bigasterisk.com>
parents:
351
diff
changeset
|
351 def createSubtermGraph(song, subterms): |
7771f37252da
curvecalc persistence, wavecurve -a option
Drew Perttula <drewp@bigasterisk.com>
parents:
351
diff
changeset
|
352 """rdf graph describing the subterms, readable by add_subterms_for_song""" |
7771f37252da
curvecalc persistence, wavecurve -a option
Drew Perttula <drewp@bigasterisk.com>
parents:
351
diff
changeset
|
353 graph = Graph() |
7771f37252da
curvecalc persistence, wavecurve -a option
Drew Perttula <drewp@bigasterisk.com>
parents:
351
diff
changeset
|
354 for subterm in subterms: |
7771f37252da
curvecalc persistence, wavecurve -a option
Drew Perttula <drewp@bigasterisk.com>
parents:
351
diff
changeset
|
355 uri = URIRef(song + "/subterm/" + subterm.submaster.name) |
7771f37252da
curvecalc persistence, wavecurve -a option
Drew Perttula <drewp@bigasterisk.com>
parents:
351
diff
changeset
|
356 graph.add((song, L9['subterm'], uri)) |
7771f37252da
curvecalc persistence, wavecurve -a option
Drew Perttula <drewp@bigasterisk.com>
parents:
351
diff
changeset
|
357 graph.add((uri, RDF.type, L9['Subterm'])) |
473
9ed6c40b3d6a
new subterms get a good uri and label
drewp@bigasterisk.com
parents:
454
diff
changeset
|
358 graph.add((uri, RDFS.label, Literal(subterm.submaster.name))) |
357
7771f37252da
curvecalc persistence, wavecurve -a option
Drew Perttula <drewp@bigasterisk.com>
parents:
351
diff
changeset
|
359 graph.add((uri, L9['sub'], L9['sub/%s' % subterm.submaster.name])) |
7771f37252da
curvecalc persistence, wavecurve -a option
Drew Perttula <drewp@bigasterisk.com>
parents:
351
diff
changeset
|
360 graph.add((uri, L9['expression'], Literal(subterm.subexpr.expr))) |
7771f37252da
curvecalc persistence, wavecurve -a option
Drew Perttula <drewp@bigasterisk.com>
parents:
351
diff
changeset
|
361 return graph |
7771f37252da
curvecalc persistence, wavecurve -a option
Drew Perttula <drewp@bigasterisk.com>
parents:
351
diff
changeset
|
362 |
516
73b181155555
curvecalc ui touchups, adjustable pane, curve draw speedup, restructured main layout code
drewp@bigasterisk.com
parents:
505
diff
changeset
|
363 def add_subterms_for_song(graph, song, curveset, subterms, master): |
335 | 364 for st in graph.objects(song, L9['subterm']): |
400
b2858c2d4a4d
aft() has smooth arg; workaround for CC writing poor subterms
Drew Perttula <drewp@bigasterisk.com>
parents:
399
diff
changeset
|
365 try: |
516
73b181155555
curvecalc ui touchups, adjustable pane, curve draw speedup, restructured main layout code
drewp@bigasterisk.com
parents:
505
diff
changeset
|
366 add_one_subterm(graph, graph.value(st, L9['sub']), curveset, |
73b181155555
curvecalc ui touchups, adjustable pane, curve draw speedup, restructured main layout code
drewp@bigasterisk.com
parents:
505
diff
changeset
|
367 subterms, master, graph.value(st, L9['expression'])) |
400
b2858c2d4a4d
aft() has smooth arg; workaround for CC writing poor subterms
Drew Perttula <drewp@bigasterisk.com>
parents:
399
diff
changeset
|
368 except rdflib.exceptions.UniquenessError: |
b2858c2d4a4d
aft() has smooth arg; workaround for CC writing poor subterms
Drew Perttula <drewp@bigasterisk.com>
parents:
399
diff
changeset
|
369 print "working around curvecalc save corruption" |
b2858c2d4a4d
aft() has smooth arg; workaround for CC writing poor subterms
Drew Perttula <drewp@bigasterisk.com>
parents:
399
diff
changeset
|
370 # curvecalc put all the expressions on one subterm, which is wrong |
b2858c2d4a4d
aft() has smooth arg; workaround for CC writing poor subterms
Drew Perttula <drewp@bigasterisk.com>
parents:
399
diff
changeset
|
371 for expr in graph.objects(st, L9['expression']): |
b2858c2d4a4d
aft() has smooth arg; workaround for CC writing poor subterms
Drew Perttula <drewp@bigasterisk.com>
parents:
399
diff
changeset
|
372 add_one_subterm(graph, graph.value(st, L9['sub']), |
516
73b181155555
curvecalc ui touchups, adjustable pane, curve draw speedup, restructured main layout code
drewp@bigasterisk.com
parents:
505
diff
changeset
|
373 curveset, subterms, master, expr) |
400
b2858c2d4a4d
aft() has smooth arg; workaround for CC writing poor subterms
Drew Perttula <drewp@bigasterisk.com>
parents:
399
diff
changeset
|
374 |
287
5322639d61e9
refactoring and little fixes in curvecalc and keyboardcomposer
Drew Perttula <drewp@bigasterisk.com>
parents:
284
diff
changeset
|
375 |
357
7771f37252da
curvecalc persistence, wavecurve -a option
Drew Perttula <drewp@bigasterisk.com>
parents:
351
diff
changeset
|
376 def graphPathForSubterms(song): |
7771f37252da
curvecalc persistence, wavecurve -a option
Drew Perttula <drewp@bigasterisk.com>
parents:
351
diff
changeset
|
377 return showconfig.subtermsForSong(showconfig.songFilenameFromURI(song)) + ".n3" |
351
a6662d61ebcd
SC, KC, CC now run and seem to load and save ok. CC does not have any rdf for its data files
Drew Perttula <drewp@bigasterisk.com>
parents:
335
diff
changeset
|
378 |
360
415c206f7534
fix sub loading and reloading in CC
Drew Perttula <drewp@bigasterisk.com>
parents:
357
diff
changeset
|
379 def read_all_subs(graph): |
415c206f7534
fix sub loading and reloading in CC
Drew Perttula <drewp@bigasterisk.com>
parents:
357
diff
changeset
|
380 """read all sub files into this graph so when add_one_subterm tries |
415c206f7534
fix sub loading and reloading in CC
Drew Perttula <drewp@bigasterisk.com>
parents:
357
diff
changeset
|
381 to add, the sub will be available""" |
415c206f7534
fix sub loading and reloading in CC
Drew Perttula <drewp@bigasterisk.com>
parents:
357
diff
changeset
|
382 subsDir = showconfig.subsDir() |
415c206f7534
fix sub loading and reloading in CC
Drew Perttula <drewp@bigasterisk.com>
parents:
357
diff
changeset
|
383 for filename in os.listdir(subsDir): |
415c206f7534
fix sub loading and reloading in CC
Drew Perttula <drewp@bigasterisk.com>
parents:
357
diff
changeset
|
384 graph.parse(os.path.join(subsDir, filename), format="n3") |
415c206f7534
fix sub loading and reloading in CC
Drew Perttula <drewp@bigasterisk.com>
parents:
357
diff
changeset
|
385 |
505 | 386 def makeGraph(): |
387 graphOrig = showconfig.getGraph() | |
388 graph = Graph() # a copy, since we're going to add subs into it | |
389 for s in graphOrig: | |
390 graph.add(s) | |
391 read_all_subs(graph) | |
392 return graph | |
0 | 393 |
505 | 394 def savekey(song, subterms, curveset): |
395 print "saving", song | |
357
7771f37252da
curvecalc persistence, wavecurve -a option
Drew Perttula <drewp@bigasterisk.com>
parents:
351
diff
changeset
|
396 g = createSubtermGraph(song, subterms) |
7771f37252da
curvecalc persistence, wavecurve -a option
Drew Perttula <drewp@bigasterisk.com>
parents:
351
diff
changeset
|
397 g.serialize(graphPathForSubterms(song), format="nt") |
7771f37252da
curvecalc persistence, wavecurve -a option
Drew Perttula <drewp@bigasterisk.com>
parents:
351
diff
changeset
|
398 |
505 | 399 curveset.save(basename=os.path.join(showconfig.curvesDir(), |
400 showconfig.songFilenameFromURI(song))) | |
205
3905d3c92aaa
twisted mainloop, more row-change keys, xmlrpc fadesub command on port 8050
drewp
parents:
202
diff
changeset
|
401 print "saved" |
505 | 402 |
403 def setupKeyBindings(root, song, subterms, curveset): | |
404 root.bind("<Control-Key-s>", | |
405 lambda *args: savekey(song, subterms, curveset)) | |
406 root.bind("<Control-Key-r>", lambda evt: dispatcher.send('reload all subs')) | |
407 root.bind("<Control-Key-n>", | |
408 lambda evt: dispatcher.send('focus new subterm')) | |
409 root.bind("<Control-Key-N>", lambda evt: dispatcher.send('focus new curve')) | |
410 root.bind("<Control-Key-q>",lambda ev: reactor.stop) | |
411 root.bind("<Destroy>",lambda ev: reactor.stop) | |
412 root.protocol('WM_DELETE_WINDOW', reactor.stop) | |
413 | |
414 def createHelpLines(root): | |
415 for helpline in ["Bindings: C-s save subterms; Esc see current time; S-Esc see curtime to end; C-Esc show all; Mousewheel zoom; C-p play/pause music at mouse", | |
416 "Curve point bindings: B1 drag point; C-B1 curve add point; S-B1 sketch points; Del selected points; 1..5 add point at time; B1 drag select points", | |
417 "Available in functions: nsin/ncos period=amp=1; within(a,b) bef(x) aft(x) compare to time; smoove(x) cubic smoothstep; chan(name); curvename(t) eval curve"]: | |
418 line = tk.Label(root, text=helpline, font="Helvetica -12 italic", | |
419 anchor='w') | |
420 line.pack(side='top',fill='x') | |
421 | |
422 | |
423 def main(): | |
424 parser = optparse.OptionParser() | |
425 parser.set_usage("%prog [opts] songURI") | |
426 parser.add_option("--sliders", action='store_true', | |
427 help='use hardware sliders') | |
428 parser.add_option("--skip-music", action='store_true', | |
429 help="ignore music and smooth_music curve files") | |
430 opts, args = parser.parse_args() | |
431 | |
432 try: | |
433 song = URIRef(args[0]) | |
434 except IndexError: | |
435 raise SystemExit("song URI is required, e.g. 'http://light9.bigasterisk.com/show/dance2008/song3'") | |
436 | |
437 log.debug("music") | |
438 music=Music() | |
516
73b181155555
curvecalc ui touchups, adjustable pane, curve draw speedup, restructured main layout code
drewp@bigasterisk.com
parents:
505
diff
changeset
|
439 graph = makeGraph() |
505 | 440 curveset = Curveset(sliders=opts.sliders) |
516
73b181155555
curvecalc ui touchups, adjustable pane, curve draw speedup, restructured main layout code
drewp@bigasterisk.com
parents:
505
diff
changeset
|
441 subterms = [] |
505 | 442 |
516
73b181155555
curvecalc ui touchups, adjustable pane, curve draw speedup, restructured main layout code
drewp@bigasterisk.com
parents:
505
diff
changeset
|
443 graph.parse(graphPathForSubterms(song), format='n3') |
73b181155555
curvecalc ui touchups, adjustable pane, curve draw speedup, restructured main layout code
drewp@bigasterisk.com
parents:
505
diff
changeset
|
444 |
73b181155555
curvecalc ui touchups, adjustable pane, curve draw speedup, restructured main layout code
drewp@bigasterisk.com
parents:
505
diff
changeset
|
445 log.debug("output") |
73b181155555
curvecalc ui touchups, adjustable pane, curve draw speedup, restructured main layout code
drewp@bigasterisk.com
parents:
505
diff
changeset
|
446 out = Output(subterms, music) |
505 | 447 |
448 musicfilename = showconfig.songOnDisk(song) | |
449 maxtime = wavelength(musicfilename) | |
516
73b181155555
curvecalc ui touchups, adjustable pane, curve draw speedup, restructured main layout code
drewp@bigasterisk.com
parents:
505
diff
changeset
|
450 dispatcher.connect(lambda: maxtime, "get max time", weak=False) |
73b181155555
curvecalc ui touchups, adjustable pane, curve draw speedup, restructured main layout code
drewp@bigasterisk.com
parents:
505
diff
changeset
|
451 |
73b181155555
curvecalc ui touchups, adjustable pane, curve draw speedup, restructured main layout code
drewp@bigasterisk.com
parents:
505
diff
changeset
|
452 |
73b181155555
curvecalc ui touchups, adjustable pane, curve draw speedup, restructured main layout code
drewp@bigasterisk.com
parents:
505
diff
changeset
|
453 root=tk.Tk() |
73b181155555
curvecalc ui touchups, adjustable pane, curve draw speedup, restructured main layout code
drewp@bigasterisk.com
parents:
505
diff
changeset
|
454 root.tk_setPalette("gray50") |
73b181155555
curvecalc ui touchups, adjustable pane, curve draw speedup, restructured main layout code
drewp@bigasterisk.com
parents:
505
diff
changeset
|
455 toplevelat("curvecalc",root) |
73b181155555
curvecalc ui touchups, adjustable pane, curve draw speedup, restructured main layout code
drewp@bigasterisk.com
parents:
505
diff
changeset
|
456 root.tk_focusFollowsMouse() |
73b181155555
curvecalc ui touchups, adjustable pane, curve draw speedup, restructured main layout code
drewp@bigasterisk.com
parents:
505
diff
changeset
|
457 root.title("Curvemaster 3000MX - %s" % graph.label(song)) |
73b181155555
curvecalc ui touchups, adjustable pane, curve draw speedup, restructured main layout code
drewp@bigasterisk.com
parents:
505
diff
changeset
|
458 |
73b181155555
curvecalc ui touchups, adjustable pane, curve draw speedup, restructured main layout code
drewp@bigasterisk.com
parents:
505
diff
changeset
|
459 if 'fixed top rows': |
73b181155555
curvecalc ui touchups, adjustable pane, curve draw speedup, restructured main layout code
drewp@bigasterisk.com
parents:
505
diff
changeset
|
460 zc = Zoomcontrol(root) |
73b181155555
curvecalc ui touchups, adjustable pane, curve draw speedup, restructured main layout code
drewp@bigasterisk.com
parents:
505
diff
changeset
|
461 zc.pack(side='top', fill='x') |
73b181155555
curvecalc ui touchups, adjustable pane, curve draw speedup, restructured main layout code
drewp@bigasterisk.com
parents:
505
diff
changeset
|
462 |
73b181155555
curvecalc ui touchups, adjustable pane, curve draw speedup, restructured main layout code
drewp@bigasterisk.com
parents:
505
diff
changeset
|
463 if 'panes': |
73b181155555
curvecalc ui touchups, adjustable pane, curve draw speedup, restructured main layout code
drewp@bigasterisk.com
parents:
505
diff
changeset
|
464 panes = tk.PanedWindow(root, height=1) |
73b181155555
curvecalc ui touchups, adjustable pane, curve draw speedup, restructured main layout code
drewp@bigasterisk.com
parents:
505
diff
changeset
|
465 panes.add('curvesetView') |
73b181155555
curvecalc ui touchups, adjustable pane, curve draw speedup, restructured main layout code
drewp@bigasterisk.com
parents:
505
diff
changeset
|
466 panes.add('subterms') |
73b181155555
curvecalc ui touchups, adjustable pane, curve draw speedup, restructured main layout code
drewp@bigasterisk.com
parents:
505
diff
changeset
|
467 panes.pack(side='top', fill='both', expand=True) |
73b181155555
curvecalc ui touchups, adjustable pane, curve draw speedup, restructured main layout code
drewp@bigasterisk.com
parents:
505
diff
changeset
|
468 |
73b181155555
curvecalc ui touchups, adjustable pane, curve draw speedup, restructured main layout code
drewp@bigasterisk.com
parents:
505
diff
changeset
|
469 csv = Curvesetview(panes.subwidget('curvesetView'), curveset, |
73b181155555
curvecalc ui touchups, adjustable pane, curve draw speedup, restructured main layout code
drewp@bigasterisk.com
parents:
505
diff
changeset
|
470 height=400) |
73b181155555
curvecalc ui touchups, adjustable pane, curve draw speedup, restructured main layout code
drewp@bigasterisk.com
parents:
505
diff
changeset
|
471 csv.pack(fill='both', expand=True) |
73b181155555
curvecalc ui touchups, adjustable pane, curve draw speedup, restructured main layout code
drewp@bigasterisk.com
parents:
505
diff
changeset
|
472 |
73b181155555
curvecalc ui touchups, adjustable pane, curve draw speedup, restructured main layout code
drewp@bigasterisk.com
parents:
505
diff
changeset
|
473 subtermArea = tk.Frame(panes.subwidget('subterms'), height=100) |
73b181155555
curvecalc ui touchups, adjustable pane, curve draw speedup, restructured main layout code
drewp@bigasterisk.com
parents:
505
diff
changeset
|
474 subtermArea.pack(fill='both', expand=True) |
73b181155555
curvecalc ui touchups, adjustable pane, curve draw speedup, restructured main layout code
drewp@bigasterisk.com
parents:
505
diff
changeset
|
475 |
73b181155555
curvecalc ui touchups, adjustable pane, curve draw speedup, restructured main layout code
drewp@bigasterisk.com
parents:
505
diff
changeset
|
476 subtermScroll = tk.ScrolledWindow(subtermArea) |
73b181155555
curvecalc ui touchups, adjustable pane, curve draw speedup, restructured main layout code
drewp@bigasterisk.com
parents:
505
diff
changeset
|
477 subtermScroll.pack(fill='both') |
73b181155555
curvecalc ui touchups, adjustable pane, curve draw speedup, restructured main layout code
drewp@bigasterisk.com
parents:
505
diff
changeset
|
478 |
73b181155555
curvecalc ui touchups, adjustable pane, curve draw speedup, restructured main layout code
drewp@bigasterisk.com
parents:
505
diff
changeset
|
479 if 'fixed bottom rows': |
73b181155555
curvecalc ui touchups, adjustable pane, curve draw speedup, restructured main layout code
drewp@bigasterisk.com
parents:
505
diff
changeset
|
480 makeSubtermCommandRow(root, curveset, subterms, root, subtermArea, |
73b181155555
curvecalc ui touchups, adjustable pane, curve draw speedup, restructured main layout code
drewp@bigasterisk.com
parents:
505
diff
changeset
|
481 graph).pack(side='top', fill='x') |
73b181155555
curvecalc ui touchups, adjustable pane, curve draw speedup, restructured main layout code
drewp@bigasterisk.com
parents:
505
diff
changeset
|
482 makeStatusLines(root) |
73b181155555
curvecalc ui touchups, adjustable pane, curve draw speedup, restructured main layout code
drewp@bigasterisk.com
parents:
505
diff
changeset
|
483 |
73b181155555
curvecalc ui touchups, adjustable pane, curve draw speedup, restructured main layout code
drewp@bigasterisk.com
parents:
505
diff
changeset
|
484 helpBox = tk.Frame(root) |
73b181155555
curvecalc ui touchups, adjustable pane, curve draw speedup, restructured main layout code
drewp@bigasterisk.com
parents:
505
diff
changeset
|
485 createHelpLines(helpBox) |
73b181155555
curvecalc ui touchups, adjustable pane, curve draw speedup, restructured main layout code
drewp@bigasterisk.com
parents:
505
diff
changeset
|
486 helpBox.pack(side='top', fill='x') |
73b181155555
curvecalc ui touchups, adjustable pane, curve draw speedup, restructured main layout code
drewp@bigasterisk.com
parents:
505
diff
changeset
|
487 |
73b181155555
curvecalc ui touchups, adjustable pane, curve draw speedup, restructured main layout code
drewp@bigasterisk.com
parents:
505
diff
changeset
|
488 add_subterms_for_song(graph, song, curveset, subterms, |
73b181155555
curvecalc ui touchups, adjustable pane, curve draw speedup, restructured main layout code
drewp@bigasterisk.com
parents:
505
diff
changeset
|
489 subtermScroll.subwidget('window')) |
73b181155555
curvecalc ui touchups, adjustable pane, curve draw speedup, restructured main layout code
drewp@bigasterisk.com
parents:
505
diff
changeset
|
490 setupKeyBindings(root, song, subterms, curveset) |
73b181155555
curvecalc ui touchups, adjustable pane, curve draw speedup, restructured main layout code
drewp@bigasterisk.com
parents:
505
diff
changeset
|
491 |
73b181155555
curvecalc ui touchups, adjustable pane, curve draw speedup, restructured main layout code
drewp@bigasterisk.com
parents:
505
diff
changeset
|
492 # curvesetview must already exist, since this makes 'add_curve' |
73b181155555
curvecalc ui touchups, adjustable pane, curve draw speedup, restructured main layout code
drewp@bigasterisk.com
parents:
505
diff
changeset
|
493 # signals for all the initial curves |
505 | 494 curveset.load(basename=os.path.join(showconfig.curvesDir(), |
495 showconfig.songFilenameFromURI(song)), | |
496 skipMusic=opts.skip_music) | |
516
73b181155555
curvecalc ui touchups, adjustable pane, curve draw speedup, restructured main layout code
drewp@bigasterisk.com
parents:
505
diff
changeset
|
497 |
73b181155555
curvecalc ui touchups, adjustable pane, curve draw speedup, restructured main layout code
drewp@bigasterisk.com
parents:
505
diff
changeset
|
498 dispatcher.send("max time",maxtime=maxtime) |
73b181155555
curvecalc ui touchups, adjustable pane, curve draw speedup, restructured main layout code
drewp@bigasterisk.com
parents:
505
diff
changeset
|
499 dispatcher.send("show all") |
505 | 500 |
501 tksupport.install(root,ms=20) | |
502 log.debug("run") | |
503 prof.run(reactor.run, profile=False) | |
504 | |
505 main() |