示例#1
0
class ArtworkPopover(CommonPopover):
    """
        Popover with artist-artwork from the web
    """
    def __init__(self, artist_id):
        """
            Init Popover
            @param album as album
        """
        CommonPopover.__init__(self)
        self._widget = ArtworkSearchWidget(artist_id, None)
        self._widget.show()
        self.add(self._widget)
        self._widget.populate()
示例#2
0
class CoversPopover(CommonPopover):
    """
        Popover with album covers from the web
    """
    def __init__(self, album):
        """
            Init Popover
            @param album as album
        """
        CommonPopover.__init__(self)
        if not album.artist_ids:
            self._widget = None
            return
        # FIXME We only search with first artist
        self._widget = ArtworkSearchWidget(album.artist_ids[0], album)
        self._widget.show()
        self.add(self._widget)
        self._widget.populate()
示例#3
0
 def populate(self):
     """
         Populate view
     """
     try:
         ArtworkSearchWidget.populate(self)
         # First load local files
         uris = App().art.get_album_artworks(self.__album)
         # Direct load, not using loopback because not many items
         for uri in uris:
             child = ArtworkSearchChild(_("Local"))
             child.show()
             f = Gio.File.new_for_uri(uri)
             (status, content, tag) = f.load_contents()
             if status:
                 status = child.populate(content)
             if status:
                 self._flowbox.add(child)
     except Exception as e:
         Logger.error("AlbumArtworkSearchWidget::populate(): %s", e)