diff --git a/bin/curvecalc b/bin/curvecalc --- a/bin/curvecalc +++ b/bin/curvecalc @@ -163,13 +163,6 @@ class Main(object): 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 @@ def main(): 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') diff --git a/light9/curvecalc/curve.py b/light9/curvecalc/curve.py --- a/light9/curvecalc/curve.py +++ b/light9/curvecalc/curve.py @@ -133,16 +133,17 @@ class Curveset(object): 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 @@ class Curveset(object): 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 diff --git a/light9/curvecalc/curveview.py b/light9/curvecalc/curveview.py --- a/light9/curvecalc/curveview.py +++ b/light9/curvecalc/curveview.py @@ -712,6 +712,9 @@ class Curvesetview(object): 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 @@ class Curvesetview(object): entry.bind("", self.new_curve) self.entry = entry - dispatcher.connect(self.focus_entry, "focus new curve") def focus_entry(self):