From 6234b08a2fd5db692bcc345cbb972e4c20b090af Mon Sep 17 00:00:00 2001 From: Thomas Vander Stichele Date: Sat, 11 Apr 2009 16:38:41 +0000 Subject: [PATCH] * morituri/common/task.py: Move methods around. --- ChangeLog | 5 +++++ morituri/common/task.py | 18 ++++++++++++++---- 2 files changed, 19 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index 9811285..330bc0e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2009-04-11 Thomas Vander Stichele + + * morituri/common/task.py: + Move methods around. + 2009-04-11 Thomas Vander Stichele * examples/ARcue.py: diff --git a/morituri/common/task.py b/morituri/common/task.py index f0a1127..ff16967 100644 --- a/morituri/common/task.py +++ b/morituri/common/task.py @@ -39,20 +39,30 @@ class Task(object): _listeners = None - def debug(self, *args, **kwargs): - return - print args, kwargs - sys.stdout.flush() + ### subclass methods def start(self): + """ + Subclasses should chain up to me at the beginning. + """ + self.progress = 0.0 self.running = True self._notifyListeners('started') def stop(self): + """ + Subclasses should chain up to me at the end. + """ self.debug('stopping') self.running = False self._notifyListeners('stopped') + ### base class methods + def debug(self, *args, **kwargs): + return + print self, args, kwargs + sys.stdout.flush() + def setProgress(self, value): if value - self.progress > self.increment or value >= 1.0: self.progress = value