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

EXP: show how one would always create a new subset #2192

Closed
Closed
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
7 changes: 7 additions & 0 deletions glue/core/edit_subset_mode.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ def _combine_data(self, new_state, override_mode=None):
:param override_mode: Mode to use instead of EditSubsetMode.mode
"""
mode = override_mode or self.mode
len_edit_subset = len(self._edit_subset)
if not self._edit_subset or mode is NewMode:
if self.data_collection is None:
raise RuntimeError("Must set data_collection before "
Expand All @@ -72,6 +73,12 @@ def _combine_data(self, new_state, override_mode=None):
subs = self._edit_subset
for s in as_list(subs):
mode(s, new_state)
# If we wanted to make sure that when in NewMode we go back to having
# no current subset selected (which would mean creating a new subset
# every time) we need to reset edit_subset here
print(self.mode, self._edit_subset)
if self.mode is NewMode or len_edit_subset == 0:
self.edit_subset = []

@contract(d='inst($DataCollection, $Data)',
new_state='isinstance(SubsetState)',
Expand Down