Ejemplo n.º 1
0
    def execute(self, args):
	todo_notebook = self.config("ToDos", "NextAction")
	if not todo_notebook:
	    raise MissingConfigurationException("No ToDos notebook defined")
	todos = ToDos(todo_notebook)
	past_due, due_today, due_soon, due_later, not_due = todos.bin_by_due_date()
	if args.show_flags == []:
	    lists = [ past_due, due_today, due_soon, due_later, not_due ]
	else:
	    lists = []
	    for flag in args.show_flags:
		if flag == self.PAST_DUE:
		    lists.append(past_due)
		elif flag == self.DUE_TODAY:
		    lists.append(due_today)
		elif flag == self.DUE_SOON:
		    lists.append(due_soon)
		elif flag == self.DUE_LATER:
		    lists.append(due_later)
		elif flag == self.NO_DUE_DATE:
		    lists.append(not_due)
	for list in lists:
	    if len(list) > 0:
		for todo in list:
		    self.output(todo.title())
	return(0)
Ejemplo n.º 2
0
    def get_todos_as_html(self):
	"""Return list of todos as html"""

	next_action_notebook = self.config("ToDos", "NextAction")
	if next_action_notebook is None:
	    self.debug("No Next Action notebook defined")
	    next_action_todos = ToDos()
	else:
	    self.debug("Next Action notebook is {}".format(next_action_notebook))
	    next_action_todos = ToDos(next_action_notebook)
	    self.debug("Read {} Next Action ToDos".format(len(next_action_todos)))

	pending_notebook = self.config("ToDos", "Pending")
	if pending_notebook is None:
	    self.debug("No Pending Todos notebook defined")
	    pending_todos = ToDos()
	else:
	    pending_todos = ToDos(pending_notebook)
	    self.debug("Read {} Pending ToDos".format(len(pending_todos)))

	scheduled_notebook = self.config("ToDos", "Scheduled")
	if scheduled_notebook is None:
	    self.debug("No Scheduled notebook defined")
	    scheduled_todos = ToDos()
	else:
	    scheduled_todos = ToDos(scheduled_notebook)
	    self.debug("Read {} Scheduled ToDos".format(len(scheduled_todos)))

	html =""
	html += "<b>Past due:</b>\n"
	html += self.todos_to_html(next_action_todos.past_due())
	html += self.todos_to_html(scheduled_todos.past_due())

	html += "<b>Pending past due:</b>\n"
	html += self.todos_to_html(pending_todos.past_due())

	html += "<b>Due today:</b>\n"
	html += self.todos_to_html(next_action_todos.due_today())
	html += self.todos_to_html(scheduled_todos.due_today())

	html += "<b>Pending due today:</b>\n"
	html += self.todos_to_html(pending_todos.due_today())

	html += "<b>Due ASAP:</b>\n"
	html += self.todos_to_html(next_action_todos.due_asap())

	html += "<b>Pending due ASAP:</b>\n"
	html += self.todos_to_html(pending_todos.due_asap())

	html += "<b>Due soon:</b>\n"
	html += self.todos_to_html(next_action_todos.due_soon())

	html += "<b>Pending due soon:</b>\n"
	html += self.todos_to_html(pending_todos.due_soon())

	return html