summaryrefslogtreecommitdiff
path: root/DistUpgrade/DistUpgradeView.py
diff options
context:
space:
mode:
authorglatzor@ubuntu.com <>2006-09-09 23:02:52 +0200
committerglatzor@ubuntu.com <>2006-09-09 23:02:52 +0200
commita5a1685317f25de0a0d7bd8ccc5317a17fa219bf (patch)
tree4eaf74f7e56334a1a8c787b2ac5d8ee1f675c3bd /DistUpgrade/DistUpgradeView.py
parent650cb474d23914be801af09d5f9c31cfc9765b07 (diff)
parente4b06af1ace3bbb4281a9c762113f8a2699116c3 (diff)
downloadpython-apt-a5a1685317f25de0a0d7bd8ccc5317a17fa219bf.tar.gz
* merge with mvo
Diffstat (limited to 'DistUpgrade/DistUpgradeView.py')
-rw-r--r--DistUpgrade/DistUpgradeView.py32
1 files changed, 31 insertions, 1 deletions
diff --git a/DistUpgrade/DistUpgradeView.py b/DistUpgrade/DistUpgradeView.py
index 4b24ee7f..9fda83d4 100644
--- a/DistUpgrade/DistUpgradeView.py
+++ b/DistUpgrade/DistUpgradeView.py
@@ -19,11 +19,38 @@
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
# USA
+from gettext import gettext as _
+
+def FuzzyTimeToStr(sec):
+ " return the time a bit fuzzy (no seconds if time > 60 secs "
+ if sec > 60*60*24:
+ return _("%li days %li hours %li minutes") % (sec/60/60/24, (sec/60/60) % 24, (sec/60) % 60)
+ if sec > 60*60:
+ return _("%li hours %li minutes") % (sec/60/60, (sec/60) % 60)
+ if sec > 60:
+ return _("%li minutes") % (sec/60)
+ return _("%li seconds") % sec
+
+def estimatedDownloadTime(requiredDownload):
+ """ get the estimated download time """
+ timeModem = requiredDownload/(56*1024/8) # 56 kbit
+ timeDSL = requiredDownload/(1024*1024/8) # 1Mbit = 1024 kbit
+ s= _("This download will take about %s with a 56k modem and about %s with "
+ "a 1Mbit DSL connection" % (FuzzyTimeToStr(timeModem), FuzzyTimeToStr(timeDSL)))
+ return s
+
+
class DumbTerminal(object):
def call(self, cmd):
" expects a command in the subprocess style (as a list) "
subprocess.call(cmd)
-
+
+
+(STEP_PREPARE,
+ STEP_MODIFY_SOURCES,
+ STEP_FETCH_INSTALL,
+ STEP_CLEANUP,
+ STEP_REBOOT) = range(1,6)
class DistUpgradeView(object):
" abstraction for the upgrade view "
@@ -54,6 +81,9 @@ class DistUpgradeView(object):
5. Complete
"""
pass
+ def hideStep(self, step):
+ " hide a certain step from the GUI "
+ pass
def confirmChanges(self, summary, changes, downloadSize, actions=None):
""" display the list of changed packages (apt.Package) and
return if the user confirms them