__init__.py 文件源码

python
阅读 17 收藏 0 点赞 0 评论 0

项目:gui_tool 作者: UAVCAN 项目源码 文件源码
def _process_entry_point(channel):
    logger.info('Plotter process started with PID %r', os.getpid())
    app = QApplication(sys.argv)    # Inheriting args from the parent process

    def exit_if_should():
        if RUNNING_ON_WINDOWS:
            return False
        else:
            return os.getppid() != PARENT_PID       # Parent is dead

    exit_check_timer = QTimer()
    exit_check_timer.setSingleShot(False)
    exit_check_timer.timeout.connect(exit_if_should)
    exit_check_timer.start(2000)

    def get_transfer():
        received, obj = channel.receive_nonblocking()
        if received:
            if obj == IPC_COMMAND_STOP:
                logger.info('Plotter process has received a stop request, goodbye')
                app.exit(0)
            else:
                return obj

    win = PlotterWindow(get_transfer)
    win.show()

    logger.info('Plotter process %r initialized successfully, now starting the event loop', os.getpid())
    sys.exit(app.exec_())
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号