Mercurial > code > home > repos > light9
changeset 964:ced2c5e5fb31
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
author | drewp@bigasterisk.com |
---|---|
date | Sat, 15 Jun 2013 08:21:33 +0000 |
parents | 56218ce0fd37 |
children | a472171c50e4 |
files | bin/curvecalc light9/curvecalc/curve.py light9/curvecalc/curvecalc.glade light9/curvecalc/curveview.py light9/curvecalc/musicaccess.py |
diffstat | 5 files changed, 87 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/bin/curvecalc Sat Jun 15 08:21:16 2013 +0000 +++ b/bin/curvecalc Sat Jun 15 08:21:33 2013 +0000 @@ -78,6 +78,25 @@ 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)
--- a/light9/curvecalc/curve.py Sat Jun 15 08:21:16 2013 +0000 +++ b/light9/curvecalc/curve.py Sat Jun 15 08:21:33 2013 +0000 @@ -170,6 +170,13 @@ 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']:
--- a/light9/curvecalc/curvecalc.glade Sat Jun 15 08:21:16 2013 +0000 +++ b/light9/curvecalc/curvecalc.glade Sat Jun 15 08:21:33 2013 +0000 @@ -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>
--- a/light9/curvecalc/curveview.py Sat Jun 15 08:21:16 2013 +0000 +++ b/light9/curvecalc/curveview.py Sat Jun 15 08:21:33 2013 +0000 @@ -1048,6 +1048,9 @@ 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 @@ 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 @@ 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"""
--- a/light9/curvecalc/musicaccess.py Sat Jun 15 08:21:16 2013 +0000 +++ b/light9/curvecalc/musicaccess.py Sat Jun 15 08:21:33 2013 +0000 @@ -62,7 +62,10 @@ 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):