def main(): # initialize application args = get_argparser().parse_args() widget_log_handler = log.init_log(args, "browser") app = QtWidgets.QApplication(["ARTIQ Browser"]) loop = QEventLoop(app) asyncio.set_event_loop(loop) atexit.register(loop.close) datasets_sub = models.LocalModelManager(datasets.Model) datasets_sub.init({}) smgr = state.StateManager(args.db_file) browser = Browser(smgr, datasets_sub, args.browse_root, args.server, args.port) widget_log_handler.callback = browser.log.append_message if os.name == "nt": # HACK: show the main window before creating applets. # Otherwise, the windows of those applets that are in detached # QDockWidgets fail to be embedded. browser.show() smgr.load() smgr.start() atexit_register_coroutine(smgr.stop) if args.select is not None: browser.files.select(args.select) browser.show() loop.run_until_complete(browser.exit_request.wait())
def main(): # initialize application args = get_argparser().parse_args() if args.db_file is None: args.db_file = os.path.join(get_user_config_dir(), "artiq_browser.pyon") widget_log_handler = log.init_log(args, "browser") app = QtWidgets.QApplication(["ARTIQ Browser"]) loop = QEventLoop(app) asyncio.set_event_loop(loop) # https://github.com/harvimt/quamash/issues/123 if sys.version_info >= (3, 8): asyncio.events._set_running_loop(loop) atexit.register(loop.close) datasets_sub = models.LocalModelManager(datasets.Model) datasets_sub.init({}) smgr = state.StateManager(args.db_file) browser = Browser(smgr, datasets_sub, args.browse_root, args.server, args.port) widget_log_handler.callback = browser.log.append_message if os.name == "nt": # HACK: show the main window before creating applets. # Otherwise, the windows of those applets that are in detached # QDockWidgets fail to be embedded. browser.show() smgr.load() smgr.start() atexit_register_coroutine(smgr.stop) if args.select is not None: browser.files.select(args.select) browser.show() loop.run_until_complete(browser.exit_request.wait())