summaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
authorMichael Vogt <michael.vogt@ubuntu.com>2009-07-20 15:37:25 +0200
committerMichael Vogt <michael.vogt@ubuntu.com>2009-07-20 15:37:25 +0200
commit8f9c131d127a59e5ea4ce3eed8d96be1766399f0 (patch)
treee796847cae94cb1a1ca93339a085b395a981503f /doc
parent87f6d28c1555ee70da9dddb9625cea0c4d6ab9a5 (diff)
parent53f514317550cc09ad3c3fb9503be51d88e3d31d (diff)
downloadpython-apt-8f9c131d127a59e5ea4ce3eed8d96be1766399f0.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() - better threading support * aptsources/distro.py: - fix indent error that causes incorrect sources.list additons (LP: #372224) * python/progress.cc: - fix crash in RunSimpleCallback() * apt/cache.py: - when the cache is run with a alternative rootdir, create required dirs/files automatically
Diffstat (limited to 'doc')
-rw-r--r--doc/examples/progress.py18
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()