diff options
Diffstat (limited to 'examples')
-rw-r--r-- | examples/plugin_chmod_keybindings.py | 1 | ||||
-rw-r--r-- | examples/plugin_file_filter.py | 2 | ||||
-rw-r--r-- | examples/plugin_hello_world.py | 2 | ||||
-rw-r--r-- | examples/plugin_ipc.py | 3 | ||||
-rw-r--r-- | examples/plugin_linemode.py | 2 | ||||
-rw-r--r-- | examples/plugin_new_macro.py | 2 | ||||
-rw-r--r-- | examples/plugin_pmount.py | 2 |
7 files changed, 14 insertions, 0 deletions
diff --git a/examples/plugin_chmod_keybindings.py b/examples/plugin_chmod_keybindings.py index 1c9558f7..63f42b0e 100644 --- a/examples/plugin_chmod_keybindings.py +++ b/examples/plugin_chmod_keybindings.py @@ -7,6 +7,7 @@ import ranger.api old_hook_init = ranger.api.hook_init + def hook_init(fm): old_hook_init(fm) diff --git a/examples/plugin_file_filter.py b/examples/plugin_file_filter.py index d5ea2d2d..5d5f1466 100644 --- a/examples/plugin_file_filter.py +++ b/examples/plugin_file_filter.py @@ -10,6 +10,8 @@ old_accept_file = ranger.container.directory.accept_file HIDE_FILES = ("/boot", "/sbin", "/proc", "/sys") # Define a new one + + def custom_accept_file(file, filters): if not file.fm.settings.show_hidden and file.path in HIDE_FILES: return False diff --git a/examples/plugin_hello_world.py b/examples/plugin_hello_world.py index b64916d4..0158a653 100644 --- a/examples/plugin_hello_world.py +++ b/examples/plugin_hello_world.py @@ -12,6 +12,8 @@ import ranger.api old_hook_ready = ranger.api.hook_ready # Create a replacement for the hook that... + + def hook_ready(fm): # ...does the desired action... fm.notify("Hello World") diff --git a/examples/plugin_ipc.py b/examples/plugin_ipc.py index a9e79205..47fb1c84 100644 --- a/examples/plugin_ipc.py +++ b/examples/plugin_ipc.py @@ -10,6 +10,8 @@ import ranger.api old_hook_init = ranger.api.hook_init + + def hook_init(fm): try: # Create a FIFO. @@ -22,6 +24,7 @@ def hook_init(fm): import thread except ImportError: import _thread as thread + def ipc_reader(filepath): while True: with open(filepath, 'r') as fifo: diff --git a/examples/plugin_linemode.py b/examples/plugin_linemode.py index 8a92552e..851d6213 100644 --- a/examples/plugin_linemode.py +++ b/examples/plugin_linemode.py @@ -9,8 +9,10 @@ import codecs import ranger.api from ranger.core.linemode import LinemodeBase + @ranger.api.register_linemode class MyLinemode(LinemodeBase): name = "rot13" + def filetitle(self, file, metadata): return codecs.encode(file.relative_path, "rot_13") diff --git a/examples/plugin_new_macro.py b/examples/plugin_new_macro.py index 31350387..8dbe435d 100644 --- a/examples/plugin_new_macro.py +++ b/examples/plugin_new_macro.py @@ -10,6 +10,8 @@ old_get_macros = ranger.core.actions.Actions._get_macros # Define a new macro function import time + + def get_macros_with_date(self): macros = old_get_macros(self) macros['date'] = time.strftime('%m/%d/%Y') diff --git a/examples/plugin_pmount.py b/examples/plugin_pmount.py index 61ee0dbd..ba61b0e5 100644 --- a/examples/plugin_pmount.py +++ b/examples/plugin_pmount.py @@ -16,6 +16,8 @@ UMOUNT_KEY = '<alt>M' LIST_MOUNTS_KEY = '<alt>N' old_hook_init = ranger.api.hook_init + + def hook_init(fm): try: fm.execute_console("map {key} shell -p lsblk".format(key=LIST_MOUNTS_KEY)) |