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,6 +351,11 @@ class Manager():
def cancel_alarm(self, time, action): def cancel_alarm(self, time, action):
"""Unqueue an alarm.""" """Unqueue an alarm."""
try: try:
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)) self._alarms.remove((time, action))
except: except:
return False return False