Mercurial > code > home > repos > light9
comparison bin/curvecalc @ 903:bca2e8d754aa
tripleFilter optimization on currentState. optimize how often curvecalc rebuilds Subterm objs
Ignore-this: 7402387bd9f4f99c2e7ef27b8dcfc4db
author | Drew Perttula <drewp@bigasterisk.com> |
---|---|
date | Mon, 10 Jun 2013 06:00:48 +0000 |
parents | 0dacbba70d06 |
children | 5054d49ed44e |
comparison
equal
deleted
inserted
replaced
902:f376e7605e25 | 903:bca2e8d754aa |
---|---|
44 class Main(object): | 44 class Main(object): |
45 def __init__(self, graph, opts, session, curveset, music): | 45 def __init__(self, graph, opts, session, curveset, music): |
46 self.graph, self.opts, self.session = graph, opts, session | 46 self.graph, self.opts, self.session = graph, opts, session |
47 self.curveset, self.music = curveset, music | 47 self.curveset, self.music = curveset, music |
48 self.lastSeenInputTime = 0 | 48 self.lastSeenInputTime = 0 |
49 self.currentSubterms = [] # Subterm objects that are synced to the graph | |
49 | 50 |
50 wtree = self.wtree = gtk.Builder() | 51 wtree = self.wtree = gtk.Builder() |
51 wtree.add_from_file("light9/curvecalc/curvecalc.glade") | 52 wtree.add_from_file("light9/curvecalc/curvecalc.glade") |
52 mainwin = wtree.get_object("MainWindow") | 53 mainwin = wtree.get_object("MainWindow") |
53 | 54 |
209 if withCurve: | 210 if withCurve: |
210 self.curveset.new_curve(newname) | 211 self.curveset.new_curve(newname) |
211 return uri | 212 return uri |
212 | 213 |
213 def set_subterms_from_graph(self): | 214 def set_subterms_from_graph(self): |
215 """rebuild all the gtktable 'subterms' widgets and the | |
216 self.currentSubterms list""" | |
217 song = self.graph.value(self.session, L9['currentSong']) | |
218 | |
219 newList = [] | |
220 for st in set(self.graph.objects(song, L9['subterm'])): | |
221 log.info("song %s has subterm %s", song, st) | |
222 term = Subterm(self.graph, st, self.songSubtermsContext(), | |
223 self.curveset) | |
224 newList.append(term) | |
225 self.currentSubterms[:] = newList | |
226 | |
214 master = self.wtree.get_object("subterms") | 227 master = self.wtree.get_object("subterms") |
215 log.info("removing subterm widgets") | 228 log.info("removing subterm widgets") |
216 [master.remove(c) for c in master.get_children()] | 229 [master.remove(c) for c in master.get_children()] |
217 | 230 for term in self.currentSubterms: |
218 song = self.graph.value(self.session, L9['currentSong']) | |
219 | |
220 for st in set(self.graph.objects(song, L9['subterm'])): | |
221 log.info("song %s has subterm %s", song, st) | |
222 term = Subterm(self.graph, st, self.songSubtermsContext(), self.curveset) | |
223 add_one_subterm(term, self.curveset, master) | 231 add_one_subterm(term, self.curveset, master) |
224 | |
225 master.show_all() | 232 master.show_all() |
226 log.info("%s table children showing" % len(master.get_children())) | 233 log.info("%s table children showing" % len(master.get_children())) |
227 | 234 |
228 def refreshTheme(self): | 235 def refreshTheme(self): |
229 gtk.rc_reparse_all() | 236 gtk.rc_reparse_all() |
394 showconfig.songFilenameFromURI(song)), | 401 showconfig.songFilenameFromURI(song)), |
395 skipMusic=opts.skip_music) | 402 skipMusic=opts.skip_music) |
396 graph.addHandler(curvesetReload) | 403 graph.addHandler(curvesetReload) |
397 | 404 |
398 log.debug("startup: output %s", time.time() - startTime) | 405 log.debug("startup: output %s", time.time() - startTime) |
399 out = Output(graph, session, music, curveset) | |
400 | 406 |
401 mt = MaxTime(graph, session) | 407 mt = MaxTime(graph, session) |
402 dispatcher.connect(lambda: mt.get(), "get max time", weak=False) | 408 dispatcher.connect(lambda: mt.get(), "get max time", weak=False) |
403 | 409 |
404 start = Main(graph, opts, session, curveset, music) | 410 start = Main(graph, opts, session, curveset, music) |
411 out = Output(graph, session, music, curveset, start.currentSubterms) | |
405 | 412 |
406 dispatcher.send("show all") | 413 dispatcher.send("show all") |
407 | 414 |
408 if opts.startup_only: | 415 if opts.startup_only: |
409 log.debug("quitting now because of --startup-only") | 416 log.debug("quitting now because of --startup-only") |