Mercurial > code > home > repos > light9
annotate bin/curvecalc @ 692:ccdd04f4ca7d
subterm display is working
Ignore-this: 54254c7f9d6cd89bd80031ed1cf92066
author | Drew Perttula <drewp@bigasterisk.com> |
---|---|
date | Fri, 08 Jun 2012 05:11:41 +0000 |
parents | 62d83d456f2e |
children | 34dacd800505 |
rev | line source |
---|---|
686
a301a0039c66
buildout and rdflib updates
Drew Perttula <drewp@bigasterisk.com>
parents:
684
diff
changeset
|
1 #!bin/python |
0 | 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 |
691 | 13 from twisted.internet import gtk2reactor |
14 import time,textwrap,os,optparse, urllib2, gtk, gobject | |
689 | 15 import louie as dispatcher |
691 | 16 |
17 from twisted.python.util import sibpath | |
689 | 18 |
690 | 19 from rdflib import URIRef |
686
a301a0039c66
buildout and rdflib updates
Drew Perttula <drewp@bigasterisk.com>
parents:
684
diff
changeset
|
20 from rdflib import Graph |
400
b2858c2d4a4d
aft() has smooth arg; workaround for CC writing poor subterms
Drew Perttula <drewp@bigasterisk.com>
parents:
399
diff
changeset
|
21 import rdflib |
319
2193eab0650b
add startup logging to curvecalc
Drew Perttula <drewp@bigasterisk.com>
parents:
296
diff
changeset
|
22 import logging |
2193eab0650b
add startup logging to curvecalc
Drew Perttula <drewp@bigasterisk.com>
parents:
296
diff
changeset
|
23 log = logging.getLogger() |
0 | 24 |
210
f41004d5a507
factored out some networking, new show/ layout, curvecalc works
drewp@bigasterisk.com
parents:
205
diff
changeset
|
25 import run_local |
690 | 26 from light9 import showconfig, prof |
688 | 27 from light9.curvecalc.zoomcontrol import Zoomcontrol |
28 from light9.curvecalc.curve import Curveset | |
29 from light9.curvecalc.curveview import Curvesetview | |
689 | 30 from light9.curvecalc.musicaccess import Music, currentlyPlayingSong |
264
0f112a7dd6b3
fix window positoins for subcomposer and curvecalc. now saves geometry continuously
drewp@bigasterisk.com
parents:
248
diff
changeset
|
31 from light9.wavelength import wavelength |
0f112a7dd6b3
fix window positoins for subcomposer and curvecalc. now saves geometry continuously
drewp@bigasterisk.com
parents:
248
diff
changeset
|
32 from light9.uihelpers import toplevelat |
335 | 33 from light9.namespaces import L9 |
690 | 34 from light9.curvecalc.subterm import read_all_subs, savekey, graphPathForSubterms |
35 from light9.curvecalc.subtermview import makeSubtermCommandRow, add_one_subterm | |
36 from light9.curvecalc.output import Output | |
0 | 37 |
516
73b181155555
curvecalc ui touchups, adjustable pane, curve draw speedup, restructured main layout code
drewp@bigasterisk.com
parents:
505
diff
changeset
|
38 def makeStatusLines(master): |
73b181155555
curvecalc ui touchups, adjustable pane, curve draw speedup, restructured main layout code
drewp@bigasterisk.com
parents:
505
diff
changeset
|
39 """various labels that listen for dispatcher signals""" |
197
ba2677823b35
zoom control and other cleanups. also reads song length now
drewp
parents:
196
diff
changeset
|
40 for signame,textfilter in [ |
ba2677823b35
zoom control and other cleanups. also reads song length now
drewp
parents:
196
diff
changeset
|
41 ('input time',lambda t: "%.2fs"%t), |
ba2677823b35
zoom control and other cleanups. also reads song length now
drewp
parents:
196
diff
changeset
|
42 ('output levels', |
ba2677823b35
zoom control and other cleanups. also reads song length now
drewp
parents:
196
diff
changeset
|
43 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
|
44 for n,v in |
205
3905d3c92aaa
twisted mainloop, more row-change keys, xmlrpc fadesub command on port 8050
drewp
parents:
202
diff
changeset
|
45 levels.items()[:5] |
3905d3c92aaa
twisted mainloop, more row-change keys, xmlrpc fadesub command on port 8050
drewp
parents:
202
diff
changeset
|
46 if v>0]),70)), |
197
ba2677823b35
zoom control and other cleanups. also reads song length now
drewp
parents:
196
diff
changeset
|
47 ('update period',lambda t: "%.1fms"%(t*1000)), |
236
63601fe0c3b0
curvecalc cmdline checking, connection status now in gui
drewp@bigasterisk.com
parents:
230
diff
changeset
|
48 ('update status',lambda t: str(t)), |
197
ba2677823b35
zoom control and other cleanups. also reads song length now
drewp
parents:
196
diff
changeset
|
49 ]: |
516
73b181155555
curvecalc ui touchups, adjustable pane, curve draw speedup, restructured main layout code
drewp@bigasterisk.com
parents:
505
diff
changeset
|
50 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
|
51 l.pack(side='top',fill='x') |
ba2677823b35
zoom control and other cleanups. also reads song length now
drewp
parents:
196
diff
changeset
|
52 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
|
53 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
|
54 signame, weak=False) |
197
ba2677823b35
zoom control and other cleanups. also reads song length now
drewp
parents:
196
diff
changeset
|
55 |
287
5322639d61e9
refactoring and little fixes in curvecalc and keyboardcomposer
Drew Perttula <drewp@bigasterisk.com>
parents:
284
diff
changeset
|
56 |
505 | 57 def makeGraph(): |
58 graphOrig = showconfig.getGraph() | |
59 graph = Graph() # a copy, since we're going to add subs into it | |
60 for s in graphOrig: | |
61 graph.add(s) | |
62 read_all_subs(graph) | |
63 return graph | |
0 | 64 |
505 | 65 def setupKeyBindings(root, song, subterms, curveset): |
66 root.bind("<Control-Key-s>", | |
67 lambda *args: savekey(song, subterms, curveset)) | |
68 root.bind("<Control-Key-r>", lambda evt: dispatcher.send('reload all subs')) | |
69 root.bind("<Control-Key-n>", | |
70 lambda evt: dispatcher.send('focus new subterm')) | |
71 root.bind("<Control-Key-N>", lambda evt: dispatcher.send('focus new curve')) | |
72 root.bind("<Control-Key-q>",lambda ev: reactor.stop) | |
73 root.bind("<Destroy>",lambda ev: reactor.stop) | |
74 root.protocol('WM_DELETE_WINDOW', reactor.stop) | |
75 | |
641
c113c759559b
more menubar. not many working actions yet
Drew Perttula <drewp@bigasterisk.com>
parents:
639
diff
changeset
|
76 def setupMenubar(barFrame, root, song, subterms, curveset): |
639 | 77 class newMenu(object): |
78 def __init__(self, name): | |
79 self.name = name | |
80 def __enter__(self): | |
81 m = tk.Menubutton(barFrame, text=self.name) | |
82 m.pack(side='left') | |
83 mm = tk.Menu(m) | |
84 m.config(menu=mm) | |
85 return mm | |
86 def __exit__(self, type, value, traceback): | |
87 return False | |
88 | |
641
c113c759559b
more menubar. not many working actions yet
Drew Perttula <drewp@bigasterisk.com>
parents:
639
diff
changeset
|
89 def notImpl(*args): |
c113c759559b
more menubar. not many working actions yet
Drew Perttula <drewp@bigasterisk.com>
parents:
639
diff
changeset
|
90 print "sorry, menu command binding isn't done yet. Use the keyboard shortcut" |
c113c759559b
more menubar. not many working actions yet
Drew Perttula <drewp@bigasterisk.com>
parents:
639
diff
changeset
|
91 |
c113c759559b
more menubar. not many working actions yet
Drew Perttula <drewp@bigasterisk.com>
parents:
639
diff
changeset
|
92 with newMenu("Curvecalc") as m: |
c113c759559b
more menubar. not many working actions yet
Drew Perttula <drewp@bigasterisk.com>
parents:
639
diff
changeset
|
93 m.add_command(label='Save', underline=0, accelerator="Ctrl+s", |
c113c759559b
more menubar. not many working actions yet
Drew Perttula <drewp@bigasterisk.com>
parents:
639
diff
changeset
|
94 command=lambda *args: savekey(song, subterms, curveset)) |
c113c759559b
more menubar. not many working actions yet
Drew Perttula <drewp@bigasterisk.com>
parents:
639
diff
changeset
|
95 m.add_command(label='Quit', command=root.destroy) |
c113c759559b
more menubar. not many working actions yet
Drew Perttula <drewp@bigasterisk.com>
parents:
639
diff
changeset
|
96 |
c113c759559b
more menubar. not many working actions yet
Drew Perttula <drewp@bigasterisk.com>
parents:
639
diff
changeset
|
97 with newMenu("View") as m: |
c113c759559b
more menubar. not many working actions yet
Drew Perttula <drewp@bigasterisk.com>
parents:
639
diff
changeset
|
98 m.add_command(label="See current time", accelerator="Esc", command=notImpl) |
c113c759559b
more menubar. not many working actions yet
Drew Perttula <drewp@bigasterisk.com>
parents:
639
diff
changeset
|
99 m.add_command(label="See from current time -> end", accelerator="Shift+Esc", command=notImpl) |
c113c759559b
more menubar. not many working actions yet
Drew Perttula <drewp@bigasterisk.com>
parents:
639
diff
changeset
|
100 m.add_command(label="Zoom all", accelerator="Ctrl+Esc", command=notImpl) |
c113c759559b
more menubar. not many working actions yet
Drew Perttula <drewp@bigasterisk.com>
parents:
639
diff
changeset
|
101 m.add_command(label="Zoom in", accelerator="Wheel up", command=notImpl) |
c113c759559b
more menubar. not many working actions yet
Drew Perttula <drewp@bigasterisk.com>
parents:
639
diff
changeset
|
102 m.add_command(label="Zoom out", accelerator="Wheel down", command=notImpl) |
c113c759559b
more menubar. not many working actions yet
Drew Perttula <drewp@bigasterisk.com>
parents:
639
diff
changeset
|
103 |
c113c759559b
more menubar. not many working actions yet
Drew Perttula <drewp@bigasterisk.com>
parents:
639
diff
changeset
|
104 with newMenu("Playback") as m: |
c113c759559b
more menubar. not many working actions yet
Drew Perttula <drewp@bigasterisk.com>
parents:
639
diff
changeset
|
105 m.add_command(label="Play/pause at mouse", accelerator="Ctrl+P", command=notImpl) |
c113c759559b
more menubar. not many working actions yet
Drew Perttula <drewp@bigasterisk.com>
parents:
639
diff
changeset
|
106 |
c113c759559b
more menubar. not many working actions yet
Drew Perttula <drewp@bigasterisk.com>
parents:
639
diff
changeset
|
107 with newMenu("Points") as m: |
c113c759559b
more menubar. not many working actions yet
Drew Perttula <drewp@bigasterisk.com>
parents:
639
diff
changeset
|
108 m.add_command(label="Delete", accelerator="Del", command=notImpl) |
c113c759559b
more menubar. not many working actions yet
Drew Perttula <drewp@bigasterisk.com>
parents:
639
diff
changeset
|
109 |
639 | 110 |
505 | 111 def createHelpLines(root): |
641
c113c759559b
more menubar. not many working actions yet
Drew Perttula <drewp@bigasterisk.com>
parents:
639
diff
changeset
|
112 for helpline in ["Mousewheel zoom; C-p play/pause music at mouse", |
c113c759559b
more menubar. not many working actions yet
Drew Perttula <drewp@bigasterisk.com>
parents:
639
diff
changeset
|
113 "Curve point bindings: B1 drag point; C-B1 curve add point; S-B1 sketch points; 1..5 add point at time; B1 drag select points", |
505 | 114 "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"]: |
115 line = tk.Label(root, text=helpline, font="Helvetica -12 italic", | |
116 anchor='w') | |
117 line.pack(side='top',fill='x') | |
118 | |
691 | 119 class Main(object): |
692
ccdd04f4ca7d
subterm display is working
Drew Perttula <drewp@bigasterisk.com>
parents:
691
diff
changeset
|
120 def __init__(self, graph, song, curveset, subterms): |
ccdd04f4ca7d
subterm display is working
Drew Perttula <drewp@bigasterisk.com>
parents:
691
diff
changeset
|
121 self.graph = graph |
691 | 122 wtree = gtk.Builder() |
123 wtree.add_from_file(sibpath(__file__, "../light9/curvecalc/curvecalc.glade")) | |
124 mainwin = wtree.get_object("MainWindow") | |
125 mainwin.connect("destroy", gtk.main_quit) | |
126 wtree.connect_signals(self) | |
127 mainwin.show_all() | |
128 #gobject.timeout_add(1000 // framerate, self.updateLoop) | |
129 | |
692
ccdd04f4ca7d
subterm display is working
Drew Perttula <drewp@bigasterisk.com>
parents:
691
diff
changeset
|
130 mainwin.set_title("curvecalc - %s" % graph.label(song)) |
ccdd04f4ca7d
subterm display is working
Drew Perttula <drewp@bigasterisk.com>
parents:
691
diff
changeset
|
131 |
ccdd04f4ca7d
subterm display is working
Drew Perttula <drewp@bigasterisk.com>
parents:
691
diff
changeset
|
132 self.add_subterms_for_song(song, curveset, subterms, |
ccdd04f4ca7d
subterm display is working
Drew Perttula <drewp@bigasterisk.com>
parents:
691
diff
changeset
|
133 wtree.get_object("subterms") |
ccdd04f4ca7d
subterm display is working
Drew Perttula <drewp@bigasterisk.com>
parents:
691
diff
changeset
|
134 ) |
ccdd04f4ca7d
subterm display is working
Drew Perttula <drewp@bigasterisk.com>
parents:
691
diff
changeset
|
135 |
ccdd04f4ca7d
subterm display is working
Drew Perttula <drewp@bigasterisk.com>
parents:
691
diff
changeset
|
136 def add_subterms_for_song(self, song, curveset, subterms, master): |
ccdd04f4ca7d
subterm display is working
Drew Perttula <drewp@bigasterisk.com>
parents:
691
diff
changeset
|
137 for st in self.graph.objects(song, L9['subterm']): |
ccdd04f4ca7d
subterm display is working
Drew Perttula <drewp@bigasterisk.com>
parents:
691
diff
changeset
|
138 log.info("song %s has subterm %s", song, st) |
ccdd04f4ca7d
subterm display is working
Drew Perttula <drewp@bigasterisk.com>
parents:
691
diff
changeset
|
139 add_one_subterm(self.graph, |
ccdd04f4ca7d
subterm display is working
Drew Perttula <drewp@bigasterisk.com>
parents:
691
diff
changeset
|
140 self.graph.value(st, L9['sub']), |
ccdd04f4ca7d
subterm display is working
Drew Perttula <drewp@bigasterisk.com>
parents:
691
diff
changeset
|
141 curveset, |
ccdd04f4ca7d
subterm display is working
Drew Perttula <drewp@bigasterisk.com>
parents:
691
diff
changeset
|
142 subterms, |
ccdd04f4ca7d
subterm display is working
Drew Perttula <drewp@bigasterisk.com>
parents:
691
diff
changeset
|
143 master, |
ccdd04f4ca7d
subterm display is working
Drew Perttula <drewp@bigasterisk.com>
parents:
691
diff
changeset
|
144 self.graph.value(st, L9['expression'])) |
ccdd04f4ca7d
subterm display is working
Drew Perttula <drewp@bigasterisk.com>
parents:
691
diff
changeset
|
145 master.show_all() |
ccdd04f4ca7d
subterm display is working
Drew Perttula <drewp@bigasterisk.com>
parents:
691
diff
changeset
|
146 |
505 | 147 def main(): |
680
ad17b0a09f5c
CC more startup logging, timing option to quit after init
drewp@bigasterisk.com
parents:
641
diff
changeset
|
148 startTime = time.time() |
505 | 149 parser = optparse.OptionParser() |
551
ad5043f70fda
bin/curvecalc (with no song choice) defaults to whatever-ascoltami-is-currently-on
drewp@bigasterisk.com
parents:
532
diff
changeset
|
150 parser.set_usage("%prog [opts] [songURI]") |
505 | 151 parser.add_option("--sliders", action='store_true', |
152 help='use hardware sliders') | |
153 parser.add_option("--skip-music", action='store_true', | |
154 help="ignore music and smooth_music curve files") | |
680
ad17b0a09f5c
CC more startup logging, timing option to quit after init
drewp@bigasterisk.com
parents:
641
diff
changeset
|
155 parser.add_option("--debug", action="store_true", |
ad17b0a09f5c
CC more startup logging, timing option to quit after init
drewp@bigasterisk.com
parents:
641
diff
changeset
|
156 help="log at DEBUG") |
ad17b0a09f5c
CC more startup logging, timing option to quit after init
drewp@bigasterisk.com
parents:
641
diff
changeset
|
157 parser.add_option("--startup-only", action='store_true', |
ad17b0a09f5c
CC more startup logging, timing option to quit after init
drewp@bigasterisk.com
parents:
641
diff
changeset
|
158 help="quit after loading everything (for timing tests)") |
505 | 159 opts, args = parser.parse_args() |
160 | |
590 | 161 logging.basicConfig(format="%(asctime)s %(levelname)-5s %(name)s %(filename)s:%(lineno)d: %(message)s") |
680
ad17b0a09f5c
CC more startup logging, timing option to quit after init
drewp@bigasterisk.com
parents:
641
diff
changeset
|
162 log.setLevel(logging.DEBUG if opts.debug else logging.INFO) |
590 | 163 |
680
ad17b0a09f5c
CC more startup logging, timing option to quit after init
drewp@bigasterisk.com
parents:
641
diff
changeset
|
164 log.debug("startup: music %s", time.time() - startTime) |
505 | 165 try: |
166 song = URIRef(args[0]) | |
167 except IndexError: | |
551
ad5043f70fda
bin/curvecalc (with no song choice) defaults to whatever-ascoltami-is-currently-on
drewp@bigasterisk.com
parents:
532
diff
changeset
|
168 song = currentlyPlayingSong() |
505 | 169 |
170 music=Music() | |
516
73b181155555
curvecalc ui touchups, adjustable pane, curve draw speedup, restructured main layout code
drewp@bigasterisk.com
parents:
505
diff
changeset
|
171 graph = makeGraph() |
691 | 172 |
505 | 173 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
|
174 subterms = [] |
505 | 175 |
637
af5539fe35a7
CC startup doesn't need a subterms file. it'll make the first one
Drew Perttula <drewp@bigasterisk.com>
parents:
636
diff
changeset
|
176 subtermPath = graphPathForSubterms(song) |
af5539fe35a7
CC startup doesn't need a subterms file. it'll make the first one
Drew Perttula <drewp@bigasterisk.com>
parents:
636
diff
changeset
|
177 try: |
af5539fe35a7
CC startup doesn't need a subterms file. it'll make the first one
Drew Perttula <drewp@bigasterisk.com>
parents:
636
diff
changeset
|
178 graph.parse(subtermPath, format='n3') |
af5539fe35a7
CC startup doesn't need a subterms file. it'll make the first one
Drew Perttula <drewp@bigasterisk.com>
parents:
636
diff
changeset
|
179 except urllib2.URLError, e: |
af5539fe35a7
CC startup doesn't need a subterms file. it'll make the first one
Drew Perttula <drewp@bigasterisk.com>
parents:
636
diff
changeset
|
180 if e.reason.errno != 2: |
af5539fe35a7
CC startup doesn't need a subterms file. it'll make the first one
Drew Perttula <drewp@bigasterisk.com>
parents:
636
diff
changeset
|
181 raise |
af5539fe35a7
CC startup doesn't need a subterms file. it'll make the first one
Drew Perttula <drewp@bigasterisk.com>
parents:
636
diff
changeset
|
182 log.info("%s not found, starting with empty graph" % subtermPath) |
516
73b181155555
curvecalc ui touchups, adjustable pane, curve draw speedup, restructured main layout code
drewp@bigasterisk.com
parents:
505
diff
changeset
|
183 |
680
ad17b0a09f5c
CC more startup logging, timing option to quit after init
drewp@bigasterisk.com
parents:
641
diff
changeset
|
184 log.debug("startup: output %s", time.time() - startTime) |
516
73b181155555
curvecalc ui touchups, adjustable pane, curve draw speedup, restructured main layout code
drewp@bigasterisk.com
parents:
505
diff
changeset
|
185 out = Output(subterms, music) |
505 | 186 |
187 musicfilename = showconfig.songOnDisk(song) | |
188 maxtime = wavelength(musicfilename) | |
516
73b181155555
curvecalc ui touchups, adjustable pane, curve draw speedup, restructured main layout code
drewp@bigasterisk.com
parents:
505
diff
changeset
|
189 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
|
190 |
692
ccdd04f4ca7d
subterm display is working
Drew Perttula <drewp@bigasterisk.com>
parents:
691
diff
changeset
|
191 start = Main(graph, song, curveset, subterms) |
ccdd04f4ca7d
subterm display is working
Drew Perttula <drewp@bigasterisk.com>
parents:
691
diff
changeset
|
192 #gtk2reactor.install() |
ccdd04f4ca7d
subterm display is working
Drew Perttula <drewp@bigasterisk.com>
parents:
691
diff
changeset
|
193 |
ccdd04f4ca7d
subterm display is working
Drew Perttula <drewp@bigasterisk.com>
parents:
691
diff
changeset
|
194 if opts.startup_only: |
ccdd04f4ca7d
subterm display is working
Drew Perttula <drewp@bigasterisk.com>
parents:
691
diff
changeset
|
195 log.debug("quitting now because of --startup-only") |
ccdd04f4ca7d
subterm display is working
Drew Perttula <drewp@bigasterisk.com>
parents:
691
diff
changeset
|
196 return |
ccdd04f4ca7d
subterm display is working
Drew Perttula <drewp@bigasterisk.com>
parents:
691
diff
changeset
|
197 |
ccdd04f4ca7d
subterm display is working
Drew Perttula <drewp@bigasterisk.com>
parents:
691
diff
changeset
|
198 gtk.main() |
ccdd04f4ca7d
subterm display is working
Drew Perttula <drewp@bigasterisk.com>
parents:
691
diff
changeset
|
199 1/0 |
ccdd04f4ca7d
subterm display is working
Drew Perttula <drewp@bigasterisk.com>
parents:
691
diff
changeset
|
200 ################### |
ccdd04f4ca7d
subterm display is working
Drew Perttula <drewp@bigasterisk.com>
parents:
691
diff
changeset
|
201 |
639 | 202 |
516
73b181155555
curvecalc ui touchups, adjustable pane, curve draw speedup, restructured main layout code
drewp@bigasterisk.com
parents:
505
diff
changeset
|
203 if 'fixed top rows': |
73b181155555
curvecalc ui touchups, adjustable pane, curve draw speedup, restructured main layout code
drewp@bigasterisk.com
parents:
505
diff
changeset
|
204 zc = Zoomcontrol(root) |
73b181155555
curvecalc ui touchups, adjustable pane, curve draw speedup, restructured main layout code
drewp@bigasterisk.com
parents:
505
diff
changeset
|
205 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
|
206 |
73b181155555
curvecalc ui touchups, adjustable pane, curve draw speedup, restructured main layout code
drewp@bigasterisk.com
parents:
505
diff
changeset
|
207 if 'panes': |
73b181155555
curvecalc ui touchups, adjustable pane, curve draw speedup, restructured main layout code
drewp@bigasterisk.com
parents:
505
diff
changeset
|
208 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
|
209 panes.add('curvesetView') |
73b181155555
curvecalc ui touchups, adjustable pane, curve draw speedup, restructured main layout code
drewp@bigasterisk.com
parents:
505
diff
changeset
|
210 panes.add('subterms') |
73b181155555
curvecalc ui touchups, adjustable pane, curve draw speedup, restructured main layout code
drewp@bigasterisk.com
parents:
505
diff
changeset
|
211 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
|
212 |
519
f2dbb0b1fb35
optimize the number of curve redraws at curvecalc's startup
drewp@bigasterisk.com
parents:
517
diff
changeset
|
213 curvesetView = Curvesetview(panes.subwidget('curvesetView'), curveset, |
613 | 214 height=600) |
519
f2dbb0b1fb35
optimize the number of curve redraws at curvecalc's startup
drewp@bigasterisk.com
parents:
517
diff
changeset
|
215 curvesetView.pack(fill='both', expand=True) |
516
73b181155555
curvecalc ui touchups, adjustable pane, curve draw speedup, restructured main layout code
drewp@bigasterisk.com
parents:
505
diff
changeset
|
216 |
73b181155555
curvecalc ui touchups, adjustable pane, curve draw speedup, restructured main layout code
drewp@bigasterisk.com
parents:
505
diff
changeset
|
217 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
|
218 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
|
219 |
73b181155555
curvecalc ui touchups, adjustable pane, curve draw speedup, restructured main layout code
drewp@bigasterisk.com
parents:
505
diff
changeset
|
220 subtermScroll = tk.ScrolledWindow(subtermArea) |
73b181155555
curvecalc ui touchups, adjustable pane, curve draw speedup, restructured main layout code
drewp@bigasterisk.com
parents:
505
diff
changeset
|
221 subtermScroll.pack(fill='both') |
73b181155555
curvecalc ui touchups, adjustable pane, curve draw speedup, restructured main layout code
drewp@bigasterisk.com
parents:
505
diff
changeset
|
222 |
73b181155555
curvecalc ui touchups, adjustable pane, curve draw speedup, restructured main layout code
drewp@bigasterisk.com
parents:
505
diff
changeset
|
223 if 'fixed bottom rows': |
73b181155555
curvecalc ui touchups, adjustable pane, curve draw speedup, restructured main layout code
drewp@bigasterisk.com
parents:
505
diff
changeset
|
224 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
|
225 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
|
226 makeStatusLines(root) |
73b181155555
curvecalc ui touchups, adjustable pane, curve draw speedup, restructured main layout code
drewp@bigasterisk.com
parents:
505
diff
changeset
|
227 |
73b181155555
curvecalc ui touchups, adjustable pane, curve draw speedup, restructured main layout code
drewp@bigasterisk.com
parents:
505
diff
changeset
|
228 helpBox = tk.Frame(root) |
73b181155555
curvecalc ui touchups, adjustable pane, curve draw speedup, restructured main layout code
drewp@bigasterisk.com
parents:
505
diff
changeset
|
229 createHelpLines(helpBox) |
73b181155555
curvecalc ui touchups, adjustable pane, curve draw speedup, restructured main layout code
drewp@bigasterisk.com
parents:
505
diff
changeset
|
230 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
|
231 |
73b181155555
curvecalc ui touchups, adjustable pane, curve draw speedup, restructured main layout code
drewp@bigasterisk.com
parents:
505
diff
changeset
|
232 setupKeyBindings(root, song, subterms, curveset) |
641
c113c759559b
more menubar. not many working actions yet
Drew Perttula <drewp@bigasterisk.com>
parents:
639
diff
changeset
|
233 setupMenubar(menubar, root, song, subterms, curveset) |
516
73b181155555
curvecalc ui touchups, adjustable pane, curve draw speedup, restructured main layout code
drewp@bigasterisk.com
parents:
505
diff
changeset
|
234 |
73b181155555
curvecalc ui touchups, adjustable pane, curve draw speedup, restructured main layout code
drewp@bigasterisk.com
parents:
505
diff
changeset
|
235 # 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
|
236 # signals for all the initial curves |
505 | 237 curveset.load(basename=os.path.join(showconfig.curvesDir(), |
238 showconfig.songFilenameFromURI(song)), | |
239 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
|
240 |
73b181155555
curvecalc ui touchups, adjustable pane, curve draw speedup, restructured main layout code
drewp@bigasterisk.com
parents:
505
diff
changeset
|
241 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
|
242 dispatcher.send("show all") |
519
f2dbb0b1fb35
optimize the number of curve redraws at curvecalc's startup
drewp@bigasterisk.com
parents:
517
diff
changeset
|
243 |
f2dbb0b1fb35
optimize the number of curve redraws at curvecalc's startup
drewp@bigasterisk.com
parents:
517
diff
changeset
|
244 # this is scheduled after some tk shuffling, to try to minimize |
f2dbb0b1fb35
optimize the number of curve redraws at curvecalc's startup
drewp@bigasterisk.com
parents:
517
diff
changeset
|
245 # the number of times we redraw the curve at startup. If tk is |
f2dbb0b1fb35
optimize the number of curve redraws at curvecalc's startup
drewp@bigasterisk.com
parents:
517
diff
changeset
|
246 # very slow, it's ok. You'll just get some wasted redraws. |
f2dbb0b1fb35
optimize the number of curve redraws at curvecalc's startup
drewp@bigasterisk.com
parents:
517
diff
changeset
|
247 reactor.callLater(.1, curvesetView.goLive) |
505 | 248 |
249 | |
250 main() |