forked from M-Labs/artiq
gui/applets/simple: support for optional datasets
This commit is contained in:
parent
2199eadb99
commit
4136ff68cf
|
@ -30,11 +30,14 @@ class SimpleApplet:
|
||||||
help="embed main widget into existing window")
|
help="embed main widget into existing window")
|
||||||
self._arggroup_datasets = self.argparser.add_argument_group("datasets")
|
self._arggroup_datasets = self.argparser.add_argument_group("datasets")
|
||||||
|
|
||||||
def add_dataset(self, name, help=None):
|
def add_dataset(self, name, help=None, required=True):
|
||||||
if help is None:
|
kwargs = dict()
|
||||||
self._arggroup_datasets.add_argument(name)
|
if help is not None:
|
||||||
|
kwargs["help"] = help
|
||||||
|
if required:
|
||||||
|
self._arggroup_datasets.add_argument(name, **kwargs)
|
||||||
else:
|
else:
|
||||||
self._arggroup_datasets.add_argument(name, help=help)
|
self._arggroup_datasets.add_argument("--" + name, **kwargs)
|
||||||
|
|
||||||
def args_init(self):
|
def args_init(self):
|
||||||
self.args = self.argparser.parse_args()
|
self.args = self.argparser.parse_args()
|
||||||
|
|
Loading…
Reference in New Issue