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_())
评论列表
文章目录