summaryrefslogtreecommitdiff
path: root/doc/examples/progress.py
diff options
context:
space:
mode:
authorMichael Vogt <michael.vogt@ubuntu.com>2009-01-13 17:22:27 +0100
committerMichael Vogt <michael.vogt@ubuntu.com>2009-01-13 17:22:27 +0100
commit38d602dc83006c51dfe4ed594d691ea9b0679498 (patch)
treeb7aedfba82c44cad6c3012f879b5d6d7e8ad1425 /doc/examples/progress.py
parent12cf58d12b969010f3d98b2974d72bbb950b775f (diff)
parent614897f798d9f16591fbd29ebe2a6c5674102d2d (diff)
downloadpython-apt-38d602dc83006c51dfe4ed594d691ea9b0679498.tar.gz
* apt/*.py:
- Almost complete cleanup of the code - Remove inconsistent use of tabs and spaces (Closes: #505443) - Improved documentation * apt/debfile.py: - Drop get*() methods, as they are deprecated and were never in a stable release - Make DscSrcPackage working * apt/gtk/widgets.py: - Fix the code and document the signals * Introduce new documentation build with Sphinx - Contains style Guide (Closes: #481562) - debian/rules: Build the documentation here - setup.py: Remove pydoc building and add new docs. - debian/examples: Include examples from documentation - debian/python-apt.docs: + Change html/ to build/doc/html. + Add build/doc/text for the text-only documentation * setup.py: - Only create build/data when building, not all the time - Remove build/mo and build/data on clean -a * debian/control: - Remove the Conflicts on python2.3-apt, python2.4-apt, as they are only needed for oldstable (sarge) - Build-Depend on python-sphinx (>= 0.5) * aptsources/distinfo.py: - Allow @ in mirror urls (Closes: #478171) (LP: #223097) * Merge Ben Finney's whitespace changes (Closes: #481563) * Merge Ben Finney's do not use has_key() (Closes: #481878) * Do not use deprecated form of raise statement (Closes: #494259) * Add support for PkgRecords.SHA256Hash (Closes: #456113)
Diffstat (limited to 'doc/examples/progress.py')
-rw-r--r--doc/examples/progress.py38
1 files changed, 27 insertions, 11 deletions
diff --git a/doc/examples/progress.py b/doc/examples/progress.py
index 2723c382..83847598 100644
--- a/doc/examples/progress.py
+++ b/doc/examples/progress.py
@@ -1,10 +1,11 @@
-import apt
-from apt import SizeToStr
import sys
import time
-import string
+
+import apt
+
class TextProgress(apt.OpProgress):
+
def __init__(self):
self.last=0.0
@@ -21,37 +22,47 @@ class TextProgress(apt.OpProgress):
class TextFetchProgress(apt.FetchProgress):
+
def __init__(self):
pass
-
+
def start(self):
pass
-
+
def stop(self):
pass
-
+
def updateStatus(self, uri, descr, shortDescr, status):
- print "UpdateStatus: '%s' '%s' '%s' '%i'" % (uri,descr,shortDescr, status)
+ print "UpdateStatus: '%s' '%s' '%s' '%i'" % (
+ uri, descr, shortDescr, status)
+
def pulse(self):
- print "Pulse: CPS: %s/s; Bytes: %s/%s; Item: %s/%s" % (SizeToStr(self.currentCPS), SizeToStr(self.currentBytes), SizeToStr(self.totalBytes), self.currentItems, self.totalItems)
+ print "Pulse: CPS: %s/s; Bytes: %s/%s; Item: %s/%s" % (
+ apt.SizeToStr(self.currentCPS), SizeToStr(self.currentBytes),
+ apt.SizeToStr(self.totalBytes), self.currentItems, self.totalItems)
return True
def mediaChange(self, medium, drive):
- print "Please insert medium %s in drive %s" % (medium, drive)
- sys.stdin.readline()
+ print "Please insert medium %s in drive %s" % (medium, drive)
+ sys.stdin.readline()
#return False
class TextInstallProgress(apt.InstallProgress):
+
def __init__(self):
apt.InstallProgress.__init__(self)
pass
+
def startUpdate(self):
print "StartUpdate"
+
def finishUpdate(self):
print "FinishUpdate"
+
def statusChange(self, pkg, percent, status):
print "[%s] %s: %s" % (percent, pkg, status)
+
def updateInterface(self):
apt.InstallProgress.updateInterface(self)
# usefull to e.g. redraw a GUI
@@ -59,20 +70,25 @@ class TextInstallProgress(apt.InstallProgress):
class TextCdromProgress(apt.CdromProgress):
+
def __init__(self):
pass
+
# update is called regularly so that the gui can be redrawn
+
def update(self, text, step):
# check if we actually have some text to display
if text != "":
print "Update: %s %s" % (string.strip(text), step)
+
def askCdromName(self):
print "Please enter cd-name: ",
cd_name = sys.stdin.readline()
return (True, string.strip(cd_name))
+
def changeCdrom(self):
print "Please insert cdrom and press <ENTER>"
- answer = sys.stdin.readline()
+ answer = sys.stdin.readline()
return True