From 81e940d4e3230657bbf31f28af92f1ec14b832f5 Mon Sep 17 00:00:00 2001 From: Kyle Conroy Date: Mon, 2 Dec 2024 09:51:30 -0500 Subject: [PATCH] data-menu: UI tweaks (#3310) * data-menu UI improvements * API hints improved formatting * fix plt. api hint typos * custom API icons * improve dark-theme support --------- Co-authored-by: Jennifer Kotler --- CHANGES.rst | 2 +- jdaviz/app.py | 6 +- jdaviz/app.vue | 5 +- jdaviz/components/data_menu_add.vue | 3 +- jdaviz/components/glue_state_select.vue | 36 +++++ jdaviz/components/hover_api_hint.vue | 32 ++--- jdaviz/components/plugin_dataset_select.vue | 10 +- jdaviz/components/plugin_editable_select.vue | 11 ++ .../components/plugin_file_import_select.vue | 12 +- jdaviz/components/plugin_inline_select.vue | 1 + .../components/plugin_inline_select_item.vue | 14 +- jdaviz/components/plugin_layer_select.vue | 23 +-- jdaviz/components/plugin_select.vue | 87 +++++++++++ jdaviz/components/plugin_subset_select.vue | 25 ++-- jdaviz/components/plugin_viewer_select.vue | 23 +-- jdaviz/components/tray_plugin.vue | 6 - .../spectral_extraction.vue | 39 +++-- .../default/plugins/collapse/collapse.vue | 19 ++- .../default/plugins/data_menu/data_menu.py | 4 +- .../default/plugins/data_menu/data_menu.vue | 26 +++- .../plugins/data_quality/data_quality.vue | 10 +- .../configs/default/plugins/export/export.vue | 130 ++++++++--------- .../gaussian_smooth/gaussian_smooth.vue | 21 ++- .../default/plugins/line_lists/line_lists.vue | 8 +- .../plugins/plot_options/plot_options.vue | 109 +++++++------- .../aper_phot_simple/aper_phot_simple.vue | 18 +-- .../imviz/plugins/orientation/orientation.vue | 9 +- .../ramp_extraction/ramp_extraction.vue | 18 +-- .../unit_conversion/unit_conversion.vue | 106 ++++++-------- .../spectral_extraction.vue | 132 +++++++---------- jdaviz/core/template_mixin.py | 4 +- jdaviz/data/icons/api.svg | 105 ++++++++++++++ jdaviz/data/icons/api_lock.svg | 136 ++++++++++++++++++ jdaviz/main_styles.vue | 28 ++-- 34 files changed, 797 insertions(+), 421 deletions(-) create mode 100644 jdaviz/components/glue_state_select.vue create mode 100644 jdaviz/components/plugin_select.vue create mode 100644 jdaviz/data/icons/api.svg create mode 100644 jdaviz/data/icons/api_lock.svg diff --git a/CHANGES.rst b/CHANGES.rst index 9873808c38..9ae34fee26 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -4,7 +4,7 @@ New Features ------------ -* New design for viewer legend and data-menu. [#3220, #3254, #3263, #3264, #3271, #3272, #3274, #3289] +* New design for viewer legend and data-menu. [#3220, #3254, #3263, #3264, #3271, #3272, #3274, #3289, #3310] Cubeviz ^^^^^^^ diff --git a/jdaviz/app.py b/jdaviz/app.py index 556e0279a5..4a8837afb5 100644 --- a/jdaviz/app.py +++ b/jdaviz/app.py @@ -139,6 +139,7 @@ def to_unit(self, data, cid, values, original_units, target_units): 'j-child-layer-icon': 'components/child_layer_icon.vue', 'plugin-previews-temp-disabled': 'components/plugin_previews_temp_disabled.vue', # noqa 'plugin-table': 'components/plugin_table.vue', + 'plugin-select': 'components/plugin_select.vue', 'plugin-dataset-select': 'components/plugin_dataset_select.vue', 'plugin-subset-select': 'components/plugin_subset_select.vue', 'plugin-viewer-select': 'components/plugin_viewer_select.vue', @@ -156,6 +157,7 @@ def to_unit(self, data, cid, values, original_units, target_units): 'plugin-color-picker': 'components/plugin_color_picker.vue', 'plugin-input-header': 'components/plugin_input_header.vue', 'glue-state-sync-wrapper': 'components/glue_state_sync_wrapper.vue', + 'glue-state-select': 'components/glue_state_select.vue', 'data-menu-add': 'components/data_menu_add.vue', 'data-menu-remove': 'components/data_menu_remove.vue', 'data-menu-subset-edit': 'components/data_menu_subset_edit.vue', @@ -232,7 +234,9 @@ class ApplicationState(State): 'radialtocheck': read_icon(os.path.join(ICON_DIR, 'radialtocheck.svg'), 'svg+xml'), 'checktoradial': read_icon(os.path.join(ICON_DIR, 'checktoradial.svg'), 'svg+xml'), 'nuer': read_icon(os.path.join(ICON_DIR, 'right-east.svg'), 'svg+xml'), - 'nuel': read_icon(os.path.join(ICON_DIR, 'left-east.svg'), 'svg+xml') + 'nuel': read_icon(os.path.join(ICON_DIR, 'left-east.svg'), 'svg+xml'), + 'api': read_icon(os.path.join(ICON_DIR, 'api.svg'), 'svg+xml'), + 'api-lock': read_icon(os.path.join(ICON_DIR, 'api_lock.svg'), 'svg+xml'), }, docstring="Custom application icons") viewer_icons = DictCallbackProperty({}, docstring="Indexed icons (numbers) for viewers across the app") # noqa diff --git a/jdaviz/app.vue b/jdaviz/app.vue index ce756732ef..3a529d5123 100644 --- a/jdaviz/app.vue +++ b/jdaviz/app.vue @@ -57,7 +57,7 @@ - mdi-code-tags + @@ -125,6 +125,9 @@ {{ trayItem.label }} + + plg = {{ config }}.plugins['{{ trayItem.label }}'] + {{ trayItem.tray_item_description }} diff --git a/jdaviz/components/data_menu_add.vue b/jdaviz/components/data_menu_add.vue index 2d41844281..21612b869e 100644 --- a/jdaviz/components/data_menu_add.vue +++ b/jdaviz/components/data_menu_add.vue @@ -66,6 +66,7 @@ v-if="api_hints_enabled" :hover_api_hint.sync="hover_api_hint" :lock_hover_api_hint.sync="lock_hover_api_hint" + :icons="icons" /> @@ -80,6 +81,6 @@ module.exports = { lock_hover_api_hint: false, } }, - props: ['dataset_items', 'subset_tools', 'loaded_n_data', 'api_hints_enabled'], + props: ['dataset_items', 'subset_tools', 'loaded_n_data', 'api_hints_enabled', 'icons'], }; \ No newline at end of file diff --git a/jdaviz/components/glue_state_select.vue b/jdaviz/components/glue_state_select.vue new file mode 100644 index 0000000000..3cae088f0b --- /dev/null +++ b/jdaviz/components/glue_state_select.vue @@ -0,0 +1,36 @@ + + + + + diff --git a/jdaviz/components/hover_api_hint.vue b/jdaviz/components/hover_api_hint.vue index 59fba111d8..5bf9e8a0a0 100644 --- a/jdaviz/components/hover_api_hint.vue +++ b/jdaviz/components/hover_api_hint.vue @@ -6,28 +6,22 @@ {{ hover_api_hint }} - + - - - - mdi-code-tags - - - + + @@ -35,6 +29,6 @@ \ No newline at end of file diff --git a/jdaviz/components/plugin_dataset_select.vue b/jdaviz/components/plugin_dataset_select.vue index df5f5ad0eb..40c8cc53ae 100644 --- a/jdaviz/components/plugin_dataset_select.vue +++ b/jdaviz/components/plugin_dataset_select.vue @@ -24,9 +24,13 @@ {{ data.item.label }} - - - {{ data.item.label }} + + + {{ api_hints_enabled ? + '\'' + data.item.label + '\'' + : + data.item.label + }} diff --git a/jdaviz/components/plugin_editable_select.vue b/jdaviz/components/plugin_editable_select.vue index 97694883be..5069c3ec16 100644 --- a/jdaviz/components/plugin_editable_select.vue +++ b/jdaviz/components/plugin_editable_select.vue @@ -16,6 +16,17 @@ item-value="label" persistent-hint > + + + diff --git a/jdaviz/components/plugin_subset_select.vue b/jdaviz/components/plugin_subset_select.vue index 472a449aff..072523e832 100644 --- a/jdaviz/components/plugin_subset_select.vue +++ b/jdaviz/components/plugin_subset_select.vue @@ -12,26 +12,33 @@ :hint="hint ? hint : 'Select subset.'" :rules="rules ? rules : []" :multiple="multiselect" - :chips="multiselect" + :chips="multiselect && !api_hints_enabled" item-text="label" item-value="label" persistent-hint > -