Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extract on SubsetCreateMessage #3238

Open
wants to merge 9 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion jdaviz/core/template_mixin.py
Original file line number Diff line number Diff line change
Expand Up @@ -2025,6 +2025,8 @@ def __init__(self, plugin, items, selected, multiselect=None, selected_has_subre

self.hub.subscribe(self, SubsetUpdateMessage,
handler=lambda msg: self._update_subset(msg.subset, msg.attribute))
self.hub.subscribe(self, SubsetCreateMessage,
handler=lambda msg: self._update_subset(msg.subset))
Comment on lines +2028 to +2029
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I hoped that I could just replace the trigger for this from SubsetUpdateMessage to SubsetCreateMessage, but it didn't work.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably cannot work as a drop-in replacement since SubsetCreateMessage does not have an attribute (in fact, does nothing). Wondering if this would need something equivalent of LayerSelect._on_subset_created, or if _update_subset can tricked into doing the right action some other way.

self.hub.subscribe(self, SubsetDeleteMessage,
handler=lambda msg: self._delete_subset(msg.subset))
self.hub.subscribe(self, SubsetRenameMessage,
Expand Down Expand Up @@ -2102,7 +2104,8 @@ def _update_subset(self, subset, attribute=None):
self.items = self.items + [self._subset_to_dict(subset)] # noqa
else:
# 'type' can be passed manually rather than coming from SubsetUpdateMessage.attribute
if attribute in ('style', 'type'):
# This will be None if triggered by SubsetCreateMessage
if attribute in ('style', 'type') or attribute is None:
# TODO: may need to add label and then rebuild the entire list if/when
# we add support for renaming subsets

Expand Down
Loading