From 7327aab14542763cdd1e135ed5317fccab1d51d4 Mon Sep 17 00:00:00 2001 From: hut Date: Wed, 14 Apr 2010 16:34:34 +0200 Subject: widgets.browsercolumn: added sanity check when clicking on preview --- ranger/gui/widgets/browsercolumn.py | 29 +++++++++++++++-------------- 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/ranger/gui/widgets/browsercolumn.py b/ranger/gui/widgets/browsercolumn.py index 0ef37ef1..7d38576d 100644 --- a/ranger/gui/widgets/browsercolumn.py +++ b/ranger/gui/widgets/browsercolumn.py @@ -95,20 +95,21 @@ class BrowserColumn(Pager): pass elif self.target.type is T_DIRECTORY: - index = self.scroll_begin + event.y - self.y - - if event.pressed(1): - if not self.main_column: - self.fm.enter_dir(self.target.path) - - if index < len(self.target): - self.fm.move_pointer(absolute = index) - elif event.pressed(3): - try: - clicked_file = self.target.files[index] - self.fm.enter_dir(clicked_file.path) - except: - pass + if self.target.accessible and self.target.content_loaded: + index = self.scroll_begin + event.y - self.y + + if event.pressed(1): + if not self.main_column: + self.fm.enter_dir(self.target.path) + + if index < len(self.target): + self.fm.move_pointer(absolute = index) + elif event.pressed(3): + try: + clicked_file = self.target.files[index] + self.fm.enter_dir(clicked_file.path) + except: + pass else: if self.level > 0: -- cgit 1.4.1-2-gfad0