# HG changeset patch
# User drewp@bigasterisk.com
# Date 1371284493 0
# Node ID ced2c5e5fb31b7a2a341be3226c0c505d4e82e26
# Parent 56218ce0fd378fac3ccfd178f08a8e9f04fbe6b0
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
diff -r 56218ce0fd37 -r ced2c5e5fb31 bin/curvecalc
--- 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)
diff -r 56218ce0fd37 -r ced2c5e5fb31 light9/curvecalc/curve.py
--- 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']:
diff -r 56218ce0fd37 -r ced2c5e5fb31 light9/curvecalc/curvecalc.glade
--- 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 @@
+
+
+ False
+ False
+ 1
+
+
+
+
+
+ False
+ False
+ 2
+
+
+
+
+
+ False
+ False
+ 15
+ 3
+
+
+
diff -r 56218ce0fd37 -r ced2c5e5fb31 light9/curvecalc/curveview.py
--- 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"""
diff -r 56218ce0fd37 -r ced2c5e5fb31 light9/curvecalc/musicaccess.py
--- 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):