refactor: Make all the valued containers subclass ValueWidget#663
refactor: Make all the valued containers subclass ValueWidget#663tlambert03 merged 11 commits intopyapp-kit:mainfrom
ValueWidget#663Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #663 +/- ##
==========================================
- Coverage 89.00% 88.87% -0.14%
==========================================
Files 39 39
Lines 4777 4754 -23
==========================================
- Hits 4252 4225 -27
- Misses 525 529 +4 ☔ View full report in Codecov by Sentry. 🚨 Try these New Features:
|
|
this looks like a great start @hanjinliu, the one thing I'm not thrilled about is the changing of the meaning of |
|
That makes sense. Keeping |
|
sorry that this has sat so long @hanjinliu. would you mind resolving conflicts now that TypeMap is in? |
|
docs are not building correctly anymore. I think it may require |
|
Thank you for your help! I found that after the implementation of |
ValueWidgetValueWidget
Closes #372 #661
Now this works:
I had to refactor more than I first thought. The major problem was that
ValueWidgethadValueWidgetProtocolbefore, which is not compatible with container-like widgets (e.g. there's no_mgui_get_valueforFileEdit). In this PR, I madeValueWidgetmore abstract: it only implements the basic interface for getting/setting values, thus independent of backends.PrimitiveValueWidgetis the class that require backends, which is identical to the formerValueWidget. Besides, I introduced_BaseContainerWidgetforValuedContainerWidgetbecause many methods ofContainerWidgetis not publicly needed for value widgets (e.g. we never useinsertforFileEdit).Inheritance map is now like below.
Notes:
EmptyWidgetis now aValuedContainerWidgetbecause it's simply an empty container. Backend implementation ofEmptyWidgetis no longer needed.ValueWidgetnow inheritsABCbecause abstractmethodget_valueandset_valueare needed. This means if one made a Qt widget and magicgui interface likePlease let me know what you think.