diff options
author | hut <hut@lavabit.com> | 2011-10-22 05:04:29 +0200 |
---|---|---|
committer | hut <hut@lavabit.com> | 2011-10-22 05:04:29 +0200 |
commit | 3c0fd67fd5581bb1aaa84c957b568abdb5dc1a54 (patch) | |
tree | 5ac0a2797b9b2088da881006242cbf83aed93f89 | |
parent | 2970f6158daa8783302ce7005fe5b30d3b93d39e (diff) | |
download | ranger-3c0fd67fd5581bb1aaa84c957b568abdb5dc1a54.tar.gz |
Added option "autoupdate_cumulative_size"
-rw-r--r-- | ranger/container/settingobject.py | 1 | ||||
-rw-r--r-- | ranger/defaults/options.py | 6 | ||||
-rw-r--r-- | ranger/defaults/rc.conf | 1 | ||||
-rw-r--r-- | ranger/fsobject/directory.py | 10 |
4 files changed, 16 insertions, 2 deletions
diff --git a/ranger/container/settingobject.py b/ranger/container/settingobject.py index 5c24d663..51c12c6e 100644 --- a/ranger/container/settingobject.py +++ b/ranger/container/settingobject.py @@ -19,6 +19,7 @@ from ranger.core.shared import FileManagerAware ALLOWED_SETTINGS = { 'autosave_bookmarks': bool, + 'autoupdate_cumulative_size': bool, 'collapse_preview': bool, 'colorscheme_overlay': (type(None), type(lambda:0)), 'colorscheme': str, diff --git a/ranger/defaults/options.py b/ranger/defaults/options.py index 3b44d4f6..92b9ada9 100644 --- a/ranger/defaults/options.py +++ b/ranger/defaults/options.py @@ -104,6 +104,12 @@ padding_right = True # When false, bookmarks are saved when ranger is exited. autosave_bookmarks = True +# You can display the "real" cumulative size of directories by using the +# command :get_cumulative_size or typing "dc". The size is expensive to +# calculate and will not be updated automatically. You can choose +# to update it automatically though by turning on this option: +autoupdate_cumulative_size = False + # Makes sense for screen readers: show_cursor = False diff --git a/ranger/defaults/rc.conf b/ranger/defaults/rc.conf index b75c188e..b8106663 100644 --- a/ranger/defaults/rc.conf +++ b/ranger/defaults/rc.conf @@ -228,6 +228,7 @@ map zm toggle_option mouse_enabled map zp toggle_option preview_files map zP toggle_option preview_directories map zs toggle_option sort_case_insensitive +map zu toggle_option autoupdate_cumulative_size map zv toggle_option use_preview_script map zf console filter diff --git a/ranger/fsobject/directory.py b/ranger/fsobject/directory.py index ce6be623..bc09b080 100644 --- a/ranger/fsobject/directory.py +++ b/ranger/fsobject/directory.py @@ -193,8 +193,14 @@ class Directory(FileSystemObject, Accumulator, Loadable, SettingsAware): # If self.content_loaded is true, this is not the first # time loading. So I can't really be sure if the # size has changed and I'll add a "?". - self.infostring = ' %s' % (human_readable(self.size, - separator=('? ' if self.content_loaded else ' '))) + if self.content_loaded: + if self.fm.settings.autoupdate_cumulative_size: + self.look_up_cumulative_size() + else: + self.infostring = ' %s' % human_readable( + self.size, separator='? ') + else: + self.infostring = ' %s' % human_readable(self.size) else: self.size = len(filelist) self.infostring = ' %d' % self.size |