about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorhut <hut@lavabit.com>2013-02-03 05:41:32 +0100
committerhut <hut@lavabit.com>2013-02-03 05:41:53 +0100
commit66aad8a70013fdf76c1f77a9690e6c87d659cab7 (patch)
treea6274c6c57106f91e8443e62cdb76719ed6858b7
parent229a1487ce27feccf0bf0e1c99d476736384ad18 (diff)
downloadranger-66aad8a70013fdf76c1f77a9690e6c87d659cab7.tar.gz
widgets.pager: no unnecessary redrawing of images
-rw-r--r--ranger/gui/widgets/pager.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/ranger/gui/widgets/pager.py b/ranger/gui/widgets/pager.py
index ffb4a647..141ed8a9 100644
--- a/ranger/gui/widgets/pager.py
+++ b/ranger/gui/widgets/pager.py
@@ -19,6 +19,7 @@ class Pager(Widget):
 	old_scroll_begin = 0
 	old_startx = 0
 	need_clear_image = False
+	need_redraw_image = False
 	max_width = None
 	def __init__(self, win, embedded=False):
 		Widget.__init__(self, win)
@@ -61,9 +62,9 @@ class Pager(Widget):
 				self.old_startx != self.startx:
 			self.old_startx = self.startx
 			self.old_scroll_begin = self.scroll_begin
-		self.need_redraw = True
 
 		if self.need_redraw:
+			self.need_redraw_image = True
 			self.clear_image()
 
 			if not self.image:
@@ -76,8 +77,9 @@ class Pager(Widget):
 			self.need_redraw = False
 
 	def draw_image(self):
-		if self.image:
+		if self.image and self.need_redraw_image:
 			self.source = None
+			self.need_redraw_image = False
 			try:
 				img_display.draw(self.image, self.x, self.y, self.wid, self.hei)
 			except Exception as e: