Add support for formatters to ValueRef#13650
Conversation
|
When working on this I noticed that the template case only renders tooltip entry for the last selected index, not all of the selected indices as in the default (tuple) case. |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## branch-3.5 #13650 +/- ##
==============================================
+ Coverage 91.57% 92.59% +1.02%
==============================================
Files 326 325 -1
Lines 20737 20733 -4
==============================================
+ Hits 18990 19198 +208
+ Misses 1747 1535 -212 |
5e5d5b8 to
5bf80e4
Compare
5606cb2 to
fbc9362
Compare
fe501ce to
b5ba116
Compare
b5ba116 to
bbe2610
Compare
bbe2610 to
89903b7
Compare
|
This is tentatively ready. Some more unit testing will follow. |
| ), | ||
| children=[ | ||
| "index:", Div(children=["#", Index()]), | ||
| "(x, y):", Div(children=["(", ValueRef(field="x"), ", ", ValueRef(field="y"), ")"]), |
There was a problem hiding this comment.
Just thinking out loud here, having a convenience class like this could make sense to me.
"(x, y):", Div(children=[ValueRefs("({x}, {y})", fields=["x", "y"])]),or
"(x, y):", ValueRefs("({x}, {y})", fields=["x", "y"]),Likely out-of-scope for this PR.
There was a problem hiding this comment.
ValueRef is a low-level API meant for having full control over formatting, instead of relying on an ad-hoc syntax. However, most of the time users will choose the syntax out of convenience. Thus I don't see a need for additional convenience here. If only PEP 501 (general purpose string interpolation) wasn't deferred, then this could be made really convenient while retaining complete control.
| column_gap="10px", | ||
| ), | ||
| children=[ | ||
| "index:", Div(children=["#", Index()]), |
There was a problem hiding this comment.
Maybe add a style to this Div.
I feel like this example shows the API but not why to use it, which is a bit sad.
There was a problem hiding this comment.
This is also a bit much. I will see if I can simplify this with HTML() model.
There was a problem hiding this comment.
The "improved" example is still quite much, but is shows styling and better shows how to reference things.
89903b7 to
057f06e
Compare
* Add support for formatters to ValueRef * Robustify handling of templatable DOM trees * Allow multiple tooltip entries by cloning * Rename FormatterType -> BuiltinFormatter * Add interaction/tools/hover_tooltip-advanced.py * Add visual integration tests * Add MDN links to ValueRef.formatter docstring * Update a unit test description * Make HTML inherit from DOMElement * Use HTML model and styling in the example * Added release notes
|
This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |

Example (side-by-side comparison):
fixes #13599