-
Notifications
You must be signed in to change notification settings - Fork 50
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
refactor: Make all the valued containers subclass ValueWidget
#663
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 |
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!
ValueWidget
ValueWidget
Closes #372 #661
Now this works:
I had to refactor more than I first thought. The major problem was that
ValueWidget
hadValueWidgetProtocol
before, which is not compatible with container-like widgets (e.g. there's no_mgui_get_value
forFileEdit
). In this PR, I madeValueWidget
more abstract: it only implements the basic interface for getting/setting values, thus independent of backends.PrimitiveValueWidget
is the class that require backends, which is identical to the formerValueWidget
. Besides, I introduced_BaseContainerWidget
forValuedContainerWidget
because many methods ofContainerWidget
is not publicly needed for value widgets (e.g. we never useinsert
forFileEdit
).Inheritance map is now like below.
Notes:
EmptyWidget
is now aValuedContainerWidget
because it's simply an empty container. Backend implementation ofEmptyWidget
is no longer needed.ValueWidget
now inheritsABC
because abstractmethodget_value
andset_value
are needed. This means if one made a Qt widget and magicgui interface likePlease let me know what you think.