eric6/Helpviewer/Download/DownloadUtilities.py

changeset 7220
5cf645f6daab
parent 7218
eaf2cf171f3a
parent 7211
1c97f3142fa8
child 7221
0485ccdf7877
diff -r eaf2cf171f3a -r 5cf645f6daab eric6/Helpviewer/Download/DownloadUtilities.py
--- a/eric6/Helpviewer/Download/DownloadUtilities.py	Sat Sep 07 14:45:27 2019 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,59 +0,0 @@
-# -*- coding: utf-8 -*-
-
-# Copyright (c) 2010 - 2019 Detlev Offenbach <detlev@die-offenbachs.de>
-#
-
-"""
-Module implementing some utility functions for the Download package.
-"""
-
-from __future__ import unicode_literals
-
-from PyQt5.QtCore import QCoreApplication
-
-from Globals import translate
-
-
-def timeString(timeRemaining):
-    """
-    Module function to format the given time.
-    
-    @param timeRemaining time to be formatted (float)
-    @return time string (string)
-    """
-    if timeRemaining > 60:
-        minutes = int(timeRemaining / 60)
-        seconds = int(timeRemaining % 60)
-        remaining = translate(
-            "DownloadUtilities",
-            "%n:{0:02} minutes remaining", "",
-            minutes).format(seconds)
-    else:
-        seconds = int(timeRemaining)
-        remaining = translate(
-            "DownloadUtilities",
-            "%n seconds remaining", "", seconds)
-    
-    return remaining
-
-
-def dataString(size):
-    """
-    Module function to generate a formatted size string.
-    
-    @param size size to be formatted (integer)
-    @return formatted data string (string)
-    """
-    unit = ""
-    if size < 1024:
-        unit = QCoreApplication.translate("DownloadUtilities", "Bytes")
-    elif size < 1024 * 1024:
-        size /= 1024
-        unit = QCoreApplication.translate("DownloadUtilities", "KiB")
-    elif size < 1024 * 1024 * 1024:
-        size /= 1024 * 1024
-        unit = QCoreApplication.translate("DownloadUtilities", "MiB")
-    else:
-        size /= 1024 * 1024 * 1024
-        unit = QCoreApplication.translate("DownloadUtilities", "GiB")
-    return "{0:.1f} {1}".format(size, unit)

eric ide

mercurial