From f700c53fd9baa4d82adcfd8d0217ba2cfbab6254 Mon Sep 17 00:00:00 2001 From: Dimitur Kirov Date: Sun, 7 Aug 2005 12:55:34 +0000 Subject: [PATCH] show file size with 1 unit after the floating point --- src/gtkgui_helpers.py | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/src/gtkgui_helpers.py b/src/gtkgui_helpers.py index 8aa12a893..87c5cd8d5 100644 --- a/src/gtkgui_helpers.py +++ b/src/gtkgui_helpers.py @@ -35,21 +35,18 @@ def convert_bytes(string): suffix = '' bytes = int(string) if bytes >= 1024: - bytes /= 1024 + bytes = round(bytes/1024.,1) if bytes >= 1024: - bytes /= 1024 + bytes = round(bytes/1024.,1) if bytes >= 1024: - bytes /= 1024 + bytes = round(bytes/1024.,1) suffix = _('%s Gb') else: suffix = _('%s Mb') else: suffix = _('%s Kb') else: - if bytes == 1: - suffix = _('%s byte') - else: - suffix = _('%s bytes') + suffix = _('%s b') return suffix % str(bytes) def escape_for_pango_markup(string):