about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authornfnty <git@nfnty.se>2016-12-24 06:15:54 +0100
committernfnty <git@nfnty.se>2017-01-17 05:59:03 +0100
commitc60f4c1b7e9d4c86c536b1d1e511f31ed4dde250 (patch)
tree801fc8167c1dd118eaca2163404f30b853862d80
parentcc5c53a696f6d517f8661fbac89444afa3224475 (diff)
downloadranger-c60f4c1b7e9d4c86c536b1d1e511f31ed4dde250.tar.gz
linting: `ranger.gui.widgets.view_base.ViewBase`: Init all attributes
-rw-r--r--.pylintrc2
-rw-r--r--ranger/gui/widgets/view_base.py24
2 files changed, 6 insertions, 20 deletions
diff --git a/.pylintrc b/.pylintrc
index 2adabf2f..8e87a39d 100644
--- a/.pylintrc
+++ b/.pylintrc
@@ -11,4 +11,4 @@ max-line-length = 99
 disable=locally-disabled,locally-enabled,missing-docstring,duplicate-code,fixme,broad-except,cyclic-import,attribute-defined-outside-init,access-member-before-definition
 
 [TYPECHECK]
-ignored-classes=ranger.core.actions.Actions,ranger.gui.widgets.view_base.ViewBase,ranger.gui.curses_shortcuts.CursesShortcuts
+ignored-classes=ranger.core.actions.Actions,ranger.gui.curses_shortcuts.CursesShortcuts
diff --git a/ranger/gui/widgets/view_base.py b/ranger/gui/widgets/view_base.py
index 3ec01c72..b91c7e21 100644
--- a/ranger/gui/widgets/view_base.py
+++ b/ranger/gui/widgets/view_base.py
@@ -23,6 +23,10 @@ class ViewBase(Widget, DisplayableContainer):  # pylint: disable=too-many-instan
         self.fm.signal_bind('move', self.request_clear)
         self.old_draw_borders = self.settings.draw_borders
 
+        self.columns = None
+        self.main_column = None
+        self.pager = None
+
     def request_clear(self):
         self.need_clear = True
 
@@ -45,7 +49,7 @@ class ViewBase(Widget, DisplayableContainer):  # pylint: disable=too-many-instan
             self._draw_info(self.draw_info)
 
     def finalize(self):
-        if hasattr(self, 'pager') and self.pager.visible:
+        if self.pager is not None and self.pager.visible:
             try:
                 self.fm.ui.win.move(self.main_column.y, self.main_column.x)
             except Exception:
@@ -129,24 +133,6 @@ class ViewBase(Widget, DisplayableContainer):  # pylint: disable=too-many-instan
             self.addnstr(i, 0, string, self.wid)
             i += 1
 
-    def _collapse(self):
-        # Should the last column be cut off? (Because there is no preview)
-        if not self.settings.collapse_preview or not self.preview \
-                or not self.stretch_ratios:
-            return False
-        result = not self.columns[-1].has_preview()
-        target = self.columns[-1].target
-        if not result and target and target.is_file:
-            if self.fm.settings.preview_script and \
-                    self.fm.settings.use_preview_script:
-                try:
-                    result = not self.fm.previews[target.realpath]['foundpreview']
-                except Exception:
-                    return self.old_collapse
-
-        self.old_collapse = result
-        return result
-
     def click(self, event):
         if DisplayableContainer.click(self, event):
             return True