From eb597c9c137313b7dfcdfa00115affe3b38dfec6 Mon Sep 17 00:00:00 2001 From: Kyle Conroy Date: Fri, 18 Mar 2022 12:51:41 -0400 Subject: [PATCH] show label of selected line at top of line list plugin * click un-identifies it --- .../configs/default/plugins/line_lists/line_lists.py | 11 ++++++++++- .../configs/default/plugins/line_lists/line_lists.vue | 7 +++++++ 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/jdaviz/configs/default/plugins/line_lists/line_lists.py b/jdaviz/configs/default/plugins/line_lists/line_lists.py index c9137859d8..8bbfd2a22c 100644 --- a/jdaviz/configs/default/plugins/line_lists/line_lists.py +++ b/jdaviz/configs/default/plugins/line_lists/line_lists.py @@ -54,6 +54,7 @@ class LineListTool(PluginTemplateMixin): custom_unit_choices = List([]).tag(sync=True) custom_unit = Unicode().tag(sync=True) + identify_label = Unicode().tag(sync=True) identify_line_icon = Unicode(read_icon(os.path.join(ICON_DIR, 'line_select.svg'), 'svg+xml')).tag(sync=True) # noqa def __init__(self, *args, **kwargs): @@ -693,6 +694,7 @@ def _update_identify_to_line(self, name_rest, listname=None, identify=True): self.list_contents = {} self.list_contents = list_contents + self.identify_label = name_rest if identify else "" def _process_identify_change(self, msg): if msg.sender == self: @@ -703,10 +705,17 @@ def _process_identify_change(self, msg): # then line mark themselves will also respond to the same event, so there is # no need to broadcast another - def vue_set_identify(self, data): + def vue_set_identify(self, data=None): """ Set the selected line as "identified" """ + if data is None: + # then default to the currently identified (which will unidentify it) + for listname, this_list in self.list_contents.items(): + for line_ind, line in enumerate(this_list['lines']): + if line['identify']: + return self.vue_set_identify((listname, line, line_ind)) + listname, line, line_ind = data identify = not line.get('identify', False) if identify and not line['show']: diff --git a/jdaviz/configs/default/plugins/line_lists/line_lists.vue b/jdaviz/configs/default/plugins/line_lists/line_lists.vue index 433a80d08c..4d22d906ac 100644 --- a/jdaviz/configs/default/plugins/line_lists/line_lists.vue +++ b/jdaviz/configs/default/plugins/line_lists/line_lists.vue @@ -4,6 +4,13 @@ Plot lines from preset or custom line lists. + + {{ identify_label }} + + Redshift Shift spectral lines according to a specific redshift. Only enabled if at least one line is plotted.