From 8b60e8caababb8342894f9e15c6e7630097741c0 Mon Sep 17 00:00:00 2001 From: hut Date: Wed, 2 Dec 2009 09:10:49 +0100 Subject: fixed non-accessible directories --- ranger/conf/colorschemes/snow.py | 2 +- ranger/directory.py | 6 +++++- ranger/gui/colorscheme.py | 2 +- ranger/gui/wdisplay.py | 12 ++++++------ 4 files changed, 13 insertions(+), 9 deletions(-) diff --git a/ranger/conf/colorschemes/snow.py b/ranger/conf/colorschemes/snow.py index ee2ecb4a..4bb00ca9 100644 --- a/ranger/conf/colorschemes/snow.py +++ b/ranger/conf/colorschemes/snow.py @@ -14,7 +14,7 @@ class MyColorScheme(ColorScheme): else: attr = normal - if context.empty: + if context.empty or context.error: bg = red if context.directory: diff --git a/ranger/directory.py b/ranger/directory.py index cb5b9ddc..55ca89a9 100644 --- a/ranger/directory.py +++ b/ranger/directory.py @@ -2,6 +2,7 @@ import ranger.fsobject from ranger.file import File #from ranger.helper import log +from ranger.fsobject import BAD_INFO from ranger.fsobject import FileSystemObject as SuperClass def sort_by_basename(path): @@ -78,9 +79,12 @@ class Directory(SuperClass): else: self.filenames = None self.files = None - self.infostring = superclass.BAD_INFO + self.infostring = BAD_INFO def sort(self): + if self.files is None: + return + old_pointed_file = self.pointed_file self.files.sort(key = sort_by_basename) diff --git a/ranger/gui/colorscheme.py b/ranger/gui/colorscheme.py index d6bf5cce..282a08ba 100644 --- a/ranger/gui/colorscheme.py +++ b/ranger/gui/colorscheme.py @@ -1,4 +1,4 @@ -CONTEXT_KEYS = [ 'reset', +CONTEXT_KEYS = [ 'reset', 'error', 'in_display', 'in_statusbar', 'in_titlebar', 'in_console', 'directory', 'file', 'hostname', 'executable', 'media', 'link', diff --git a/ranger/gui/wdisplay.py b/ranger/gui/wdisplay.py index 1379c24e..a1953001 100644 --- a/ranger/gui/wdisplay.py +++ b/ranger/gui/wdisplay.py @@ -84,18 +84,18 @@ class WDisplay(SuperClass): if self.main_display: base_color.append('maindisplay') - if self.target.empty(): - self.color(base_color, 'empty') - self.win.addnstr(self.y, self.x, "empty", self.wid) - self.color_reset() - return - if not self.target.accessible: self.color(base_color, 'error') self.win.addnstr(self.y, self.x, "not accessible", self.wid) self.color_reset() return + if self.target.empty(): + self.color(base_color, 'empty') + self.win.addnstr(self.y, self.x, "empty", self.wid) + self.color_reset() + return + self.set_scroll_begin() selected_i = self.target.pointed_index -- cgit 1.4.1-2-gfad0