Exemple #1
0
 def checkprojects(self):
     for p in Project.objects.filter():
         n_nextactions = NextAction.objects.filter(project=p.id, done=False).count()
         n_waiting = WaitingFor.objects.filter(project=p.id,done=False).count()
         keep = inp("{p.name} ({n_nextactions} actions, waiting for {n_waiting})\nKeep? [y/n]".format(**locals()),['x in "yn"'])
         if keep == 'n':
             sure = inp("Sure? [Y/n]")
             if sure == 'Y':
                 p.delete()
Exemple #2
0
def add_actionable_cli():
    choice = inp("[e] = execute | [d] = delegate | [l] = list", ['x in "edl"'])
    if choice == "e":
        raw_input("Gogogo! 2 minutes! [RET]\n> ")
        print("Win.")
    elif choice == "d":
        raw_input("Delegate that shit! [RET]\n> ")
        waiting = inp("Would you like to create a waiting-for action? (y/n)", ['x in "yn"'])
        if waiting == "y":
            create_action(type = 'w')
    elif choice == "l":
        create_action()
Exemple #3
0
 def _create_cli(cls, action):
     for c in Context.objects.all():
         print(c.pk, c.name)
     choice = inp("Please choose a context or type ADD", ['x.isdigit() or x == "ADD"'])
     if choice == "ADD":
         name = inp("Name?")
         context = Context.create(name)
         context.save()
     elif choice.isdigit():
         context = Context.objects.get(pk = int(choice))
     action.context = context
     action.duration = inp("How long, in minutes, should this take?", ['x.isdigit()'])
     return action
Exemple #4
0
 def create_cli(cls):
     project = cls()
     project.name = inp("Name?", ['len(x) > 3'])
     print("Now, please select a parent.")
     project.parent = cls.get_cli()
     project.save()
     return project
Exemple #5
0
def add_action_cli(item = None):
    if item:
        print(item.info)
        choice = inp("[p] = project | [f] = file | [a] = actionable | [d] = delete", ['x in "pfad" and len(x) == 1'])
    else:
        choice = inp("[p] = project | [a] = actionable", ["x == 'p' or x == 'a'"])
    if choice == "p":
        Project.create_cli()
    elif choice == "f":
        item.filed = True
        item.save()
    elif choice == "a":
        add_actionable_cli()
    elif choice == "d":
        item.delete()
    print("That's it for this item.")
    sleep(1)
Exemple #6
0
 def checkactions(self, model):
     for a in model.objects.filter(done=False):
         print(a.project and a.project.name)
         print(a.name)
         do = inp("[c = complete | d = delete | k = keep]",['x in "cdk"','len(x)==1'])
         if do == 'c':
             a.done = True
             a.save()
         elif do == 'd':
             a.delete()
Exemple #7
0
def create_action(type = None):
    if not type:
        type = inp("[n] = next action | [w] = waiting for | [s] = some day/maybe | [d] = deadline | [r] = recurrent action", ['x in "nwsdr"'])
    if type == "n":
        action = NextAction.create_cli()
    elif type == "w":
        action = WaitingFor.create_cli()
    elif type == "s":
        action = SomeDayAction.create_cli()
    elif type == "d":
        action = DeadlineAction.create_cli()
    elif type == "r":
        action = RecurrentAction.create_cli()
    action.save()
Exemple #8
0
 def create_cli(cls):
     """Create item, using cli prompts"""
     action = cls()
     action.name = inp("Action name?", [])
     print("Please describe the action, type 'OK' if done.")
     lines = []
     while True:
         line = raw_input("> ")
         if line == "OK":
             break
         lines.append(line)
     action.description = "\n".join(lines)
     action.project = Project.get_cli()
     action = cls._create_cli(action)
     return action
Exemple #9
0
 def _iteritems(self):
     items = Item.objects.filter(filed = False)
     print("You have {n} items in your inbox".format(n = items.count()))
     for item in items:
         while True:
             try:
                 add_action_cli(item)
             except KeyboardInterrupt:
                 cont = raw_input("Start over from last item? (RET/^C)\n> ")
             else:
                 more = inp("Continue? (y/n)", ['x == "y" or x == "n"'])
                 if more == 'n':
                     break
                     
         if not item.filed:
             item.delete()
Exemple #10
0
 def brainstorm(self):
     add = inp("Would you like to add any actions you can think of now? [y/n]",["x in 'yn'"])
     while add == 'y':
         create_action()
         add = inp("Anything else? [y/n]",["x in 'yn'"])
Exemple #11
0
 def checkweek(self, day):
     week(day)
     add = inp("Anything to add? [y/n]", ['x in "yn"'])
     while add == 'y':
         create_action()
         add = inp("Anything to add? [y/n]", ['x in "yn"'])
Exemple #12
0
 def _create_cli(cls, action):
     action = NextAction._create_cli(action)
     action.deadline = inp("Deadline date?")
     return action
Exemple #13
0
 def get_cli(cls):
     for p in cls.objects.all():
         print(p.id, p.name)
     _id = inp("Select project (or type N)", ['x.isdigit() or x == "N"'])
     if not _id == "N":
         return cls.objects.get(pk = _id)
Exemple #14
0
 def _create_cli(cls, action):
     action = Action._create_cli(action)
     action.cron = inp("Please input cron")
     action.duration = inp("How long, in minutes, should this take?", ['x.isdigit()'])
     return action
Exemple #15
0
 def _getcontexts(self):
     for c in Context.objects.all():
         print(c.pk, c.name)
     contexts = inp("please choose contexts:", ['x.isdigit()'])
     return contexts