diff options
author | hut <hut@lavabit.com> | 2010-10-12 05:01:42 +0200 |
---|---|---|
committer | hut <hut@lavabit.com> | 2010-10-12 05:01:42 +0200 |
commit | 7137526a07bf98671a8398a2bc987cbd5623f676 (patch) | |
tree | 45b6d71b3f760b81db272f87a368569e8b342061 | |
parent | dcd610f7b768b75f57017c0a037b99540e5cb061 (diff) | |
download | ranger-7137526a07bf98671a8398a2bc987cbd5623f676.tar.gz |
core.shared: added error message
when typing zv and there is no preview_script
-rw-r--r-- | ranger/core/shared.py | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/ranger/core/shared.py b/ranger/core/shared.py index 1d0f96a0..38dc7cdd 100644 --- a/ranger/core/shared.py +++ b/ranger/core/shared.py @@ -17,6 +17,7 @@ inherited, essentially acting like global variables.""" from ranger.ext.lazy_property import lazy_property +import os.path class Awareness(object): pass @@ -54,12 +55,19 @@ class SettingsAware(Awareness): settings.signal_bind('setopt.colorscheme', _colorscheme_name_to_class, priority=1) - def postprocess_paths(signal): + def after_setting_preview_script(signal): if isinstance(signal.value, str): - import os signal.value = os.path.expanduser(signal.value) + if not os.path.exists(signal.value): + signal.value = None settings.signal_bind('setopt.preview_script', - postprocess_paths, priority=1) + after_setting_preview_script, priority=1) + def after_setting_use_preview_script(signal): + if signal.fm.settings.preview_script is None and signal.value: + signal.fm.notify("Preview script undefined or not found!", + bad=True) + settings.signal_bind('setopt.use_preview_script', + after_setting_use_preview_script, priority=1) if not clean: # add the custom options to the list of setting sources |