From 671facf0a061d6fa7e94f82bf7eb2f6f3c7a0d4b Mon Sep 17 00:00:00 2001 From: Kyle Conroy Date: Tue, 19 Nov 2024 14:07:51 -0500 Subject: [PATCH 1/2] raise error for sidecar or popout when not supported ie in VSCode --- jdaviz/core/template_mixin.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/jdaviz/core/template_mixin.py b/jdaviz/core/template_mixin.py index 97716728ee..18153a76ec 100644 --- a/jdaviz/core/template_mixin.py +++ b/jdaviz/core/template_mixin.py @@ -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 @@ -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 @@ -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 From a9473d692fec075fd004e6d28f55e94a07b86299 Mon Sep 17 00:00:00 2001 From: Kyle Conroy Date: Tue, 19 Nov 2024 14:11:38 -0500 Subject: [PATCH 2/2] changelog --- CHANGES.rst | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGES.rst b/CHANGES.rst index 676130399a..36747fd2a5 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -92,6 +92,8 @@ Bug Fixes - Fixed width of sliders in plugins to use full-width of plugin. [#3303] +- Raise an error when attempting to open in a popout or sidecar when not supported (i.e. within VSCode). [#3309] + Cubeviz ^^^^^^^