当前位置: 首页>>代码示例>>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;未经允许,请勿转载。