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


Python Model.stop方法代码示例

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


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

示例1: main

# 需要导入模块: from model import Model [as 别名]
# 或者: from model.Model import stop [as 别名]
def main():
    # objs/emulator -verbose @Nexus4

    parser = argparse.ArgumentParser()
    parser.add_argument('--emu-path', default=os.path.abspath('../qemu/obj/emulator'),
                        help='emulator path')
    parser.add_argument('emu_args', default=['-verbose', '@Nexus4'], nargs='*',
                        help='args for the emulator. e.g: @Nexus4')
    args = parser.parse_args()

    device = Emulator(args.emu_path, *args.emu_args)
    model = Model(device)

    modem = Modem()
    model.add_component('modem_driver_read', modem)

    try:
        model.run()
    except (KeyboardInterrupt, SystemExit):
        print("got Ctrl+C (SIGINT) or exit() is called")
        model.stop()
开发者ID:android-energy,项目名称:energy,代码行数:23,代码来源:__main__.py

示例2: __init__

# 需要导入模块: from model import Model [as 别名]
# 或者: from model.Model import stop [as 别名]
class Presenter:
    def __init__(self, view):

        self.__model = Model()
        self.__view = view

        # Run communication and start thread
        self.__model.begin()
        self.__model.start()

        # Signal connection
        self.__view.send_data.connect(self.__model.write)
        self.__view.baudrate_changed.connect(self.__model.set_br)
        self.__view.eol_changed.connect(self.__model.set_eol)
        self.__view.port_changed.connect(self.__model.set_port)
        self.__view.pause_m.connect(self.__model.pause)
        self.__view.start_m.connect(self.start_model)

        self.__model.error.connect(self.__view.show_error)

        self.__view.set_queue(self.__model.get_queue())
        self.__view.set_end_cmd(self.end_cmd)
        self.__view.set_port(self.__model.get_port())
        self.__view.update_gui()

    def start_model(self):
        """
        Initalizate serial settings in model and start thread.
        """
        if not self.__model.paused.is_set():
            self.__model.resume()

    def end_cmd(self):
        """
        Stop model thread.
        """
        self.__model.stop()
开发者ID:alberand,项目名称:PySM,代码行数:39,代码来源:presenter.py

示例3: __init__

# 需要导入模块: from model import Model [as 别名]
# 或者: from model.Model import stop [as 别名]
class Presenter:

    def __init__(self, view):
        self.__model = Model()
        self.__view = view

        self.__view.setQueue(self.__model.getQueue())

        self.__view.signal.connect(self.processSignal)

        # This signal is used once and just set offsets values in legend
        self.__model.data_ready.connect(self.__view.updatePlot)
        self.__model.offsets_ready.connect(self.__view.plot.setLegends)

        self.__model.start()

    def processSignal(self, command, value):
        if command == 'quit':
            self.__model.stop()
            # self.__view.close()

        elif command == 'start_model':
            print('Start model signal received.')
            self.__model.start()
开发者ID:alberand,项目名称:Logger_GUI,代码行数:26,代码来源:presenter.py


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