diff options
| author | Michael Vogt <michael.vogt@ubuntu.com> | 2005-04-08 00:51:04 +0000 |
|---|---|---|
| committer | Michael Vogt <michael.vogt@ubuntu.com> | 2005-04-08 00:51:04 +0000 |
| commit | 8f914ef267ab1bbcbda1c6694edd2e4c9b6401ec (patch) | |
| tree | ed06ac66d1e0675a77080bf5a5d6f33e3c492d52 /doc/examples/progress.py | |
| parent | 7e76103c2b13d27f4a9987b1f9fca50504177268 (diff) | |
| download | python-apt-8f914ef267ab1bbcbda1c6694edd2e4c9b6401ec.tar.gz | |
* started the DepCache.Commit() interface
Diffstat (limited to 'doc/examples/progress.py')
| -rw-r--r-- | doc/examples/progress.py | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/doc/examples/progress.py b/doc/examples/progress.py new file mode 100644 index 00000000..f6cf1495 --- /dev/null +++ b/doc/examples/progress.py @@ -0,0 +1,30 @@ +import apt_pkg +import sys + +class OpProgress: + def __init__(self): + self.last = 0.0 + + def Update(self, percent): + if (self.last + 1.0) <= percent: + sys.stdout.write("\rProgress: %i.2 " % (percent)) + self.last = percent + if percent >= 100: + self.last = 0.0 + + def Done(self): + self.last = 0.0 + print "\rDone " + + +class FetchProgress: + def __init__(self): + pass + def UpdateStatus(self, 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" % (apt_pkg.SizeToStr(self.CurrentCPS), apt_pkg.SizeToStr(self.CurrentBytes), apt_pkg.SizeToStr(self.TotalBytes), self.CurrentItems, self.TotalItems) + + def MediaChange(self, medium, drive): + print "Please insert medium %s in drive %s" % (medium, drive) + sys.stdin.readline()
\ No newline at end of file |
