當前位置: 首頁>>代碼示例>>Python>>正文


Python Cli.wait方法代碼示例

本文整理匯總了Python中cjh.cli.Cli.wait方法的典型用法代碼示例。如果您正苦於以下問題:Python Cli.wait方法的具體用法?Python Cli.wait怎麽用?Python Cli.wait使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在cjh.cli.Cli的用法示例。


在下文中一共展示了Cli.wait方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: main

# 需要導入模塊: from cjh.cli import Cli [as 別名]
# 或者: from cjh.cli.Cli import wait [as 別名]
def main():
    """
    Reads in a specified file, removes trailing whitespace, and re-saves.
    """
    # Open file and store lines as str list
    try:
        file_handler = open(ARGS.filename, 'r+')
    except IOError:
        print(traceback.format_exc())  # pylint: disable=C0325
        sys.exit()

    lines_of_text = file_handler.readlines()
    file_handler.seek(0)

    # Preview and write text back to file and close file
    print(lines_of_text)  # pylint: disable=C0325
    Cli.wait()
    string = ''
    preview_string = ''
    for index, _ in enumerate(lines_of_text):
        string += lines_of_text[index].rstrip() + '\n'
        preview_string = string.strip() + Cli.term_fx('b', 'EOL')
    pydoc.pipepager(preview_string, cmd='less -R')
    try:
        char = Cli.get_keypress('Write to file?')
        assert char == 'y'
        file_handler.write(string)
    except AssertionError:
        print('File not saved.  Good bye.')  # pylint: disable=C0325
    finally:
        file_handler.close()
開發者ID:hammerhorn,項目名稱:hammerhorn-jive,代碼行數:33,代碼來源:trimline.py

示例2: main

# 需要導入模塊: from cjh.cli import Cli [as 別名]
# 或者: from cjh.cli.Cli import wait [as 別名]
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'
開發者ID:hammerhorn,項目名稱:hammerhorn-jive,代碼行數:29,代碼來源:sgf_read.py

示例3: main

# 需要導入模塊: from cjh.cli import Cli [as 別名]
# 或者: from cjh.cli.Cli import wait [as 別名]
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)
開發者ID:hammerhorn,項目名稱:hammerhorn-jive,代碼行數:17,代碼來源:dice.py

示例4: access_gnugo_functs

# 需要導入模塊: from cjh.cli import Cli [as 別名]
# 或者: from cjh.cli.Cli import wait [as 別名]
    def access_gnugo_functs(self, basename):
        """
        Scoring/estimating tools from gnugo; this should take filename instead.
        """
        Cli.make_page(
            'WRITE FILE: {}.sgf'.format(basename), self, lambda: self.write_sgf(
            basename))

        menu1 = ListPrompt(['..', 'fast', 'medium', 'slow'])
        sel1 = Cli.make_page('MENU: GNUGO Scoring Tools', self, menu1.input)
        gnugo_dict = {'fast':'estimate', 'medium':'finish', 'slow':'aftermath'}
        print('') #pylint: disable=C0325
        if sel1 != 1:
            os.system('gnugo --score ' + gnugo_dict[menu1.items[sel1 - 1]] +\
                      ' --quiet -l {}.sgf'.format(basename))
            Cli.wait()
開發者ID:hammerhorn,項目名稱:hammerhorn-jive,代碼行數:18,代碼來源:igo.py

示例5: main

# 需要導入模塊: from cjh.cli import Cli [as 別名]
# 或者: from cjh.cli.Cli import wait [as 別名]
def main():
    """
    Gets the user's choice and gives them a preview.
    """
    _first_pass = True
    art = ''
    if __name__ == '__main__':
        while True:
            if SHELL.interface in ['dialog'] and not _first_pass:
                Cli.wait()
            else:
                _first_pass = False
            #selection = Cli.make_page(obj='\n' + art, func=menu_func)
            selection = Cli.make_page(
                obj='\n' + art, func=lambda: SHELL.list_menu(LIST_OBJ))
            if selection == -1:
                break
            figlet_font = FONT_OPTIONS[selection - 1]
            art = subprocess.check_output('toilet --gay -f {} "{}"'.format(
                figlet_font, PHRASE), shell=True)
開發者ID:hammerhorn,項目名稱:hammerhorn-jive,代碼行數:22,代碼來源:toilet_preview.py


注:本文中的cjh.cli.Cli.wait方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。