From 5d7424f9e7d7bb726fccc6cb92688c2f6a0566b1 Mon Sep 17 00:00:00 2001 From: Duy Nguyen Date: Fri, 11 Oct 2024 12:18:45 -0400 Subject: [PATCH] Replace waveband with SelectPluginComponent --- .../default/plugins/virtual_observatory/vo_plugin.py | 10 +++++++--- .../default/plugins/virtual_observatory/vo_plugin.vue | 2 +- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/jdaviz/configs/default/plugins/virtual_observatory/vo_plugin.py b/jdaviz/configs/default/plugins/virtual_observatory/vo_plugin.py index 655ee5f419..741927a5c5 100644 --- a/jdaviz/configs/default/plugins/virtual_observatory/vo_plugin.py +++ b/jdaviz/configs/default/plugins/virtual_observatory/vo_plugin.py @@ -20,6 +20,7 @@ AddResultsMixin, TableMixin, ViewerSelect, + SelectPluginComponent, UnitSelectPluginComponent, ) @@ -36,7 +37,7 @@ class VoPlugin(PluginTemplateMixin, AddResultsMixin, TableMixin): viewer_items = List([]).tag(sync=True) viewer_selected = Unicode().tag(sync=True) - wavebands = List().tag(sync=True) + wavebands_items = List().tag(sync=True) waveband_selected = Any().tag(sync=True) # Any to accept Nonetype resource_filter_coverage = Bool(False).tag(sync=True) resources = List([]).tag(sync=True) @@ -67,9 +68,12 @@ def __init__(self, *args, **kwargs): self.radius_unit.choices = ["deg", "rad", "arcmin", "arcsec"] # Waveband properties to filter available registry resources - self.wavebands = [ + self.wavebands = SelectPluginComponent( + self, items="wavebands_items", selected="waveband_selected" + ) + self.wavebands.choices = ( w.lower() for w in vocabularies.get_vocabulary("messenger")["terms"] - ] + ) self.waveband_selected = None self._full_registry_results = None diff --git a/jdaviz/configs/default/plugins/virtual_observatory/vo_plugin.vue b/jdaviz/configs/default/plugins/virtual_observatory/vo_plugin.vue index 80f8d7f4ff..fdaab90dc9 100644 --- a/jdaviz/configs/default/plugins/virtual_observatory/vo_plugin.vue +++ b/jdaviz/configs/default/plugins/virtual_observatory/vo_plugin.vue @@ -101,7 +101,7 @@ v-model="waveband_selected" :menu-props="{ left: true }" attach - :items="wavebands" + :items="wavebands_items.map(i => i.label)" label="Resource Waveband" hint="Select a spectral waveband to filter your surveys" persistent-hint