datalad / datalad-gooey

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

Extend constraint concept to dataset context #283

Closed mih closed 1 year ago

mih commented 1 year ago

This implements and demos an idea from https://github.com/datalad/datalad/issues/7054

With this change, a Constraint can implement a for_dataset() method that return an instance of another constraint (same or different type), tailored for a particular dataset instance.

This feature is demo'ed for EnsureDatasetSiblingName, which is EnsureStr without a dataset context, but generated an EnsureChoice with the names of the siblings of a particular dataset.

EnsureDatasetSiblingName is then used in SiblingChoiceParamWidget, which enables to move and re-use the sibling discovery to/from the constraint, rather than making the Qt-specific code longer.

codecov-commenter commented 1 year ago

Codecov Report

Base: 65.90% // Head: 65.97% // Increases project coverage by +0.06% :tada:

Coverage data is based on head (d02536a) compared to base (169f33c). Patch coverage: 48.00% of modified lines in pull request are covered.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #283 +/- ## ========================================== + Coverage 65.90% 65.97% +0.06% ========================================== Files 39 39 Lines 2238 2251 +13 ========================================== + Hits 1475 1485 +10 - Misses 763 766 +3 ``` | [Impacted Files](https://codecov.io/gh/datalad/datalad-gooey/pull/283?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=datalad) | Coverage Δ | | |---|---|---| | [datalad\_gooey/param\_widgets.py](https://codecov.io/gh/datalad/datalad-gooey/pull/283/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=datalad#diff-ZGF0YWxhZF9nb29leS9wYXJhbV93aWRnZXRzLnB5) | `57.00% <45.45%> (+1.13%)` | :arrow_up: | | [datalad\_gooey/constraints.py](https://codecov.io/gh/datalad/datalad-gooey/pull/283/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=datalad#diff-ZGF0YWxhZF9nb29leS9jb25zdHJhaW50cy5weQ==) | `56.66% <50.00%> (-5.84%)` | :arrow_down: | Help us with your feedback. Take ten seconds to tell us [how you rate us](https://about.codecov.io/nps?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=datalad). Have a feature suggestion? [Share it here.](https://app.codecov.io/gh/feedback/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=datalad)

:umbrella: View full report at Codecov.
:loudspeaker: Do you have feedback about the report comment? Let us know in this issue.