From cf9836760c710eec3d1b9712d2cb541de86730f1 Mon Sep 17 00:00:00 2001 From: Kyle Conroy Date: Mon, 20 Nov 2023 09:25:11 -0500 Subject: [PATCH 1/2] create new component * better consistency for coloring by passing :results_isolated_to_plugin="true/false" * update UI style guide * adds spinner for "Calculate" button in aperture photometry, "Search" in catalogs, and "Apply RGB Presets" in plot options --- CHANGES.rst | 2 +- docs/dev/ui_style_guide.rst | 15 +++++++----- jdaviz/app.py | 1 + jdaviz/components/plugin_action_button.vue | 24 +++++++++++++++++++ jdaviz/components/plugin_add_results.vue | 22 ++++++----------- jdaviz/components/plugin_table.vue | 5 ++-- .../plugins/export_plot/export_plot.vue | 18 +++++++------- .../default/plugins/line_lists/line_lists.vue | 4 +++- .../plugins/model_fitting/model_fitting.vue | 10 ++++---- .../plugins/plot_options/plot_options.py | 4 +++- .../plugins/plot_options/plot_options.vue | 8 ++++++- .../plugins/subset_plugin/subset_plugin.vue | 22 ++++++++++++++--- .../aper_phot_simple/aper_phot_simple.vue | 9 ++++++- .../imviz/plugins/catalogs/catalogs.vue | 15 ++++++++++-- .../line_profile_xy/line_profile_xy.vue | 7 +++++- 15 files changed, 116 insertions(+), 50 deletions(-) create mode 100644 jdaviz/components/plugin_action_button.vue diff --git a/CHANGES.rst b/CHANGES.rst index efa17e696b..3a2492eab7 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -19,7 +19,7 @@ New Features - Add button in Plot Options to apply preset RBG options to visible layers when in Monochromatic mode. [#2558, #2568] -- Plugin "action" buttons disable and show icon indicating that an action is in progress. [#2560] +- Plugin "action" buttons disable and show icon indicating that an action is in progress. [#2560, #2571] - Plugin APIs now include a ``close_in_tray()`` method. [#2562] diff --git a/docs/dev/ui_style_guide.rst b/docs/dev/ui_style_guide.rst index f9f627c58d..d507f70f25 100644 --- a/docs/dev/ui_style_guide.rst +++ b/docs/dev/ui_style_guide.rst @@ -20,8 +20,12 @@ try to adhere to the following principles: components are necessary in a single row. Always emphasize readability at the default/minimum width of the plugin tray, rather than using columns that result in a ton of text overflow. * Use ```` to align content to the right (such as action buttons). -* Action buttons should use ```` with ``color="accent"`` if applying something - to the viewers/apps/data, and ``color="primary"`` otherwise. +* Action buttons should use ``text`` + to control the color depending on whether the button affects things outside the plugin itself + (adding/modifying data collection or subset entries, etc) or are isolated to within the plugin + (adding model components in model fitting, etc). These buttons can be wrapped in tooltip components + and also have the capability of adding spinners (by passing a traitlet to ``:spinner``) or disabling + (by passing a traitlet to ``:disabled``). * To remove vertical padding from rows (i.e., two successive buttons stacked vertically), use ````. * Use new ``Header Text`` to separate content @@ -85,13 +89,12 @@ try to adhere to the following principles: - Action Text - + diff --git a/jdaviz/app.py b/jdaviz/app.py index e06a26924d..2ec4180432 100644 --- a/jdaviz/app.py +++ b/jdaviz/app.py @@ -140,6 +140,7 @@ def to_unit(self, data, cid, values, original_units, target_units): 'plugin-viewer-select': 'components/plugin_viewer_select.vue', 'plugin-layer-select': 'components/plugin_layer_select.vue', 'plugin-editable-select': 'components/plugin_editable_select.vue', + 'plugin-action-button': 'components/plugin_action_button.vue', 'plugin-add-results': 'components/plugin_add_results.vue', 'plugin-auto-label': 'components/plugin_auto_label.vue', 'plugin-file-import-select': 'components/plugin_file_import_select.vue', diff --git a/jdaviz/components/plugin_action_button.vue b/jdaviz/components/plugin_action_button.vue new file mode 100644 index 0000000000..5222eee794 --- /dev/null +++ b/jdaviz/components/plugin_action_button.vue @@ -0,0 +1,24 @@ + + + diff --git a/jdaviz/components/plugin_add_results.vue b/jdaviz/components/plugin_add_results.vue index c8db2dd96a..bdd7c4715c 100644 --- a/jdaviz/components/plugin_add_results.vue +++ b/jdaviz/components/plugin_add_results.vue @@ -54,22 +54,14 @@ - - - + + {{action_label}}{{label_overwrite ? ' (Overwrite)' : ''}} - + diff --git a/jdaviz/components/plugin_table.vue b/jdaviz/components/plugin_table.vue index d6b56169b9..323c2e372a 100644 --- a/jdaviz/components/plugin_table.vue +++ b/jdaviz/components/plugin_table.vue @@ -54,9 +54,8 @@ - Clear Table diff --git a/jdaviz/configs/default/plugins/export_plot/export_plot.vue b/jdaviz/configs/default/plugins/export_plot/export_plot.vue index 1b59e64b67..43af03ed85 100644 --- a/jdaviz/configs/default/plugins/export_plot/export_plot.vue +++ b/jdaviz/configs/default/plugins/export_plot/export_plot.vue @@ -13,24 +13,22 @@
- - Export to PNG - + Export to PNG + - - Export to SVG - + Export to SVG + diff --git a/jdaviz/configs/default/plugins/line_lists/line_lists.vue b/jdaviz/configs/default/plugins/line_lists/line_lists.vue index 990d95bbea..ecf8a82c65 100644 --- a/jdaviz/configs/default/plugins/line_lists/line_lists.vue +++ b/jdaviz/configs/default/plugins/line_lists/line_lists.vue @@ -106,7 +106,9 @@ - Load List + Load List diff --git a/jdaviz/configs/default/plugins/model_fitting/model_fitting.vue b/jdaviz/configs/default/plugins/model_fitting/model_fitting.vue index 921a627e3a..b135882af0 100644 --- a/jdaviz/configs/default/plugins/model_fitting/model_fitting.vue +++ b/jdaviz/configs/default/plugins/model_fitting/model_fitting.vue @@ -74,13 +74,13 @@ - Add Component - + > + Add Component + diff --git a/jdaviz/configs/default/plugins/plot_options/plot_options.py b/jdaviz/configs/default/plugins/plot_options/plot_options.py index b4d4318a49..191f5169f7 100644 --- a/jdaviz/configs/default/plugins/plot_options/plot_options.py +++ b/jdaviz/configs/default/plugins/plot_options/plot_options.py @@ -22,7 +22,7 @@ from jdaviz.core.registries import tray_registry from jdaviz.core.template_mixin import (PluginTemplateMixin, ViewerSelect, LayerSelect, PlotOptionsSyncState, Plot, - skip_if_no_updates_since_last_active) + skip_if_no_updates_since_last_active, with_spinner) from jdaviz.core.user_api import PluginUserApi from jdaviz.core.tools import ICON_DIR from jdaviz.core.custom_traitlets import IntHandleEmpty @@ -326,6 +326,7 @@ class PlotOptions(PluginTemplateMixin): show_viewer_labels = Bool(True).tag(sync=True) swatches_palette = List().tag(sync=True) + apply_RGB_presets_spinner = Bool(False).tag(sync=True) def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) @@ -605,6 +606,7 @@ def vue_set_value(self, data): value = data.get('value') setattr(self, attr_name, value) + @with_spinner('apply_RGB_presets_spinner') def apply_RGB_presets(self): """ Applies preset colors, opacities, and stretch settings to all visible layers diff --git a/jdaviz/configs/default/plugins/plot_options/plot_options.vue b/jdaviz/configs/default/plugins/plot_options/plot_options.vue index 0f9778c8df..fbe6379994 100644 --- a/jdaviz/configs/default/plugins/plot_options/plot_options.vue +++ b/jdaviz/configs/default/plugins/plot_options/plot_options.vue @@ -71,7 +71,13 @@
- Assign Presets + + Assign Presets +
diff --git a/jdaviz/configs/default/plugins/subset_plugin/subset_plugin.vue b/jdaviz/configs/default/plugins/subset_plugin/subset_plugin.vue index e6b13ae1f2..a4bd2f9752 100644 --- a/jdaviz/configs/default/plugins/subset_plugin/subset_plugin.vue +++ b/jdaviz/configs/default/plugins/subset_plugin/subset_plugin.vue @@ -114,12 +114,28 @@ - Freeze + + Freeze + - Simplify + + Simplify + - Update + + Update + diff --git a/jdaviz/configs/imviz/plugins/aper_phot_simple/aper_phot_simple.vue b/jdaviz/configs/imviz/plugins/aper_phot_simple/aper_phot_simple.vue index 32d867a064..cf022a417c 100644 --- a/jdaviz/configs/imviz/plugins/aper_phot_simple/aper_phot_simple.vue +++ b/jdaviz/configs/imviz/plugins/aper_phot_simple/aper_phot_simple.vue @@ -154,7 +154,14 @@
- Calculate + + Calculate +
diff --git a/jdaviz/configs/imviz/plugins/catalogs/catalogs.vue b/jdaviz/configs/imviz/plugins/catalogs/catalogs.vue index 092c3398ce..d5b089d91f 100644 --- a/jdaviz/configs/imviz/plugins/catalogs/catalogs.vue +++ b/jdaviz/configs/imviz/plugins/catalogs/catalogs.vue @@ -29,10 +29,21 @@ - Clear + + Clear + - Search + + Search + diff --git a/jdaviz/configs/imviz/plugins/line_profile_xy/line_profile_xy.vue b/jdaviz/configs/imviz/plugins/line_profile_xy/line_profile_xy.vue index 9304009000..04b443abad 100644 --- a/jdaviz/configs/imviz/plugins/line_profile_xy/line_profile_xy.vue +++ b/jdaviz/configs/imviz/plugins/line_profile_xy/line_profile_xy.vue @@ -34,7 +34,12 @@
- Plot + + Plot + From 4e9d41ee3141729026122df835e681069e4076a5 Mon Sep 17 00:00:00 2001 From: Kyle Conroy Date: Wed, 22 Nov 2023 09:38:04 -0500 Subject: [PATCH 2/2] Update jdaviz/components/plugin_table.vue Co-authored-by: Ricky O'Steen <39831871+rosteen@users.noreply.github.com> --- jdaviz/components/plugin_table.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jdaviz/components/plugin_table.vue b/jdaviz/components/plugin_table.vue index 323c2e372a..5d3fe56f52 100644 --- a/jdaviz/components/plugin_table.vue +++ b/jdaviz/components/plugin_table.vue @@ -58,7 +58,7 @@ :results_isolated_to_plugin="true" @click="clear_table" >Clear Table - +