summaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
authorStephan Peijnik <debian@sp.or.at>2009-05-04 15:39:18 +0200
committerStephan Peijnik <debian@sp.or.at>2009-05-04 15:39:18 +0200
commitc639dfe4d9c77bf7406bb6e4b433c297d293f709 (patch)
treeaf0a28f0b268f9a5bc007bbd8b964f78ca9fb776 /doc
parent23d29169c30b2f05a0c2943832a7cf7288ff5802 (diff)
downloadpython-apt-c639dfe4d9c77bf7406bb6e4b433c297d293f709.tar.gz
More information available for fetch progress callbacks.
Better exception handling (we really shouldn't segfault on an exception).
Diffstat (limited to 'doc')
-rw-r--r--doc/examples/progress.py14
1 files changed, 10 insertions, 4 deletions
diff --git a/doc/examples/progress.py b/doc/examples/progress.py
index 2231001f..f7650f69 100644
--- a/doc/examples/progress.py
+++ b/doc/examples/progress.py
@@ -34,14 +34,20 @@ class TextFetchProgress(apt.FetchProgress):
def stop(self):
pass
- def updateStatus(self, uri, descr, shortDescr, status):
- print "UpdateStatus: '%s' '%s' '%s' '%i'" % (
- uri, descr, shortDescr, status)
+ def updateStatus(self, uri, descr, shortDescr, status, fileSize,
+ partialSize):
+ print "UpdateStatus: '%s' '%s' '%s' '%i' '%d/%d'" % (
+ uri, descr, shortDescr, status, partialSize, fileSize)
- def pulse(self):
+ def pulse(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):