2
0
mirror of https://github.com/m-labs/artiq.git synced 2024-12-25 03:08:27 +08:00

environment,dashboard: generalize multiple defaults, fix HDF5 argument load

This commit is contained in:
Sebastien Bourdeauducq 2016-05-24 08:58:34 -05:00
parent 43081b4f64
commit b3e55b753b
4 changed files with 14 additions and 3 deletions

View File

@ -331,7 +331,12 @@ class _ExperimentDock(QtWidgets.QMdiSubWindow):
self.expurl, exc_info=True)
return
for k, v in overrides.items():
arginfo[k][0]["default"] = v
# Some values (e.g. scans) may have multiple defaults in a list
if ("default" in arginfo[k][0]
and isinstance(arginfo[k][0]["default"], list)):
arginfo[k][0]["default"].insert(0, v)
else:
arginfo[k][0]["default"] = v
self.manager.initialize_submission_arguments(self.expurl, arginfo)
self.argeditor.deleteLater()

View File

@ -274,8 +274,10 @@ class _ScanEntry(LayoutWidget):
}
if "default" in procdesc:
defaults = procdesc["default"]
if not isinstance(defaults, list):
defaults = [defaults]
state["selected"] = defaults[0]["ty"]
for default in defaults:
for default in reversed(defaults):
ty = default["ty"]
if ty == "NoScan":
state[ty]["value"] = default["value"]

View File

@ -23,6 +23,10 @@ class DefaultMissing(Exception):
class _SimpleArgProcessor:
def __init__(self, default=NoDefault):
# If default is a list, it means multiple defaults are specified, with
# decreasing priority.
if isinstance(default, list):
raise NotImplementedError
if default is not NoDefault:
self.default_value = default

View File

@ -166,7 +166,7 @@ class Scannable:
if global_step is None:
global_step = scale/10.0
if default is not NoDefault:
if not isinstance(default, (tuple, list)):
if not isinstance(default, list):
default = [default]
self.default_values = default
self.unit = unit