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

AutocompleteInput: allow user-defined values #1588

Conversation

ltalirz
Copy link
Contributor

@ltalirz ltalirz commented Sep 16, 2020

fixes #685

bokeh 2.3.0 introduces a new restrict keyword (default: True).
Setting it to False allows users to enter values that are not present in
the list of completions.

bokeh 2.3.0 introduces a new `restrict` keyword (default: True).
Setting it to False allows users to enter values that are not present in
the list of completions.
@ltalirz ltalirz force-pushed the issue_685_autocompleteinput_predefined_values branch from db027e6 to cff3c3d Compare September 16, 2020 21:01
@ltalirz
Copy link
Contributor Author

ltalirz commented Sep 16, 2020

It's not really clear to me what caused the CI to fail here.

From local testing, however, it seems to me that there is some incompatibility with the panel master branch and bokeh 2.3 (?)

@ltalirz
Copy link
Contributor Author

ltalirz commented Sep 20, 2020

@philippjfr Is there something I should be doing to fix this PR?

I'm also trying to set up a development version of bokeh and panel side-by-side (using python setup.py install to build the JS libraries for both bokeh and panel; tried both with bokeh 2.2 and 2.3.0.dev1) but I'm getting issues like those in the browser console and am not sure how to continue:

image

@philippjfr
Copy link
Member

Hmm, that sounds like problem with bokeh 2.3.0dev1 rather than anything in Panel.

@ltalirz
Copy link
Contributor Author

ltalirz commented Sep 22, 2020

@philippjfr Thanks, indeed this was an issue in my development setup.

The following example seems to work fine

import panel as pn
import bokeh.models.widgets as bw
import panel.widgets as pw
from bokeh.models.widgets import PreText
from bokeh.layouts import column
from bokeh.plotting import curdoc

pn.extension()

txt = bw.PreText(text="")
input_box = pw.AutocompleteInput(restrict=False)
input_box.title = "Foo Bar"
input_box.value = "400"
input_box.completions = ["100001", "12344556", "3194567289", "209374209374"]

def update():
    txt.text = f"Autocomplete value is {input_box.value}"

input_box.param.watch(lambda new_val: update(), 'value')

col = pn.Column()
col.extend([input_box, txt])
col.servable()

It's still not clear to me why the CI on this PR failed and whether I need to make any modifications.

@philippjfr
Copy link
Member

That's not caused by you, I'll have to adjust the CI setup.

@philippjfr
Copy link
Member

Thanks again for this. I don't want to require bokeh 2.3 yet. So two favors, please add a version check which defines an entry in the AutocompleteInput ._rename which renames it to None when bokeh<2.3. Secondly please document the restrict keyword in the AutocompleteInput notebook in examples/reference/widgets.

@ltalirz
Copy link
Contributor Author

ltalirz commented Sep 28, 2020

Done!

Here just a check that the version selector does what it is supposed to do:

>>> from distutils.version import LooseVersion
>>> LooseVersion('2.3.0') < '2.3.0'
False
>>> LooseVersion('2.3.0dev1') < '2.3.0'
False
>>> LooseVersion('2.2.0') < '2.3.0'
True

@philippjfr
Copy link
Member

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

AutocompleteInput that allows non-pre-defined options as their value
2 participants