possible disappearing widget fix
[comic-widget] / src / usr / lib / hildon-desktop / comicwidget.py
index 4cc5e43..df1d35f 100644 (file)
@@ -138,7 +138,6 @@ comics = {
                "wulff":{"name":"Wulffmorgenthaler","link":"http://wulffmorgenthaler.com/","start":"edd3411b-96ca-4d93-bd5f-0cf1deb67c8a","dbfile":dbdir + "comicdb.wulff.csv"},
                "xkcd":{"name":"xkcd","link":"http://xkcd.org/","start":666,"dbfile":dbdir + "comicdb.xkcd.csv"},
                "zack_hillcomicscom":{"name":"Zack Hill","link":'http://comics.com/zack_hill/',"start":"2010-02-01","dbfile":dbdir + "comicdb.zackhill.csv"},
-
                "amazing_spidermanckdm":{"name":"The Amazing Spider-Man","link":'http://content.comicskingdom.net/Spiderman/',"start":"20100209","dbfile":dbdir + "comicdb.spiderman.csv"},
                "apartment_3-gckdm":{"name":"Apartment 3-G","link":'http://content.comicskingdom.net/Apartment_3-G/',"start":"20100209","dbfile":dbdir + "comicdb.partment3g.csv"},
                "arcticckdm":{"name":"Arctic Circle","link":'http://content.comicskingdom.net/Arctic/',"start":"20100209","dbfile":dbdir + "comicdb.arctic.csv"},
@@ -1135,7 +1134,7 @@ class ComicHomePlugin(hildondesktop.HomePluginItem):
 
        # **************** Cairo draw functions ***************
 
-       def realize(self, widget):
+       def do_realize(self):
                global supports_alpha
 
                # To check if the display supports alpha channels, get the colormap
@@ -1152,7 +1151,6 @@ class ComicHomePlugin(hildondesktop.HomePluginItem):
                # Now we have a colormap appropriate for the screen, use it
                self.set_colormap(colormap)
                hildondesktop.HomePluginItem.do_realize(self)
-               return False
 
        def do_expose_event(widget, event):
                cr = widget.window.cairo_create()
@@ -1172,7 +1170,7 @@ class ComicHomePlugin(hildondesktop.HomePluginItem):
                        cr.set_source_rgb (0.0, 0.0, 0.0)
                        
                cr.fill_preserve()
-               return False
+               hildondesktop.HomePluginItem.do_expose_event(widget,event)
 
        # Function that draws a button preloaded in the images dictionary.
        def draw(self, target, postfix):
@@ -1240,7 +1238,7 @@ class ComicHomePlugin(hildondesktop.HomePluginItem):
 
                        elif func == 'switch':
                                # Check if store needed..
-                               if not self.db.currentcomic == 0 and not self.db.currentcomic == (len(self.db.db) - 1):
+                               if not self.db.currentcomic == 0:
                                        print "Storing location " + str(self.db.currentcomic)
                                        if self.db.store_last():
                                                print "stored successfully"
@@ -1318,12 +1316,14 @@ class ComicHomePlugin(hildondesktop.HomePluginItem):
                scaled_buf = pixbuf.scale_simple(new_width,new_height,gtk.gdk.INTERP_BILINEAR)
                print "scaled height: " + str(scaled_buf.get_height())
                if scaled_buf.get_height() > maxheight:
+                       self.scrollable = True
                        if scaled_buf.get_height() - (vpos + maxheight) < 0:
                                vpos = scaled_buf.get_height() - maxheight
                        scaled_buf.copy_area(0,vpos,picwidth,maxheight,parent_buf,1,0)
                        # parent_buf.composite(scaled_buf, 0, 0, 478, maxheight, 0, 0, 478, maxheight, gtk.gdk.INTERP_BILINEAR, 0)
                        self.imgvpos = vpos
                else:
+                       self.scrollable = False
                        tmpy = maxheight - scaled_buf.get_height()
                        if tmpy > 0:
                                tmpy = tmpy / 2
@@ -1436,17 +1436,17 @@ class ComicHomePlugin(hildondesktop.HomePluginItem):
                comics_button.connect("clicked", self.show_comics)
 
                navfirst_button = hildon.Button(gtk.HILDON_SIZE_AUTO_WIDTH | gtk.HILDON_SIZE_FINGER_HEIGHT, hildon.BUTTON_ARRANGEMENT_VERTICAL)
-               navfirst_button.set_text("Go to earliest", "Jump to the earliest cached comic")
+               navfirst_button.set_text("Go to earliest", "Jump to the oldest cached comic")
                navfirst_button.set_alignment(0,0,0,0)
                navfirst_button.connect("clicked", self.show_nav, "oldest")
 
                navlast_button = hildon.Button(gtk.HILDON_SIZE_AUTO_WIDTH | gtk.HILDON_SIZE_FINGER_HEIGHT, hildon.BUTTON_ARRANGEMENT_VERTICAL)
-               navlast_button.set_text("Go to latest", "Jump to the latest cached comic")
+               navlast_button.set_text("Go to latest", "Jump to the newest cached comic")
                navlast_button.set_alignment(0,0,0,0)
                navlast_button.connect("clicked", self.show_nav, "newest")
 
                navstored_button = hildon.Button(gtk.HILDON_SIZE_AUTO_WIDTH | gtk.HILDON_SIZE_FINGER_HEIGHT, hildon.BUTTON_ARRANGEMENT_VERTICAL)
-               navstored_button.set_text("Go to last visited", "Jump to where you were before you switched comics")
+               navstored_button.set_text("Go to stored comic", "Jump to where you were before you switched comics")
                navstored_button.set_alignment(0,0,0,0)
                navstored_button.connect("clicked", self.show_nav, "stored")