Added page refresh(/retry) feature.
authorFredrik Tolf <fredrik@dolda2000.com>
Mon, 13 May 2013 17:59:28 +0000 (19:59 +0200)
committerFredrik Tolf <fredrik@dolda2000.com>
Mon, 13 May 2013 17:59:28 +0000 (19:59 +0200)
manga/reader.py

index 1a8aa05..12089e7 100644 (file)
@@ -115,6 +115,14 @@ class pagecache(object):
             self.bk = self.bk[-self.sz:]
         return f
 
+    def __delitem__(self, page):
+        idl = page.idlist()
+        for i, (ol, f) in enumerate(self.bk):
+            if ol == idl:
+                del self.bk[i]
+                return
+        raise KeyError(idl)
+
 class relpageget(future):
     def __init__(self, cur, prev, cache=None):
         super(relpageget, self).__init__()
@@ -608,6 +616,10 @@ class reader(gtk.Window):
                 self.fetchpage(self.point.next, lambda page: self.preload.set(preload(relpageget(page, False, self.cache))))
             elif ev.keyval in [65288]:
                 self.fetchpage(self.point.prev, lambda page: self.preload.set(preload(relpageget(page, True, self.cache))))
+            elif ev.keyval in [ord('R'), ord('r')]:
+                page = self.point.cur.cur
+                del self.cache[page]
+                self.imgfetch.set(imgfetch(self.cache[page]))
 
     def quit(self):
         self.hide()