def _main(args): # import pydm # app = QApplication([]) # app = pydm.PyDMApplication() app = QApplication([]) signal.signal(signal.SIGINT, signal.SIG_DFL) from xicam.gui.windows import splash from xicam.core import msg if args.verbose in sys.argv: QErrorMessage.qtHandler() # start splash in subprocess splash_proc = QProcess() # splash_proc.started.connect(lambda: print('started splash')) # splash_proc.finished.connect(lambda: print('finished splashing')) log_file = msg.file_handler.baseFilename initial_length = os.path.getsize(log_file) splash_proc.start(sys.executable, [splash.__file__, log_file, str(initial_length)]) from xicam.gui.windows.mainwindow import XicamMainWindow mainwindow = XicamMainWindow() while splash_proc.state() != QProcess.NotRunning: app.processEvents() # splash_proc.waitForFinished() mainwindow.show() # splash = splash.XicamSplashScreen(args=args) return sys.exit(app.exec_())
def _main(args, exec=True): global mainwindow, splash_proc, show_check_timer # import pydm # app = QApplication([]) # app = pydm.PyDMApplication() app = QApplication.instance() or QApplication([]) signal.signal(signal.SIGINT, signal.SIG_DFL) from xicam.gui.windows import splash from xicam.core import msg if getattr(args, 'verbose', False): QErrorMessage.qtHandler() # start splash in subprocess splash_proc = QProcess() # splash_proc.started.connect(lambda: print('started splash')) # splash_proc.finished.connect(lambda: print('finished splashing')) log_file = msg.file_handler.baseFilename initial_length = os.path.getsize(log_file) splash_proc.start(sys.executable, [splash.__file__, log_file, str(initial_length)]) show_check_timer = QTimer() show_check_timer.timeout.connect(check_show_mainwindow) show_check_timer.start(100) from xicam.gui.windows.mainwindow import XicamMainWindow mainwindow = XicamMainWindow() if exec: return app.exec_() else: return mainwindow