Use __ to prefix internal methods
[mussorgsky] / src / download_dialog.py
index 469272a..eb03119 100644 (file)
@@ -1,6 +1,7 @@
 #!/usr/bin/env python2.5
 import gtk, gobject
 from album_art import MussorgskyAlbumArt
+from utils import escape_html
 
 class MussorgskyAlbumArtDownloadDialog (gtk.Dialog):
 
@@ -13,10 +14,10 @@ class MussorgskyAlbumArtDownloadDialog (gtk.Dialog):
         self.downloader = MussorgskyAlbumArt ()
         self.set_title ("Downloading album art")
         self.connect ("response", self.handle_response)
-        self.create_view ()
+        self.__create_view ()
         self.cancel = False
 
-    def create_view (self):
+    def __create_view (self):
 
         hbox = gtk.HBox (homogeneous=False)
 
@@ -58,16 +59,19 @@ class MussorgskyAlbumArtDownloadDialog (gtk.Dialog):
             try:
                 (image, thumb) = self.downloader.get_album_art (artist, album)
                 if thumb:
-                    pixbuf = gtk.gdk.pixbuf_new_from_file_at_size (thumb, 124, 124)
-                    artist_albums_model.set_value (it, 1, pixbuf)
-            except LookupError, e:
+                        pixbuf = gtk.gdk.pixbuf_new_from_file_at_size (thumb, 124, 124)
+                        artist_albums_model.set_value (it, 1, pixbuf)
+            except Exception, e:
                 print "Error processing %s - %s" % (artist, album)
                 print str(e)
                 self.album_art.set_from_stock (gtk.STOCK_CDROM, gtk.ICON_SIZE_DIALOG)
+                current += 1
+                it = artist_albums_model.iter_next (it)
                 continue
 
-            self.status_label.set_text ("Retrieved (%d/%d)" % (current, TOTAL))
-            self.current_label.set_markup ("<b>%s - %s</b>" % (artist, album))
+            #self.status_label.set_text ("Retrieved (%d/%d)" % (current, TOTAL))
+            self.set_title ("Downloading album art (%d/%d)" % (current, TOTAL))
+            self.current_label.set_markup ("<b>%s - %s</b>" % (escape_html(artist), escape_html(album)))
               
             if (thumb):
                 self.album_art.set_from_file (thumb)
@@ -86,12 +90,6 @@ class MussorgskyAlbumArtDownloadDialog (gtk.Dialog):
 
 if __name__ == "__main__":
 
-    PAIRS_NO = [("Led Zeppelin", "Led Zeppelin IV"),
-             ("Pink Floyd", "The Wall"),
-             ("Deep purple", "Made in Japan"),
-             ("", "Freakin' out"),
-             ("Dinah Washington", "")]
-
     PAIRS_store = gtk.ListStore (str, gtk.gdk.Pixbuf, str, str)
     for i in range (0, 100):
         PAIRS_store.append (("blablabal", None, "Artist %d" % i, "Album %d" %i))