def addReminder(name, time, uuid, body='', urgency=0, hidden=True):
"""
Queue reminder.
Show notification at the specified time. With the given name as title and an optional body
for further information.
The mandatory is used to identify the reminder and remove it with removeReminder().
If the reminder should show up in the list printed by 'remind print' hidden (default: True)
should be set to false. In this case the reminder is requeued at startup. If reminders are
used e.g. with a todo list for due dates, hidden should probably be set to true so that the
list is not cluttered with automatically created data.
If the reminder needs a different priority, it can be set with urgency to critical (=2),
high (=1) or normal (=0, default).
"""
waitTime = time - dt.now()
n = notify2.Notification(name, body)
n.set_urgency(urgency)
timerList[uuid] = Timer(waitTime.total_seconds(), showAlarm, [n, name])
timerList[uuid].start()
newItem = {'name': name, 'time': time, 'hidden': hidden, 'uuid': uuid}
reminderList['items'].append(newItem)
reminderList['items'] = sort(reminderList['items'])
write_file("reminderlist.txt", reminderList)
评论列表
文章目录