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 Aug 18, 2023
1 parent 3ce7b54 commit 4a149d2
Showing 1 changed file with 7 additions and 9 deletions.
16 changes: 7 additions & 9 deletions Modules/Scripted/DataProbe/DataProbeLib/SliceViewAnnotations.py
Original file line number Diff line number Diff line change
Expand Up @@ -191,10 +191,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 @@ -203,10 +200,8 @@ def onSliceViewAnnotationsCheckBox(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 @@ -250,6 +245,10 @@ def restoreDefaultValues(self):
def _defaultValue(key):
return SliceAnnotations.DEFAULTS[key]

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

self.topLeftCheckBox.checked = _defaultValue("topLeft")
self.topLeft = _defaultValue("topLeft")

Expand Down Expand Up @@ -292,7 +291,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 4a149d2

Please sign in to comment.