Skip to content

Commit

Permalink
ENH: Support restoring SliceViewAnnotations enabled state
Browse files Browse the repository at this point in the history
Also simplify setting of checkbox state in SliceViewAnnotations
  • Loading branch information
jcfr committed Sep 28, 2023
1 parent c410ead commit 5b0bcad
Showing 1 changed file with 6 additions and 9 deletions.
15 changes: 6 additions & 9 deletions Modules/Scripted/DataProbe/DataProbeLib/SliceViewAnnotations.py
Original file line number Diff line number Diff line change
Expand Up @@ -193,10 +193,7 @@ def onLayoutManagerDestroyed(self):
self.layoutManager.connect("destroyed()", self.onLayoutManagerDestroyed)

def onSliceViewAnnotationsCheckBox(self):
if self.sliceViewAnnotationsCheckBox.checked:
self.sliceViewAnnotationsEnabled = 1
else:
self.sliceViewAnnotationsEnabled = 0
self.sliceViewAnnotationsEnabled = int(self.sliceViewAnnotationsCheckBox.checked)

settings = qt.QSettings()
settings.setValue('DataProbe/sliceViewAnnotations.enabled', self.sliceViewAnnotationsEnabled)
Expand All @@ -219,10 +216,7 @@ def onDisplayDisplayLevelRadioButton(self):
self.updateSliceViewFromGUI()

def onBackgroundLayerPersistenceCheckBox(self):
if self.backgroundPersistenceCheckBox.checked:
self.backgroundDICOMAnnotationsPersistence = 1
else:
self.backgroundDICOMAnnotationsPersistence = 0
self.backgroundDICOMAnnotationsPersistence = int(self.backgroundPersistenceCheckBox.checked)
settings = qt.QSettings()
settings.setValue('DataProbe/sliceViewAnnotations.bgDICOMAnnotationsPersistence',
self.backgroundDICOMAnnotationsPersistence)
Expand Down Expand Up @@ -266,6 +260,10 @@ def restoreDefaultValues(self):
def _defaultValue(key):
return SliceAnnotations.DEFAULTS[key]

self.sliceViewAnnotationsCheckBox.checked = _defaultValue("enabled")
self.sliceViewAnnotationsEnabled = _defaultValue("enabled")
self.updateEnabledButtons()

radioButtons = [self.level1RadioButton, self.level2RadioButton, self.level3RadioButton]
radioButtons[_defaultValue("displayLevel")].checked = True
self.annotationsDisplayAmount = _defaultValue("displayLevel")
Expand Down Expand Up @@ -312,7 +310,6 @@ def updateEnabledButtons(self):
self.activateCornersGroupBox.enabled = enabled
self.fontPropertiesGroupBox.enabled = enabled
self.annotationsAmountGroupBox.enabled = enabled
self.restoreDefaultsButton.enabled = enabled

def updateSliceViewFromGUI(self):
if not self.sliceViewAnnotationsEnabled:
Expand Down

0 comments on commit 5b0bcad

Please sign in to comment.