Skip to content

Commit

Permalink
API hints tweaks (#3159)
Browse files Browse the repository at this point in the history
* fix hint-styling in slice plugin

* allow downstream override of plugin key

when inheriting from upstream plugin, currently only used for Slice (called Time Selector in lcviz) and cubeviz's Spectral Extraction (will be used downstream by both lcviz and rampviz)

* append to existing changelog entry

* ignore codestyle complaint

* fix styling for button in plot options

* fix options for orientation when api hints enabled

* add quotes around color string in color picker API hints
  • Loading branch information
kecnry authored Aug 21, 2024
1 parent 95d6008 commit 3ee85ce
Show file tree
Hide file tree
Showing 7 changed files with 8 additions and 6 deletions.
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
2 changes: 1 addition & 1 deletion jdaviz/components/plugin_color_picker.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<plugin-input-header
v-if="label && !label_inline"
:label="label"
:api_hint="api_hint + value"
:api_hint="api_hint + '\''+value+'\''"
:api_hints_enabled="api_hints_enabled"
></plugin-input-header>
<v-menu>
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'"
: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
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,7 @@
<plugin-action-button
:spinner="apply_RGB_presets_spinner"
:results_isolated_to_plugin="false"
:class="api_hints_enabled ? 'api-hint' : null"
@click="apply_RGB_presets"
>
{{ api_hints_enabled ?
Expand Down
2 changes: 1 addition & 1 deletion jdaviz/configs/imviz/plugins/orientation/orientation.vue
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@
<v-radio
v-for="item in align_by_items"
:key="item.label"
:label="item.label == 'WCS' ? 'WCS (Sky)' : item.label"
:label="item.label == 'WCS' && !api_hints_enabled ? 'WCS (Sky)' : item.label"
:value="item.label"
></v-radio>
</v-radio-group>
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

0 comments on commit 3ee85ce

Please sign in to comment.