summaryrefslogtreecommitdiff
path: root/doc/examples/progress.py
diff options
context:
space:
mode:
authorMichael Vogt <egon@bottom>2006-04-29 21:43:22 +0200
committerMichael Vogt <egon@bottom>2006-04-29 21:43:22 +0200
commitb2027f3494dcc42846c8a1106a4fd4b71cd8ed24 (patch)
treeef83cdce0261661c21f588edbe838acf47166d3c /doc/examples/progress.py
parenta6d05b8fe1d75e27ca938e684971e4e0cb0ea8c9 (diff)
parent0e8fd33b1b741cc65c284a08faa50b3a2995ac3c (diff)
downloadpython-apt-b2027f3494dcc42846c8a1106a4fd4b71cd8ed24.tar.gz
* merged from mainline
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