diff --git a/jdaviz/configs/default/plugins/virtual_observatory/tests/test_vo_imviz.py b/jdaviz/configs/default/plugins/virtual_observatory/tests/test_vo_imviz.py index f8593bac05..865511b181 100644 --- a/jdaviz/configs/default/plugins/virtual_observatory/tests/test_vo_imviz.py +++ b/jdaviz/configs/default/plugins/virtual_observatory/tests/test_vo_imviz.py @@ -224,7 +224,7 @@ def test_query_registry_args(self, imviz_helper): # If waveband isn't selected, plugin should ignore our registry query attempts vo_plugin = imviz_helper.plugins[vo_plugin_label] vo_plugin.waveband = "" - vo_plugin._obj.vue_query_registry_resources() + vo_plugin.query_registry_resources() assert len(vo_plugin.resource.choices) == 0 # If waveband selected and coverage filtering, can't query registry if don't have a source @@ -244,7 +244,7 @@ def test_query_registry_args(self, imviz_helper): # If waveband selected, but NOT filtering by coverage, then allow registry query vo_plugin.resource_filter_coverage = False - vo_plugin._obj.vue_query_registry_resources() + vo_plugin.query_registry_resources() assert len(vo_plugin.resource.choices) > 0 def test_coverage_toggle(self, imviz_helper): @@ -260,14 +260,14 @@ def test_coverage_toggle(self, imviz_helper): # Retrieve registry options with filtering on vo_plugin.resource_filter_coverage = True - vo_plugin._obj.vue_query_registry_resources() + vo_plugin.query_registry_resources() assert vo_plugin._obj.resources_loading is False filtered_resources = vo_plugin.resource.choices assert len(filtered_resources) > 0 # Retrieve registry options with filtering off vo_plugin.resource_filter_coverage = False - vo_plugin._obj.vue_query_registry_resources() + vo_plugin.query_registry_resources() assert vo_plugin._obj.resources_loading is False nonfiltered_resources = vo_plugin.resource.choices @@ -292,7 +292,7 @@ def test_target_lookup_warnings(self, imviz_helper): vo_plugin.resource_filter_coverage = True with pytest.raises(LookupError, match=expected_error_msg): vo_plugin.waveband = "optical" - vo_plugin._obj.vue_query_registry_resources() + vo_plugin.query_registry_resources() assert any( expected_error_msg in d["text"] for d in imviz_helper.app.state.snackbar_history @@ -302,7 +302,7 @@ def test_target_lookup_warnings(self, imviz_helper): # By clearing coverage filtering, we should now be able to query the registry # and return the full list of available resources: vo_plugin.resource_filter_coverage = False - vo_plugin._obj.vue_query_registry_resources() + vo_plugin.query_registry_resources() assert len(vo_plugin.resource.choices) > 0 # However, if we try to query a resource, we should be prevented @@ -333,7 +333,7 @@ def test_HSTM51_load_data(self, imviz_helper): # Select HST.M51 survey # Coverage not implemented for HST.M51 vo_plugin.resource_filter_coverage = False - vo_plugin._obj.vue_query_registry_resources() + vo_plugin.query_registry_resources() assert "HST.M51" in vo_plugin.resource.choices vo_plugin.resource = "HST.M51" diff --git a/jdaviz/configs/default/plugins/virtual_observatory/vo_plugin.py b/jdaviz/configs/default/plugins/virtual_observatory/vo_plugin.py index 5d79e34e44..f356676a4e 100644 --- a/jdaviz/configs/default/plugins/virtual_observatory/vo_plugin.py +++ b/jdaviz/configs/default/plugins/virtual_observatory/vo_plugin.py @@ -103,8 +103,6 @@ def __init__(self, *args, **kwargs): @property def user_api(self): - # NOTE: leaving save_as_fits out for now - we may want a more general API to do that - # accross all plugins at some point return PluginUserApi( self, expose=( @@ -119,6 +117,7 @@ def user_api(self): "resource", # Methods "center_on_data", + "query_registry_resources", "load_selected_data", ), ) @@ -208,9 +207,13 @@ def center_on_data(self, event=None): self.viewer_centered = True - @observe("waveband_selected", "change") - @with_spinner(spinner_traitlet="resources_loading") + @observe("waveband_selected", type="change") def vue_query_registry_resources(self, _=None): + """UI entrypoint for resource selection and manual resource refresh btn""" + self.query_registry_resources() + + @with_spinner(spinner_traitlet="resources_loading") + def query_registry_resources(self, _=None): """ Query Virtual Observatory registry for all SIA services that serve data in that waveband around the source.