import gtk, gobject
from album_art_spec import getCoverArtThumbFileName
from download_dialog import MussorgskyAlbumArtDownloadDialog
+from album_art import MussorgskyAlbumArt
from utils import escape_html
+from aa_selection_dialog import AlbumArtSelectionDialog
class MussorgskyAlbumArtPanel (hildon.StackableWindow):
self.set_title ("Album art handling")
self.set_border_width (12)
self.__create_view ()
+ self.downloader = None
self.model = gtk.ListStore (str, gtk.gdk.Pixbuf, str, str)
for p in album_artists:
dialog.do_the_job (self.model)
def row_activated_cb (self, treeview, path, view_colum):
- print "Get alternatives for..."
it = treeview.get_model ().get_iter (path)
album = treeview.get_model ().get_value (it, 3)
artist = treeview.get_model ().get_value (it, 2)
+ if (not self.downloader):
+ self.downloader = MussorgskyAlbumArt ()
+
+ dialog = AlbumArtSelectionDialog (self, 4)
+ dialog.show_all ()
-
-
+ paths = self.downloader.get_alternatives (album, artist, 4)
+ dialog.populate (paths)
+
+ response = dialog.run ()
+ if (response > -1):
+ assert response < len (paths)
+ (img, thumb) = self.downloader.save_alternative (artist, album, paths[response])
+ pixbuf = gtk.gdk.pixbuf_new_from_file_at_size (thumb, 64, 64)
+ treeview.get_model ().set (it, 1, pixbuf)
+ dialog.destroy ()
+
if __name__ == "__main__":
artists_albums = [("Artist %d the greatest bolero singer in the universe" % i, "Album <%d>" % i) for i in range (0, 100)]