- Timer: simplified stop()
git-svn-id: http://moon:8086/svn/projects/HendiControl@255 fda53097-d464-4ada-af97-ba876c37ca34
This commit is contained in:
@@ -10,7 +10,6 @@ class Timer(object):
|
||||
self.interval = 0
|
||||
self.elapseTime = 0
|
||||
self.count = 0
|
||||
self.cancel = False
|
||||
|
||||
def start(self, interval, mode='periodic'):
|
||||
now = time.time()
|
||||
@@ -21,7 +20,8 @@ class Timer(object):
|
||||
pass
|
||||
|
||||
def stop(self):
|
||||
self.cancel = True
|
||||
self.isActive = False
|
||||
self.count = 0
|
||||
|
||||
def __str__(self):
|
||||
return self.name
|
||||
@@ -47,10 +47,7 @@ class TimerManager(object):
|
||||
now = time.time()
|
||||
if timer.isActive:
|
||||
if timer.elapseTime <= now:
|
||||
if timer.cancel:
|
||||
timer.isActive = False
|
||||
timer.count = 0
|
||||
elif timer.listener:
|
||||
if timer.listener:
|
||||
if 'periodic' in timer.mode:
|
||||
timer.start(timer.interval)
|
||||
timer.listener.onTimer(timer)
|
||||
|
||||
Reference in New Issue
Block a user