- Timer: simplified stop()

git-svn-id: http://moon:8086/svn/projects/HendiControl@255 fda53097-d464-4ada-af97-ba876c37ca34
This commit is contained in:
2019-04-23 09:04:20 +00:00
parent 7546df5f2b
commit ebd27336cb
+3 -6
View File
@@ -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)