From 1426ecad649babdc29f43847a97454538d0c33d3 Mon Sep 17 00:00:00 2001 From: Chris Ballance Date: Mon, 27 Nov 2017 22:00:30 +0000 Subject: [PATCH] dashboard: tidy dashboard naming logic --- artiq/frontend/artiq_dashboard.py | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/artiq/frontend/artiq_dashboard.py b/artiq/frontend/artiq_dashboard.py index 22e7332a8..3ee539713 100755 --- a/artiq/frontend/artiq_dashboard.py +++ b/artiq/frontend/artiq_dashboard.py @@ -113,10 +113,10 @@ def main(): rpc_clients[target] = client config = Client(args.server, args.port_control, "master_config") - atexit.register(config.close_rpc) - server_name = config.get_name() - if server_name is None: - server_name = args.server + try: + server_name = config.get_name() + finally: + config.close_rpc() disconnect_reported = False def report_disconnect(): @@ -147,7 +147,7 @@ def main(): broadcast_clients[target] = client # initialize main window - main_window = MainWindow(server_name) + main_window = MainWindow(args.server if server_name is None else server_name) smgr.register(main_window) mdi_area = MdiArea() mdi_area.setHorizontalScrollBarPolicy(QtCore.Qt.ScrollBarAsNeeded) @@ -218,9 +218,11 @@ def main(): if d_log0 is not None: main_window.tabifyDockWidget(d_schedule, d_log0) - server_description = server_name - if server_name != args.server: - server_description += " ({})".format(args.server) + + if server_name is not None: + server_description = server_name + " ({})".format(args.server) + else: + server_description = args.server logging.info("ARTIQ dashboard %s connected to %s", artiq_version, server_description)