summaryrefslogtreecommitdiff
path: root/doc/examples/action.py
diff options
context:
space:
mode:
Diffstat (limited to 'doc/examples/action.py')
-rw-r--r--doc/examples/action.py26
1 files changed, 1 insertions, 25 deletions
diff --git a/doc/examples/action.py b/doc/examples/action.py
index 09ded0a7..3eb58d9e 100644
--- a/doc/examples/action.py
+++ b/doc/examples/action.py
@@ -4,31 +4,7 @@
import apt_pkg
import sys
import copy
-
-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)
-
+from progress import OpProgress, FetchProgress
# init