fix: remove any alarm given an action
Signed-off-by: thiswillbeyourgithub <github@32mail.33mail.com>
This commit is contained in:
parent
1ad2ee1d66
commit
81e38a85b0
1 changed files with 5 additions and 5 deletions
10
wasp/wasp.py
10
wasp/wasp.py
|
@ -350,13 +350,13 @@ class Manager():
|
||||||
|
|
||||||
def cancel_alarm(self, time, action):
|
def cancel_alarm(self, time, action):
|
||||||
"""Unqueue an alarm."""
|
"""Unqueue an alarm."""
|
||||||
|
alarms = self._alarms
|
||||||
try:
|
try:
|
||||||
if time is None:
|
if not time:
|
||||||
for i, al in enumerate(self._alarms):
|
time_to_remove = [al[0] for al in alarms if al[1] == action]
|
||||||
if self._alarms[i][1] == action:
|
[alarms.remove((t, action)) for t in time_to_remove]
|
||||||
self._alarms.remove(self._alarms[i])
|
|
||||||
else:
|
else:
|
||||||
self._alarms.remove((time, action))
|
alarms.remove((time, action))
|
||||||
except:
|
except:
|
||||||
return False
|
return False
|
||||||
return True
|
return True
|
||||||
|
|
Loading…
Reference in a new issue