summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorhut <hut@lavabit.com>2013-02-18 01:35:08 +0100
committerhut <hut@lavabit.com>2013-02-18 01:35:23 +0100
commitd5e6a43d9a0c29c13aecb1df1a3459aabab1c3e6 (patch)
tree752d96fc0e5dbf704f87a7532fc31c40602399c8
parentba6d22d6cf062a6dd79e253578985364cb411834 (diff)
downloadranger-d5e6a43d9a0c29c13aecb1df1a3459aabab1c3e6.tar.gz
widgets.pager: clear image on exit
-rw-r--r--ranger/gui/widgets/pager.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/ranger/gui/widgets/pager.py b/ranger/gui/widgets/pager.py
index 8bfdf42d..98c434b4 100644
--- a/ranger/gui/widgets/pager.py
+++ b/ranger/gui/widgets/pager.py
@@ -30,6 +30,7 @@ class Pager(Widget):
         self.markup = None
         self.lines = []
         self.image = None
+        self.image_drawn = False
 
     def open(self):
         self.scroll_begin = 0
@@ -42,6 +43,7 @@ class Pager(Widget):
         if self.need_clear_image:
             img_display.clear(self.x, self.y, self.wid, self.hei)
             self.need_clear_image = False
+            self.image_drawn = False
 
     def close(self):
         if self.image:
@@ -50,6 +52,10 @@ class Pager(Widget):
         if self.source and self.source_is_stream:
             self.source.close()
 
+    def destroy(self):
+        if self.image_drawn:
+            img_display.clear(self.x, self.y, self.wid, self.hei)
+
     def finalize(self):
         self.fm.ui.win.move(self.y, self.x)
 
@@ -91,6 +97,7 @@ class Pager(Widget):
                         descr="loading preview image",
                         silent=True, kill_on_pause=True)
                 self.fm.loader.add(cmd)
+                self.image_drawn = True
             except img_display.ImgDisplayUnsupportedException:
                 self.fm.settings.preview_images = False
             except Exception as e: