示例#1
0
	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)
示例#2
0
	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)
示例#3
0
	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)
示例#4
0
	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)