forked from M-Labs/artiq
1
0
Fork 0

gui/applets/simple: support for optional datasets

This commit is contained in:
Sebastien Bourdeauducq 2016-01-10 18:18:47 +08:00
parent 2199eadb99
commit 4136ff68cf
1 changed files with 7 additions and 4 deletions

View File

@ -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()