projects
/
mussorgsky
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
43f8a56
)
Use the album art selection dialog
author
Ivan Frade
<ivan.frade@gmail.com>
Fri, 21 Aug 2009 15:01:08 +0000
(18:01 +0300)
committer
Ivan Frade
<ivan.frade@gmail.com>
Fri, 21 Aug 2009 15:01:08 +0000
(18:01 +0300)
src/album_art_panel.py
patch
|
blob
|
history
diff --git
a/src/album_art_panel.py
b/src/album_art_panel.py
index
26ff92f
..
6788d19
100644
(file)
--- a/
src/album_art_panel.py
+++ b/
src/album_art_panel.py
@@
-3,7
+3,9
@@
import hildon
import gtk, gobject
from album_art_spec import getCoverArtThumbFileName
from download_dialog import MussorgskyAlbumArtDownloadDialog
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 utils import escape_html
+from aa_selection_dialog import AlbumArtSelectionDialog
class MussorgskyAlbumArtPanel (hildon.StackableWindow):
class MussorgskyAlbumArtPanel (hildon.StackableWindow):
@@
-12,6
+14,7
@@
class MussorgskyAlbumArtPanel (hildon.StackableWindow):
self.set_title ("Album art handling")
self.set_border_width (12)
self.__create_view ()
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:
self.model = gtk.ListStore (str, gtk.gdk.Pixbuf, str, str)
for p in album_artists:
@@
-62,13
+65,26
@@
class MussorgskyAlbumArtPanel (hildon.StackableWindow):
dialog.do_the_job (self.model)
def row_activated_cb (self, treeview, path, view_colum):
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)
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)]
if __name__ == "__main__":
artists_albums = [("Artist %d the greatest bolero singer in the universe" % i, "Album <%d>" % i) for i in range (0, 100)]