Mercurial > code > home > repos > light9
changeset 704:d5a9933a2222
don't reload curve files upon curve code reload
Ignore-this: 597d66003a1e45daca5470fbd57974b7
author | Drew Perttula <drewp@bigasterisk.com> |
---|---|
date | Sun, 10 Jun 2012 07:34:41 +0000 |
parents | 54a3dcba6597 |
children | ed50631cf333 |
files | bin/curvecalc light9/curvecalc/curve.py light9/curvecalc/curveview.py |
diffstat | 3 files changed, 19 insertions(+), 12 deletions(-) [+] |
line wrap: on
line diff
--- a/bin/curvecalc Sun Jun 10 07:22:39 2012 +0000 +++ b/bin/curvecalc Sun Jun 10 07:34:41 2012 +0000 @@ -163,13 +163,6 @@ curvesVBox, zoomControlBox, self.curveset) self.curvesetView._mtimes = mtimes - # curvesetview must already exist, since this - # makes 'add_curve' signals for all the initial - # curves - self.curveset.load(basename=os.path.join( - showconfig.curvesDir(), - showconfig.songFilenameFromURI(self.song)), - skipMusic=self.opts.skip_music) # this is scheduled after some tk shuffling, to # try to minimize the number of times we redraw # the curve at startup. If tk is very slow, it's @@ -225,6 +218,14 @@ curveset = Curveset(sliders=opts.sliders) subterms = [] + # curvesetview must already exist, since this + # makes 'add_curve' signals for all the initial + # curves. + curveset.load(basename=os.path.join( + showconfig.curvesDir(), + showconfig.songFilenameFromURI(song)), + skipMusic=opts.skip_music) + subtermPath = graphPathForSubterms(song) try: graph.parse(subtermPath, format='n3')
--- a/light9/curvecalc/curve.py Sun Jun 10 07:22:39 2012 +0000 +++ b/light9/curvecalc/curve.py Sun Jun 10 07:34:41 2012 +0000 @@ -133,16 +133,17 @@ self.sliderIgnoreInputUntil = {} else: self.sliders = None - + + def sorter(self, name): + return not name.endswith('music'), name + def load(self,basename, skipMusic=False): """find all files that look like basename-curvename and add curves with their contents This fires 'add_curve' dispatcher events to announce the new curves. """ - def sorter(name): - return not name.endswith('music'), name - for filename in sorted(glob.glob("%s-*"%basename), key=sorter): + for filename in sorted(glob.glob("%s-*"%basename), key=self.sorter): curvename = filename[filename.rfind('-')+1:] if skipMusic and curvename in ['music', 'smooth_music']: continue @@ -156,6 +157,9 @@ like basename-curvename""" for name,cur in self.curves.items(): cur.save("%s-%s" % (basename,name)) + + def curveNamesInOrder(self): + return sorted(self.curves.keys(), key=self.sorter) def add_curve(self,name,curve): self.curves[name] = curve
--- a/light9/curvecalc/curveview.py Sun Jun 10 07:22:39 2012 +0000 +++ b/light9/curvecalc/curveview.py Sun Jun 10 07:34:41 2012 +0000 @@ -712,6 +712,9 @@ zoomControlBox.add(self.zoomControl.widget) self.zoomControl.widget.show_all() + for c in curveset.curveNamesInOrder(): + self.add_curve(c) + dispatcher.connect(self.add_curve, "add_curve", sender=self.curveset) self.newcurvename = gtk.EntryBuffer("", 0) @@ -723,7 +726,6 @@ entry.bind("<Key-Return>", self.new_curve) self.entry = entry - dispatcher.connect(self.focus_entry, "focus new curve") def focus_entry(self):