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")
self._arggroup_datasets = self.argparser.add_argument_group("datasets")
def add_dataset(self, name, help=None):
if help is None:
self._arggroup_datasets.add_argument(name)
def add_dataset(self, name, help=None, required=True):
kwargs = dict()
if help is not None:
kwargs["help"] = help
if required:
self._arggroup_datasets.add_argument(name, **kwargs)
else:
self._arggroup_datasets.add_argument(name, help=help)
self._arggroup_datasets.add_argument("--" + name, **kwargs)
def args_init(self):
self.args = self.argparser.parse_args()