diff options
| author | Michael Vogt <michael.vogt@ubuntu.com> | 2009-07-20 15:37:25 +0200 |
|---|---|---|
| committer | Michael Vogt <michael.vogt@ubuntu.com> | 2009-07-20 15:37:25 +0200 |
| commit | 8f9c131d127a59e5ea4ce3eed8d96be1766399f0 (patch) | |
| tree | e796847cae94cb1a1ca93339a085b395a981503f /apt/progress | |
| parent | 87f6d28c1555ee70da9dddb9625cea0c4d6ab9a5 (diff) | |
| parent | 53f514317550cc09ad3c3fb9503be51d88e3d31d (diff) | |
| download | python-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 'apt/progress')
| -rw-r--r-- | apt/progress/__init__.py | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/apt/progress/__init__.py b/apt/progress/__init__.py index 769942ce..3be197f7 100644 --- a/apt/progress/__init__.py +++ b/apt/progress/__init__.py @@ -112,6 +112,13 @@ class FetchProgress(object): This happens eg. when the downloads fails or is completed. """ + def update_status_full(self, uri, descr, short_descr, status, file_size, + partial_size): + """Called when the status of an item changes. + + This happens eg. when the downloads fails or is completed. This + version include information on current filesize and partial size + """ def pulse(self): """Called periodically to update the user interface. @@ -125,6 +132,19 @@ class FetchProgress(object): float(self.currentCPS)) return True + def pulse_items(self, items): + """Called periodically to update the user interface. + This function includes details about the items being fetched + Return True to continue or False to cancel. + + """ + self.percent = (((self.currentBytes + self.currentItems) * 100.0) / + float(self.totalBytes + self.totalItems)) + if self.currentCPS > 0: + self.eta = ((self.totalBytes - self.currentBytes) / + float(self.currentCPS)) + return True + def mediaChange(self, medium, drive): """react to media change events.""" |
