diff options
-rw-r--r-- | TODO | 2 | ||||
-rw-r--r-- | ranger/fsobject/directory.py | 4 | ||||
-rw-r--r-- | ranger/gui/widgets/statusbar.py | 9 |
3 files changed, 13 insertions, 2 deletions
diff --git a/TODO b/TODO index d19beb47..bef08455 100644 --- a/TODO +++ b/TODO @@ -26,7 +26,7 @@ General (X) #30 10/01/06 add a way to create symlinks ( ) #32 10/01/08 place the (hidden) cursor to a meaningful position (X) #34 10/01/09 display free disk space - ( ) #35 10/01/09 display disk usage of files in current directory + (X) #35 10/01/09 display disk usage of files in current directory ( ) #36 10/01/11 help coloring is terribly inefficient ( ) #37 10/01/13 better tab completion for OpenConsole ( ) #38 10/01/16 searching in pager diff --git a/ranger/fsobject/directory.py b/ranger/fsobject/directory.py index 79b39f69..d007f66e 100644 --- a/ranger/fsobject/directory.py +++ b/ranger/fsobject/directory.py @@ -47,6 +47,7 @@ class Directory(FileSystemObject, Accumulator, SettingsAware): scroll_offset = 0 mount_path = '/' + disk_usage = 0 last_update_time = -1 load_content_mtime = -1 @@ -184,6 +185,9 @@ class Directory(FileSystemObject, Accumulator, SettingsAware): files.append(item) yield + self.disk_usage = sum(isinstance(f, File) and f.size or 0 \ + for f in files) + self.scroll_offset = 0 self.filenames = filenames self.infostring = ' %d' % len(self.filenames) # update the infostring diff --git a/ranger/gui/widgets/statusbar.py b/ranger/gui/widgets/statusbar.py index a1fc4973..2531206f 100644 --- a/ranger/gui/widgets/statusbar.py +++ b/ranger/gui/widgets/statusbar.py @@ -39,6 +39,7 @@ class StatusBar(Widget): old_cf = None old_mtime = None + old_du = None old_hint = None result = None @@ -79,6 +80,10 @@ class StatusBar(Widget): if not self.result: self.need_redraw = True + if self.old_du and not self.env.pwd.disk_usage: + self.old_du = self.env.pwd.disk_usage + self.need_redraw = True + if self.old_cf != self.env.cf: self.old_cf = self.env.cf self.need_redraw = True @@ -199,9 +204,11 @@ class StatusBar(Widget): max_pos = len(target) - self.column.hei base = 'scroll' + right.add(human_readable(target.disk_usage, seperator='')) + right.add(", ", "space") right.add(human_readable(self.env.get_free_space(target.mount_path), seperator='')) - right.add(" ", "space") + right.add(" ", "space") if target.marked_items: # Indicate that there are marked files. Useful if you scroll |