mirror of
https://github.com/m-labs/artiq.git
synced 2024-12-25 19:28:26 +08:00
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")
|
||||
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()
|
||||
|
Loading…
Reference in New Issue
Block a user