dashboard: tidy dashboard naming logic

This commit is contained in:
Chris Ballance 2017-11-27 22:00:30 +00:00 committed by Sébastien Bourdeauducq
parent fbd4d8eb6f
commit 1426ecad64
1 changed files with 10 additions and 8 deletions

View File

@ -113,10 +113,10 @@ def main():
rpc_clients[target] = client rpc_clients[target] = client
config = Client(args.server, args.port_control, "master_config") config = Client(args.server, args.port_control, "master_config")
atexit.register(config.close_rpc) try:
server_name = config.get_name() server_name = config.get_name()
if server_name is None: finally:
server_name = args.server config.close_rpc()
disconnect_reported = False disconnect_reported = False
def report_disconnect(): def report_disconnect():
@ -147,7 +147,7 @@ def main():
broadcast_clients[target] = client broadcast_clients[target] = client
# initialize main window # 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) smgr.register(main_window)
mdi_area = MdiArea() mdi_area = MdiArea()
mdi_area.setHorizontalScrollBarPolicy(QtCore.Qt.ScrollBarAsNeeded) mdi_area.setHorizontalScrollBarPolicy(QtCore.Qt.ScrollBarAsNeeded)
@ -218,9 +218,11 @@ def main():
if d_log0 is not None: if d_log0 is not None:
main_window.tabifyDockWidget(d_schedule, d_log0) main_window.tabifyDockWidget(d_schedule, d_log0)
server_description = server_name
if server_name != args.server: if server_name is not None:
server_description += " ({})".format(args.server) server_description = server_name + " ({})".format(args.server)
else:
server_description = args.server
logging.info("ARTIQ dashboard %s connected to %s", logging.info("ARTIQ dashboard %s connected to %s",
artiq_version, server_description) artiq_version, server_description)