summary refs log tree commit diff stats
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
parentdcd610f7b768b75f57017c0a037b99540e5cb061 (diff)
downloadranger-7137526a07bf98671a8398a2bc987cbd5623f676.tar.gz
core.shared: added error message
when typing zv and there is no preview_script
-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
vious revision' href='/akspecs/ranger/blame/ranger/gui/mouse_event.py?h=v1.4.2&id=3de15ddd7fb0151e5f43f0b8e7d06bd76568e235'>^
728fb838 ^
d88232a3 ^



728fb838 ^











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
52
53