Skip to content

Commit

Permalink
refactor: Remove try/except import for popup functionality (#6423)
Browse files Browse the repository at this point in the history
  • Loading branch information
hoxbro authored Oct 25, 2024
1 parent 591faa3 commit 72e596a
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions holoviews/plotting/bokeh/callbacks.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,6 @@
from panel.io.state import set_curdoc, state
from panel.pane import panel

try:
from bokeh.models import XY, Panel
except Exception:
Panel = XY = None

from ...core.data import Dataset
from ...core.options import CallbackError
from ...core.util import (
Expand Down Expand Up @@ -73,7 +68,10 @@
Tap,
)
from ...util.warnings import warn
from .util import BOKEH_GE_3_3_0, convert_timestamp
from .util import BOKEH_GE_3_3_0, BOKEH_GE_3_4_0, convert_timestamp

if BOKEH_GE_3_4_0:
from bokeh.models import XY, Panel as BokehPanel

POPUP_POSITION_ANCHOR = {
"top_right": "bottom_left",
Expand Down Expand Up @@ -595,7 +593,7 @@ def initialize(self, plot_id=None):
stream = self.streams[0]
if not getattr(stream, 'popup', None):
return
elif Panel is None:
elif not BOKEH_GE_3_4_0:
raise VersionError("Popup requires Bokeh >= 3.4")

close_button = Button(label="", stylesheets=[r"""
Expand Down Expand Up @@ -623,7 +621,7 @@ def initialize(self, plot_id=None):
"""],
css_classes=["popup-close-btn"])
self._popup_position = stream.popup_position
self._panel = Panel(
self._panel = BokehPanel(
position=XY(x=np.nan, y=np.nan),
anchor=stream.popup_anchor or POPUP_POSITION_ANCHOR[self._popup_position],
elements=[close_button],
Expand Down

0 comments on commit 72e596a

Please sign in to comment.