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

Handle explicit triggering in Param pane #1623

Merged
merged 1 commit into from
Oct 12, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions panel/param.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

import param

from param.parameterized import classlist
from param.parameterized import classlist, discard_events

from .io import init_doc, state
from .layout import Row, Panel, Tabs, Column
Expand Down Expand Up @@ -467,7 +467,12 @@ def action(event):

try:
self._updating.append(p_name)
widget.param.set_param(**updates)
if change.type == 'triggered':
with discard_events(widget):
widget.param.set_param(**updates)
widget.param.trigger(*updates)
else:
widget.param.set_param(**updates)
finally:
self._updating.remove(p_name)

Expand Down
15 changes: 15 additions & 0 deletions panel/tests/test_param.py
Original file line number Diff line number Diff line change
Expand Up @@ -547,6 +547,21 @@ class Test(param.Parameterized):
assert isinstance(text, TextInput)


def test_trigger_parameters(document, comm):
class Test(param.Parameterized):
a = param.ListSelector(objects=[1,2,3,4], default=list())

t = Test()
t.a.append(4)

pane = Param(t.param.a)

t.a.append(1)
t.param.trigger('a')

assert pane[0].value == [4, 1]


def test_set_display_threshold(document, comm):
class Test(param.Parameterized):
a = param.Number(bounds=(0, 10), precedence=1)
Expand Down