From ba6d518ee6b8e48d1ff9de1cc83a8efcbd6ca4c9 Mon Sep 17 00:00:00 2001 From: hut Date: Mon, 12 Apr 2010 10:38:27 +0200 Subject: Fixed handling of directories with GC'd subdirs --- ranger/fsobject/directory.py | 5 +++-- ranger/gui/widgets/statusbar.py | 11 ++++++----- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/ranger/fsobject/directory.py b/ranger/fsobject/directory.py index bf626004..3574f329 100644 --- a/ranger/fsobject/directory.py +++ b/ranger/fsobject/directory.py @@ -237,6 +237,7 @@ class Directory(FileSystemObject, Accumulator, SettingsAware): Loads the contents of the directory. Use this sparingly since it takes rather long. """ + self.content_outdated = False if not self.loading: self.load_once() @@ -370,8 +371,7 @@ class Directory(FileSystemObject, Accumulator, SettingsAware): if self.load_content_once(*a, **k): return True - if self.content_outdated: - self.content_outdated = False + if self.files is None or self.content_outdated: self.load_content(*a, **k) return True @@ -403,6 +403,7 @@ class Directory(FileSystemObject, Accumulator, SettingsAware): """The number of containing files""" if not self.accessible or not self.content_loaded: raise ranger.fsobject.NotLoadedYet() + assert self.files is not None return len(self.files) def __eq__(self, other): diff --git a/ranger/gui/widgets/statusbar.py b/ranger/gui/widgets/statusbar.py index 75fbbe89..78666a3d 100644 --- a/ranger/gui/widgets/statusbar.py +++ b/ranger/gui/widgets/statusbar.py @@ -146,10 +146,9 @@ class StatusBar(Widget): else: target = self.env.at_level(0).pointed_obj - if target is None: - return - - if target.accessible is False: + if target is None \ + or not target.accessible \ + or (target.is_directory and target.files is None): return perms = target.get_permission_string() @@ -208,7 +207,9 @@ class StatusBar(Widget): if target is None: return - if not target.content_loaded or not target.accessible: + if target is None \ + or not target.accessible \ + or (target.is_directory and target.files is None): return pos = target.scroll_begin -- cgit 1.4.1-2-gfad0