summary refs log tree commit diff stats
path: root/ranger/gui
diff options
context:
space:
mode:
authorhut <hut@lavabit.com>2009-12-10 01:37:14 +0100
committerhut <hut@lavabit.com>2009-12-10 01:37:14 +0100
commit871c502d58055c7611f0763eaa71a7fafad7efdc (patch)
tree0f0080aac9f8bdbee5a7d6ca9bf6bb0d4866ffb7 /ranger/gui
parentaea67778ad2366b4e4171008af7b0dcd5d91f93b (diff)
downloadranger-871c502d58055c7611f0763eaa71a7fafad7efdc.tar.gz
Restructuration
Diffstat (limited to 'ranger/gui')
-rw-r--r--ranger/gui/colorscheme.py5
-rw-r--r--ranger/gui/ui.py13
-rw-r--r--ranger/gui/wconsole.py5
-rw-r--r--ranger/gui/wdisplay.py1
-rw-r--r--ranger/gui/widget.py6
-rw-r--r--ranger/gui/wtitlebar.py11
6 files changed, 27 insertions, 14 deletions
diff --git a/ranger/gui/colorscheme.py b/ranger/gui/colorscheme.py
index 6f3ef01f..281396a5 100644
--- a/ranger/gui/colorscheme.py
+++ b/ranger/gui/colorscheme.py
@@ -3,7 +3,8 @@ CONTEXT_KEYS = [ 'reset', 'error',
 		'directory', 'file', 'hostname',
 		'executable', 'media', 'link',
 		'video', 'audio', 'image', 'media', 'document', 'container',
-		'broken', 'selected', 'empty', 'maindisplay']
+		'broken', 'selected', 'empty', 'maindisplay',
+		'keybuffer']
 
 # colorscheme specification:
 #
@@ -27,7 +28,7 @@ CONTEXT_KEYS = [ 'reset', 'error',
 # If your colorscheme-file contains more than one colorscheme, specify it with:
 # colorscheme = colorschemes.filename.classname
 
-from ranger.helper import OpenStruct
+from ranger.ext import OpenStruct
 
 class ColorScheme(object):
 	def __init__(self):
diff --git a/ranger/gui/ui.py b/ranger/gui/ui.py
index b5ae78dc..beedea09 100644
--- a/ranger/gui/ui.py
+++ b/ranger/gui/ui.py
@@ -17,14 +17,15 @@ class MouseEvent(object):
 		except:
 			return False
 
-class UI(object):
-	def __init__(self, env, commandlist, colorscheme):
+from ranger.shared import EnvironmentAware
+
+class UI(EnvironmentAware):
+	def __init__(self, commandlist):
 		import os
 		os.environ['ESCDELAY'] = '25' # don't know a cleaner way
 
-		self.env = env
 		self.commandlist = commandlist
-		self.colorscheme = colorscheme
+		self.colorscheme = self.env.settings.colorscheme
 		self.is_set_up = False
 		self.win = curses.initscr()
 
@@ -52,7 +53,7 @@ class UI(object):
 		self.resize()
 
 	def exit(self):
-		from ranger.helper import log
+		from ranger import log
 		log("exiting ui!")
 		self.win.keypad(0)
 		curses.nocbreak()
@@ -108,7 +109,7 @@ class UI(object):
 				return
 
 		try:
-			cmd = self.commandlist.paths[self.env.keybuffer]
+			cmd = self.commandlist.paths[tuple(self.env.keybuffer)]
 		except KeyError:
 			self.env.key_clear()
 			return
diff --git a/ranger/gui/wconsole.py b/ranger/gui/wconsole.py
index a0322c42..581745b4 100644
--- a/ranger/gui/wconsole.py
+++ b/ranger/gui/wconsole.py
@@ -6,13 +6,12 @@ CONSOLE_MODES_DICTIONARY = { '@': 'open with: ' }
 
 class WConsole(SuperClass):
 	def __init__(self, win, colorscheme):
-		from ranger.command import CommandList
-		from ranger.conf import keys
+		from ranger.container import CommandList
 		SuperClass.__init__(self, win, colorscheme)
 		self.mode = None
 		self.visible = False
 		self.commandlist = CommandList()
-		keys.initialize_console_commands(self.commandlist)
+		self.settings.keys.initialize_console_commands(self.commandlist)
 		self.last_cursor_mode = 1
 		self.clear()
 		self.prompt = None
diff --git a/ranger/gui/wdisplay.py b/ranger/gui/wdisplay.py
index fd4f7dec..5e5e80d6 100644
--- a/ranger/gui/wdisplay.py
+++ b/ranger/gui/wdisplay.py
@@ -70,6 +70,7 @@ class WDisplay(SuperClass):
 		import curses
 		import stat
 
+		self.target.use()
 		self.target.load_content_if_outdated()
 		self.target.sort_if_outdated()
 
diff --git a/ranger/gui/widget.py b/ranger/gui/widget.py
index 071b88bc..093eee14 100644
--- a/ranger/gui/widget.py
+++ b/ranger/gui/widget.py
@@ -8,12 +8,12 @@ def combine(keylist, keys):
 	else:
 		return tuple((keylist, ) + keys)
 
-from ranger.conf import SettingsAware
+from ranger.shared import SettingsAware
 class Widget(SettingsAware):
-	def __init__(self, win, colorscheme):
+	def __init__(self, win, _):
 		self.win = win
 		self.focused = False
-		self.colorscheme = colorscheme
+		self.colorscheme = self.settings.colorscheme
 		self.visible = True
 		self.setdim(0, 0, 0, 0)
 
diff --git a/ranger/gui/wtitlebar.py b/ranger/gui/wtitlebar.py
index af8ab0d7..65ed2e33 100644
--- a/ranger/gui/wtitlebar.py
+++ b/ranger/gui/wtitlebar.py
@@ -4,6 +4,7 @@ class WTitleBar(SuperClass):
 	def feed_env(self, env):
 		self.pathway = env.pathway
 		self.cf = env.cf
+		self.keybuffer = env.keybuffer
 
 	def draw(self):
 		import curses, socket, os
@@ -30,5 +31,15 @@ class WTitleBar(SuperClass):
 			currentx = self.win.getyx()[1]
 			self.color('in_titlebar', 'file')
 			self.win.addnstr(self.cf.basename, max(self.wid - currentx, 0))
+
+		self.color('in_titlebar', 'keybuffer')
+
+		kb = str(self.keybuffer)
+		if self.wid + self.x - currentx > len(kb):
+			self.win.addstr(
+					self.y,
+					self.x + self.wid - len(kb) - 2,
+					kb)
+
 		self.color_reset()