about summary refs log tree commit diff stats
path: root/ranger
diff options
context:
space:
mode:
authorhut <hut@lavabit.com>2009-12-25 06:54:56 +0100
committerhut <hut@lavabit.com>2009-12-25 06:54:56 +0100
commit5b4dd42744f16b68e6f6e4736a64326e13e2b260 (patch)
tree8237b6071f92f5eb63c274e2d9af10cc2a1bb5b8 /ranger
parent7fe6d250b44c1f06d4b578b8cdbd4fb055dedc28 (diff)
downloadranger-5b4dd42744f16b68e6f6e4736a64326e13e2b260.tar.gz
don't reconstruct statusbar if nothing changed
Diffstat (limited to 'ranger')
-rw-r--r--ranger/gui/widgets/statusbar.py23
1 files changed, 20 insertions, 3 deletions
diff --git a/ranger/gui/widgets/statusbar.py b/ranger/gui/widgets/statusbar.py
index c3c5e74e..6913672d 100644
--- a/ranger/gui/widgets/statusbar.py
+++ b/ranger/gui/widgets/statusbar.py
@@ -17,6 +17,11 @@ class StatusBar(Widget):
 	timeformat = '%Y-%m-%d %H:%M'
 	override = None
 
+	old_cf = None
+	old_mtime = None
+	old_wid = None
+	result = None
+
 	def __init__(self, win, filelist=None):
 		Widget.__init__(self, win)
 		self.filelist = filelist
@@ -31,9 +36,21 @@ class StatusBar(Widget):
 		if self.override and isinstance(self.override, str):
 			self._draw_message()
 		else:
-			left = self._get_left_part()
-			right = self._get_right_part()
-			self._print_result(self._combine_parts(left, right))
+			try:
+				mtime = self.env.cf.stat.st_mtime
+			except:
+				mtime = -1
+			if not self.result or self.old_cf != self.env.cf or \
+					mtime != self.old_mtime or self.old_wid != self.wid:
+				self.old_mtime = mtime
+				self.old_cf = self.env.cf
+				self.old_wid = self.wid
+
+				left = self._get_left_part()
+				right = self._get_right_part()
+
+				self.result = self._combine_parts(left, right)
+			self._print_result(self.result)
 	
 	def _draw_message(self):
 		highlight = True