Skip to content

Commit

Permalink
EXP: show how one would always create a new subset
Browse files Browse the repository at this point in the history
  • Loading branch information
astrofrog committed May 13, 2021
1 parent efcccbb commit cccabfd
Showing 1 changed file with 7 additions and 0 deletions.
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

0 comments on commit cccabfd

Please sign in to comment.