1
0
Fork 0

feat: remove any alarm given an action

Signed-off-by: thiswillbeyourgithub <github@32mail.33mail.com>
This commit is contained in:
thiswillbeyourgithub 2022-10-04 12:55:51 +02:00 committed by Daniel Thompson
parent 4ca3a4ef20
commit 03c16d6c99

View file

@ -351,7 +351,12 @@ class Manager():
def cancel_alarm(self, time, action):
"""Unqueue an alarm."""
try:
self._alarms.remove((time, action))
if time is None:
for i, al in enumerate(self._alarms):
if self._alarms[i][1] == action:
self._alarms.remove(self._alarms[i])
else:
self._alarms.remove((time, action))
except:
return False
return True