summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorMarcel Partap <mpartap@gmx.net>2015-09-15 16:26:05 +0200
committerhut <hut@lepus.uberspace.de>2015-10-20 13:27:07 +0200
commitb1e8f48f012b93b28945f5a900f606ced061f7ee (patch)
treebe379c071170a6cfeae01ea99b4a87ecb613ac35
parent60d5880785647a9c4c8fbee760fac4ef4179ec30 (diff)
downloadranger-b1e8f48f012b93b28945f5a900f606ced061f7ee.tar.gz
Add display of source size for copy/move tasks.
-rw-r--r--ranger/core/loader.py10
1 files changed, 6 insertions, 4 deletions
diff --git a/ranger/core/loader.py b/ranger/core/loader.py
index 411b16ec..2184d2b1 100644
--- a/ranger/core/loader.py
+++ b/ranger/core/loader.py
@@ -6,6 +6,7 @@ from time import time, sleep
 from subprocess import Popen, PIPE
 from ranger.core.shared import FileManagerAware
 from ranger.ext.signals import SignalDispatcher
+from ranger.ext.human_readable import human_readable
 import math
 import os.path
 import sys
@@ -77,13 +78,14 @@ class CopyLoader(Loadable, FileManagerAware):
             # TODO: Don't calculate size when renaming (needs detection)
             bytes_per_tick = shutil_g.BLOCK_SIZE
             size = max(1, self._calculate_size(bytes_per_tick))
+            size_str = " (" + human_readable(self._calculate_size(1)) + ")"
             done = 0
             if self.do_cut:
                 self.original_copy_buffer.clear()
                 if len(self.copy_buffer) == 1:
-                    self.description = "moving: " + self.one_file.path
+                    self.description = "moving: " + self.one_file.path + size_str
                 else:
-                    self.description = "moving files from: " + self.one_file.dirname
+                    self.description = "moving files from: " + self.one_file.dirname + size_str
                 for f in self.copy_buffer:
                     for tf in self.fm.tags.tags:
                         if tf == f.path or str(tf).startswith(f.path):
@@ -101,9 +103,9 @@ class CopyLoader(Loadable, FileManagerAware):
                     done += d
             else:
                 if len(self.copy_buffer) == 1:
-                    self.description = "copying: " + self.one_file.path
+                    self.description = "copying: " + self.one_file.path + size_str
                 else:
-                    self.description = "copying files from: " + self.one_file.dirname
+                    self.description = "copying files from: " + self.one_file.dirname + size_str
                 for f in self.copy_buffer:
                     if os.path.isdir(f.path) and not os.path.islink(f.path):
                         d = 0