def _on_playlist_activated(self, sidebar, row, data=None): """Update view with content from selected playlist""" playlist = row.playlist playlist_name = utils.get_media_title(playlist) if self.rename_active: self._pl_ctrls.disable_rename_playlist() self._current_playlist = playlist self._pl_ctrls.props.playlist_name = playlist_name self._current_playlist_index = row.get_index() # if the active queue has been set by this playlist, # use it as model, otherwise build the liststore self._view.set_model(None) self.model.clear() self._iter_to_clean = None self._iter_to_clean_model = None self._update_songs_count(0) self._pl_ctrls.props.display_songs_count = False grilo.populate_playlist_songs(playlist, self._add_song) protected_pl = playlists.is_smart_playlist(self._current_playlist) self._playlist_delete_action.set_enabled(not protected_pl) self._playlist_rename_action.set_enabled(not protected_pl) self._remove_song_action.set_enabled(not protected_pl) self._view.set_reorderable(not protected_pl)
def _on_playlist_activated(self, widget, item_id, path): _iter = self._playlists_model.get_iter(path) playlist_name = self._playlists_model[_iter][2] playlist = self._playlists_model[_iter][5] if self.rename_active: self.disable_rename_playlist() self.current_playlist = playlist self._name_label.set_text(playlist_name) self._current_playlist_index = int(path.to_string()) # if the active queue has been set by this playlist, # use it as model, otherwise build the liststore self._view.set_model(None) self.model.clear() self._songs_count = 0 grilo.populate_playlist_songs(playlist, self._add_item) if self._current_playlist_is_protected(): self._playlist_delete_action.set_enabled(False) self._playlist_rename_action.set_enabled(False) else: self._playlist_delete_action.set_enabled(True) self._playlist_rename_action.set_enabled(True)
def _on_playlist_activated(self, sidebar, row, data=None): """Update view with content from selected playlist""" playlist = row.playlist playlist_name = utils.get_media_title(playlist) if self.rename_active: self.disable_rename_playlist() self._current_playlist = playlist self._name_label.set_text(playlist_name) self._current_playlist_index = row.get_index() # if the active queue has been set by this playlist, # use it as model, otherwise build the liststore self._view.set_model(None) self.model.clear() self._iter_to_clean = None self._iter_to_clean_model = None self._songs_count = 0 grilo.populate_playlist_songs(playlist, self._add_song) if self._current_playlist_is_protected(): self._playlist_delete_action.set_enabled(False) self._playlist_rename_action.set_enabled(False) self._remove_song_action.set_enabled(False) self._view.set_reorderable(False) else: self._playlist_delete_action.set_enabled(True) self._playlist_rename_action.set_enabled(True) self._remove_song_action.set_enabled(True) self._view.set_reorderable(True)
def _on_playlist_activated(self, widget, item_id, path): _iter = self.playlists_model.get_iter(path) playlist_name = self.playlists_model.get_value(_iter, 2) playlist = self.playlists_model.get_value(_iter, 5) self.current_playlist = playlist self.name_label.set_text(playlist_name) self.current_playlist_index = int(path.to_string()) # if the active queue has been set by this playlist, # use it as model, otherwise build the liststore self.view.set_model(None) self.model.clear() self.songs_count = 0 grilo.populate_playlist_songs(playlist, self._add_item) # disable delete button if current playlist is a smart playlist if self.current_playlist_is_protected(): self.playlistDeleteAction.set_enabled(False) else: self.playlistDeleteAction.set_enabled(True)