Skip to content

Commit

Permalink
Fix toggle visibility for threshold masks
Browse files Browse the repository at this point in the history
The visibility of the threshold mask was not being saved. Makes sure that it is.

Signed-off-by: Brianna Major <[email protected]>
  • Loading branch information
bnmajor committed Aug 2, 2023
1 parent c19ebf0 commit f41e04b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
6 changes: 5 additions & 1 deletion hexrd/ui/hexrd_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -2422,10 +2422,14 @@ def threshold_values(self, v):
@property
def threshold_mask_status(self):
mask_vals = HexrdConfig().threshold_masks.values()
if len(mask_vals) > 0:
if self._threshold_data.get('visible', True) and len(mask_vals) > 0:
return all([v is not None for v in mask_vals])
return False

@threshold_mask_status.setter
def threshold_mask_status(self, v):
self._threshold_data['visible'] = v

@property
def threshold_masks(self):
return self._threshold_data.setdefault('masks', {})
Expand Down
3 changes: 3 additions & 0 deletions hexrd/ui/mask_manager_dialog.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,9 @@ def toggle_visibility(self, checked, name):
elif not checked and name in HexrdConfig().visible_masks:
HexrdConfig().visible_masks.remove(name)

if name == self.threshold:
HexrdConfig().threshold_mask_status = checked

self.masks_changed()

def reset_threshold(self):
Expand Down

0 comments on commit f41e04b

Please sign in to comment.