diff options
author | hut <hut@lavabit.com> | 2010-03-19 16:45:27 +0100 |
---|---|---|
committer | hut <hut@lavabit.com> | 2010-03-19 16:45:27 +0100 |
commit | 3a9e3382f920f40a3d92bd7b8c304f87558eb04c (patch) | |
tree | e9aac32e81a9d857ac75bf7f1f918d83755a23f6 | |
parent | 14c8ed430806aa1be1abd9e8cbd6a0fe508b8469 (diff) | |
download | ranger-3a9e3382f920f40a3d92bd7b8c304f87558eb04c.tar.gz |
Added option "preview_directories"
-rw-r--r-- | ranger/defaults/keys.py | 1 | ||||
-rw-r--r-- | ranger/defaults/options.py | 1 | ||||
-rw-r--r-- | ranger/gui/widgets/browsercolumn.py | 7 | ||||
-rw-r--r-- | ranger/shared/settings.py | 1 |
4 files changed, 10 insertions, 0 deletions
diff --git a/ranger/defaults/keys.py b/ranger/defaults/keys.py index 3a8f4d95..ceff36a7 100644 --- a/ranger/defaults/keys.py +++ b/ranger/defaults/keys.py @@ -111,6 +111,7 @@ def initialize_commands(map): "//c//ollapse_preview flush//i//nput") map('bh', fm.toggle_boolean_option('show_hidden')) map('bp', fm.toggle_boolean_option('preview_files')) + map('bP', fm.toggle_boolean_option('preview_directories')) map('bi', fm.toggle_boolean_option('flushinput')) map('bd', fm.toggle_boolean_option('directories_first')) map('bc', fm.toggle_boolean_option('collapse_preview')) diff --git a/ranger/defaults/options.py b/ranger/defaults/options.py index 5b35a551..74450ba5 100644 --- a/ranger/defaults/options.py +++ b/ranger/defaults/options.py @@ -46,6 +46,7 @@ colorscheme = 'default' # Preview files on the rightmost column? # And collapse the last column if there is nothing to preview? preview_files = True +preview_directories = True max_filesize_for_preview = 300 * 1024 # 300kb collapse_preview = True diff --git a/ranger/gui/widgets/browsercolumn.py b/ranger/gui/widgets/browsercolumn.py index bcc48cd1..ed6b26d1 100644 --- a/ranger/gui/widgets/browsercolumn.py +++ b/ranger/gui/widgets/browsercolumn.py @@ -108,6 +108,10 @@ class BrowserColumn(Pager): if not self._preview_this_file(self.target): return False + if self.target.is_directory: + if not self.settings.preview_directories: + return False + return True def poke(self): @@ -173,6 +177,9 @@ class BrowserColumn(Pager): """Draw the contents of a directory""" import stat + if self.level > 0 and not self.settings.preview_directories: + return + base_color = ['in_browser'] self.target.use() diff --git a/ranger/shared/settings.py b/ranger/shared/settings.py index 7d67d83d..63d6d59a 100644 --- a/ranger/shared/settings.py +++ b/ranger/shared/settings.py @@ -34,6 +34,7 @@ ALLOWED_SETTINGS = { 'max_history_size': (int, type(None)), 'scroll_offset': int, 'preview_files': bool, + 'preview_directories': bool, 'flushinput': bool, 'colorscheme': str, 'hidden_filter': lambda x: isinstance(x, str) or hasattr(x, 'match'), |