diff options
author | hut <hut@lavabit.com> | 2010-05-07 13:06:48 +0200 |
---|---|---|
committer | hut <hut@lavabit.com> | 2010-05-10 21:03:40 +0200 |
commit | f6bcc4b6b8efdf381f5a1349f6be64123b8e6ddd (patch) | |
tree | cd018679d86c20d7ef834544a2b5712e1439df2a /ranger | |
parent | 2a4a9fd3ddab885de474e1cc9c87b38591443d72 (diff) | |
download | ranger-f6bcc4b6b8efdf381f5a1349f6be64123b8e6ddd.tar.gz |
fixed "zc" key
Diffstat (limited to 'ranger')
-rw-r--r-- | ranger/gui/widgets/browserview.py | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/ranger/gui/widgets/browserview.py b/ranger/gui/widgets/browserview.py index 105c3ae6..a90231f2 100644 --- a/ranger/gui/widgets/browserview.py +++ b/ranger/gui/widgets/browserview.py @@ -24,7 +24,7 @@ from ..displayable import DisplayableContainer class BrowserView(Widget, DisplayableContainer): ratios = None preview = True - preview_available = True + is_collapsed = False draw_bookmarks = False stretch_ratios = None need_clear = False @@ -196,6 +196,11 @@ class BrowserView(Widget, DisplayableContainer): except: pass + def _collapse(self): + # Should the last column be cut off? (Because there is no preview) + return self.settings.collapse_preview and self.preview and \ + not self.columns[-1].has_preview() and self.stretch_ratios + def resize(self, y, x, hei, wid): """Resize all the columns according to the given ratio""" DisplayableContainer.resize(self, y, x, hei, wid) @@ -203,10 +208,8 @@ class BrowserView(Widget, DisplayableContainer): pad = 1 if borders else 0 left = pad - cut_off_last = self.preview and not self.preview_available \ - and self.stretch_ratios - - if cut_off_last: + self.is_collapsed = self._collapse() + if self.is_collapsed: generator = enumerate(self.stretch_ratios) else: generator = enumerate(self.ratios) @@ -263,8 +266,5 @@ class BrowserView(Widget, DisplayableContainer): def poke(self): DisplayableContainer.poke(self) - if self.settings.collapse_preview and self.preview: - has_preview = self.columns[-1].has_preview() - if self.preview_available != has_preview: - self.preview_available = has_preview - self.resize(self.y, self.x, self.hei, self.wid) + if self.preview and self.is_collapsed != self._collapse(): + self.resize(self.y, self.x, self.hei, self.wid) |