diff options
| author | Michael Vogt <michael.vogt@ubuntu.com> | 2009-05-05 11:59:53 +0200 |
|---|---|---|
| committer | Michael Vogt <michael.vogt@ubuntu.com> | 2009-05-05 11:59:53 +0200 |
| commit | 1b5b026c1013dc20b572a7fd2a690fe451248ab0 (patch) | |
| tree | 521023c930ce6d98962beb7c6737e90a28dc9261 /doc | |
| parent | 51c60cb3447247188bb8bf5c82b53e5199878b36 (diff) | |
| download | python-apt-1b5b026c1013dc20b572a7fd2a690fe451248ab0.tar.gz | |
* apt/progress/__init__.py:
- add update_status_full() that takes file_size/partial_size as
additional callback arguments
- add pulse_items() that takes a addtional "items" tuple that
gives the user full access to the individual items that are
fetched
* python/progress.cc:
- low level code for update_status_full and pulse_items()
Diffstat (limited to 'doc')
| -rw-r--r-- | doc/examples/progress.py | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/doc/examples/progress.py b/doc/examples/progress.py index 2231001f..c007681f 100644 --- a/doc/examples/progress.py +++ b/doc/examples/progress.py @@ -35,15 +35,31 @@ class TextFetchProgress(apt.FetchProgress): pass def updateStatus(self, uri, descr, shortDescr, status): - print "UpdateStatus: '%s' '%s' '%s' '%i'" % ( + print "UpdateStatus: '%s' '%s' '%s' '%i' " % ( uri, descr, shortDescr, status) + def update_status_full(self, uri, descr, shortDescr, status, fileSize, + partialSize): + print "update_status_full: '%s' '%s' '%s' '%i' '%d/%d'" % ( + uri, descr, shortDescr, status, partialSize, fileSize) + def pulse(self): print "Pulse: CPS: %s/s; Bytes: %s/%s; Item: %s/%s" % ( apt.SizeToStr(self.currentCPS), apt.SizeToStr(self.currentBytes), apt.SizeToStr(self.totalBytes), self.currentItems, self.totalItems) return True + def pulse_items(self, items): + print "Pulse: CPS: %s/s; Bytes: %s/%s; Item: %s/%s" % ( + apt.SizeToStr(self.currentCPS), apt.SizeToStr(self.currentBytes), + apt.SizeToStr(self.totalBytes), self.currentItems, self.totalItems) + print "Pulse-Items: " + for itm in items: + uri, descr, shortDescr, fileSize, partialSize = itm + print " - '%s' '%s' '%s' '%d/%d'" % ( + uri, descr, shortDescr, partialSize, fileSize) + return True + def mediaChange(self, medium, drive): print "Please insert medium %s in drive %s" % (medium, drive) sys.stdin.readline() |
