-
Notifications
You must be signed in to change notification settings - Fork 53
refactor: Make all the valued containers subclass ValueWidget
#663
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
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 |
tlambert03
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks @hanjinliu!
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.