def bolus_reminder(): r_bol = reminders.Reminder() r_post = reminders.Reminder() r_bol.title = 'Ya te diste el bolo? \n Empieza a comer.' r_post.title = 'Checar glc postprandial' bol = datetime.datetime.now() +\ datetime.timedelta(minutes=5) post_prand =\ datetime.datetime.now() +\ datetime.timedelta(minutes=119) r_bol.due_date = bol r_post.due_date = post_prand a1 = reminders.Alarm() a2 = reminders.Alarm() a1.date = bol a2.date = post_prand r_bol.alarms = [a1] r_bol.save() r_post.alarms = [a2] r_post.save()
def hypo_remind(): r = reminders.Reminder() r.title = '15 min desde hipoglucemia, volver a medir' due = datetime.datetime.now() +\ datetime.timedelta(minutes=15) r.due_date = due a = reminders.Alarm() a.date = due r.alarms = [a] r.save()
def create_reminder(item, calendar): r = reminders.Reminder(calendar) r.title = item['headline'] if 'deadline' in item: r.due_date = item['deadline'] if 'scheduled' in item: a = reminders.Alarm() a.date = item['scheduled'] r.alarms = [a] return r
def addNotice(self, info): notice = reminders.Reminder(self.getCalendar()) notice.title = info due = datetime.now() + timedelta(seconds=1) notice.due_date = due alarm = reminders.Alarm() alarm.date = due notice.alarms = [alarm] notice.save()
def main(): title = dialogs.input_alert('Remind me in 5 minutes', 'Enter a title.', '', 'Remind me') r = reminders.Reminder() r.title = title due = datetime.now() + timedelta(minutes=5) r.due_date = due alarm = reminders.Alarm() alarm.date = due r.alarms = [alarm] r.save() dialogs.hud_alert('Reminder saved')
import dialogs import datetime import workflow import reminders action_in = workflow.get_input() for line in action_in.split('\n'): for name, s_time in re.findall(r'(.*)@alarm\((.*)\)', line): date, time = s_time.split(', ') d_yyyy, d_mm, d_dd = [int(x) for x in date.split('-')] t_hh, t_mm = [int(x) for x in time.split(':')] rem = reminders.Reminder() rem.title = name due = datetime.datetime(d_yyyy, d_mm, d_dd, t_hh, t_mm) rem.due_date = due a = reminders.Alarm() a.date = due rem.alarms = [a] try: res = dialogs.alert( 'The Reminder Was Set', 'Name: {name}\n{date} {time}'.format(name=name, date=date, time=time), 'Ok') rem.save() except KeyboardInterrupt: print("User Cancled Input") action_out = action_in workflow.set_output(action_out)