summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorhut <hut@lavabit.com>2009-12-28 23:25:49 +0100
committerhut <hut@lavabit.com>2009-12-28 23:25:49 +0100
commitb19e53f9f6b25bfcc6c5e03f7078c8d0a14790e1 (patch)
treeda4e124d0471041c45006ad8476c6ede730a5e0e
parentf376e337c0fd4a0a855bc868de3cb94865ca77c4 (diff)
downloadranger-b19e53f9f6b25bfcc6c5e03f7078c8d0a14790e1.tar.gz
sub-windows are working well now
-rw-r--r--ranger/gui/displayable.py11
-rw-r--r--ranger/gui/widgets/console.py3
-rw-r--r--ranger/gui/widgets/filelist.py40
3 files changed, 27 insertions, 27 deletions
diff --git a/ranger/gui/displayable.py b/ranger/gui/displayable.py
index 4604f881..e876927b 100644
--- a/ranger/gui/displayable.py
+++ b/ranger/gui/displayable.py
@@ -140,13 +140,16 @@ class Displayable(EnvironmentAware, FileManagerAware, SettingsAware):
 			if y + hei > maxy:
 				raise OutOfBoundsException("Y out of bounds!")
 
-		self.win.mvderwin(0, 0)
 		try:
 			self.win.resize(hei, wid)
 		except:
-			log(self.__class__)
-			log("failed to resize {0}x{1}  {2}x{3}".format(y,x,hei,wid))
-		log("moving {2} to {0}x{1}".format(y, x, self.__class__.__name__))
+			# Not enough space for resizing...
+			try:
+				self.win.mvderwin(0, 0)
+				self.win.resize(hei, wid)
+			except:
+				raise OutOfBoundsException("Resizing Failed!")
+
 		self.win.mvderwin(y, x)
 		self.absx = x
 		self.absy = y
diff --git a/ranger/gui/widgets/console.py b/ranger/gui/widgets/console.py
index 2d3f9b4c..52a8963b 100644
--- a/ranger/gui/widgets/console.py
+++ b/ranger/gui/widgets/console.py
@@ -46,7 +46,8 @@ class Console(Widget):
 
 	def finalize(self):
 		try:
-			self.win.move(self.y, self.x + self.pos + len(self.prompt))
+			self.fm.ui.win.move(self.absy,
+					self.absx + self.pos + len(self.prompt))
 		except:
 			pass
 
diff --git a/ranger/gui/widgets/filelist.py b/ranger/gui/widgets/filelist.py
index 9bbfb8f6..12f0c99a 100644
--- a/ranger/gui/widgets/filelist.py
+++ b/ranger/gui/widgets/filelist.py
@@ -2,6 +2,7 @@
 from . import Widget
 from ..displayable import DisplayableContainer
 from .pager import Pager
+from ranger import log
 
 class FileList(Widget, DisplayableContainer):
 	main_display = False
@@ -208,32 +209,27 @@ class FileList(Widget, DisplayableContainer):
 				this_color.append(drawed.exists and 'good' or 'bad')
 
 			string = drawed.basename
-			if self.main_display:
-				if tagged:
-					if self.wid > 1:
-						self.win.addnstr(self.y + line, self.x,
+			try:
+				if self.main_display:
+					if tagged:
+						if self.wid > 1:
+							self.win.addnstr(self.y + line, self.x,
+									text, self.wid - 2)
+					elif self.wid > 2:
+						self.win.addnstr(self.y + line, self.x + 1,
 								text, self.wid - 2)
-				elif self.wid > 2:
-					self.win.addnstr(self.y + line, self.x + 1,
-							text, self.wid - 2)
-			else:
-				try:
+				else:
 					self.win.addnstr(self.y + line, self.x, text, self.wid)
-				except:
-					# the last string will cause an error because
-					# ncurses tries to move out of the bounds
-					pass
 
-			if self.display_infostring and drawed.infostring:
-				info = drawed.infostring
-				x = self.x + self.wid - 1 - len(info)
-				if x > self.x:
-					try:
+				if self.display_infostring and drawed.infostring:
+					info = drawed.infostring
+					x = self.x + self.wid - 1 - len(info)
+					if x > self.x:
 						self.win.addstr(self.y + line, x, str(info) + ' ')
-					except:
-						# the last string will cause an error because
-						# ncurses tries to move out of the bounds
-						pass
+			except:
+				# the last string will cause an error because
+				# ncurses tries to move out of the bounds
+				pass
 
 			self.color_at(self.y + line, self.x, self.wid, this_color)