From 37dc6f42250342c027065c0a4fa20ffcfbd2899a Mon Sep 17 00:00:00 2001 From: Kyle Conroy Date: Fri, 6 Dec 2024 14:46:48 -0500 Subject: [PATCH 1/3] force data menu layer_items to update when changing linewidth or cmap --- jdaviz/core/template_mixin.py | 1 + 1 file changed, 1 insertion(+) diff --git a/jdaviz/core/template_mixin.py b/jdaviz/core/template_mixin.py index 165e34b3f3..7f78f3cce8 100644 --- a/jdaviz/core/template_mixin.py +++ b/jdaviz/core/template_mixin.py @@ -4484,6 +4484,7 @@ def _on_glue_value_changed(self, value): # currently in subscribed states will be ignored. for viewer in self.subscribed_viewers: viewer._update_layer_icons() + viewer.data_menu.layer._update_layer_items() # callbacks from the viewer state also do not trigger an update to the # layer items (tabs), so we'll force those to update from here as well. self.plugin.layer._update_layer_items() From bd16688707c07d5b120c2da0bc07e7fb19535054 Mon Sep 17 00:00:00 2001 From: Kyle Conroy Date: Fri, 6 Dec 2024 15:01:12 -0500 Subject: [PATCH 2/3] ensure LayerSelect updates * overly greedy, but ensures the layer items in the legend are updated for a new subset. --- jdaviz/core/template_mixin.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/jdaviz/core/template_mixin.py b/jdaviz/core/template_mixin.py index 7f78f3cce8..c47fbce27d 100644 --- a/jdaviz/core/template_mixin.py +++ b/jdaviz/core/template_mixin.py @@ -1497,8 +1497,8 @@ def __init__(self, plugin, items, selected, viewer, self.hub.subscribe(self, SubsetCreateMessage, handler=lambda _: self._on_subset_created()) # will need SubsetUpdateMessage for name only (style shouldn't force a full refresh) - # self.hub.subscribe(self, SubsetUpdateMessage, - # handler=lambda _: self._update_layer_items()) + self.hub.subscribe(self, SubsetUpdateMessage, + handler=lambda _: self._update_layer_items()) self.hub.subscribe(self, SubsetDeleteMessage, handler=lambda _: self._update_layer_items()) @@ -1714,6 +1714,8 @@ def _on_data_added(self, msg=None): @observe('filters', 'sort_by') def _update_layer_items(self, msg={}): # NOTE: _on_layers_changed is passed without a msg object during init + # TODO: if the message is a SubsetUpdateMessage, only act on those that require + # an update # TODO: Handle changes to just one item without recompiling the whole thing manual_items = [{'label': label} for label in self.manual_options] # use getattr so the super() call above doesn't try to access the attr before From 86dffd88e7068b9122133e534a668e137692e68e Mon Sep 17 00:00:00 2001 From: Kyle Conroy Date: Fri, 6 Dec 2024 15:02:29 -0500 Subject: [PATCH 3/3] remove irrelevant comment (moved to section below in prev commit --- jdaviz/core/template_mixin.py | 1 - 1 file changed, 1 deletion(-) diff --git a/jdaviz/core/template_mixin.py b/jdaviz/core/template_mixin.py index c47fbce27d..3779d97383 100644 --- a/jdaviz/core/template_mixin.py +++ b/jdaviz/core/template_mixin.py @@ -1496,7 +1496,6 @@ def __init__(self, plugin, items, selected, viewer, handler=lambda _: self._update_layer_items()) self.hub.subscribe(self, SubsetCreateMessage, handler=lambda _: self._on_subset_created()) - # will need SubsetUpdateMessage for name only (style shouldn't force a full refresh) self.hub.subscribe(self, SubsetUpdateMessage, handler=lambda _: self._update_layer_items()) self.hub.subscribe(self, SubsetDeleteMessage,