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
ghlight .vi { color: #3333bb } /* Name.Variable.Instance */ .highlight .vm { color: #336699 } /* Name.Variable.Magic */ .highlight .il { color: #0000DD; font-weight: bold } /* Literal.Number.Integer.Long */
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<title>Mu - 401test.mu</title>
<meta name="Generator" content="Vim/8.1">
<meta name="plugin-version" content="vim8.1_v1">
<meta name="syntax" content="none">
<meta name="settings" content="number_lines,use_css,pre_wrap,no_foldcolumn,expand_tabs,line_ids,prevent_copy=">
<meta name="colorscheme" content="minimal-light">
<style type="text/css">
<!--
pre { white-space: pre-wrap; font-family: monospace; color: #000000; background-color: #c6c6c6; }
body { font-size:12pt; font-family: monospace; color: #000000; background-color: #c6c6c6; }
a { color:inherit; }
* { font-size:12pt; font-size: 1em; }
.muComment { color: #005faf; }
.LineNr { }
.SpecialChar { color: #d70000; }
.Delimiter { color: #c000c0; }
.muFunction { color: #af5f00; text-decoration: underline; }
.Constant { color: #008787; }
.PreProc { color: #c000c0; }
-->
</style>

<script type='text/javascript'>
<!--

/* function to open any folds containing a jumped-to line before jumping to it */
function JumpToLine()
{
  var lineNum;
  lineNum = window.location.hash;
  lineNum = lineNum.substr(1); /* strip off '#' */

  if (lineNum.indexOf('L') == -1) {
    lineNum = 'L'+lineNum;
  }
  var lineElem = document.getElementById(lineNum);
  /* Always jump to new location even if the line was hidden inside a fold, or
   * we corrected the raw number to a line ID.
   */
  if (lineElem) {
    lineElem.scrollIntoView(true);
  }
  return true;
}
if ('onhashchange' in window) {
  window.onhashchange = JumpToLine;
}

-->
</script>
</head>
<body onload='JumpToLine();'>
<a href='https://github.com/akkartik/mu/blob/main/401test.mu'>https://github.com/akkartik/mu/blob/main/401test.mu</a>
<pre id='vimCodeElement'>
<span id="L1" class="LineNr"> 1 </span><span class="muComment"># Some helpers for Mu tests.</span>
<span id="L2" class="LineNr"> 2 </span>
<span id="L3" class="LineNr"> 3 </span><span class="PreProc">fn</span> <span class="muFunction"><a href='401test.mu.html#L3'>check-true</a></span> val: boolean, msg: (addr array byte) <span class="Delimiter">{</span>
<span id="L4" class="LineNr"> 4 </span>  <span class="PreProc">var</span> tmp/<span class="Constant">eax</span>: int <span class="SpecialChar">&lt;-</span> copy val
<span id="L5" class="LineNr"> 5 </span>  <a href='102test.subx.html#L23'>check-ints-equal</a> tmp, <span class="Constant">1</span>, msg
<span id="L6" class="LineNr"> 6 </span><span class="Delimiter">}</span>
<span id="L7" class="LineNr"> 7 </span>
<span id="L8" class="LineNr"> 8 </span><span class="PreProc">fn</span> <span class="muFunction"><a href='401test.mu.html#L8'>check-false</a></span> val: boolean, msg: (addr array byte) <span class="Delimiter">{</span>
<span id="L9" class="LineNr"> 9 </span>  <span class="PreProc">var</span> tmp/<span class="Constant">eax</span>: int <span class="SpecialChar">&lt;-</span> copy val
<span id="L10" class="LineNr">10 </span>  <a href='102test.subx.html#L23'>check-ints-equal</a> tmp, <span class="Constant">0</span>, msg
<span id="L11" class="LineNr">11 </span><span class="Delimiter">}</span>
</pre>
</body>
</html>
<!-- vim: set foldmethod=manual : -->