summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorhut <hut@lavabit.com>2013-02-16 17:01:59 +0100
committerhut <hut@lavabit.com>2013-02-16 17:26:43 +0100
commit9cc2278339448e1f1b8dff2664175b49e28fa035 (patch)
tree342bd823e4940e02271944a4d52cf9bd0b65c350
parent323d2742b488da9ff720e478cb5dec6145c10e54 (diff)
downloadranger-9cc2278339448e1f1b8dff2664175b49e28fa035.tar.gz
widgets.pager: draw images in a background process
-rw-r--r--ranger/gui/widgets/pager.py9
1 files changed, 8 insertions, 1 deletions
diff --git a/ranger/gui/widgets/pager.py b/ranger/gui/widgets/pager.py
index 4e8161a5..8bfdf42d 100644
--- a/ranger/gui/widgets/pager.py
+++ b/ranger/gui/widgets/pager.py
@@ -6,6 +6,7 @@
 The pager displays text and allows you to scroll inside it.
 """
 from . import Widget
+from ranger.core.loader import CommandLoader
 from ranger.gui import ansi
 from ranger.ext.direction import Direction
 import ranger.ext.img_display as img_display
@@ -83,7 +84,13 @@ class Pager(Widget):
             self.source = None
             self.need_redraw_image = False
             try:
-                img_display.draw(self.image, self.x, self.y, self.wid, self.hei)
+                cmd = CommandLoader([img_display.W3MIMGDISPLAY_PATH] +
+                            img_display.W3MIMGDISPLAY_OPTIONS,
+                        input=img_display.generate_w3m_input(self.image,
+                            self.x, self.y, self.wid, self.hei),
+                        descr="loading preview image",
+                        silent=True, kill_on_pause=True)
+                self.fm.loader.add(cmd)
             except img_display.ImgDisplayUnsupportedException:
                 self.fm.settings.preview_images = False
             except Exception as e: