From ab901030dbec4180254a680dd1c49016cfc36d4a Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Tue, 29 Aug 2006 23:11:17 +0200 Subject: * DistUpgrade/*: - added download time estimation (based on modem and 1Mbit DSL) --- DistUpgrade/DistUpgradeCache.py | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'DistUpgrade/DistUpgradeCache.py') diff --git a/DistUpgrade/DistUpgradeCache.py b/DistUpgrade/DistUpgradeCache.py index 455ef34f..e1f892ac 100644 --- a/DistUpgrade/DistUpgradeCache.py +++ b/DistUpgrade/DistUpgradeCache.py @@ -8,6 +8,7 @@ import re import logging from gettext import gettext as _ from DistUpgradeConfigParser import DistUpgradeConfig +from DistUpgradeView import FuzzyTimeToStr class MyCache(apt.Cache): # init @@ -35,6 +36,15 @@ class MyCache(apt.Cache): pm.GetArchives(fetcher, self._list, self._records) return fetcher.FetchNeeded @property + def estimatedDownloadTime(self): + """ get the estimated download time """ + requiredDownload = self.requiredDownload + timeModem = requiredDownload/(56*1024/8) # 56 kbit + timeDSL = requiredDownload/(1024*1024/8) # 1Mbit = 1024 kbit + s= _("The download will approximately take %s with a 56k modem and %s with " + "a 1Mbit DSL connection" % FuzzyTimeToStr(timeModem), FuzzyTimeToStr(timeDSL)) + return s + @property def additionalRequiredSpace(self): """ get the size of the additonal required space on the fs """ return self._depcache.UsrSize -- cgit v1.2.3