forked from M-Labs/artiq
browser,dashboard: fix asyncio loop management
This commit is contained in:
parent
d872c3ab4d
commit
9e8bb3c701
|
@ -83,7 +83,7 @@ class Browser(QtWidgets.QMainWindow):
|
||||||
|
|
||||||
self.applets = applets.AppletsDock(self, datasets_sub)
|
self.applets = applets.AppletsDock(self, datasets_sub)
|
||||||
smgr.register(self.applets)
|
smgr.register(self.applets)
|
||||||
atexit_register_coroutine(self.applets.stop)
|
atexit_register_coroutine(self.applets.stop, loop=loop)
|
||||||
|
|
||||||
self.datasets = datasets.DatasetsDock(
|
self.datasets = datasets.DatasetsDock(
|
||||||
datasets_sub, master_host, master_port)
|
datasets_sub, master_host, master_port)
|
||||||
|
@ -162,7 +162,7 @@ def main():
|
||||||
browser.show()
|
browser.show()
|
||||||
smgr.load()
|
smgr.load()
|
||||||
smgr.start()
|
smgr.start()
|
||||||
atexit_register_coroutine(smgr.stop)
|
atexit_register_coroutine(smgr.stop, loop=loop)
|
||||||
|
|
||||||
if args.select is not None:
|
if args.select is not None:
|
||||||
browser.files.select(args.select)
|
browser.files.select(args.select)
|
||||||
|
|
|
@ -148,7 +148,7 @@ def main():
|
||||||
report_disconnect)
|
report_disconnect)
|
||||||
loop.run_until_complete(subscriber.connect(
|
loop.run_until_complete(subscriber.connect(
|
||||||
args.server, args.port_notify))
|
args.server, args.port_notify))
|
||||||
atexit_register_coroutine(subscriber.close)
|
atexit_register_coroutine(subscriber.close, loop=loop)
|
||||||
sub_clients[notifier_name] = subscriber
|
sub_clients[notifier_name] = subscriber
|
||||||
|
|
||||||
broadcast_clients = dict()
|
broadcast_clients = dict()
|
||||||
|
@ -156,7 +156,7 @@ def main():
|
||||||
client = Receiver(target, [], report_disconnect)
|
client = Receiver(target, [], report_disconnect)
|
||||||
loop.run_until_complete(client.connect(
|
loop.run_until_complete(client.connect(
|
||||||
args.server, args.port_broadcast))
|
args.server, args.port_broadcast))
|
||||||
atexit_register_coroutine(client.close)
|
atexit_register_coroutine(client.close, loop=loop)
|
||||||
broadcast_clients[target] = client
|
broadcast_clients[target] = client
|
||||||
|
|
||||||
# initialize main window
|
# initialize main window
|
||||||
|
@ -196,13 +196,13 @@ def main():
|
||||||
"port_notify": args.port_notify,
|
"port_notify": args.port_notify,
|
||||||
"port_control": args.port_control,
|
"port_control": args.port_control,
|
||||||
})
|
})
|
||||||
atexit_register_coroutine(d_applets.stop)
|
atexit_register_coroutine(d_applets.stop, loop=loop)
|
||||||
smgr.register(d_applets)
|
smgr.register(d_applets)
|
||||||
broadcast_clients["ccb"].notify_cbs.append(d_applets.ccb_notify)
|
broadcast_clients["ccb"].notify_cbs.append(d_applets.ccb_notify)
|
||||||
|
|
||||||
d_ttl_dds = moninj.MonInj(rpc_clients["schedule"])
|
d_ttl_dds = moninj.MonInj(rpc_clients["schedule"])
|
||||||
loop.run_until_complete(d_ttl_dds.start(args.server, args.port_notify))
|
loop.run_until_complete(d_ttl_dds.start(args.server, args.port_notify))
|
||||||
atexit_register_coroutine(d_ttl_dds.stop)
|
atexit_register_coroutine(d_ttl_dds.stop, loop=loop)
|
||||||
|
|
||||||
d_schedule = schedule.ScheduleDock(
|
d_schedule = schedule.ScheduleDock(
|
||||||
rpc_clients["schedule"], sub_clients["schedule"])
|
rpc_clients["schedule"], sub_clients["schedule"])
|
||||||
|
@ -232,7 +232,7 @@ def main():
|
||||||
main_window.show()
|
main_window.show()
|
||||||
smgr.load()
|
smgr.load()
|
||||||
smgr.start()
|
smgr.start()
|
||||||
atexit_register_coroutine(smgr.stop)
|
atexit_register_coroutine(smgr.stop, loop=loop)
|
||||||
|
|
||||||
# work around for https://github.com/m-labs/artiq/issues/1307
|
# work around for https://github.com/m-labs/artiq/issues/1307
|
||||||
d_ttl_dds.ttl_dock.show()
|
d_ttl_dds.ttl_dock.show()
|
||||||
|
|
Loading…
Reference in New Issue