diff options
Diffstat (limited to 'ranger/gui/widgets/browsercolumn.py')
-rw-r--r-- | ranger/gui/widgets/browsercolumn.py | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/ranger/gui/widgets/browsercolumn.py b/ranger/gui/widgets/browsercolumn.py index 3fde7f03..28216dd5 100644 --- a/ranger/gui/widgets/browsercolumn.py +++ b/ranger/gui/widgets/browsercolumn.py @@ -3,21 +3,18 @@ """The BrowserColumn widget displays the contents of a directory or file.""" -import curses import stat from time import time from os.path import splitext -from . import Widget -from .pager import Pager from ranger.ext.widestring import WideString - from ranger.core import linemode -from ranger.gui.color import * +from . import Widget +from .pager import Pager -class BrowserColumn(Pager): +class BrowserColumn(Pager): # pylint: disable=too-many-instance-attributes main_column = False display_infostring = False display_vcsstate = True @@ -39,7 +36,7 @@ class BrowserColumn(Pager): level <0 => parent directories """ Pager.__init__(self, win) - Widget.__init__(self, win) + Widget.__init__(self, win) # pylint: disable=non-parent-init-called self.level = level self.tab = tab self.original_level = level @@ -182,14 +179,14 @@ class BrowserColumn(Pager): Pager.close(self) return - f = self.target.get_preview_source(self.wid, self.hei) - if f is None: + path = self.target.get_preview_source(self.wid, self.hei) + if path is None: Pager.close(self) else: if self.target.is_image_preview(): - self.set_image(f) + self.set_image(path) else: - self.set_source(f) + self.set_source(path) Pager.draw(self) def _format_line_number(self, linum_format, i, selected_i): @@ -201,7 +198,8 @@ class BrowserColumn(Pager): return linum_format.format(line_number) - def _draw_directory(self): + def _draw_directory( # pylint: disable=too-many-locals,too-many-branches,too-many-statements + self): """Draw the contents of a directory""" if self.image: self.image = None @@ -273,7 +271,8 @@ class BrowserColumn(Pager): # Extract linemode-related information from the drawn object metadata = None - current_linemode = drawn.linemode_dict[drawn._linemode] + current_linemode = \ + drawn.linemode_dict[drawn._linemode] # pylint: disable=protected-access if current_linemode.uses_metadata: metadata = self.fm.metadata.get_metadata(drawn.path) if not all(getattr(metadata, tag) @@ -390,7 +389,8 @@ class BrowserColumn(Pager): else: return self.target.pointer - def _total_len(self, predisplay): + @staticmethod + def _total_len(predisplay): return sum([len(WideString(s)) for s, L in predisplay]) def _draw_text_display(self, text, space): @@ -479,7 +479,7 @@ class BrowserColumn(Pager): return this_color - def _get_scroll_begin(self): + def _get_scroll_begin(self): # pylint: disable=too-many-return-statements """Determines scroll_begin (the position of the first displayed file)""" offset = self.settings.scroll_offset dirsize = len(self.target) |