summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--TODO2
-rw-r--r--ranger/fsobject/directory.py4
-rw-r--r--ranger/gui/widgets/statusbar.py9
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
19:14:15 +0000 committer James Booth <boothj5@gmail.com> 2014-02-16 19:14:15 +0000 Mock otr module for cmd_otr tests' href='/danisanti/profani-tty/commit/tests/otr/mock_otr.c?id=a21ab6d4c8d9de9abce9dddd1d23668779ca15e7'>a21ab6d4 ^
037ca818 ^



52f66fde ^
037ca818 ^

18e0884f ^





c0037608 ^


52f66fde ^
c0037608 ^

a21ab6d4 ^


4eac5c0d ^
a21ab6d4 ^





82ad0cd3 ^
a21ab6d4 ^

82ad0cd3 ^






037ca818 ^







18e0884f ^






c0037608 ^






e10ea1be ^
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97