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
a id='n132' href='#n132'>132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262