-
Notifications
You must be signed in to change notification settings - Fork 47
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
feature: add UiField
as the new intermediate object representing widget parameters
#475
Conversation
just some notes for myself about the mapping between any current widget parameter names and corresponding fields in UiField (if applicable): # these params directly map to the UiField names
{
"name",
"visible",
"nullable",
"orientation",
}
# aliases
{
"annotation": "type",
"choices": "enum", # CategoricalWidget
"enabled": "NOT disabled",
"label": "title",
"max": "maximum",
"min": "minimum",
"start": "minimum", # "RangeEdit",
"step": "multiple_of", # "RangedWidget" ... complicated, not true for RangeEdit
"stop": "exclusive_maximum", # "RangeEdit",
"text": "title", # ButtonWidgets have "text"... confusing
"tooltip": "description",
# 'value': 'default',
}
# no correlate:
{
"gui_only": "RadioButtons",
"parent": "RadioButtons",
"backend_kwargs": "RadioButtons",
# used for options of child widgets ... but they should be done with annotations?
"options": "ListEdit",
"min_pos": "TransformedRangedWidget",
"max_pos": "TransformedRangedWidget",
"bind": "RadioButtons",
"base": "LogSlider",
"tracking": "SliderWidget",
"readout": "SliderWidget", # toggles editable spinbox visibility.
# allow_multiple is used to induce a Select widget...
# but it is most like an array type with items:
# {
# "type": "array",
# "items": {
# "type": "string",
# "enum": [ "foo", "bar", "baz" ]
# },
# "uniqueItems": true,
# "minItems": 1
# }
# DEPRECATE
"allow_multiple": "CategoricalWidget",
"mode": "FileEdit",
"filter": "FileEdit", # most like 'pattern'??
}
# Table stuff (don't map these... can be done directly with value)
{
"index": "Table",
"columns": "Table",
}
# container stuff
{
"app": "FunctionGui",
"auto_call": "FunctionGui",
"result_widget": "FunctionGui",
"param_options": "FunctionGui",
"persist": "FunctionGui",
"raise_on_unknown": "FunctionGui",
"layout": "Container",
"scrollable": "Container",
"widgets": "Container",
"labels": "Container",
"function": "MainFunctionGui",
"call_button": "FunctionGui",
"tooltips": "FunctionGui",
} |
Codecov Report
@@ Coverage Diff @@
## main #475 +/- ##
==========================================
+ Coverage 89.56% 89.98% +0.41%
==========================================
Files 31 32 +1
Lines 3987 4212 +225
==========================================
+ Hits 3571 3790 +219
- Misses 416 422 +6
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. |
Codecov ReportBase: 89.56% // Head: 89.98% // Increases project coverage by
Additional details and impacted files@@ Coverage Diff @@
## main #475 +/- ##
==========================================
+ Coverage 89.56% 89.98% +0.41%
==========================================
Files 31 32 +1
Lines 3987 4214 +227
==========================================
+ Hits 3571 3792 +221
- Misses 416 422 +6
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. ☔ View full report at Codecov. |
UiField
as the new intermediate object representing widget parameters
see #474 for the complete context and motivation for this PR
UiField
will be the thing that all type annotations are coerced to prior to widget generation (think of it as a UI-focused variant ofdataclasses.field
).this is an alternative to #446 ... it is less "heavy" in that it doesn't bring in the pydantic dependency, instead, aiming to support pydantic, attrs, dataclasses, named tuples, etc...
All of these are a set of
name: annotation = 'defaut_value'
.... which can be reduced to a "model" that is a collection of field objects. This PR adds that field object, and adds some tests that begin to demonstrate intended usage.everything is private still, so this will be just one of a number of PRs moving in this direction