summaryrefslogtreecommitdiff
path: root/doc/examples/progress.py
diff options
context:
space:
mode:
authorMichael Vogt <egon@bottom>2006-07-26 16:59:37 +0200
committerMichael Vogt <egon@bottom>2006-07-26 16:59:37 +0200
commit70c850f4910cfcb6a825c67f577d8bc554612044 (patch)
tree5321c9aa207b8743c7cca63e2b7b05609fbcddf7 /doc/examples/progress.py
parentf701fc174a88d8f2b418a032571ff40ed6fd56e6 (diff)
parent6fc084d34105f336fdf090e2dd45e402e25cfc57 (diff)
downloadpython-apt-70c850f4910cfcb6a825c67f577d8bc554612044.tar.gz
* merged from the auto-mark branch
Diffstat (limited to 'doc/examples/progress.py')
-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