Skip to content
Open
Show file tree
Hide file tree
Changes from 2 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
7 changes: 6 additions & 1 deletion holoviews/selection.py
Original file line number Diff line number Diff line change
Expand Up @@ -395,7 +395,12 @@ def update_selection_expr(*_):
# Disable regions if setting selection_expr directly
if inst.show_regions:
inst.show_regions = False
inst._selection_override.event(selection_expr=new_selection_expr)
try:
inst._selection_override.event(selection_expr=new_selection_expr)
inst._cross_filter_stream.selection_expr = new_selection_expr
finally:
with param.parameterized.discard_events(inst):
inst.show_regions = True
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure why this has been indented and why the try/finally is needed.

Should there be a special case for inst.show_regions = True when new_selection_expr is None?


inst.param.watch(
update_selection_expr, ['selection_expr']
Expand Down
12 changes: 12 additions & 0 deletions holoviews/tests/test_selection.py
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,18 @@ def test_layout_selection_points_table(self):
]
)

def test_select_expr_show_regions(self):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we need a UI test for this change.

lnk_sel = link_selections.instance()
self.assertTrue(lnk_sel.show_regions)
se = (
(hv.dim('x') >= 0) & (hv.dim('x') <= 1) &
(hv.dim('y') >= 0) & (hv.dim('y') <= 1)
)
lnk_sel.selection_expr = se
self.assertTrue(lnk_sel.show_regions)
lnk_sel.selection_expr = None
self.assertTrue(lnk_sel.show_regions)

def test_overlay_points_errorbars(self, dynamic=False):
points = Points(self.data)
error = ErrorBars(self.data, kdims='x', vdims=['y', 'e'])
Expand Down
Loading