forked from M-Labs/artiq
1
0
Fork 0

experiments: style (NFC)

This commit is contained in:
Simon Renblad 2024-04-10 12:26:20 +08:00 committed by Sébastien Bourdeauducq
parent 400c1644b0
commit 3ecd115252
1 changed files with 20 additions and 19 deletions

View File

@ -289,8 +289,7 @@ class _ExperimentDock(QtWidgets.QMdiSubWindow):
arginfo = expdesc["arginfo"] arginfo = expdesc["arginfo"]
for k, v in overrides.items(): for k, v in overrides.items():
# Some values (e.g. scans) may have multiple defaults in a list # Some values (e.g. scans) may have multiple defaults in a list
if ("default" in arginfo[k][0] if ("default" in arginfo[k][0] and isinstance(arginfo[k][0]["default"], list)):
and isinstance(arginfo[k][0]["default"], list)):
arginfo[k][0]["default"].insert(0, v) arginfo[k][0]["default"].insert(0, v)
else: else:
arginfo[k][0]["default"] = v arginfo[k][0]["default"] = v
@ -355,9 +354,9 @@ class _ExperimentDock(QtWidgets.QMdiSubWindow):
unparse_devarg_override(expid["devarg_override"])) unparse_devarg_override(expid["devarg_override"]))
self.log_level.setCurrentIndex(log_levels.index( self.log_level.setCurrentIndex(log_levels.index(
log_level_to_name(expid["log_level"]))) log_level_to_name(expid["log_level"])))
if ("repo_rev" in expid and if "repo_rev" in expid and \
expid["repo_rev"] != "N/A" and expid["repo_rev"] != "N/A" and \
hasattr(self, "repo_rev")): hasattr(self, "repo_rev"):
self.repo_rev.setText(expid["repo_rev"]) self.repo_rev.setText(expid["repo_rev"])
except: except:
logger.error("Could not set submission options from HDF5 expid", logger.error("Could not set submission options from HDF5 expid",
@ -560,7 +559,8 @@ class ExperimentManager:
if expurl in self.open_experiments.keys(): if expurl in self.open_experiments.keys():
self.open_experiments[expurl].argeditor.update_argument(name, argument) self.open_experiments[expurl].argeditor.update_argument(name, argument)
except: except:
logger.warn("Failed to set value for argument \"{}\" in experiment: {}.".format(name, expurl), exc_info=1) logger.warn("Failed to set value for argument \"{}\" in experiment: {}."
.format(name, expurl), exc_info=1)
def get_submission_arguments(self, expurl): def get_submission_arguments(self, expurl):
if expurl in self.submission_arguments: if expurl in self.submission_arguments:
@ -570,8 +570,8 @@ class ExperimentManager:
raise ValueError("Submission arguments must be preinitialized " raise ValueError("Submission arguments must be preinitialized "
"when not using repository") "when not using repository")
class_desc = self.explist[expurl[5:]] class_desc = self.explist[expurl[5:]]
return self.initialize_submission_arguments(expurl, return self.initialize_submission_arguments(expurl, class_desc["arginfo"],
class_desc["arginfo"], class_desc.get("argument_ui", None)) class_desc.get("argument_ui", None))
def open_experiment(self, expurl): def open_experiment(self, expurl):
if expurl in self.open_experiments: if expurl in self.open_experiments:
@ -671,9 +671,9 @@ class ExperimentManager:
repo_match = "repo_rev" in expid repo_match = "repo_rev" in expid
else: else:
repo_match = "repo_rev" not in expid repo_match = "repo_rev" not in expid
if (repo_match and if repo_match and \
("file" in expid and expid["file"] == file) and ("file" in expid and expid["file"] == file) and \
expid["class_name"] == class_name): expid["class_name"] == class_name:
rids.append(rid) rids.append(rid)
asyncio.ensure_future(self._request_term_multiple(rids)) asyncio.ensure_future(self._request_term_multiple(rids))
@ -727,6 +727,7 @@ class ExperimentManager:
self.is_quick_open_shown = True self.is_quick_open_shown = True
dialog = _QuickOpenDialog(self) dialog = _QuickOpenDialog(self)
def closed(): def closed():
self.is_quick_open_shown = False self.is_quick_open_shown = False
dialog.closed.connect(closed) dialog.closed.connect(closed)