diff options
author | hut <hut@lavabit.com> | 2013-02-19 07:13:07 +0100 |
---|---|---|
committer | hut <hut@lavabit.com> | 2013-02-19 07:13:07 +0100 |
commit | 4d48d33ca5529464dadbb2fc70888da4cd9d24fa (patch) | |
tree | 372fd68e91f346d8c441bcfe97db538cf2d16a8a /ranger | |
parent | 740d1e5fd20525f2ac2c6b6af493b0c21d2e845e (diff) | |
parent | b389735d681a26114377b747fe3a8fe1d3effd51 (diff) | |
download | ranger-4d48d33ca5529464dadbb2fc70888da4cd9d24fa.tar.gz |
Merge branch 'master' into vcs
Diffstat (limited to 'ranger')
-rw-r--r-- | ranger/core/loader.py | 12 | ||||
-rw-r--r-- | ranger/gui/ui.py | 4 | ||||
-rw-r--r-- | ranger/gui/widgets/browserview.py | 7 | ||||
-rw-r--r-- | ranger/gui/widgets/pager.py | 13 |
4 files changed, 31 insertions, 5 deletions
diff --git a/ranger/core/loader.py b/ranger/core/loader.py index 926c11d1..e968b2eb 100644 --- a/ranger/core/loader.py +++ b/ranger/core/loader.py @@ -204,7 +204,12 @@ class CommandLoader(Loadable, SignalDispatcher, FileManagerAware): if not self.finished and not self.paused: if self.kill_on_pause: self.finished = True - self.process.kill() + try: + self.process.kill() + except OSError: + # probably a race condition where the process finished + # between the last poll()ing and this point. + pass return try: self.process.send_signal(20) @@ -225,7 +230,10 @@ class CommandLoader(Loadable, SignalDispatcher, FileManagerAware): def destroy(self): self.signal_emit('destroy', process=self.process, loader=self) if self.process: - self.process.kill() + try: + self.process.kill() + except OSError: + pass def safeDecode(string): diff --git a/ranger/gui/ui.py b/ranger/gui/ui.py index f35b11bf..5760090c 100644 --- a/ranger/gui/ui.py +++ b/ranger/gui/ui.py @@ -119,8 +119,8 @@ class UI(DisplayableContainer): def destroy(self): """Destroy all widgets and turn off curses""" - self.suspend() DisplayableContainer.destroy(self) + self.suspend() def handle_mouse(self): """Handles mouse input""" @@ -321,6 +321,7 @@ class UI(DisplayableContainer): self.browser.visible = True def open_pager(self): + self.browser.columns[-1].clear_image(force=True) if self.console.focused: self.console.focused = False self.pager.open() @@ -351,6 +352,7 @@ class UI(DisplayableContainer): self.close_pager() def open_taskview(self): + self.browser.columns[-1].clear_image(force=True) self.pager.close() self.pager.visible = False self.pager.focused = False diff --git a/ranger/gui/widgets/browserview.py b/ranger/gui/widgets/browserview.py index 742bd9d4..e0a2275e 100644 --- a/ranger/gui/widgets/browserview.py +++ b/ranger/gui/widgets/browserview.py @@ -170,6 +170,7 @@ class BrowserView(Widget, DisplayableContainer): self.addch(self.hei - 1, right_end, curses.ACS_LRCORNER) def _draw_bookmarks(self): + self.columns[-1].clear_image(force=True) self.fm.bookmarks.update_if_outdated() self.color_reset() self.need_clear = True @@ -194,6 +195,7 @@ class BrowserView(Widget, DisplayableContainer): self.win.chgat(ystart - 1, 0, curses.A_UNDERLINE) def _draw_info(self, lines): + self.columns[-1].clear_image(force=True) self.need_clear = True hei = min(self.hei - 1, len(lines)) ystart = self.hei - hei @@ -207,6 +209,7 @@ class BrowserView(Widget, DisplayableContainer): i += 1 def _draw_hints(self): + self.columns[-1].clear_image(force=True) self.need_clear = True hints = [] for k, v in self.fm.ui.keybuffer.pointer.items(): @@ -341,4 +344,8 @@ class BrowserView(Widget, DisplayableContainer): self.columns[-1].visible = True if self.preview and self.is_collapsed != self._collapse(): + if (self.fm.settings.preview_images and + self.fm.settings.preview_files): + # force clearing the image when resizing preview column + self.columns[-1].clear_image(force=True) self.resize(self.y, self.x, self.hei, self.wid) diff --git a/ranger/gui/widgets/pager.py b/ranger/gui/widgets/pager.py index 8bfdf42d..de73ddc2 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 @@ -38,10 +39,11 @@ class Pager(Widget): self.startx = 0 self.need_redraw = True - def clear_image(self): - if self.need_clear_image: + def clear_image(self, force=False): + if force or 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) @@ -65,8 +71,10 @@ 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.win.erase() self.need_redraw_image = True self.clear_image() @@ -91,6 +99,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: |