Skip to content

Commit

Permalink
fallback on linked_by_wcs for configs without default_viewer
Browse files Browse the repository at this point in the history
  • Loading branch information
kecnry committed Feb 14, 2024
1 parent 54e1691 commit fb3cf40
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion jdaviz/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -2293,13 +2293,15 @@ def _on_new_viewer(self, msg, vid=None, name=None, add_layers_to_viewer=False):
orientation_plugin = self._jdaviz_helper.plugins.get('Orientation', None)
if orientation_plugin is not None:
linked_by_wcs = orientation_plugin.link_type.selected == 'WCS'
elif len(self._viewer_store):
elif len(self._viewer_store) and hasattr(self._jdaviz_helper, 'default_viewer'):
# The plugin would only not exist for instances of Imviz where the user has
# intentionally removed the Orientation plugin, but in that case we will
# adopt "linked_by_wcs" from the first (assuming all are the same)
# NOTE: deleting the default viewer is forbidden both by API and UI, but if
# for some reason that was the case here, linked_by_wcs will default to False
linked_by_wcs = self._jdaviz_helper.default_viewer._obj.state.linked_by_wcs
else:
linked_by_wcs = False
viewer.state.linked_by_wcs = linked_by_wcs

if linked_by_wcs:
Expand Down

0 comments on commit fb3cf40

Please sign in to comment.