summary refs log tree commit diff stats
path: root/ranger
diff options
context:
space:
mode:
authorhut <hut@lavabit.com>2010-10-12 05:01:42 +0200
committerhut <hut@lavabit.com>2010-10-12 05:01:42 +0200
commit7137526a07bf98671a8398a2bc987cbd5623f676 (patch)
tree45b6d71b3f760b81db272f87a368569e8b342061 /ranger
parentdcd610f7b768b75f57017c0a037b99540e5cb061 (diff)
downloadranger-7137526a07bf98671a8398a2bc987cbd5623f676.tar.gz
core.shared: added error message
when typing zv and there is no preview_script
Diffstat (limited to 'ranger')
-rw-r--r--ranger/core/shared.py14
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
gt; 2010-08-28 08:30:52 +0200 Changed default config dir to $XDG_CONFIG_HOME/ranger' href='/akspecs/ranger/commit/ranger.py?h=v1.9.2&id=a2853ab67f2e471d9a34b4c528db6ee2024ef874'>a2853ab6 ^
cba63cf3 ^
ce9e6572 ^
8fa87054 ^


a66c4a26 ^

f027adc0 ^
08f08fb9 ^









cba63cf3 ^
3de15ddd ^

cba63cf3 ^
b4250dbc ^

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51