def _set_artwork(self):
     """
         Set artist artwork
     """
     if self._artwork is None:
         return
     RoundedFlowBoxWidget.set_artwork(self)
     if App().settings.get_value("artist-artwork"):
         App().art_helper.set_artist_artwork(
                                         self.name,
                                         self._art_size,
                                         self._art_size,
                                         self._artwork.get_scale_factor(),
                                         ArtBehaviour.ROUNDED |
                                         ArtBehaviour.CROP_SQUARE |
                                         ArtBehaviour.CACHE,
                                         self.__on_artist_artwork)
     else:
         album_ids = App().albums.get_ids([], [self._data],
                                          StorageType.ALL, True)
         if album_ids:
             shuffle(album_ids)
             App().art_helper.set_album_artwork(
                                         Album(album_ids[0]),
                                         self._art_size,
                                         self._art_size,
                                         self._artwork.get_scale_factor(),
                                         ArtBehaviour.ROUNDED |
                                         ArtBehaviour.CROP_SQUARE |
                                         ArtBehaviour.CACHE,
                                         self.__on_artist_artwork)
         else:
             self.__on_artist_artwork(None)
Example #2
0
 def set_artwork(self):
     """
         Set artwork
     """
     RoundedFlowBoxWidget.set_artwork(self)
     if App().art.artwork_exists_in_cache(self.artwork_name, "ROUNDED",
                                          self._art_size, self._art_size):
         App().task_helper.run(App().art.get_artwork_from_cache,
                               self.artwork_name,
                               "ROUNDED",
                               self._art_size,
                               self._art_size,
                               callback=(self.__on_load_from_cache, ))
     else:
         self.__album_ids = self._get_album_ids()
         shuffle(self.__album_ids)
         App().task_helper.run(self._create_surface, True)
    def _set_artwork(self):
        """
            Set artist artwork
        """
        def set_icon_name():
            icon_name = get_icon_name(self._data) or "avatar-default-symbolic"
            self._artwork.set_from_icon_name(icon_name, Gtk.IconSize.DIALOG)
            self.emit("populated")
            self._artwork.get_style_context().add_class("artwork-icon-large")

        if self._artwork is None:
            return
        RoundedFlowBoxWidget.set_artwork(self)
        if self._data < 0:
            set_icon_name()
        elif App().settings.get_value("artist-artwork"):
            App().art_helper.set_artist_artwork(
                                            self.name,
                                            self._art_size,
                                            self._art_size,
                                            self._artwork.get_scale_factor(),
                                            ArtBehaviour.ROUNDED |
                                            ArtBehaviour.CROP_SQUARE |
                                            ArtBehaviour.CACHE,
                                            self.__on_artist_artwork)
        else:
            album_ids = App().albums.get_ids([self._data], [])
            if album_ids:
                shuffle(album_ids)
                App().art_helper.set_album_artwork(
                                            Album(album_ids[0]),
                                            self._art_size,
                                            self._art_size,
                                            self._artwork.get_scale_factor(),
                                            ArtBehaviour.ROUNDED |
                                            ArtBehaviour.CROP_SQUARE |
                                            ArtBehaviour.CACHE,
                                            self.__on_artist_artwork)
            else:
                set_icon_name()
Example #4
0
 def set_artwork(self):
     """
         Set artwork
     """
     RoundedFlowBoxWidget.set_artwork(self)
     App().task_helper.run(self._create_surface)