diff options
author | hut <hut@lavabit.com> | 2011-10-30 01:33:17 +0200 |
---|---|---|
committer | hut <hut@lavabit.com> | 2011-10-30 01:33:17 +0200 |
commit | 6b3a30d788bdb186a66a05e6e910c37d66164ace (patch) | |
tree | 7954d4babaad5fe703a4af0e233feb7275646e38 | |
parent | 353d765c2a14ac23ccea337f4cac2bc73b2b0693 (diff) | |
download | ranger-6b3a30d788bdb186a66a05e6e910c37d66164ace.tar.gz |
Added option "init_function"
-rw-r--r-- | ranger/container/settingobject.py | 1 | ||||
-rw-r--r-- | ranger/core/fm.py | 3 | ||||
-rw-r--r-- | ranger/defaults/options.py | 10 |
3 files changed, 14 insertions, 0 deletions
diff --git a/ranger/container/settingobject.py b/ranger/container/settingobject.py index 51c12c6e..e7ded15e 100644 --- a/ranger/container/settingobject.py +++ b/ranger/container/settingobject.py @@ -32,6 +32,7 @@ ALLOWED_SETTINGS = { 'draw_borders': bool, 'flushinput': bool, 'hidden_filter': lambda x: isinstance(x, str) or hasattr(x, 'match'), + 'init_function': (type(None), type(lambda:0)), 'load_default_rc': (bool, type(None)), 'max_console_history_size': (int, type(None)), 'max_history_size': (int, type(None)), diff --git a/ranger/core/fm.py b/ranger/core/fm.py index 7ba07484..9b5cc036 100644 --- a/ranger/core/fm.py +++ b/ranger/core/fm.py @@ -89,6 +89,9 @@ class FM(Actions, SignalDispatcher): self.env.signal_bind('cd', self._update_current_tab) + if self.settings.init_function: + self.settings.init_function(self) + def destroy(self): debug = ranger.arg.debug if self.ui: diff --git a/ranger/defaults/options.py b/ranger/defaults/options.py index 92b9ada9..548dc0fe 100644 --- a/ranger/defaults/options.py +++ b/ranger/defaults/options.py @@ -123,6 +123,16 @@ sort_directories_first = True # (Especially on xterm) xterm_alt_key = False +# A function that is called when the user interface is being set up. +#init_function = None + +# You can use it to initialize some custom functionality or bind singals +#def init_function(fm): +# fm.notify("Hello :)") +# def on_tab_change(signal): +# signal.origin.notify("Changing tab! Yay!") +# fm.signal_bind("tab.change", on_tab_change) + # The color scheme overlay. Explained below. colorscheme_overlay = None |