Пример #1
0
 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)
Пример #2
0
 def populate(self):
     """
         Populate widget content
     """
     self.__album_ids = self._get_album_ids()
     shuffle(self.__album_ids)
     RoundedFlowBoxWidget.populate(self)
     self._artwork.get_style_context().add_class("light-background")
Пример #3
0
 def set_view_type(self, view_type):
     """
         Update artwork size
         @param view_type as ViewType
     """
     RoundedFlowBoxWidget.set_view_type(self, view_type)
     self.__cover_size = self._art_size / 2
     self._pixel_size = self._art_size / 8
 def set_view_type(self, view_type):
     """
         Update view type
         @param view_type as ViewType
     """
     RoundedFlowBoxWidget.set_view_type(self, view_type)
     self.set_size_request(self._art_size,
                           self._art_size + self.__font_height)
 def __init__(self, item, view_type, font_height):
     """
         Init widget
         @param item as (int, str, str)
         @param view_type as ViewType
         @param font_height as int
     """
     self.__font_height = font_height
     RoundedFlowBoxWidget.__init__(self, item[0], item[1],
                                   item[1], view_type)
Пример #6
0
 def __init__(self, item, art_size):
     """
         Init widget
         @param item as (int, str, str)
         @param art_size as int
     """
     RoundedFlowBoxWidget.__init__(self, item[0], item[1],
                                   item[1], art_size)
     self.connect("realize", self.__on_realize)
     self.connect("destroy", self.__on_destroy)
Пример #7
0
 def populate(self):
     """
         Populate widget content
     """
     if self._artwork is None:
         RoundedFlowBoxWidget.populate(self)
         self._artwork.get_style_context().add_class("circle-icon-large")
         self.connect("destroy", self.__on_destroy)
     else:
         self.set_artwork()
Пример #8
0
 def __init__(self, data, name, sortname, art_size=ArtSize.ROUNDED):
     """
         Init widget
         @param data as object
         @param name as str
         @param sortname as str
         @param art_size as int
     """
     RoundedFlowBoxWidget.__init__(self, data, name, sortname, art_size)
     self.__cover_size = art_size / 3
     self.__cancellable = Gio.Cancellable()
     self.connect("unmap", self.__on_unmap)
Пример #9
0
 def __init__(self, data, name, sortname, view_type):
     """
         Init widget
         @param data as object
         @param name as str
         @param sortname as str
         @param art_size as int
     """
     RoundedFlowBoxWidget.__init__(self, data, name, sortname, view_type)
     self._genre = Type.NONE
     self.__album_ids = []
     self.__cancellable = Gio.Cancellable()
     self._scale_factor = self.get_scale_factor()
     self.connect("unmap", self.__on_unmap)
 def populate(self):
     """
         Populate widget content
     """
     if self._artwork is None:
         RoundedFlowBoxWidget.populate(self)
         self.connect("destroy", self.__on_destroy)
         self.connect("button-release-event",
                      self.__on_button_release_event)
         self.__gesture = Gtk.GestureLongPress.new(self)
         self.__gesture.connect("pressed", self.__on_gesture_pressed)
         # We want to get release event after gesture
         self.__gesture.set_propagation_phase(Gtk.PropagationPhase.CAPTURE)
         self.__gesture.set_button(0)
     else:
         self.set_artwork()
Пример #11
0
 def __init__(self, item, view_type, font_height):
     """
         Init widget
         @param item as (int, str, str)
         @param view_type as ViewType
         @param font_height as int
     """
     # Get values from DB
     if isinstance(item, int):
         artist_id = item
         artist_name = artist_sortname = App().artists.get_name(artist_id)
     else:
         artist_id = item[0]
         artist_name = item[1]
         artist_sortname = item[2]
     RoundedFlowBoxWidget.__init__(self, artist_id, artist_name,
                                   artist_sortname, view_type, font_height)
Пример #12
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()
Пример #14
0
 def populate(self):
     """
         Populate widget content
     """
     RoundedFlowBoxWidget.populate(self)
     self._artwork.get_style_context().add_class("rounded-icon-large")
Пример #15
0
 def set_artwork(self):
     """
         Set artwork
     """
     RoundedFlowBoxWidget.set_artwork(self)
     App().task_helper.run(self._create_surface)
Пример #16
0
 def populate(self):
     """
         Populate widget content
     """
     RoundedFlowBoxWidget.populate(self)
     self.connect("button-press-event", self.__on_button_press_event)
Пример #17
0
 def populate(self):
     """
         Populate widget content
     """
     RoundedFlowBoxWidget.populate(self)
     self._artwork.get_style_context().add_class("light-background")