diff --git a/CHANGES.rst b/CHANGES.rst index 631f974490..a76ad95e8d 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -62,6 +62,8 @@ Specviz2d Other Changes and Additions --------------------------- +- Added a short description of each plugin in the side menu, visible before the plugin is opened. Removes redundant descriptions above link + out to documentation when plugin is opened. Enable search on plugin description in addition to title. [#3268] 4.0.1 (unreleased) ================== diff --git a/jdaviz/app.py b/jdaviz/app.py index c4b6d3d8c8..8f108fa99b 100644 --- a/jdaviz/app.py +++ b/jdaviz/app.py @@ -2758,6 +2758,7 @@ def compose_viewer_area(viewer_area_items): self._application_handler._tools[name] = tool for name in config.get('tray', []): + tray = tray_registry.members.get(name) tray_item_instance = tray.get('cls')(app=self, tray_instance=True) @@ -2766,10 +2767,13 @@ def compose_viewer_area(viewer_area_items): # plugin itself tray_item_label = tray.get('label') + tray_item_description = tray_item_instance.plugin_description + # NOTE: is_relevant is later updated by observing irrelevant_msg traitlet self.state.tray_items.append({ 'name': name, 'label': tray_item_label, + 'tray_item_description': tray_item_description, 'is_relevant': len(tray_item_instance.irrelevant_msg) == 0, 'widget': "IPY_MODEL_" + tray_item_instance.model_id }) diff --git a/jdaviz/app.vue b/jdaviz/app.vue index 5f67b89839..1f8c5e58f0 100644 --- a/jdaviz/app.vue +++ b/jdaviz/app.vue @@ -112,10 +112,17 @@
- - - {{ trayItem.label }} - + + + + + {{ trayItem.label }} + + + + {{ trayItem.tray_item_description }} + + @@ -174,7 +181,7 @@ export default { return true } // simple exact text search match on the plugin title for now. - return trayItem.label.toLowerCase().indexOf(tray_items_filter.toLowerCase()) !== -1 + return trayItem.label.toLowerCase().indexOf(tray_items_filter.toLowerCase()) !== -1 || trayItem.tray_item_description.toLowerCase().indexOf(tray_items_filter.toLowerCase()) !== -1 }, onLayoutChange() { /* Workaround for #1677, can be removed when bqplot/bqplot#1531 is released */ @@ -191,3 +198,15 @@ export default { } }; + + \ No newline at end of file diff --git a/jdaviz/configs/cubeviz/plugins/moment_maps/moment_maps.py b/jdaviz/configs/cubeviz/plugins/moment_maps/moment_maps.py index 3aad940765..d7783fff22 100644 --- a/jdaviz/configs/cubeviz/plugins/moment_maps/moment_maps.py +++ b/jdaviz/configs/cubeviz/plugins/moment_maps/moment_maps.py @@ -91,6 +91,9 @@ class MomentMap(PluginTemplateMixin, DatasetSelectMixin, SpectralSubsetSelectMix def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) + # description displayed under plugin title in tray + self._plugin_description = 'Create a 2D image from a data cube.' + self.moment = None self.continuum_dataset = DatasetSelect(self, diff --git a/jdaviz/configs/cubeviz/plugins/moment_maps/moment_maps.vue b/jdaviz/configs/cubeviz/plugins/moment_maps/moment_maps.vue index 3ffc5e73af..2345a29f88 100644 --- a/jdaviz/configs/cubeviz/plugins/moment_maps/moment_maps.vue +++ b/jdaviz/configs/cubeviz/plugins/moment_maps/moment_maps.vue @@ -3,7 +3,7 @@ :config="config" plugin_key="Moment Maps" :api_hints_enabled.sync="api_hints_enabled" - :description="docs_description || 'Create a 2D image from a data cube.'" + :description="docs_description" :link="docs_link || 'https://jdaviz.readthedocs.io/en/'+vdocs+'/'+config+'/plugins.html#moment-maps'" :uses_active_status="uses_active_status" @plugin-ping="plugin_ping($event)" diff --git a/jdaviz/configs/cubeviz/plugins/slice/slice.py b/jdaviz/configs/cubeviz/plugins/slice/slice.py index 6e50e3bdd3..b2c9ae3974 100644 --- a/jdaviz/configs/cubeviz/plugins/slice/slice.py +++ b/jdaviz/configs/cubeviz/plugins/slice/slice.py @@ -69,6 +69,10 @@ class Slice(PluginTemplateMixin): def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) + + # description displayed under plugin title in tray + self._plugin_description = 'Select and interact with slice of cube in image viewers.' + self._cached_properties = ['valid_selection_values', 'valid_selection_values_sorted', 'valid_indicator_values', 'valid_indicator_values_sorted', 'valid_values', 'valid_values_sorted'] @@ -103,6 +107,9 @@ def __init__(self, *args, **kwargs): handler=self._on_global_display_unit_changed) self._initialize_location() + self.docs_description = 'The slice can also be changed interactively\ + in the spectrum viewer by activating the slice tool.' + @property def _cube_viewer_default_label(self): if hasattr(self.app, '_jdaviz_helper') and self.app._jdaviz_helper is not None: diff --git a/jdaviz/configs/cubeviz/plugins/slice/slice.vue b/jdaviz/configs/cubeviz/plugins/slice/slice.vue index 90848761fc..2f8396bcb5 100644 --- a/jdaviz/configs/cubeviz/plugins/slice/slice.vue +++ b/jdaviz/configs/cubeviz/plugins/slice/slice.vue @@ -3,7 +3,7 @@ :config="config" :plugin_key="plugin_key || 'Slice'" :api_hints_enabled.sync="api_hints_enabled" - :description="docs_description || 'Select slice of the cube to show in the image viewers. The slice can also be changed interactively in the spectrum viewer by activating the slice tool.'" + :description="docs_description" :irrelevant_msg="irrelevant_msg" :link="docs_link || 'https://jdaviz.readthedocs.io/en/'+vdocs+'/'+config+'/plugins.html#slice'" :popout_button="popout_button" diff --git a/jdaviz/configs/cubeviz/plugins/spectral_extraction/spectral_extraction.py b/jdaviz/configs/cubeviz/plugins/spectral_extraction/spectral_extraction.py index 5d009cb76b..913faf818b 100644 --- a/jdaviz/configs/cubeviz/plugins/spectral_extraction/spectral_extraction.py +++ b/jdaviz/configs/cubeviz/plugins/spectral_extraction/spectral_extraction.py @@ -124,6 +124,9 @@ class SpectralExtraction(PluginTemplateMixin, ApertureSubsetSelectMixin, def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) + # description displayed under plugin title in tray + self._plugin_description = 'Extract a spectrum from a spectral cube.' + self.extracted_spec = None self.dataset.filters = ['is_flux_cube'] diff --git a/jdaviz/configs/cubeviz/plugins/spectral_extraction/spectral_extraction.vue b/jdaviz/configs/cubeviz/plugins/spectral_extraction/spectral_extraction.vue index 2f0dbd12a6..a9a910d9c6 100644 --- a/jdaviz/configs/cubeviz/plugins/spectral_extraction/spectral_extraction.vue +++ b/jdaviz/configs/cubeviz/plugins/spectral_extraction/spectral_extraction.vue @@ -3,7 +3,7 @@ :config="config" :plugin_key="plugin_key || 'Spectral Extraction'" :api_hints_enabled.sync="api_hints_enabled" - :description="docs_description || 'Extract a '+resulting_product_name+' from a spectral cube.'" + :description="docs_description" :link="docs_link || 'https://jdaviz.readthedocs.io/en/'+vdocs+'/'+config+'/plugins.html#spectral-extraction'" :uses_active_status="uses_active_status" @plugin-ping="plugin_ping($event)" diff --git a/jdaviz/configs/default/plugins/about/about.py b/jdaviz/configs/default/plugins/about/about.py index 6c9f0a8675..a22e56b139 100644 --- a/jdaviz/configs/default/plugins/about/about.py +++ b/jdaviz/configs/default/plugins/about/about.py @@ -28,6 +28,9 @@ def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) self.jdaviz_version = __version__ + # description displayed under plugin title in tray + self._plugin_description = 'Information about Jdaviz.' + if __version__ != "unknown": _ver_pypi = latest_version_from_pypi("jdaviz") if _ver_pypi: diff --git a/jdaviz/configs/default/plugins/about/about.vue b/jdaviz/configs/default/plugins/about/about.vue index c5b477f140..bbbbb84c89 100644 --- a/jdaviz/configs/default/plugins/about/about.vue +++ b/jdaviz/configs/default/plugins/about/about.vue @@ -1,6 +1,6 @@