Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

API hints tweaks #3159

Merged
merged 7 commits into from
Aug 21, 2024
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ New Features

- The colormap menu for image layers now shows in-line previews of the colormaps. [#2900]

- Plugins can now expose in-UI API hints. [#3137]
- Plugins can now expose in-UI API hints. [#3137, #3159]

Cubeviz
^^^^^^^
Expand Down
4 changes: 2 additions & 2 deletions jdaviz/configs/cubeviz/plugins/slice/slice.vue
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<template>
<j-tray-plugin
:config="config"
plugin_key="Slice"
:plugin_key="plugin_key || 'Slice'"
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

see https://github.com/spacetelescope/lcviz/pull/133/files#diff-32e4b267e193d9c8832ff3c8b50929e8fc6f755b802f7dad26bd910cc22375cfR42 for how this will be used in lcviz to override the API hint to access the plugin from plugins['Slice'] to plugins['Time Selector'].

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks surprising at first, but super simple in the end. Neat!

: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.'"
:irrelevant_msg="irrelevant_msg"
Expand Down Expand Up @@ -60,8 +60,8 @@
v-model.number="value"
@focus="(e) => value_editing = true"
@blur="(e) => value_editing = false"
class="mt-0 pt-0"
:label="api_hints_enabled ? 'plg.value =' : value_label"
:class="api_hints_enabled ? 'api-hint' : null"
:hint="value_label+' corresponding to slice.'+(snap_to_slice && value_editing ? ' Indicator will snap to slice when clicking or tabbing away from input.' : '')"
:suffix="value_unit"
></v-text-field>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<template>
<j-tray-plugin
:config="config"
plugin_key="Spectral Extraction"
: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.'"
:link="docs_link || 'https://jdaviz.readthedocs.io/en/'+vdocs+'/'+config+'/plugins.html#spectral-extraction'"
Expand Down
1 change: 1 addition & 0 deletions jdaviz/core/template_mixin.py
Original file line number Diff line number Diff line change
Expand Up @@ -394,6 +394,7 @@ class PluginTemplateMixin(TemplateMixin):
_plugin_name = None # noqa overwritten by the registry - won't be populated by plugins instantiated directly
disabled_msg = Unicode("").tag(sync=True) # noqa if non-empty, will show this message in place of plugin content
irrelevant_msg = Unicode("").tag(sync=True) # noqa if non-empty, will exclude from the tray, and show this message in place of any content in other instances
plugin_key = Unicode("").tag(sync=True) # noqa set to non-empty to override value in vue file (when supported by vue file)
docs_link = Unicode("").tag(sync=True) # set to non-empty to override value in vue file
docs_description = Unicode("").tag(sync=True) # set to non-empty to override value in vue file
plugin_opened = Bool(False).tag(sync=True) # noqa any instance of the plugin is open (recently sent an "alive" ping)
Expand Down
Loading