Changeset - d5a9933a2222
[Not reviewed]
default
0 3 0
Drew Perttula - 13 years ago 2012-06-10 07:34:41
drewp@bigasterisk.com
don't reload curve files upon curve code reload
Ignore-this: 597d66003a1e45daca5470fbd57974b7
3 files changed with 19 insertions and 12 deletions:
0 comments (0 inline, 0 general)
bin/curvecalc
Show inline comments
 
@@ -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')
light9/curvecalc/curve.py
Show inline comments
 
@@ -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
light9/curvecalc/curveview.py
Show inline comments
 
@@ -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("<Key-Return>", self.new_curve)
 
        self.entry = entry
 
        
 
        
 
        dispatcher.connect(self.focus_entry, "focus new curve")
 

	
 
    def focus_entry(self):
0 comments (0 inline, 0 general)