-
Notifications
You must be signed in to change notification settings - Fork 10
Added registry of 'watchers', allowing functions to be executed when … #45
base: master
Are you sure you want to change the base?
Conversation
…specific widget values change.
The main examples I've run into is situations where I want to change the |
Updating soft_bounds would be correct for |
Hmm, I thought we discussed before that doing so might not be the right thing. I am probably mistaken... In my notebook at https://github.com/ceball/paramnb/blob/1132e56df5037deb3972bd999d6cda64d1c9942e/doc/WidgetLinking.ipynb, I have a |
Do you mean like in the example notebook I added, or something different?
Thanks, I'll do that (once I've understood what the behavior to be). |
If I was present for that, I either didn't notice or don't remember. But I think you're right, and I guess we need the equivalent of soft_bounds for ranges, e.g. get_soft_range(). get_soft_range() would default to |
I was thinking the same thing. But I was also wondering if all parameters that have bounds or range could share one name for 'soft bounds'/'soft range'? And then I was wondering if we shouldn't just have used the name 'range' everywhere rather than having bounds (e.g. for Number) and range (e.g. for ObjectSelector). Oh wait, we have a Range parameter with bounds... |
Sorry, to be clear, I am actually suggesting we should have one name for the 'soft bounds'/'soft range'/'suggested range'/'values hint' concept, for all parameters with bounds/range. Or is there somewhere that wouldn't make sense? I'm not suggesting we do the same for the hard bounds/range. |
Oops, sorry, to be even more clear! Let's not discuss the name(s) of 'soft bounds' right now. It's not relevant to this PR, and I didn't think much about it anyway. |
Yes, that's mentioned in holoviz/param#160, but there are many possible problems (confusion about what cascade of things might happen when you set a parameter? performance impact on getting a parameter value? etc) that I feel we have to be strongly motivated to do it, with clear real world use cases. |
I've begun "Solve at param GUI toolkit level?" from holoviz/param#160 and have opened this PR to ask for feedback, not to merge. In particular, I am looking for more real world use cases to address. Anyone got any notebooks with examples where they have already done or want to do this kind of thing? (I'm working on a DateRange parameter and corresponding paramnb widget.)
Note that when you write code to link parameters the way I've done here, you currently have to know about both the widgets and the parameters :( E.g.
What we discussed before was instead to update the parameter, and have that be reflected in the widget. So in this case it would mean setting the parameter's soft bounds, and seeing that updated in the slider. However, I'm not yet sure how that approach would work for parameters that don't have an equivalent of soft bounds (e.g. object selectors). But anyway, I guess the next step is to make it so that you only have to update the parameters.