def show_playlist_manager(self, object_id, genre_id, is_album): view = PlaylistsManageView(object_id, genre_id, is_album, self._stack.get_allocated_width()/2) view.show() self._stack.add(view) self._stack.set_visible_child(view) start_new_thread(view.populate, ())
def show_playlist_manager(self, object_id, genre_id, is_album): """ Show playlist manager for object_id Current view stay present in ViewContainer @param object id as int @param genre id as int @param is_album as bool """ view = PlaylistsManageView(object_id, genre_id, is_album) view.populate() view.show() self._stack.add(view) self._stack.set_visible_child(view)
def _update_view_playlists(self, playlist_ids=[]): """ Update current view with playlist view @param playlist ids as [int] """ def load(): track_ids = [] for playlist_id in playlist_ids: if playlist_id == Type.POPULARS: tracks = Lp().tracks.get_populars() elif playlist_id == Type.RECENTS: tracks = Lp().tracks.get_recently_listened_to() elif playlist_id == Type.NEVER: tracks = Lp().tracks.get_never_listened_to() elif playlist_id == Type.RANDOMS: tracks = Lp().tracks.get_randoms() else: tracks = Lp().playlists.get_tracks_ids(playlist_id) for track_id in tracks: if track_id not in track_ids: track_ids.append(track_id) return track_ids view = None if playlist_ids: view = PlaylistsView(playlist_ids) loader = Loader(target=load, view=view) loader.start() else: view = PlaylistsManageView(Type.NONE, [], [], False) view.populate() view.show() self._stack.add(view) self._stack.set_visible_child(view) self._stack.clean_old_views(view)
def show_playlist_manager(self, object_id, genre_ids, artist_ids, is_album): """ Show playlist manager for object_id Current view stay present in ViewContainer @param object id as int @param genre ids as [int] @param artist ids as [int] @param is_album as bool """ from lollypop.view_playlists import PlaylistsManageView current = self.__stack.get_visible_child() view = PlaylistsManageView(object_id, genre_ids, artist_ids, is_album) view.populate() view.show() self.__stack.add(view) self.__stack.set_visible_child(view) current.disable_overlay()
def _update_view_playlists(self, playlist_id): """ Update current view with playlist view @param playlist id as int """ def load(): sql = Lp.db.get_cursor() if playlist_id == Lp.player.get_user_playlist_id(): tracks = [t.id for t in Lp.player.get_user_playlist()] elif playlist_id == Type.POPULARS: tracks = Lp.tracks.get_populars(sql) elif playlist_id == Type.RECENTS: tracks = Lp.tracks.get_recently_listened_to(sql) elif playlist_id == Type.NEVER: tracks = Lp.tracks.get_never_listened_to(sql) elif playlist_id == Type.RANDOMS: tracks = Lp.tracks.get_randoms(sql) sql.close() return tracks view = None if playlist_id is not None: name = self._list_two.get_value(playlist_id) view = PlaylistView(playlist_id, name, self._stack) else: view = PlaylistsManageView(-1, None, False, self._stack.get_allocated_width()/2) if view: # Management or user playlist if playlist_id is None or playlist_id >= 0 or\ playlist_id == Type.LOVED: view.populate() else: loader = Loader(target=load, view=view) loader.start() view.show() self._stack.add(view) self._stack.set_visible_child(view) self._stack.clean_old_views(view)
def show_playlist_manager(self, object_id, genre_ids, artist_ids, is_album): """ Show playlist manager for object_id Current view stay present in ViewContainer @param object id as int @param genre ids as [int] @param artist ids as [int] @param is_album as bool """ current = self.__stack.get_visible_child() view = PlaylistsManageView(object_id, genre_ids, artist_ids, is_album) view.populate() view.show() self.__stack.add(view) self.__stack.set_visible_child(view) current.disable_overlays()
def _update_view_playlists(self, playlist_id): """ Update current view with playlist view @param playlist id as int """ def load(): if playlist_id == Lp().player.get_user_playlist_id(): tracks = [t.id for t in Lp().player.get_user_playlist()] elif playlist_id == Type.POPULARS: tracks = Lp().tracks.get_populars() elif playlist_id == Type.RECENTS: tracks = Lp().tracks.get_recently_listened_to() elif playlist_id == Type.NEVER: tracks = Lp().tracks.get_never_listened_to() elif playlist_id == Type.RANDOMS: tracks = Lp().tracks.get_randoms() else: tracks = Lp().playlists.get_tracks_ids(playlist_id) return tracks view = None if playlist_id is not None: view = PlaylistView(playlist_id) else: view = PlaylistsManageView(Type.NONE, None, False) if view: # Management or user playlist if playlist_id is None: view.populate() else: loader = Loader(target=load, view=view) loader.start() view.show() self._stack.add(view) self._stack.set_visible_child(view) self._stack.clean_old_views(view)