Globals: changed format of the data size output and added branch for TiB. micropython

Sat, 27 Jul 2019 15:40:51 +0200

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Sat, 27 Jul 2019 15:40:51 +0200
branch
micropython
changeset 7085
328f0f44aa95
parent 7084
3eddfc540614
child 7086
b757db426076

Globals: changed format of the data size output and added branch for TiB.

eric6/Globals/__init__.py file | annotate | diff | comparison | revisions
--- a/eric6/Globals/__init__.py	Fri Jul 26 20:05:49 2019 +0200
+++ b/eric6/Globals/__init__.py	Sat Jul 27 15:40:51 2019 +0200
@@ -446,19 +446,23 @@
     """
     if size < 1024:
         return QCoreApplication.translate(
-            "Globals", "{0:.1f} Bytes").format(size)
+            "Globals", "{0:4.2f} Bytes").format(size)
     elif size < 1024 * 1024:
         size /= 1024
         return QCoreApplication.translate(
-            "Globals", "{0:.1f} KiB").format(size)
+            "Globals", "{0:4.2f} KiB").format(size)
     elif size < 1024 * 1024 * 1024:
         size /= 1024 * 1024
         return QCoreApplication.translate(
-            "Globals", "{0:.2f} MiB").format(size)
-    else:
+            "Globals", "{0:4.2f} MiB").format(size)
+    elif size < 1024 * 1024 * 1024 * 1024:
         size /= 1024 * 1024 * 1024
         return QCoreApplication.translate(
-            "Globals", "{0:.2f} GiB").format(size)
+            "Globals", "{0:4.2f} GiB").format(size)
+    else:
+        size /= 1024 * 1024 * 1024 * 1024
+        return QCoreApplication.translate(
+            "Globals", "{0:4.2f} TiB").format(size)
 
 
 ###############################################################################

eric ide

mercurial