Mercurial > code > home > repos > light9
comparison bin/curvecalc @ 1276:e4aafd2242aa
CC try to debug why it jumps to random songs sometimes.
Ignore-this: 6fe1bf762a0c34ca07e6966546d986e6
author | Drew Perttula <drewp@bigasterisk.com> |
---|---|
date | Sun, 14 Jun 2015 15:44:03 +0000 |
parents | b8e2b8acb02c |
children | 349712ddb02d |
comparison
equal
deleted
inserted
replaced
1275:b8e2b8acb02c | 1276:e4aafd2242aa |
---|---|
75 | 75 |
76 songChoice = Observable(None) # to be connected with the session song | 76 songChoice = Observable(None) # to be connected with the session song |
77 | 77 |
78 self.registerGraphToSongChoice(wtree, session, graph, songChoice) | 78 self.registerGraphToSongChoice(wtree, session, graph, songChoice) |
79 self.registerSongChoiceToGraph(session, graph, songChoice) | 79 self.registerSongChoiceToGraph(session, graph, songChoice) |
80 self.current_player_song = self.registerCurrentPlayerSongToUi(wtree, graph, songChoice) | 80 self.registerCurrentPlayerSongToUi(wtree, graph, songChoice) |
81 | 81 |
82 ec = EditChoice(graph, songChoice, label="Editing song:") | 82 ec = EditChoice(graph, songChoice, label="Editing song:") |
83 wtree.get_object("currentSongEditChoice").add(ec) | 83 wtree.get_object("currentSongEditChoice").add(ec) |
84 ec.show() | 84 ec.show() |
85 | 85 |
101 songChoice(current) | 101 songChoice(current) |
102 dispatcher.send("song_has_changed") | 102 dispatcher.send("song_has_changed") |
103 graph.addHandler(setSong) | 103 graph.addHandler(setSong) |
104 | 104 |
105 def registerSongChoiceToGraph(self, session, graph, songChoice): | 105 def registerSongChoiceToGraph(self, session, graph, songChoice): |
106 def songToGraph(newSong): | 106 self.muteSongChoiceUntil = 0 |
107 def songChoiceToGraph(newSong): | |
107 if newSong is Local: | 108 if newSong is Local: |
108 raise NotImplementedError('what do i patch') | 109 raise NotImplementedError('what do i patch') |
109 log.debug('songToGraph is going to set to %r', newSong) | 110 log.debug('songChoiceToGraph is going to set to %r', newSong) |
110 import traceback; traceback.print_stack() | 111 import traceback; traceback.print_stack() |
112 | |
113 # I get bogus newSong values in here sometimes. This | |
114 # workaround may not even be helping. | |
115 now = time.time() | |
116 if now < self.muteSongChoiceUntil: | |
117 log.debug('muted') | |
118 return | |
119 self.muteSongChoiceUntil = now + 1 | |
120 | |
111 graph.patchObject(context=session, subject=session, | 121 graph.patchObject(context=session, subject=session, |
112 predicate=L9['currentSong'], newObject=newSong) | 122 predicate=L9['currentSong'], newObject=newSong) |
113 songChoice.subscribe(songToGraph) | 123 |
124 | |
125 | |
126 songChoice.subscribe(songChoiceToGraph) | |
114 | 127 |
115 def registerCurrentPlayerSongToUi(self, wtree, graph, songChoice): | 128 def registerCurrentPlayerSongToUi(self, wtree, graph, songChoice): |
116 """current_player_song 'song' param -> playerSong ui | 129 """current_player_song 'song' param -> playerSong ui |
117 and | 130 and |
118 current_player_song 'song' param -> songChoice, if you're in autofollow | 131 current_player_song 'song' param -> songChoice, if you're in autofollow |
125 def setLabel(): | 138 def setLabel(): |
126 ps.set_label(graph.label(song)) | 139 ps.set_label(graph.label(song)) |
127 graph.addHandler(setLabel) | 140 graph.addHandler(setLabel) |
128 ps.set_uri(song) | 141 ps.set_uri(song) |
129 if song != songChoice(): | 142 if song != songChoice(): |
130 log.debug('song %s != songChoice %s', song, songChoice()) | |
131 if wtree.get_object("followPlayerSongChoice").get_active(): | 143 if wtree.get_object("followPlayerSongChoice").get_active(): |
132 log.debug('followPlayerSongChoice is on') | 144 log.debug('followPlayerSongChoice is on') |
133 songChoice(song) | 145 songChoice(song) |
134 | 146 |
135 dispatcher.connect(current_player_song, "current_player_song") | 147 dispatcher.connect(current_player_song, "current_player_song") |
136 return current_player_song | 148 self.current_player_song = current_player_song |
137 | 149 |
138 def setupNewSubZone(self): | 150 def setupNewSubZone(self): |
139 self.wtree.get_object("newSubZone").drag_dest_set( | 151 self.wtree.get_object("newSubZone").drag_dest_set( |
140 flags=Gtk.DestDefaults.ALL, | 152 flags=Gtk.DestDefaults.ALL, |
141 targets=[Gtk.TargetEntry('text/uri-list', 0, 0)], | 153 targets=[Gtk.TargetEntry('text/uri-list', 0, 0)], |