diff --git a/CHANGES.rst b/CHANGES.rst index be2699e80b..6593a14dd8 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -4,6 +4,9 @@ New Features ------------ +- New popout locations display Jdaviz in a detached popup window (``popout:window``) + or browser tab (``popout:tab``). [#1503] + Cubeviz ^^^^^^^ diff --git a/docs/display.rst b/docs/display.rst index c5a822e5df..22b1157342 100644 --- a/docs/display.rst +++ b/docs/display.rst @@ -18,6 +18,25 @@ For example, ``inline`` can be specified manually with:: imviz.show(loc='inline') +Detached Popout +--------------- +Jdaviz can also be displayed in a detached window, separate from your working Jupyter interface. + +.. note:: Popups must be allowed in your browser to display properly. + +The following shows ``jdaviz`` in a new popout window:: + + imviz.show(loc='popout') + +To manually specify the anchor location, append the anchor to popout, separated by a colon:: + + imviz.show(loc='popout:window') + +You can also popout to a new browser tab by specifying a ``tab`` anchor:: + + imviz.show(loc='popout:tab') + + Sidecar (Jupyter Lab) --------------------- diff --git a/jdaviz/core/helpers.py b/jdaviz/core/helpers.py index f1a4d07edf..e76d90a2e1 100644 --- a/jdaviz/core/helpers.py +++ b/jdaviz/core/helpers.py @@ -304,6 +304,14 @@ def show(self, loc="inline", title=None): See `jupyterlab-sidecar `_ for the most up-to-date options. + "popout": Display the Jdaviz application in a detached display. By default, a new + window will open. Browser popup permissions required. + + Other anchors: + + * ``popout:window`` (The default, opens Jdaviz in a new, detached popout) + * ``popout:tab`` (Opens Jdaviz in a new, detached tab in your browser) + title : str, optional The title of the sidecar tab. Defaults to the name of the application; e.g., "specviz". @@ -342,11 +350,16 @@ def show(self, loc="inline", title=None): with scar: display(self.app) - elif loc == "new browser tab": - raise NotImplementedError + elif loc.startswith('popout'): + anchor = None if loc == 'popout' else loc.split(':')[1] - elif loc == "popout": - raise NotImplementedError + # Default behavior (no anchor specified): display popout in new window + if anchor in (None, 'window'): + self.app.popout_button.open_window() + elif anchor == "tab": + self.app.popout_button.open_tab() + else: + raise ValueError("Unrecognized popout anchor") else: raise ValueError(f"Unrecognized display location: {loc}") diff --git a/setup.cfg b/setup.cfg index 4b9fb4aaad..7dbf1c2d28 100644 --- a/setup.cfg +++ b/setup.cfg @@ -45,7 +45,7 @@ install_requires = regions>=0.6 scikit-image sidecar>=0.5.1 - ipypopout>=0.0.8 + ipypopout>=0.0.10 [options.extras_require] test =