datalad / datalad-gooey

A graphical user interface for DataLad (datalad.org)
https://docs.datalad.org/projects/gooey
Other
4 stars 6 forks source link

Support for `nargs=<int>` #284

Open mih opened 1 year ago

mih commented 1 year ago

i.e. a fixed number of arguments.

This is needed for subdatasets(set_property=)

This could be implemented as a MultiValueInputWidget special case. It would make sense to prefil the list widget with n items, hide add and remove button, and rename 'update' to set (the latter maybe an attractive shorter alternative anyways).

A closely related, but not identical issue is the disambiguation of nargs= and action='append'. ATM nargs=* is interpreted identical to action=append. While this may be OK in practice, the particular combination of values matters. For example nargs=2 plus action='append' actually aims to assemble a list of 2-tuples (this is what subdatasets(set_property=) is doing).

If the fixed-n case is implemented via MultiValueInputWidget, we need to specifically (re-)enabled the nexting of two such widgets -- which is currently prevented (in _get_parameter_widget_factory()).