summary refs log tree commit diff stats
path: root/ranger/gui
diff options
context:
space:
mode:
authorhut <hut@lavabit.com>2009-11-29 20:35:23 +0100
committerhut <hut@lavabit.com>2009-11-29 20:35:23 +0100
commit5805deca6306eb888ebdad64c14119995521c6b8 (patch)
tree8041ac52247c99857e0d21dc4c4332cb97556f0e /ranger/gui
parentf027adc08ce0d15717c7694956f23ff637553543 (diff)
downloadranger-5805deca6306eb888ebdad64c14119995521c6b8.tar.gz
random improvements
Diffstat (limited to 'ranger/gui')
-rw-r--r--ranger/gui/colorscheme.py2
-rw-r--r--ranger/gui/wdisplay.py14
-rw-r--r--ranger/gui/wtitlebar.py25
3 files changed, 34 insertions, 7 deletions
diff --git a/ranger/gui/colorscheme.py b/ranger/gui/colorscheme.py
index ff3f9243..e69e9d7e 100644
--- a/ranger/gui/colorscheme.py
+++ b/ranger/gui/colorscheme.py
@@ -1,4 +1,4 @@
-CONTEXT_KEYS = ['reset', 'wdisplay', 'wstatusbar', 'wtitlebar', 'wconsole', 'directory', 'file', 'maindisplay', 'executable', 'media', 'link', 'broken', 'selected', 'empty']
+CONTEXT_KEYS = ['reset', 'in_display', 'in_statusbar', 'in_titlebar', 'in_console', 'directory', 'file', 'maindisplay', 'executable', 'media', 'link', 'broken', 'selected', 'empty', 'currentfile', 'hostname']
 
 class ColorSchemeContext():
 	pass
diff --git a/ranger/gui/wdisplay.py b/ranger/gui/wdisplay.py
index f021279b..00f73a93 100644
--- a/ranger/gui/wdisplay.py
+++ b/ranger/gui/wdisplay.py
@@ -46,13 +46,14 @@ class WDisplay(SuperClass):
 	def draw_directory(self):
 		from ranger.directory import Directory
 		import curses
+		import stat
 
 		self.target.show_hidden = self.show_hidden
 		self.target.load_content_if_outdated()
 		self.target.directories_first = self.directories_first
 		self.target.sort_if_outdated()
 
-		base_color = ['wdisplay']
+		base_color = ['in_display']
 
 		if self.main_display:
 			base_color.append('maindisplay')
@@ -73,10 +74,12 @@ class WDisplay(SuperClass):
 
 		selected_i = self.target.pointed_index
 		for line in range(self.hei):
-			# last file reached?
 			i = line + self.scroll_begin
-			try: drawed = self.target[i]
-			except IndexError: break
+
+			try:
+				drawed = self.target[i]
+			except IndexError:
+				break
 
 			this_color = base_color[:]
 
@@ -88,6 +91,9 @@ class WDisplay(SuperClass):
 			else:
 				this_color.append('file')
 
+			if drawed.stat is not None and drawed.stat.st_mode & stat.S_IXUSR:
+				this_color.append('executable')
+
 			if drawed.islink:
 				this_color.append('link')
 
diff --git a/ranger/gui/wtitlebar.py b/ranger/gui/wtitlebar.py
index 2ac8ae65..b95311dd 100644
--- a/ranger/gui/wtitlebar.py
+++ b/ranger/gui/wtitlebar.py
@@ -1,12 +1,33 @@
-import curses
+import curses, socket
 from ranger.gui.widget import Widget as SuperClass
 
+
 class WTitleBar(SuperClass):
 	def feed_env(self, env):
 		self.pathway = env.pathway
+		self.cf = env.cf
 
 	def draw(self):
 		self.win.move(self.y, self.x)
+
+		try:
+			self.color('in_titlebar', 'hostname')
+			self.win.addnstr(socket.gethostname(), self.wid)
+		except:
+			pass
+
 		for path in self.pathway:
 			currentx = self.win.getyx()[1]
-			self.win.addnstr(path.basename + ' / ', (self.wid - currentx))
+
+			if path.islink:
+				self.color('in_titlebar', 'link')
+			else:
+				self.color('in_titlebar', 'directory')
+
+			self.win.addnstr(path.basename + '/', max(self.wid - currentx, 0))
+		if self.cf is not None:
+			currentx = self.win.getyx()[1]
+			self.color('in_titlebar', 'file')
+			self.win.addnstr(self.cf.basename, max(self.wid - currentx, 0))
+		self.color_reset()
+