pyapp-kit / magicgui

build GUIs from type annotations
https://pyapp-kit.github.io/magicgui/
MIT License
362 stars 49 forks source link

fix: Fix parent attribute to point to proper magicgui widget parent #583

Closed tlambert03 closed 1 year ago

tlambert03 commented 1 year ago

fixes #582 closes #456 This PR fixes widget.parent behavior to point to the containing magicgui Container rather than the backend widget. The implementation is a bit hacky, and currently only works for the qt backend. But it's giving the desired behavior in tests.

@brisvag ... I believe this is something we've discussed as well. If you have a moment to take a peek and confirm that this at least moves us in the right direction, I would appreciate it!

codecov[bot] commented 1 year ago

Codecov Report

All modified lines are covered by tests :white_check_mark:

Comparison is base (c578b61) 87.60% compared to head (b3c37a5) 87.64%.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #583 +/- ## ========================================== + Coverage 87.60% 87.64% +0.03% ========================================== Files 39 39 Lines 4551 4557 +6 ========================================== + Hits 3987 3994 +7 + Misses 564 563 -1 ``` | [Files](https://app.codecov.io/gh/pyapp-kit/magicgui/pull/583?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=pyapp-kit) | Coverage Δ | | |---|---|---| | [src/magicgui/backends/\_ipynb/widgets.py](https://app.codecov.io/gh/pyapp-kit/magicgui/pull/583?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=pyapp-kit#diff-c3JjL21hZ2ljZ3VpL2JhY2tlbmRzL19pcHluYi93aWRnZXRzLnB5) | `64.55% <ø> (+0.27%)` | :arrow_up: | | [src/magicgui/backends/\_qtpy/widgets.py](https://app.codecov.io/gh/pyapp-kit/magicgui/pull/583?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=pyapp-kit#diff-c3JjL21hZ2ljZ3VpL2JhY2tlbmRzL19xdHB5L3dpZGdldHMucHk=) | `87.41% <100.00%> (+0.09%)` | :arrow_up: |

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

brisvag commented 1 year ago

Yup, in fact there's an issue about it :) https://github.com/pyapp-kit/magicgui/issues/456