def journal(self, parent_model=None): """ Create a new JournalModel. `parent_model` is the parent JournalModel to which this todo belongs. """ vjournal = icalendar.Journal() vjournal.set('UID', gen_uid()) if parent_model: vjournal.set('RELATED-TO', parent_model.get_uid()) journal_model = JournalModel(vjournal) return(journal_model)
def alarm(self, delta, parent_model): """ Create a new AlarmModel. `delta` is a date/time offset as returned by datetime.timedelta(). `parent_model` is the parent model to which this alarm belongs, such as a EventModel or TodoModel. """ valarm = icalendar.Alarm() valarm.set('UID', gen_uid()) valarm.set('TRIGGER', delta) valarm.set('ACTION', 'DISPLAY') alarm_model = AlarmModel(valarm, parent_model) return(alarm_model)
def event(self, start, end): """ Create a new EventModel. `start` and `end` are datetime values for the DTSTART and DTEND field of the model. """ vevent = icalendar.Event() vevent.set('UID', gen_uid()) vevent.set('CREATED', datetime.datetime.now()) vevent.set('DTSTART', start) vevent.set('DTEND', end) event_model = EventModel(vevent) return(event_model)
def todo(self, parent_model=None): """ Create a new TodoModel. `parent_model` is the parent TodoModel to which this todo belongs. """ vtodo = icalendar.Todo() vtodo.set('UID', gen_uid()) vtodo.set('CREATED', datetime.datetime.now()) vtodo.set('PERCENTAGE-COMPLETE', 0) if parent_model: vtodo.set('RELATED-TO', parent_model.get_uid()) todo_model = TodoModel(vtodo) return(todo_model)