summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorhut <hut@lavabit.com>2010-10-10 02:35:23 +0200
committerhut <hut@lavabit.com>2010-10-10 02:35:23 +0200
commit2e74a4d016849eede5b3cb9200aa93bf930d5298 (patch)
tree5bbe33eaba78ffb5fe27d13a484a3dd581fc61d5
parenta62a095de2d1278a92790c6614a047d4b2403107 (diff)
downloadranger-2e74a4d016849eede5b3cb9200aa93bf930d5298.tar.gz
gui.colorscheme: polished up (docs, error handling)
-rw-r--r--ranger/gui/colorscheme.py17
1 files changed, 7 insertions, 10 deletions
diff --git a/ranger/gui/colorscheme.py b/ranger/gui/colorscheme.py
index ae6aac0b..1fa23656 100644
--- a/ranger/gui/colorscheme.py
+++ b/ranger/gui/colorscheme.py
@@ -35,10 +35,7 @@ associated with either True or False.
 
 define which colorscheme to use by having this to your options.py:
 from ranger import colorschemes
-colorscheme = colorschemes.filename
-
-If your colorscheme-file contains more than one colorscheme, specify it with:
-colorscheme = colorschemes.filename.classname
+colorscheme = "name"
 """
 
 import os
@@ -121,7 +118,7 @@ class ColorScheme(SettingsAware):
 		return fg, -1, attr
 
 def _colorscheme_name_to_class(signal):
-	# Find the colorscheme.  First look for it at ~/.config/ranger/colorschemes,
+	# Find the colorscheme.  First look in ~/.config/ranger/colorschemes,
 	# then at RANGERDIR/colorschemes.  If the file contains a class
 	# named Scheme, it is used.  Otherwise, an arbitrary other class
 	# is picked.
@@ -156,11 +153,11 @@ def _colorscheme_name_to_class(signal):
 		scheme_supermodule = None  # found no matching file.
 
 	if scheme_supermodule is None:
-		# XXX: dont print while curses is running
-		print("ERROR: colorscheme not found, fall back to builtin scheme")
-		if ranger.arg.debug:
-			raise Exception("Cannot locate colorscheme!")
-		signal.value = ColorScheme()
+		if signal.previous and isinstance(signal.previous, ColorScheme):
+			signal.value = signal.previous
+		else:
+			signal.value = ColorScheme()
+		raise Exception("Cannot locate colorscheme `%s'" % scheme_name)
 	else:
 		if usecustom: allow_access_to_confdir(ranger.arg.confdir, True)
 		scheme_module = getattr(__import__(scheme_supermodule,