diff --git a/CHANGES.rst b/CHANGES.rst index c3589937e4..f68e2855e5 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -46,7 +46,7 @@ API Changes ----------- - Viewer API now exposed via ``viz.viewer`` dictionary, currently containing APIs to set axes - limits. [#2563] + limits as well as astrowidgets API commands for Imviz. [#2563] Cubeviz ^^^^^^^ diff --git a/jdaviz/configs/default/plugins/viewers.py b/jdaviz/configs/default/plugins/viewers.py index beff6c8e17..d2bd05676a 100644 --- a/jdaviz/configs/default/plugins/viewers.py +++ b/jdaviz/configs/default/plugins/viewers.py @@ -8,6 +8,7 @@ from jdaviz.configs.imviz.helper import layer_is_image_data from jdaviz.components.toolbar_nested import NestedJupyterToolbar +from jdaviz.core.astrowidgets_api import AstrowidgetsImageViewerMixin from jdaviz.core.registries import viewer_registry from jdaviz.core.user_api import ViewerUserApi from jdaviz.utils import ColorCycler, get_subset_type @@ -36,8 +37,13 @@ def __init__(self, *args, **kwargs): def user_api(self): # default exposed user APIs. Can override this method in any particular viewer. if isinstance(self, BqplotImageView): - if hasattr(self, 'zoom_level'): - expose = ['zoom', 'zoom_level'] + if isinstance(self, AstrowidgetsImageViewerMixin): + expose = ['save', + 'center_on', 'offset_by', 'zoom_level', 'zoom', + 'colormap_options', 'set_colormap', + 'stretch_options', 'stretch', + 'autocut_options', 'cuts', + 'marker', 'add_markers', 'remove_markers', 'reset_markers'] else: # cubeviz image viewers don't inherit from AstrowidgetsImageViewerMixin yet, # but also shouldn't expose set_limits because of equal aspect ratio concerns diff --git a/jdaviz/core/helpers.py b/jdaviz/core/helpers.py index a0fb9a2b20..30bfd4ce91 100644 --- a/jdaviz/core/helpers.py +++ b/jdaviz/core/helpers.py @@ -624,7 +624,7 @@ def __init__(self, *args, **kwargs): def default_viewer(self): """Default viewer instance. This is typically the first viewer (e.g., "imviz-0" or "cubeviz-0").""" - return self._default_viewer + return self._default_viewer.user_api def load_regions_from_file(self, region_file, region_format='ds9', max_num_regions=20, **kwargs):