* morituri/common/task.py:
Move methods around.
This commit is contained in:
@@ -1,3 +1,8 @@
|
||||
2009-04-11 Thomas Vander Stichele <thomas at apestaart dot org>
|
||||
|
||||
* morituri/common/task.py:
|
||||
Move methods around.
|
||||
|
||||
2009-04-11 Thomas Vander Stichele <thomas at apestaart dot org>
|
||||
|
||||
* examples/ARcue.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
|
||||
|
||||
Reference in New Issue
Block a user