From 229a1487ce27feccf0bf0e1c99d476736384ad18 Mon Sep 17 00:00:00 2001 From: hut Date: Sun, 3 Feb 2013 05:34:12 +0100 Subject: widgets.pager: draw the image at the very end --- ranger/gui/widgets/browserview.py | 2 ++ ranger/gui/widgets/pager.py | 19 +++++++++---------- 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/ranger/gui/widgets/browserview.py b/ranger/gui/widgets/browserview.py index 0f74931e..e4ab2166 100644 --- a/ranger/gui/widgets/browserview.py +++ b/ranger/gui/widgets/browserview.py @@ -108,6 +108,7 @@ class BrowserView(Widget, DisplayableContainer): self.fm.ui.win.move(self.main_column.y, self.main_column.x) except: pass + self.pager.draw_image() else: try: x = self.main_column.x @@ -116,6 +117,7 @@ class BrowserView(Widget, DisplayableContainer): self.fm.ui.win.move(y, x) except: pass + self.columns[-1].draw_image() def _draw_borders(self): win = self.win diff --git a/ranger/gui/widgets/pager.py b/ranger/gui/widgets/pager.py index 0945021e..ffb4a647 100644 --- a/ranger/gui/widgets/pager.py +++ b/ranger/gui/widgets/pager.py @@ -64,18 +64,9 @@ class Pager(Widget): self.need_redraw = True if self.need_redraw: - self.win.erase() - self.clear_image() - if self.image: - self.source = None - self.fm.ui.win.refresh() - try: - img_display.draw(self.image, self.x, self.y, self.wid, self.hei) - except Exception as e: - self.fm.notify(e, bad=True) - else: + if not self.image: line_gen = self._generate_lines( starty=self.scroll_begin, startx=self.startx) @@ -84,6 +75,14 @@ class Pager(Widget): self.need_redraw = False + def draw_image(self): + if self.image: + self.source = None + try: + img_display.draw(self.image, self.x, self.y, self.wid, self.hei) + except Exception as e: + self.fm.notify(e, bad=True) + def _draw_line(self, i, line): if self.markup is None: self.addstr(i, 0, line) -- cgit 1.4.1-2-gfad0