diff options
| author | Stephan Peijnik <debian@sp.or.at> | 2009-05-06 22:57:42 +0200 |
|---|---|---|
| committer | Stephan Peijnik <debian@sp.or.at> | 2009-05-06 22:57:42 +0200 |
| commit | 80f3ac59823b31be89dcb52b5ba38aa27d48121f (patch) | |
| tree | 521023c930ce6d98962beb7c6737e90a28dc9261 /apt/progress/__init__.py | |
| parent | c639dfe4d9c77bf7406bb6e4b433c297d293f709 (diff) | |
| parent | 1b5b026c1013dc20b572a7fd2a690fe451248ab0 (diff) | |
| download | python-apt-80f3ac59823b31be89dcb52b5ba38aa27d48121f.tar.gz | |
Merged with lp:python-apt.
Diffstat (limited to 'apt/progress/__init__.py')
| -rw-r--r-- | apt/progress/__init__.py | 25 |
1 files changed, 22 insertions, 3 deletions
diff --git a/apt/progress/__init__.py b/apt/progress/__init__.py index 68441cfa..3be197f7 100644 --- a/apt/progress/__init__.py +++ b/apt/progress/__init__.py @@ -107,14 +107,20 @@ class FetchProgress(object): def stop(self): """Called when all files have been fetched.""" - def updateStatus(self, uri, descr, shortDescr, status, fileSize, - partialSize): + def updateStatus(self, uri, descr, shortDescr, status): """Called when the status of an item changes. 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, items): + def pulse(self): """Called periodically to update the user interface. Return True to continue or False to cancel. @@ -126,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.""" |
