Make all the valued containers subclass ValueWidget
#663
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.