From b1e8f48f012b93b28945f5a900f606ced061f7ee Mon Sep 17 00:00:00 2001 From: Marcel Partap Date: Tue, 15 Sep 2015 16:26:05 +0200 Subject: Add display of source size for copy/move tasks. --- ranger/core/loader.py | 10 ++++++---- 1 file 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 -- cgit 1.4.1-2-gfad0