forked from M-Labs/artiq
environment,dashboard: generalize multiple defaults, fix HDF5 argument load
This commit is contained in:
parent
43081b4f64
commit
b3e55b753b
|
@ -331,6 +331,11 @@ class _ExperimentDock(QtWidgets.QMdiSubWindow):
|
|||
self.expurl, exc_info=True)
|
||||
return
|
||||
for k, v in overrides.items():
|
||||
# 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)
|
||||
|
||||
|
|
|
@ -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"]
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue