Skip to content
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

Panel requires bounds to be set #33

Closed
kcpevey opened this issue Sep 7, 2018 · 8 comments
Closed

Panel requires bounds to be set #33

kcpevey opened this issue Sep 7, 2018 · 8 comments
Labels
type: discussion Requiring community discussion

Comments

@kcpevey
Copy link
Contributor

kcpevey commented Sep 7, 2018

As discussed at our meeting...

minimum_size = param.Integer(default=10)

Will produce an un-editable widget (just some text on the screen). This also happens with param.Number. I believe it has something to do with None bounds.

@jbednar
Copy link
Member

jbednar commented Sep 7, 2018

When there are no bounds or softbounds, what should happen is to get an editable widget. That's because the toolkit has no way of knowing what the left and right edge of the slider should correspond to. We could make a convention for that case, e.g. to set the lower bound to 1/10th of the default value (or 10x the default value if negative) and the higher bound to 10X the default value (or 1/10th the default value if negative), but to me that seems like just covering up the fact that we really don't know an appropriate range to show, and people won't realize that it's covering an inappropriate range. So we could do that, but my vote is for simply adding some meaningful guess at the softbounds for the cases when there are no hard bounds. Even a bad guess at a suitable softbounds by a human is still going to be more appropriate than anything that could be done automatically.

Having the value not be editable is a bug, though -- the value should always be editable for a non-constant parameter.

@kcpevey
Copy link
Contributor Author

kcpevey commented Sep 7, 2018

my vote is for simply adding some meaningful guess at the softbounds for the cases when there are no hard bounds. Even a bad guess at a suitable softbounds by a human is still going to be more appropriate than anything that could be done automatically.

I don't think there is no way for us to make a meaningful guess without first knowing the ballpark. If we had a set guess that was outside of the specified default, that would throw an error. I think it will have to be tied to the default and would need to follow something like what you specified here:

set the lower bound to 1/10th of the default value (or 10x the default value if negative) and the higher bound to 10X the default value (or 1/10th the default value if negative)

Although different widgets will need slight variances of this (float vs Int vs Number).

@jbednar
Copy link
Member

jbednar commented Sep 7, 2018

I don't think there is no way for us to make a meaningful guess without first knowing the ballpark. If we had a set guess that was outside of the specified default, that would throw an error.

There shouldn't be an error in that case; that's what makes softbounds soft. That said, I think Bokeh needs extending before bounds will truly be soft -- at least the last I checked, softbounds are soft for Param but not at the widget level, where there is no way to set the value outside the bounds (even if the hard bounds do allow it).

@jbednar
Copy link
Member

jbednar commented Sep 7, 2018

(They were truly soft for our first GUI toolkit, ParamTk years ago, where they just determined the starting bounds, but people could type in other values that were within the hard bounds and the widget range would adjust. I would like Bokeh to behave that way too, but I think it would take a bit of work.)

@philippjfr
Copy link
Member

I think the issue with soft bounds is orthogonal to the issue of not defining any bounds. As you both pointed out only constant parameters should be uneditable. Should we repurpose this issue to address soft bounds or should I close it once I've fixed the uneditable bug?

@philippjfr philippjfr mentioned this issue Sep 13, 2018
2 tasks
@kajiglet
Copy link

I think we need to address when a param.Integer or param.Number has only one or no bounds. We currently represent the parameter as case A: a slider with value string. It would be nice if the value was a editable field to allow quick assignment (case B). The slider and edit field would share bounds so a invalid entry would be reset to the nearest bound. Case C shows a compact version of Case B. I would expect the appropriate arrow button to be disabled if the value is at a bound. If only one bound or no bounds are provided then Case C or Case D, where the field is unrestricted, could apply.

mockup

@jbednar
Copy link
Member

jbednar commented Sep 13, 2018

That's basically how our first, pre-web, version of this system worked -- the softbounds was truly soft, the number was editable, it could be set to any value compatible with any hard bounds, and the soft bounds (slider range) updated when a value was put in that was out of the soft bounds but inside the hard bounds. I think that's how it should work, but I don't know what's involved in making that happen.

@philippjfr philippjfr added the type: discussion Requiring community discussion label Jun 8, 2019
@kcpevey kcpevey added this to the v0.10.0 milestone Aug 3, 2020
@philippjfr philippjfr modified the milestones: v0.10.0, v0.11.0 Oct 12, 2020
@philippjfr philippjfr modified the milestones: v0.11.0, v0.11.x Feb 25, 2021
@philippjfr philippjfr modified the milestones: v0.11.x, v0.12.0, v0.12.x Jun 25, 2021
@MarcSkovMadsen
Copy link
Collaborator

I will close this one because

  1. Panel no longer requires bounds to be set which was the initial issue. See code below.
  2. A lot of the requests/ ideas here have been implemented. See https://blog.holoviz.org/panel_0.12.0.html#New-widgets
  3. It is highly unclear from this issue exactly what still remains to be delivered if anything.
import param
import panel as pn

class TestClass(param.Parameterized):
    integer_size = param.Integer(default=10)
    float_size = param.Number(default=10.0)

test_instance=TestClass()

pn.Param(test_instance).servable()

image

image

@philippjfr philippjfr removed this from the v0.12.x milestone Sep 23, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: discussion Requiring community discussion
Projects
None yet
Development

No branches or pull requests

5 participants