summary refs log tree commit diff stats
path: root/ranger
diff options
context:
space:
mode:
authorhut <hut@lavabit.com>2010-01-20 20:44:26 +0100
committerhut <hut@lavabit.com>2010-01-20 20:44:26 +0100
commite99d68577df610f885316c0d937d98bf8c0ede3c (patch)
tree0e40a78a6bef1469b0dc1830ea1b022dd8716751 /ranger
parent0fd1c723e2518b55eeea58b10cc9040040c27954 (diff)
downloadranger-e99d68577df610f885316c0d937d98bf8c0ede3c.tar.gz
curses_shortcuts: use flatten instead of _combine
Diffstat (limited to 'ranger')
-rw-r--r--ranger/gui/curses_shortcuts.py20
1 files changed, 5 insertions, 15 deletions
diff --git a/ranger/gui/curses_shortcuts.py b/ranger/gui/curses_shortcuts.py
index 4e02fca5..1ccaddc3 100644
--- a/ranger/gui/curses_shortcuts.py
+++ b/ranger/gui/curses_shortcuts.py
@@ -14,6 +14,7 @@
 
 import _curses
 
+from ranger.ext.flatten import flatten
 from ranger.shared import SettingsAware
 
 class CursesShortcuts(SettingsAware):
@@ -38,18 +39,18 @@ class CursesShortcuts(SettingsAware):
 		except (_curses.error, TypeError):
 			pass
 
-	def color(self, keylist = None, *keys):
+	def color(self, *keys):
 		"""Change the colors from now on."""
-		keys = _combine(keylist, keys)
+		keys = flatten(keys)
 		attr = self.settings.colorscheme.get_attr(*keys)
 		try:
 			self.win.attrset(attr)
 		except _curses.error:
 			pass
 
-	def color_at(self, y, x, wid, keylist = None, *keys):
+	def color_at(self, y, x, wid, *keys):
 		"""Change the colors at the specified position"""
-		keys = _combine(keylist, keys)
+		keys = flatten(keys)
 		attr = self.settings.colorscheme.get_attr(*keys)
 		try:
 			self.win.chgat(y, x, wid, attr)
@@ -59,14 +60,3 @@ class CursesShortcuts(SettingsAware):
 	def color_reset(self):
 		"""Change the colors to the default colors"""
 		CursesShortcuts.color(self, 'reset')
-
-def _combine(seq, tup):
-	# Add seq and tup. Ensures that the result is a tuple.
-	try:
-		if isinstance(seq, str): raise TypeError
-		return tuple(tuple(seq) + tup)
-	except TypeError:
-		try:
-			return tuple((seq, ) + tup)
-		except:
-			return ()