summaryrefslogtreecommitdiff
path: root/doc/examples
diff options
context:
space:
mode:
authorMichael Vogt <michael.vogt@ubuntu.com>2006-03-01 14:35:43 +0000
committerMichael Vogt <michael.vogt@ubuntu.com>2006-03-01 14:35:43 +0000
commit6e90d3114415976a20013647b0d1d6cafdd764a6 (patch)
tree4ee952ff7f4b88fe839cefa6a3aa8737eb45bdf4 /doc/examples
parent389fe246d85aa59348b770db793e9455fd17d73c (diff)
parenteb14999105a40543ee791bfa1c22b5dcf3d6fe37 (diff)
downloadpython-apt-6e90d3114415976a20013647b0d1d6cafdd764a6.tar.gz
* updated to latest python-apt--mvo
Patches applied: * michael.vogt@ubuntu.com--2005/python-apt--mvo--0--patch-130 merged with the debian upload * michael.vogt@ubuntu.com--2005/python-apt--mvo--0--patch-131 * interface fixes for kamion, pychecker fixes * michael.vogt@ubuntu.com--2005/python-apt--mvo--0--patch-132 * un-finalize the changelog * michael.vogt@ubuntu.com--2005/python-apt--mvo--0--patch-133 * initalize FetchProgress.eta as float and pass a float to InstallProgress.statusChanged() for percent * michael.vogt@ubuntu.com--2005/python-apt--mvo--0--patch-134 * strip status string before passing it, changelog updates * michael.vogt@ubuntu.com--2005/python-apt--mvo--0--patch-135 * fix the return value of Cache.update() * michael.vogt@ubuntu.com--2005/python-apt--mvo--0--patch-136 * remove a useless check in Cache.update() * michael.vogt@ubuntu.com--2005/python-apt--mvo--0--patch-137 * updated changelog * michael.vogt@ubuntu.com--2005/python-apt--mvo--0--patch-138 * undo some damage from pychecker * mvo@debian.org--2005/python-apt--debian-sid--0--base-0 tag of michael.vogt@ubuntu.com--2005/python-apt--mvo--0--patch-129 * mvo@debian.org--2005/python-apt--debian-sid--0--patch-1 * changelog finalized
Diffstat (limited to 'doc/examples')
-rw-r--r--doc/examples/progress.py17
1 files changed, 17 insertions, 0 deletions
diff --git a/doc/examples/progress.py b/doc/examples/progress.py
index d820fcb2..2723c382 100644
--- a/doc/examples/progress.py
+++ b/doc/examples/progress.py
@@ -44,12 +44,16 @@ class TextFetchProgress(apt.FetchProgress):
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
time.sleep(0.1)
@@ -70,3 +74,16 @@ class TextCdromProgress(apt.CdromProgress):
print "Please insert cdrom and press <ENTER>"
answer = sys.stdin.readline()
return True
+
+
+if __name__ == "__main__":
+ c = apt.Cache()
+ pkg = c["3dchess"]
+ if pkg.isInstalled:
+ pkg.markDelete()
+ else:
+ pkg.markInstall()
+
+ res = c.commit(TextFetchProgress(), TextInstallProgress())
+
+ print res