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


Python Engine.close方法代码示例

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


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

示例1: Application

# 需要导入模块: from engine import Engine [as 别名]
# 或者: from engine.Engine import close [as 别名]
class Application(QWidget):
    def __init__(self):
        super().__init__()
        self.init()

    def init(self):
        self.init_config()
        self.init_debug()
        self.init_canbus()
        self.init_engine()
        self.init_wheel()
        self.init_elm()
        self.init_ui()

    def deinit(self):
        self.deinit_elm()
        self.deinit_engine()
        self.deinit_wheel()
        self.deinit_canbus()
        self.close();

    def init_ui(self):
        grid = QGridLayout()

        btn0 = QPushButton("key_0")
        btn0.clicked.connect(lambda:self.btn_clicked(0))
        grid.addWidget(btn0)

        btn1 = QPushButton("key_1")
        btn1.clicked.connect(lambda:self.btn_clicked(1))
        grid.addWidget(btn1)

        btn2 = QPushButton("key_2")
        btn2.clicked.connect(lambda:self.btn_clicked(2))
        grid.addWidget(btn2)

        btn3 = QPushButton("key_3")
        btn3.clicked.connect(lambda:self.btn_clicked(3))
        grid.addWidget(btn3)

        btnExit = QPushButton("Exit")
        btnExit.clicked.connect(self.deinit);
        grid.addWidget(btnExit)

        self.setLayout(grid)
        self.setGeometry(0, 0, 500, 500)
        self.setWindowTitle("pyelmemu")
        self.show()

    def btn_clicked(self, i):
        msg = "Button clicked: %d" % i
        self.wheel.key_press(i)

    def init_config(self):
        debug_print_mtcall("Applicaion", "init_config")

    def init_canbus(self):
        debug_print_mtcall("Application", "init_canbus")
        self.canbus = CanBus(11, "CanBusThread")

    def init_engine(self):
        debug_print_mtcall("Application", "init_engine")
        self.engine = Engine(self.canbus)

    def init_wheel(self):
        debug_print_mtcall("Application", "init_wheel")
        self.wheel = Wheel(self.canbus)

    def init_elm(self):
        debug_print_mtcall("Application", "init_elm")
        self.elm = Elm(self.canbus)

    def init_debug(self):
        debug_mask_set(DEBUG_LEVEL_LOG)
        debug_add_filter("Wheel")

    def deinit_engine(self):
        debug_print_mtcall("Application", "deinit_engine")
        self.engine.close()

    def deinit_wheel(self):
        debug_print_mtcall("Application", "deinit_wheel")
        self.wheel.close()

    def deinit_elm(self):
        debug_print_mtcall("Application", "deinit_elm")
        self.elm.close()

    def deinit_canbus(self):
        debug_print_mtcall("Application", "deinit_canbus")
        self.canbus.close()
开发者ID:michalsz89,项目名称:pyelmemu,代码行数:93,代码来源:pyelmemu.py

示例2: open

# 需要导入模块: from engine import Engine [as 别名]
# 或者: from engine.Engine import close [as 别名]
__author__ = 'peter.tillotson'

from engine import Engine
import logging, os, yaml

cwd = os.getcwd()
if cwd.endswith('src'):
    os.chdir('..')
config = yaml.load( open('config.yml') )
levels = {
    'debug': logging.DEBUG,
    'critical' : logging.CRITICAL,
    'error': logging.ERROR,
    'info' : logging.INFO,
    'warn' : logging.WARN
}
level = levels.get(config['defaults']['logging']['level'].strip().lower())
format = config['defaults']['logging']['format']
logging.basicConfig(level=level, format=format)
engine = Engine( config )
try:
    engine.start()
    engine.stop()
except Exception as e:
    logging.exception(e)

finally:
    engine.close()
开发者ID:slatemine,项目名称:detect,代码行数:30,代码来源:run.py


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