Skip to content

Commit

Permalink
raise error for sidecar or popout when not supported
Browse files Browse the repository at this point in the history
ie in VSCode
  • Loading branch information
kecnry committed Nov 19, 2024
1 parent 88d82f9 commit 671facf
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions jdaviz/core/template_mixin.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@

from ipywidgets import widget_serialization
from ipypopout import PopoutButton
from ipypopout.popout_button import get_kernel_id

from jdaviz.components.toolbar_nested import NestedJupyterToolbar
from jdaviz.configs.cubeviz.plugins.viewers import WithSliceIndicator
Expand Down Expand Up @@ -126,6 +127,8 @@ def show_widget(widget, loc, title): # pragma: no cover
display(widget)

elif loc.startswith('sidecar'):
if not get_kernel_id():
raise RuntimeError(f"loc='{loc}' is not supported. Use loc='inline' or run within a JupyterLab environment.") # noqa
from sidecar import Sidecar

# Use default behavior if loc is exactly 'sidecar', else split anchor from the arg
Expand All @@ -136,6 +139,8 @@ def show_widget(widget, loc, title): # pragma: no cover
display(widget)

elif loc.startswith('popout'):
if not get_kernel_id():
raise RuntimeError(f"loc='{loc}' is not supported. Use loc='inline' or run within a JupyterLab environment.") # noqa
anchor = None if loc == 'popout' else loc.split(':')[1]

# Default behavior (no anchor specified): display popout in new window
Expand Down

0 comments on commit 671facf

Please sign in to comment.