Mercurial > code > home > repos > light9
diff 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 |
line wrap: on
line diff
--- a/bin/curvecalc Mon Jun 10 04:22:07 2013 +0000 +++ b/bin/curvecalc Mon Jun 10 06:00:48 2013 +0000 @@ -46,6 +46,7 @@ self.graph, self.opts, self.session = graph, opts, session self.curveset, self.music = curveset, music self.lastSeenInputTime = 0 + self.currentSubterms = [] # Subterm objects that are synced to the graph wtree = self.wtree = gtk.Builder() wtree.add_from_file("light9/curvecalc/curvecalc.glade") @@ -211,17 +212,23 @@ return uri def set_subterms_from_graph(self): + """rebuild all the gtktable 'subterms' widgets and the + self.currentSubterms list""" + song = self.graph.value(self.session, L9['currentSong']) + + newList = [] + for st in set(self.graph.objects(song, L9['subterm'])): + log.info("song %s has subterm %s", song, st) + term = Subterm(self.graph, st, self.songSubtermsContext(), + self.curveset) + newList.append(term) + self.currentSubterms[:] = newList + master = self.wtree.get_object("subterms") log.info("removing subterm widgets") [master.remove(c) for c in master.get_children()] - - song = self.graph.value(self.session, L9['currentSong']) - - for st in set(self.graph.objects(song, L9['subterm'])): - log.info("song %s has subterm %s", song, st) - term = Subterm(self.graph, st, self.songSubtermsContext(), self.curveset) + for term in self.currentSubterms: add_one_subterm(term, self.curveset, master) - master.show_all() log.info("%s table children showing" % len(master.get_children())) @@ -396,12 +403,12 @@ graph.addHandler(curvesetReload) log.debug("startup: output %s", time.time() - startTime) - out = Output(graph, session, music, curveset) mt = MaxTime(graph, session) dispatcher.connect(lambda: mt.get(), "get max time", weak=False) start = Main(graph, opts, session, curveset, music) + out = Output(graph, session, music, curveset, start.currentSubterms) dispatcher.send("show all")