Changeset - ced2c5e5fb31
[Not reviewed]
default
0 5 0
drewp@bigasterisk.com - 12 years ago 2013-06-15 08:21:33
drewp@bigasterisk.com
curvecalc can finally change songs without restarting, and it can optionally track the song from ascoltami (beware of losing curve edits in this mode!)
Ignore-this: 3a5349b015605c3a8d640d30ea255000
5 files changed with 87 insertions and 1 deletions:
0 comments (0 inline, 0 general)
bin/curvecalc
Show inline comments
 
@@ -78,6 +78,25 @@ class Main(object):
 
            songChoice(graph.value(session, L9['currentSong']))
 
        graph.addHandler(setSong)
 
        # next here, watch songChoice and patch the graph
 
        def songToGraph(newSong):
 
            graph.patchObject(context=session, subject=session,
 
                              predicate=L9['currentSong'], newObject=newSong)
 
        songChoice.subscribe(songToGraph)
 
        def current_player_song(song):
 
            # (this is run on every frame)
 
            ps = wtree.get_object("playerSong")
 
            if URIRef(ps.get_uri()) != song:
 
                print "update playerSong"
 
                def setLabel():
 
                    ps.set_label(graph.label(song))
 
                graph.addHandler(setLabel)
 
                ps.set_uri(song)
 
            if song != songChoice():
 
                if wtree.get_object("followPlayerSongChoice").get_active():
 
                    songChoice(song)
 
                
 
        self.current_player_song = current_player_song
 
        dispatcher.connect(current_player_song, "current_player_song")
 
        
 
        ec = EditChoice(graph, songChoice, label="Editing song:")
 
        wtree.get_object("currentSongEditChoice").add(ec)
light9/curvecalc/curve.py
Show inline comments
 
@@ -170,6 +170,13 @@ class Curveset(object):
 
        This fires 'add_curve' dispatcher events to announce the new curves.
 
        """
 
        log.info("Curveset.load %s", basename)
 
        dispatcher.send("clear_curves")
 
        self.curves.clear()
 
        self.curveName.clear()
 
        self.sliderCurve.clear()
 
        self.sliderNum.clear()
 
        self.markers = Markers()
 
        
 
        for filename in sorted(glob.glob("%s-*"%basename), key=self.sorter):
 
            curvename = filename[filename.rfind('-')+1:]
 
            if skipMusic and curvename in ['music', 'smooth_music']:
light9/curvecalc/curvecalc.glade
Show inline comments
 
@@ -314,6 +314,54 @@
 
              </packing>
 
            </child>
 
            <child>
 
              <object class="GtkLabel" id="label2">
 
                <property name="visible">True</property>
 
                <property name="can_focus">False</property>
 
                <property name="xalign">1</property>
 
                <property name="label" translatable="yes">Player is on song </property>
 
                <property name="justify">right</property>
 
              </object>
 
              <packing>
 
                <property name="expand">False</property>
 
                <property name="fill">False</property>
 
                <property name="position">1</property>
 
              </packing>
 
            </child>
 
            <child>
 
              <object class="GtkLinkButton" id="playerSong">
 
                <property name="label" translatable="yes">(song)</property>
 
                <property name="visible">True</property>
 
                <property name="can_focus">True</property>
 
                <property name="receives_default">True</property>
 
                <property name="has_tooltip">True</property>
 
                <property name="use_action_appearance">False</property>
 
                <property name="relief">none</property>
 
                <property name="xalign">0</property>
 
                <property name="uri">http://glade.gnome.org</property>
 
              </object>
 
              <packing>
 
                <property name="expand">False</property>
 
                <property name="fill">False</property>
 
                <property name="position">2</property>
 
              </packing>
 
            </child>
 
            <child>
 
              <object class="GtkCheckButton" id="followPlayerSongChoice">
 
                <property name="label" translatable="yes">follow player song choice</property>
 
                <property name="visible">True</property>
 
                <property name="can_focus">True</property>
 
                <property name="receives_default">False</property>
 
                <property name="use_action_appearance">False</property>
 
                <property name="draw_indicator">True</property>
 
              </object>
 
              <packing>
 
                <property name="expand">False</property>
 
                <property name="fill">False</property>
 
                <property name="padding">15</property>
 
                <property name="position">3</property>
 
              </packing>
 
            </child>
 
            <child>
 
              <placeholder/>
 
            </child>
 
          </object>
light9/curvecalc/curveview.py
Show inline comments
 
@@ -1048,6 +1048,9 @@ class CurveRow(object):
 
        self.initCurveView()
 
        self.update_ui_to_collapsed_state()
 

	
 
    def destroy(self):
 
        self.box.destroy()
 
        
 
    def initCurveView(self):
 
        self.curveView.widget.show()
 
        self.curveView.widget.set_size_request(-1, 100)
 
@@ -1141,6 +1144,7 @@ class Curvesetview(object):
 
        for c in curveset.curveNamesInOrder():
 
            self.add_curve(c) 
 

	
 
        dispatcher.connect(self.clear_curves, "clear_curves")
 
        dispatcher.connect(self.add_curve, "add_curve", sender=self.curveset)
 
        dispatcher.connect(self.set_featured_curves, "set_featured_curves")
 
        
 
@@ -1153,6 +1157,11 @@ class Curvesetview(object):
 
    def __del__(self):
 
        print "del curvesetview", id(self) 
 

	
 
    def clear_curves(self):
 
        """curveset is about to re-add all new curves"""
 
        while self.allCurveRows:
 
            self.allCurveRows.pop().destroy()
 
        
 
    def takeFocus(self, *args):
 
        """the whole curveset's eventbox is what gets the focus, currently, so
 
        keys like 'c' can work in it"""
light9/curvecalc/musicaccess.py
Show inline comments
 
@@ -62,7 +62,10 @@ class Music:
 
        return done
 

	
 
    def _bodyReceived(self, data):
 
        dispatcher.send("input time", val=data['t'])
 
        if 't' in data:
 
            dispatcher.send("input time", val=data['t'])
 
        if 'song' in data:
 
            dispatcher.send("current_player_song", song=URIRef(data['song']))
 
        return data['t'] # pass along to the real receiver
 
    
 
    def playOrPause(self, t=None):
0 comments (0 inline, 0 general)