From 08ea34d6a28b4b17d0146535e85d61ab7bda341d Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Fri, 8 Apr 2005 11:55:14 +0000 Subject: * simple InstallProgress interface added --- doc/examples/inst.py | 4 ++-- doc/examples/progress.py | 23 ++++++++++++++++++++++- 2 files changed, 24 insertions(+), 3 deletions(-) (limited to 'doc/examples') diff --git a/doc/examples/inst.py b/doc/examples/inst.py index 3854805b..3269900f 100644 --- a/doc/examples/inst.py +++ b/doc/examples/inst.py @@ -5,7 +5,7 @@ import apt_pkg import sys import copy -from progress import OpProgress, FetchProgress +from progress import OpProgress, FetchProgress, InstallProgress # init @@ -22,7 +22,7 @@ depcache.Init(progress) # do something fprogress = FetchProgress() -iprogress = "lala" +iprogress = InstallProgress() iter = cache["base-config"] print "\n%s"%iter diff --git a/doc/examples/progress.py b/doc/examples/progress.py index f6cf1495..0dec95d1 100644 --- a/doc/examples/progress.py +++ b/doc/examples/progress.py @@ -1,5 +1,6 @@ import apt_pkg import sys +import time class OpProgress: def __init__(self): @@ -20,6 +21,13 @@ class OpProgress: class FetchProgress: def __init__(self): pass + + def Start(self): + pass + + def Stop(self): + pass + def UpdateStatus(self, uri, descr, shortDescr, status): print "UpdateStatus: '%s' '%s' '%s' '%i'" % (uri,descr,shortDescr, status) def Pulse(self): @@ -27,4 +35,17 @@ class FetchProgress: def MediaChange(self, medium, drive): print "Please insert medium %s in drive %s" % (medium, drive) - sys.stdin.readline() \ No newline at end of file + sys.stdin.readline() + + +class InstallProgress: + def __init__(self): + pass + def StartUpdate(self): + print "StartUpdate" + def FinishUpdate(self): + print "FinishUpdate" + def UpdateInterface(self): + # usefull to e.g. redraw a GUI + time.sleep(0.1) + -- cgit v1.2.3