Exemplo n.º 1
0
    def populate(self, albums=[]):
        """
            Populate view for album ids
            Show artist_ids/genre_ids if empty
            @param albums as [Album]
        """
        def on_load(albums):
            if albums:
                FlowBoxView.populate(self, albums)
                self.show_placeholder(False)
            else:
                self.show_placeholder(True)

        def load():
            # No skipped albums for this views
            if self._genre_ids and self._genre_ids[0] in [
                    Type.POPULARS, Type.LITTLE, Type.RANDOMS, Type.RECENTS
            ]:
                skipped = False
            else:
                skipped = True
            album_ids = get_album_ids_for(self._genre_ids, self._artist_ids,
                                          self.storage_type, skipped)
            albums = []
            for album_id in album_ids:
                album = Album(album_id, self._genre_ids, self._artist_ids,
                              True)
                album.set_storage_type(self.storage_type)
                albums.append(album)
            return albums

        if albums:
            FlowBoxView.populate(self, albums)
        elif self.__populate_wanted:
            App().task_helper.run(load, callback=(on_load, ))
Exemplo n.º 2
0
 def populate(self, radio_ids):
     """
         Add radio widgets
         @param radio_ids as [int]
     """
     if radio_ids:
         FlowBoxView.populate(self, radio_ids)
     else:
         self._scrolled.hide()
         view = MessageView(_("No favorite radios"))
         view.show()
         self.add(view)
 def populate(self, items):
     """
         Populate items
         @param items
     """
     if self.__obj is not None:
         new_items = []
         for item in items:
             if not App().playlists.get_smart(item):
                 new_items.append(item)
         items = new_items
     else:
         items = [i[0] for i in ShownPlaylists.get()] + items
     FlowBoxView.populate(self, items)
Exemplo n.º 4
0
 def populate(self, items=None):
     """
         Populate items
         @param items
     """
     if self.__obj is not None:
         new_items = []
         for item in App().playlists.get_ids():
             if not App().playlists.get_smart(item):
                 new_items.append(item)
         items = new_items
     elif items is None:
         items = [i[0] for i in ShownPlaylists.get()]
         items += App().playlists.get_ids()
     FlowBoxView.populate(self, items)
Exemplo n.º 5
0
    def populate(self, artist_ids=[]):
        """
            Populate view with artist id
            Show all artists if empty
            @param artist_ids as [int]
        """
        def on_load(artist_ids):
            FlowBoxView.populate(self, artist_ids)

        def load():
            return App().artists.get([], self.storage_type)

        if artist_ids:
            FlowBoxView.populate(self, artist_ids)
        else:
            App().task_helper.run(load, callback=(on_load,))
Exemplo n.º 6
0
 def on_load(items):
     FlowBoxView.populate(self, items)
Exemplo n.º 7
0
 def on_load(artist_ids):
     FlowBoxView.populate(self, artist_ids)
Exemplo n.º 8
0
 def populate(self, radio_ids):
     """
         Add radio widgets
         @param radio_ids as [int]
     """
     FlowBoxView.populate(self, radio_ids)
Exemplo n.º 9
0
 def on_load(albums):
     if albums:
         FlowBoxView.populate(self, albums)
         self.show_placeholder(False)
     else:
         self.show_placeholder(True)