diff options
-rw-r--r-- | controls.py | 1 | ||||
-rw-r--r-- | playlist.py | 14 |
2 files changed, 15 insertions, 0 deletions
diff --git a/controls.py b/controls.py index 4655144..011406d 100644 --- a/controls.py +++ b/controls.py @@ -212,6 +212,7 @@ class Controls(GObject.GObject): self.activity.player.pause() self.set_button_play() GObject.source_remove(self._scale_update_id) + self._scale_update_id = -1 else: if self.activity.player.error: self.set_disabled() diff --git a/playlist.py b/playlist.py index 123effb..26e8f75 100644 --- a/playlist.py +++ b/playlist.py @@ -79,8 +79,22 @@ class PlayList(Gtk.ScrolledWindow): self.listview.set_enable_search(False) self.listview.connect('row-activated', self.__on_row_activated) + self.listview.connect('cursor-changed', self.__on_cursor_changed) + self.add(self.listview) + def __on_cursor_changed(self, treeview): + selection = self.listview.get_selection() + sel_model, sel_rows = self.listview.get_selection().get_selected_rows() + for row in sel_rows: + index = sel_model.get_value(sel_model.get_iter(row), 0) + if index != self._current_playing: + path = self._items[index]['path'] + available = self._items[index]['available'] + if available: + self.set_current_playing(index) + self.emit('play-index', index, path) + def __on_row_activated(self, treeview, path, col): model = treeview.get_model() |