summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rwxr-xr-xranger/config/commands.py8
-rw-r--r--ranger/container/directory.py4
-rw-r--r--ranger/core/actions.py6
-rw-r--r--ranger/core/loader.py12
-rw-r--r--ranger/core/tab.py2
-rw-r--r--ranger/ext/img_display.py18
6 files changed, 28 insertions, 22 deletions
diff --git a/ranger/config/commands.py b/ranger/config/commands.py
index cb4fd3a8..06cc8059 100755
--- a/ranger/config/commands.py
+++ b/ranger/config/commands.py
@@ -243,10 +243,10 @@ class open_with(Command):
     def execute(self):
         app, flags, mode = self._get_app_flags_mode(self.rest(1))
         self.fm.execute_file(
-                files = [f for f in self.fm.thistab.get_selection()],
-                app = app,
-                flags = flags,
-                mode = mode)
+                files=[f for f in self.fm.thistab.get_selection()],
+                app=app,
+                flags=flags,
+                mode=mode)
 
     def tab(self, tabnum):
         return self._tab_through_executables()
diff --git a/ranger/container/directory.py b/ranger/container/directory.py
index 4ffd9bc2..908b6c1e 100644
--- a/ranger/container/directory.py
+++ b/ranger/container/directory.py
@@ -460,13 +460,13 @@ class Directory(FileSystemObject, Accumulator, Loadable):
             elif sort_func in (sort_by_basename, sort_by_basename_icase):
                 sort_func = sort_unicode_wrapper_string(sort_func)
 
-        self.files_all.sort(key = sort_func)
+        self.files_all.sort(key=sort_func)
 
         if self.settings.sort_reverse:
             self.files_all.reverse()
 
         if self.settings.sort_directories_first:
-            self.files_all.sort(key = sort_by_directory)
+            self.files_all.sort(key=sort_by_directory)
 
         self.refilter()
 
diff --git a/ranger/core/actions.py b/ranger/core/actions.py
index 1d85ea04..0c2e5ce1 100644
--- a/ranger/core/actions.py
+++ b/ranger/core/actions.py
@@ -149,7 +149,7 @@ class Actions(FileManagerAware, SettingsAware):
             if ranger.arg.debug:
                 raise
             bad = True
-        elif bad == True and ranger.arg.debug:
+        elif bad is True and ranger.arg.debug:
             raise Exception(str(text))
         text = str(text)
         self.log.appendleft(text)
@@ -515,7 +515,7 @@ class Actions(FileManagerAware, SettingsAware):
         # csh variable is lowercase
         cdpath = os.environ.get('CDPATH', None) or os.environ.get('cdpath', None)
         result = self.thistab.enter_dir(path, history=history)
-        if result == False and cdpath:
+        if result is False and cdpath:
             for p in cdpath.split(':'):
                 curpath = os.path.join(p, path)
                 if os.path.isdir(curpath):
@@ -932,7 +932,7 @@ class Actions(FileManagerAware, SettingsAware):
 
             found = data.get((-1, -1), data.get((width, -1),
                 data.get((-1, height), data.get((width, height), False))))
-            if found == False:
+            if found is False:
                 try:
                     stat_ = os.stat(self.settings.preview_script)
                 except:
diff --git a/ranger/core/loader.py b/ranger/core/loader.py
index aebd6efe..d265ce80 100644
--- a/ranger/core/loader.py
+++ b/ranger/core/loader.py
@@ -211,10 +211,10 @@ class CommandLoader(Loadable, SignalDispatcher, FileManagerAware):
                 except select.error:
                     sleep(0.03)
             if not self.silent:
-                for l in process.stderr.readlines():
+                for line in process.stderr:
                     if py3:
-                        l = safeDecode(l)
-                    self.fm.notify(l, bad=True)
+                        line = safeDecode(line)
+                    self.fm.notify(line, bad=True)
             if self.read:
                 read = process.stdout.read()
                 if py3:
@@ -271,6 +271,9 @@ def safeDecode(string):
 
 
 class Loader(FileManagerAware):
+    """
+    The Manager of 'Loadable' objects, referenced as fm.loader
+    """
     seconds_of_work_time = 0.03
     throbber_chars = r'/-\|'
     throbber_paused = '#'
@@ -305,6 +308,7 @@ class Loader(FileManagerAware):
             self.queue.append(obj)
         else:
             self.queue.appendleft(obj)
+        self.fm.signal_emit("loader.before", loadable=obj, fm=self.fm)
         if self.paused:
             obj.pause()
         else:
@@ -341,6 +345,7 @@ class Loader(FileManagerAware):
                 item = self.queue[index]
             if hasattr(item, 'unload'):
                 item.unload()
+            self.fm.signal_emit("loader.destroy", loadable=item, fm=self.fm)
             item.destroy()
             del self.queue[index]
             if item.progressbar_supported:
@@ -408,6 +413,7 @@ class Loader(FileManagerAware):
     def _remove_current_process(self, item):
         item.load_generator = None
         self.queue.remove(item)
+        self.fm.signal_emit("loader.after", loadable=item, fm=self.fm)
         if item.progressbar_supported:
             self.fm.ui.status.request_redraw()
 
diff --git a/ranger/core/tab.py b/ranger/core/tab.py
index dc76568b..2faf4b0c 100644
--- a/ranger/core/tab.py
+++ b/ranger/core/tab.py
@@ -103,7 +103,7 @@ class Tab(FileManagerAware, SettingsAware):
     def inherit_history(self, other_history):
         self.history.rebase(other_history)
 
-    def enter_dir(self, path, history = True):
+    def enter_dir(self, path, history=True):
         """Enter given path"""
         # TODO: Ensure that there is always a self.thisdir
         if path is None: return
diff --git a/ranger/ext/img_display.py b/ranger/ext/img_display.py
index 61967b02..1ee421d7 100644
--- a/ranger/ext/img_display.py
+++ b/ranger/ext/img_display.py
@@ -114,11 +114,11 @@ class W3MImageDisplayer(ImageDisplayer):
         fontw, fonth = self._get_font_dimensions()
 
         cmd = "6;{x};{y};{w};{h}\n4;\n3;\n".format(
-                x = int((start_x - 0.2) * fontw),
-                y = start_y * fonth,
+                x=int((start_x - 0.2) * fontw),
+                y=start_y * fonth,
                 # y = int((start_y + 1) * fonth), # (for tmux top status bar)
-                w = int((width + 0.4) * fontw),
-                h = height * fonth + 1)
+                w=int((width + 0.4) * fontw),
+                h=height * fonth + 1)
                 # h = (height - 1) * fonth + 1) # (for tmux top status bar)
 
         try:
@@ -168,12 +168,12 @@ class W3MImageDisplayer(ImageDisplayer):
             height = max_height_pixels
 
         return "0;1;{x};{y};{w};{h};;;;;{filename}\n4;\n3;\n".format(
-                x = int((start_x - 0.2) * fontw),
-                y = start_y * fonth,
+                x=int((start_x - 0.2) * fontw),
+                y=start_y * fonth,
                 # y = (start_y + 1) * fonth, # (for tmux top status bar)
-                w = width,
-                h = height,
-                filename = path)
+                w=width,
+                h=height,
+                filename=path)
 
     def quit(self):
         if self.is_initialized and self.process and self.process.poll() is None: