summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorhut <hut@lavabit.com>2009-12-20 02:25:14 +0100
committerhut <hut@lavabit.com>2009-12-20 02:25:14 +0100
commit7d9ae552154dc4f0214a80cbd1e0fd17efba1e6c (patch)
tree37c53cf4a5e46c81331d17578d382337798e7ba1
parent1bc3dd5931da7474332d421418dffdba39de7b50 (diff)
downloadranger-7d9ae552154dc4f0214a80cbd1e0fd17efba1e6c.tar.gz
postpone directory previews if not loaded yet
-rw-r--r--ranger/gui/ui.py1
-rw-r--r--ranger/gui/widgets/filelist.py21
2 files changed, 19 insertions, 3 deletions
diff --git a/ranger/gui/ui.py b/ranger/gui/ui.py
index 190e5bb8..2cb66f2f 100644
--- a/ranger/gui/ui.py
+++ b/ranger/gui/ui.py
@@ -140,6 +140,7 @@ class UI(DisplayableContainer):
 		"""Erase the window, then draw all objects in the container"""
 		self.win.erase()
 		DisplayableContainer.draw(self)
+		self.win.refresh()
 
 	def finalize(self):
 		"""Finalize every object in container and refresh the window"""
diff --git a/ranger/gui/widgets/filelist.py b/ranger/gui/widgets/filelist.py
index 7a5e38da..f5b69e26 100644
--- a/ranger/gui/widgets/filelist.py
+++ b/ranger/gui/widgets/filelist.py
@@ -6,6 +6,7 @@ class FileList(Widget):
 	display_infostring = False
 	scroll_begin = 0
 	target = None
+	postpone_drawing = False
 
 	def __init__(self, win, level):
 		Widget.__init__(self, win)
@@ -72,7 +73,13 @@ class FileList(Widget):
 			self.draw_directory()
 #		else:
 #			self.win.addnstr(self.y, self.x, "unknown type.", self.wid)
-	
+
+	def finalize(self):
+		if self.postpone_drawing:
+			self.target.load_content_if_outdated()
+			self.draw_directory()
+			self.postpone_drawing = False
+
 	def _preview_this_file(self, target):
 		return target.document and not self.settings.preview_files
 
@@ -99,12 +106,20 @@ class FileList(Widget):
 		from ranger.fsobject.directory import Directory
 		import stat
 
+		base_color = ['in_display']
+
 		self.target.use()
+
+		if not self.target.content_loaded:
+			self.color(base_color)
+			self.win.addnstr(self.y, self.x, "...", self.wid)
+			self.color_reset()
+			self.postpone_drawing = True
+			return
+
 		self.target.load_content_if_outdated()
 		self.target.sort_if_outdated()
 
-		base_color = ['in_display']
-
 		if self.main_display:
 			base_color.append('maindisplay')