hanjinliu / magic-class

Generate multifunctional and macro recordable GUIs from Python classes
https://hanjinliu.github.io/magic-class/
BSD 3-Clause "New" or "Revised" License
40 stars 5 forks source link

`FieldGroup.parent` typing #120

Closed multimeric closed 1 year ago

multimeric commented 1 year ago

Widget.parent's type annotation indicates that it returns a magicgui.widgets.Widget, but at least for a FieldGroup, it seems to instead return a QWidget:

> isinstance(self, FieldGroup)
True
> isinstance(self.parent, Widget)
False
> type(self.parent)
<class 'PyQt5.QtWidgets.QStackedWidget'>
hanjinliu commented 1 year ago

Hi, @multimeric , it's a problem of magicgui (FieldGroup inherits magicgui's Container).

https://github.com/pyapp-kit/magicgui/blob/a65a59a2fa9a015d5ecb88b6e472069892f6de1c/src/magicgui/widgets/bases/_widget.py#L210

I remember there was a plan to let parent return magicgui widgets (at least it should return magicgui widget, otherwise it does not follow the concept of backend independency of magicgui), but apparently it is not ready now...

multimeric commented 1 year ago

Okay, my bad. I'll report this over at magicgui!