diff options
author | nfnty <git@nfnty.se> | 2017-02-06 19:40:15 +0100 |
---|---|---|
committer | nfnty <git@nfnty.se> | 2017-02-06 19:40:15 +0100 |
commit | 5b1023d5db2952311eb97a381ff3f854f515f57c (patch) | |
tree | 3237cd2c10155fb5c1ffa21f16b0541ee4bb4827 /ranger | |
parent | 9a619526f472cce3997b2aa89c13532cf8f005e1 (diff) | |
download | ranger-5b1023d5db2952311eb97a381ff3f854f515f57c.tar.gz |
gui.widgets.browsercolumn.BrowserColumn.draw: Minor refactor
Diffstat (limited to 'ranger')
-rw-r--r-- | ranger/gui/widgets/browsercolumn.py | 42 |
1 files changed, 20 insertions, 22 deletions
diff --git a/ranger/gui/widgets/browsercolumn.py b/ranger/gui/widgets/browsercolumn.py index 2b9f317e..14fde110 100644 --- a/ranger/gui/widgets/browsercolumn.py +++ b/ranger/gui/widgets/browsercolumn.py @@ -138,41 +138,39 @@ class BrowserColumn(Pager): # pylint: disable=too-many-instance-attributes tab = self.tab self.target = tab.at_level(self.level) - def _need_redraw(self, boolean): - self.need_redraw = boolean or self.need_redraw - def draw(self): """Call either _draw_file() or _draw_directory()""" - if self.target != self.old_dir: + target = self.target + + if target != self.old_dir: self.need_redraw = True - self.old_dir = self.target + self.old_dir = target - if self.target: - self.target.use() + if target: + target.use() - if self.target.is_directory and (self.level <= 0 or self.settings.preview_directories): - if self.old_thisfile != self.target.pointed_obj: - self.old_thisfile = self.target.pointed_obj + if target.is_directory and (self.level <= 0 or self.settings.preview_directories): + if self.old_thisfile != target.pointed_obj: + self.old_thisfile = target.pointed_obj self.need_redraw = True - self._need_redraw(self.target.load_content_if_outdated()) - self._need_redraw(self.target.sort_if_outdated()) - self._need_redraw(self.last_redraw_time < self.target.last_update_time) - if self.target.pointed_obj: - self._need_redraw(self.target.pointed_obj.load_if_outdated()) - self._need_redraw( - self.last_redraw_time < self.target.pointed_obj.last_load_time) + self.need_redraw |= target.load_content_if_outdated() + self.need_redraw |= target.sort_if_outdated() + self.need_redraw |= self.last_redraw_time < target.last_update_time + if target.pointed_obj: + self.need_redraw |= target.pointed_obj.load_if_outdated() + self.need_redraw |= self.last_redraw_time < target.pointed_obj.last_load_time else: - self._need_redraw(self.target.load_if_outdated()) - self._need_redraw(self.last_redraw_time < self.target.last_load_time) + self.need_redraw |= target.load_if_outdated() + self.need_redraw |= self.last_redraw_time < target.last_load_time if self.need_redraw: self.win.erase() - if self.target is None: + if target is None: pass - elif self.target.is_file: + elif target.is_file: Pager.open(self) self._draw_file() - elif self.target.is_directory: + elif target.is_directory: self._draw_directory() Widget.draw(self) self.need_redraw = False |