def main(): try: while True: action, param = ui.let_choose('What do you want to do?', actions.MAIN_ACTIONS) if action is not None: action(*param) print() except (exceptions.QuitException, KeyboardInterrupt): pass
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)