-
Notifications
You must be signed in to change notification settings - Fork 7
Defined label_formatter parameter on Widgets #48
Conversation
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.
Looks good, thanks! Maybe should provide a dummy no-op formatter, or support None, to allow this behavior to be disabled easily for people who want to see a direct mapping to their parameter names?
@@ -29,6 +29,23 @@ | |||
__version__ = '0.2.1-unknown' |
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.
Not sure why we need this conditional anymore. @ceball ?
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.
Not quite sure how this is in a pr about label format (I'm on my phone so can't easily see whole context), but isn't this just a case of parambokeh not having been updated to use autover yet?
Addressed in 8dc2816 - just supply |
I might add an option for label overrides... |
Now you can set specific labels e.g if there is one specific label where the underscore is appropriate but you want the rest to become spaces: override = {'unbounded_int': 'THIS INTEGER KNOWS NO BOUNDS'}
widgets = parambokeh.Widgets(BaseClass, label_formatter=parambokeh.default_label_formatter.instance(overrides=override)) |
The recent changes look good to me, thanks! Happy to see it merged when the tests pass. |
Looks to me like the tests have been broken a while, independent of this PR (e.g tests fail on master too). I can have a quick look to see if there is any easy fix but if there isn't I'm not sure how much effort to spend on that... |
In 8241d52 I fix a notebook using holoviews |
@ceball @philippjfr I pinned sphinx to 1.6 and install from nbsite master which fixed the doc build issue (at least on travis). This should be a temporary fix though as nbsite should be made to work with sphinx 1.7. |
@jbednar Ready to review again assuming the appveyor tests will pass. You may want to weigh in one some of the issues raised since you last looked. @philippjfr In particular, 2e10365 seems to work but this just seemed the quickest fix to me and I haven't thought too deeply about it. What is clear is that using the user facing label as a key is a bad idea, such a key should always be the actual parameter name. |
@jbednar @philippjfr All tests have now gone green. |
|
||
def HTMLWidget(*args, **kw): | ||
return Div(name=kw['title']) | ||
return Div(name=kw['name']) |
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.
Definitely sure this is the only two cases where this change is needed?
As long as you confirm that the two places you switched to |
Had a look, seems fine. I'll merge. |
I rgrepped for |
Yeah, I don't see any other way |
This simple PR is long overdue imho: the widget labels can now be formatted nicely with a custom formatter.
Before:
After:
This is makes parambokeh widgets look a lot more polished!