Skip to content

Commit

Permalink
data-menu: fix updating linewidth and colormap styling (spacetelescop…
Browse files Browse the repository at this point in the history
…e#3341)

* force data menu layer_items to update when changing linewidth or cmap
* ensure LayerSelect updates
  • Loading branch information
kecnry authored Dec 6, 2024
1 parent 1a7d932 commit 527d1f5
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions jdaviz/core/template_mixin.py
Original file line number Diff line number Diff line change
Expand Up @@ -1496,9 +1496,8 @@ 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, SubsetUpdateMessage,
handler=lambda _: self._update_layer_items())
self.hub.subscribe(self, SubsetDeleteMessage,
handler=lambda _: self._update_layer_items())

Expand Down Expand Up @@ -1714,6 +1713,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
Expand Down Expand Up @@ -4484,6 +4485,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()
Expand Down

0 comments on commit 527d1f5

Please sign in to comment.