Exemplo n.º 1
0
def main():
    '''Load, edit, and save a family tree'''

    # Don't step on an existing family tree!
    if not os.path.isfile('family.db'):
        setup.setup()

    cmd = ''
    while cmd != 'quit':
        display()
        cmd = raw_input("$ ")

        if cmd in ['insert']:
            table = raw_input(" insert where? ")
            insert(table)
        elif cmd in ['show']:
            table = raw_input(" show where? ")
            show(table)
        elif cmd in 'quit':
            print 'bye!'
        elif cmd in 'build':
            associate()
        elif cmd in 'search':
            table = raw_input(" search where? ")
            value = raw_input(" search what? ")
            user_search(table, value)
            raw_input(" \n any key to clear results")
        else:
            print "not implemented"

        time.sleep(2)
        os.system('clear')  # clear the screen
        pass  # and execute the command
Exemplo n.º 2
0
def _main(args, config, timesheet):
    if args['add']:
        add(args, config, timesheet)
    if args['show']:
        show(args, timesheet)
    if args['reauth']:
        reauth(config)
    if args['delete']:
        delete(args, timesheet)
Exemplo n.º 3
0
def _main(args, config, timesheet):
    if args['add']:
        add(args, config, timesheet)
    if args['show']:
        show(args, timesheet)
    if args['reauth']:
        reauth(config)
    if args['delete']:
        delete(args, timesheet)
Exemplo n.º 4
0
def display():

    # TODO: implememt tree-walking display
    #   cli_display call takes root_node people_id
    #     SEARCH relationship
    #     CALL method grow takes edge_type r_type role_id
    #     select all relationships where people_1_id = root_noe and role_2
    # ....

    show('relationships', timed=False)
    print
Exemplo n.º 5
0
def show(args):
    """
    provide a argparse namespace object.
    Calls the show command
    """

    # If no date supplied, set to None
    if args.date == '':
        d = None
    else:
        d = args.date
    commands.show(d)
Exemplo n.º 6
0
def handle_args(args):
    if args.recordings:
        commands.recordings()
    elif args.reset:
        commands.reset()
    elif args.setup:
        commands.setup()
    elif args.show:
        commands.show()
    elif args.start:
        commands.start(args.start)
    elif args.stop:
        commands.stop(args.stop)
    elif args.teardown:
        commands.teardown()
    else:
        print("You must select an argument.")
Exemplo n.º 7
0
def main():
    """ Main function to determine what command to enter """

    segment_list = []

    while True:

        command = raw_input("Enter a command (type 'help' or 'h' for help):\n")

        if command == 'exit':
            break

        # 'help' command
        # prints a list of possible commands
        elif command == 'help' or command == 'h':
            commands.help()

        # 'newarm (na)' command
        # creates newarms and their corresponding segment sequences in a
        # dictionary 'arms'
        elif command == 'newarms' or command == 'na':
            arms = commands.newarms()

        # 'show (s)' command
        # prints out the created arms
        elif command == 'show' or command == 's':
            try:
                commands.show(arms)
            except UnboundLocalError:
                print "Generate your arms first!"

        # 'link (l)' command
        elif command == 'link' or command == 'l':
            linker_list = commands.linker()

        # 'crunch (c)' command
        # produces random sequences of
        elif command == 'crunch' or command == 'c':
            try:
                strands
            except UnboundLocalError:
                print "Maybe you should generate your strands first ('strandgen')?"
            else:
                try:
                    arms, strands, segment_list =\
                        commands.crunch(arms, strands, linker_list, segment_list)
                    print segment_list
                except TypeError:
                    print "Something's not right. Try 'crunch' again."

        # 'strandgen (sg)' command
        elif command == 'strandgen' or command == 'sg':
            try:
                strands = commands.strandgen(arms, linker_list)
            except UnboundLocalError:
                print "Something's wrong. Maybe you missed a step?"

        # 'repeatcheck (rp) command
        elif command == 'repeatcheck' or command == 'rp':
            try:
                commands.repeatcheck(strands)
            except UnboundLocalError:
                print "Something's wrong. Maybe you missed a step?"

        # 'dyadcheck (dc) command
        elif command == 'dyadcheck' or command == 'dc':
            try:
                commands.dyadcheck(strands)
            except UnboundLocalError:
                print "Something's wrong. Maybe you missed a step?"

        # 'save (sv)' command
        elif command == 'save' or command == 'sv':
            try:
                commands.save(arms, strands)
            except UnboundLocalError:
                print "Something's wrong. Maybe you missed a step?"

        elif command == 'load' or command == 'ld':
            try:
                strands = commands.load()
            except (UnboundLocalError, TypeError):
                print "Try again?"

        else:
            print "What? Retype command!"

    return None
Exemplo n.º 8
0
def log(id):
    return commands.show(id)
Exemplo n.º 9
0
def log(id):
    return commands.show(id)
Exemplo n.º 10
0
def command_caller(command_list):
    if(command_list[0] == 'add'):
        commands.add()
        #print('Process raw now ? enter y to process, press any other key to skip > ',end = '')
        #select = input()
        #if(select == 'y'):
        command_caller(['rawpro'])
    elif(command_list[0] == 'rawpro'):
        commands.raw_process()
        print('-----------------------------')
        commands.show('todo')
    elif(command_list[0] == 'show'):
        if(len(command_list) == 1):
            commands.show('todo')
            return None
        commands.show(command_list[1].strip())
    elif(command_list[0] == 'todo'):
        commands.show('todo')
    elif(command_list[0] == 'ls'):
        commands.show('todo')
    elif(command_list[0] == 'done'):
        if(len(command_list) == 1):
            print('Usage: done [id]')
            return None
        print(commands.done(command_list[1].strip()))
        print('-----------------------------')
        commands.show('todo')
    elif(command_list[0] == 'repeatgen'):
        commands.repeatgen()
    elif(command_list[0] == 'clear'):
        os.system('clear')
    elif(command_list[0] == 'pp' or command_list[0] == 'postpone'):
        if(len(command_list) == 3):
            print(commands.postpone(command_list[1].strip(),command_list[2].strip()))
        else:
            content = call_vim_single_line('Enter target date')
            print(commands.postpone(command_list[1].strip(),content))
        commands.show('todo')
    elif(command_list[0] == 'cancel'):
        print(commands.cancel(command_list[1].strip()))
        commands.show('todo')
    elif(command_list[0] == 'editrep' or command_list[0] == 'editrepeat' or command_list[0] == 'editrp'):
        commands.repeat_edit()
        commands.repeatgen()
    elif(command_list[0] == 'addto' or command_list[0] == 'addchild'):
        commands.add_child()
        commands.show('todo')
    else:
        print('command not found: ' + command_list[0])
        commands.show('todo')