about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorhut <hut@lavabit.com>2010-02-28 19:04:25 +0100
committerhut <hut@lavabit.com>2010-02-28 19:21:33 +0100
commitd8bb27bde7952939643f2d23711bd85c401d94d1 (patch)
tree05cadee8848a437dae9a7c892f0a4a97cf6bb342
parent69d1220f348219118ecf4154a6532864a93265b1 (diff)
downloadranger-d8bb27bde7952939643f2d23711bd85c401d94d1.tar.gz
colorschemes: use "Scheme" as the default class name for colorschemes
-rw-r--r--TODO1
-rw-r--r--ranger/colorschemes/jungle.py7
-rw-r--r--ranger/shared/settings.py13
3 files changed, 11 insertions, 10 deletions
diff --git a/TODO b/TODO
index 741cf4ce..f655a936 100644
--- a/TODO
+++ b/TODO
@@ -46,6 +46,7 @@ General
    (X) #61  10/02/09  show sum of size of marked files
    (X) #63  10/02/15  limit filesize in previews
    ( ) #64  10/02/25  scroll in previews
+   ( ) #66  10/02/28  explain how colorschemes work
 
 
 Bugs
diff --git a/ranger/colorschemes/jungle.py b/ranger/colorschemes/jungle.py
index e6c3307f..376091c0 100644
--- a/ranger/colorschemes/jungle.py
+++ b/ranger/colorschemes/jungle.py
@@ -15,12 +15,11 @@
 
 from ranger.gui.colorscheme import ColorScheme
 from ranger.gui.color import *
+from ranger.colorschemes.default import Default
 
-from ranger.colorschemes.default import Default as SubClass
-
-class Default(SubClass):
+class Scheme(Default):
 	def use(self, context):
-		fg, bg, attr = SubClass.use(self, context)
+		fg, bg, attr = Default.use(self, context)
 
 		if context.directory and not context.marked:
 			fg = green
diff --git a/ranger/shared/settings.py b/ranger/shared/settings.py
index c01e5796..b549bd20 100644
--- a/ranger/shared/settings.py
+++ b/ranger/shared/settings.py
@@ -79,14 +79,15 @@ class SettingsAware(object):
 			options.colorscheme = options.colorscheme()
 
 		elif ismodule(options.colorscheme):
-			if hasattr(options.colorscheme, 'Default') \
-			and isclass(options.colorscheme.Default) \
-			and issubclass(options.colorscheme.Default, ColorScheme):
-				options.colorscheme = options.colorscheme.Default()
+			def is_scheme(x):
+				return isclass(x) and issubclass(x, ColorScheme)
+
+			if hasattr(options.colorscheme, 'Scheme') \
+					and is_scheme(options.colorscheme.Scheme):
+				options.colorscheme = options.colorscheme.Scheme()
 			else:
 				for name, var in options.colorscheme.__dict__.items():
-					if var != ColorScheme and isclass(var) \
-					and issubclass(var, ColorScheme):
+					if var != ColorScheme and is_scheme(var):
 						options.colorscheme = var()
 						break
 				else: