diff options
Diffstat (limited to 'doc/examples/progress.py')
| -rw-r--r-- | doc/examples/progress.py | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/doc/examples/progress.py b/doc/examples/progress.py index b90253cb..39e73e70 100644 --- a/doc/examples/progress.py +++ b/doc/examples/progress.py @@ -4,7 +4,9 @@ import sys import time import string + class TextProgress(apt.OpProgress): + def __init__(self): self.last=0.0 @@ -21,6 +23,7 @@ class TextProgress(apt.OpProgress): class TextFetchProgress(apt.FetchProgress): + def __init__(self): pass @@ -32,6 +35,7 @@ class TextFetchProgress(apt.FetchProgress): def updateStatus(self, uri, descr, shortDescr, status): print "UpdateStatus: '%s' '%s' '%s' '%i'" % (uri,descr,shortDescr, status) + def pulse(self): print "Pulse: CPS: %s/s; Bytes: %s/%s; Item: %s/%s" % (SizeToStr(self.currentCPS), SizeToStr(self.currentBytes), SizeToStr(self.totalBytes), self.currentItems, self.totalItems) return True @@ -43,15 +47,20 @@ class TextFetchProgress(apt.FetchProgress): class TextInstallProgress(apt.InstallProgress): + def __init__(self): apt.InstallProgress.__init__(self) pass + def startUpdate(self): print "StartUpdate" + def finishUpdate(self): print "FinishUpdate" + def statusChange(self, pkg, percent, status): print "[%s] %s: %s" % (percent, pkg, status) + def updateInterface(self): apt.InstallProgress.updateInterface(self) # usefull to e.g. redraw a GUI @@ -59,17 +68,22 @@ class TextInstallProgress(apt.InstallProgress): class TextCdromProgress(apt.CdromProgress): + def __init__(self): pass + # update is called regularly so that the gui can be redrawn + def update(self, text, step): # check if we actually have some text to display if text != "": print "Update: %s %s" % (string.strip(text), step) + def askCdromName(self): print "Please enter cd-name: ", cd_name = sys.stdin.readline() return (True, string.strip(cd_name)) + def changeCdrom(self): print "Please insert cdrom and press <ENTER>" answer = sys.stdin.readline() |
