コード例 #1
0
ファイル: actions.py プロジェクト: Silox/eva
def new_task():
    content = ui.ask("What do you want to have done?")

    if ui.ask_polar_question("Does it take less than two minutes?"):
        print("Do it now! I'll wait.")
        input("> ")
        return

    task = db.Task(content=content)

    project_choices = list(_generate_project_choices())
    task.project = ui.let_choose("Is it part of a project?", project_choices, none_option="No")

    if ui.ask_polar_question("Can it be devided in smaller chunks?"):
        while True:
            subtask_content = ui.ask("Like what?")
            if not subtask_content:
                break
            subtask = db.Task(content=subtask_content, project=task.project)
            task.subtasks.add(subtask)
コード例 #2
0
ファイル: actions.py プロジェクト: Procrat/eva
def new_reminder():
    content = ui.ask('What do you want me to remind you of?')
    if not content:
        return
    when = ui.pick_date('When do you want to be reminded?',
                        'You will be reminded at {}.')
    if not when:
        question = "Are you sure you don't want to be reminded?"
        if ui.ask_polar_question(question):
            return
    reminder = db.Reminder(content=content, when=when)
    notifier.delayed_notify(reminder)