当前位置: 首页>>代码示例>>Python>>正文


Python Connection.get_running_behaviors方法代码示例

本文整理汇总了Python中connection.Connection.get_running_behaviors方法的典型用法代码示例。如果您正苦于以下问题:Python Connection.get_running_behaviors方法的具体用法?Python Connection.get_running_behaviors怎么用?Python Connection.get_running_behaviors使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在connection.Connection的用法示例。


在下文中一共展示了Connection.get_running_behaviors方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: stop_handler

# 需要导入模块: from connection import Connection [as 别名]
# 或者: from connection.Connection import get_running_behaviors [as 别名]
def stop_handler(ns):
    verb = verbose_print(ns.verbose)
    conn = Connection(verb, ssh=False)
    if ns.life:
        conn.life_stop_focus()  # stop focused activity
    else:  # stop behavior/service
        services = conn.get_running_services()
        behaviors = conn.get_running_behaviors()
        inp = io.prompt_for_behavior(services + behaviors)
        if inp in services:
            conn.stop_service(inp)
        elif inp in behaviors:
            conn.stop_behavior(inp)
        else:
            print('{}: {} is not an eligible behavior or service'.format(col.red('ERROR'),
                                                                         inp))
开发者ID:ccann,项目名称:qidev,代码行数:18,代码来源:handlers.py

示例2: show_handler

# 需要导入模块: from connection import Connection [as 别名]
# 或者: from connection.Connection import get_running_behaviors [as 别名]
def show_handler(ns):
    """Display information about a package, service, active content, etc."""
    verb = verbose_print(ns.verbose)
    conn = Connection(verb, ssh=False)
    verb('Check installed packages...')
    pkg_data = conn.get_installed_package_data(verb)
    if ns.services:
        verb('Show installed services')
        io.show_installed_services(verb, pkg_data)
    elif ns.inspect:
        completions = [p.uuid for p in pkg_data] + [p.name for p in pkg_data]
        inp = io.prompt_for_package(completions)
        io.show_package_details(inp, pkg_data)
    elif ns.active:
        verb('Show active content')
        io.show_running(conn.get_running_behaviors(),
                        conn.get_running_services(),
                        pkg_data)
    else:
        io.show_installed_packages(verb, pkg_data)
开发者ID:ccann,项目名称:qidev,代码行数:22,代码来源:handlers.py

示例3: show_handler

# 需要导入模块: from connection import Connection [as 别名]
# 或者: from connection.Connection import get_running_behaviors [as 别名]
def show_handler(ns):
    """Show information about a package, service, active content, etc."""
    verb = verbose_print(ns.verbose)
    conn = Connection(verb, ssh=False)
    verb('Check installed packages...')
    pkg_data = conn.get_installed_package_data()
    if ns.s:
        verb('Show installed services')
        io.show_installed_services(verb, pkg_data)
    elif ns.i:
        io.prompt_for_package(pkg_data)
    elif ns.active:
        verb('Show active content')
        io.show_running(conn.get_running_behaviors(),
                        conn.get_running_services(),
                        pkg_data)

        # def refresh_content(value, *args):
        #     behaviors = conn.get_running_behaviors()
        #     services = conn.get_running_services()
        #     choices = behaviors + services
        #     os.write(io.pipe, ';'.join(choices))

        # behman = conn.session.service('ALBehaviorManager')
        # servman = conn.session.service('ALServiceManager')
        # beh_started_id = behman.behaviorStarted.connect(refresh_content)
        # beh_stopped_id = behman.behaviorStopped.connect(refresh_content)
        # serv_started_id = servman.serviceStarted.connect(refresh_content)
        # serv_stopped_id = servman.serviceStopped.connect(refresh_content)

        # io.show_running(conn)
        # stdscr = ready_screen()

        # def refresh_content(value, *args):
        #     if not value == 'first':
        #         # curses.flash()
        #         stdscr.clear()
        #     io.show_running(stdscr,
        #                     conn,
        #                     value,
        #                     pkg_data)
        #     stdscr.refresh()
        # refresh_content('first')

        # def disconnect():
        #     behman.behaviorStarted.disconnect(beh_started_id)
        #     behman.behaviorStopped.disconnect(beh_stopped_id)
        #     servman.serviceStarted.disconnect(serv_started_id)
        #     servman.serviceStopped.disconnect(serv_stopped_id)
        #     close_screen(stdscr)

        # while(True):
        #     try:
        #         c = stdscr.getch()
        #         if c == ord('q'):
        #             disconnect()
        #             break
        #     except KeyboardInterrupt:
        #         disconnect()
        #     break
    else:
        io.show_installed_packages(verb, pkg_data)
开发者ID:ccann,项目名称:qidev,代码行数:64,代码来源:handlers.py


注:本文中的connection.Connection.get_running_behaviors方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。