Exemplo n.º 1
0
def main():
    """
    Main function
    """
    record = GameRecord(ARGS.filename)

    game_list = record[:]
    game_label_list = [game.label for game in game_list]

    while True:
        int_response = Cli.list_menu(Enumeration(game_label_list))
        move_list = game_list[int_response - 1][:]
        print Enumeration(move_list)

        goban = Goban(game_list[int_response - 1].header_dict['SZ'])

        color = 'black'
        for move in move_list:
            Cli.wait()
            Cli.clear()
            print goban
            goban.place_stone(move.address[0], move.address[1], color)

            if color == 'black':
                color = 'white'
            elif color == 'white':
                color = 'black'
Exemplo n.º 2
0
def main():
    """
    In a text environment, roll one die with or without animation,
    according to command-line flags.  In Tk, run the main loop.
    """
    if SHELL.interface == 'Tk':
        SHELL.main_window.mainloop()
    else:
        while True:
            if SHELL_NAME in ['bash', 'sh']:
                if ARGS is not None and ARGS.anim:
                    die.animate()
                else: roll_and_output()
            Cli.wait()
            Cli.clear(9)
Exemplo n.º 3
0
def main():
    """
    Get stdin, echo translation to stdout.
    """
    Cli.clear()
    while True:
        words = [word.strip(".").strip().lower() for word in Cli.input().split()]
        if words == [":get-list"]:
            list_ = [w.encode("ascii") for w in list(TRANSLATE_KEY.keys())]
            print("\n{}".format(sorted(list_, key=str.lower)))  # pylint: disable=C0325
            continue
        output = ""

        for word in words:
            output += TRANSLATE_KEY[word] + " "

        print("{}.\n".format(output.encode("utf-8").capitalize().strip()))  # pylint: disable=C0325
Exemplo n.º 4
0
def main():
    """
    the main function
    """
    #fx_list = []

    if ARGS is not None and ARGS.quiet is False:
        SHELL.welcome(
            script_name='== simple graph calc ==',
            description='A simple text-based graphing calculator.')

    graph = _make_graph()

    # if there is an --infile, open graph in editor
    if ARGS is not None and ARGS.infile is True:
        graph.view_edit()

    # Main Loop
    while True:
        if SHELL.interface in ['bash']:
            Cli.clear()

        # Will this work on SL4A?
        main_response = Cli.make_page(
            'MENU: Main', graph, lambda: SHELL.list_menu(MAIN_OPTS))
        print(main_response)

        #use try keyboard interrupt
        if main_response == 1:
            graph = graph_operations(graph)
        elif main_response == 2:
            graph = functions_menu(graph)
        elif main_response == 3:
            graph.access_gnugo_functs(BASENAME)
        elif main_response == 4:
            graph = file_actions(graph)
        else:
            break