Skip to content

Commit

Permalink
ENH: Refactor HomeWidget.setSlicerUIVisible to de-duplicate toolbar n…
Browse files Browse the repository at this point in the history
…ames list

Refactors the `setSlicerUIVisible` method in `HomeWidget` to streamline
the handling of toolbar names. It introduces an `exemptToolbars` list to
store the names of toolbars that should be excluded from visibility changes.
  • Loading branch information
jcfr committed Aug 21, 2024
1 parent 617c432 commit 085453f
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions {{cookiecutter.project_name}}/Modules/Scripted/Home/Home.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,17 +74,18 @@ def cleanup(self):
pass

def setSlicerUIVisible(self, visible: bool):
exemptToolbars = [
"MainToolBar",
"ViewToolBar",
"CustomToolBar",
]
slicer.util.setDataProbeVisible(visible)
slicer.util.setMenuBarsVisible(visible, ignore=["MainToolBar", "ViewToolBar"])
slicer.util.setMenuBarsVisible(visible, ignore=exemptToolbars)
slicer.util.setModuleHelpSectionVisible(visible)
slicer.util.setModulePanelTitleVisible(visible)
slicer.util.setPythonConsoleVisible(visible)
slicer.util.setApplicationLogoVisible(visible)
keepToolbars = [
slicer.util.findChild(slicer.util.mainWindow(), "MainToolBar"),
slicer.util.findChild(slicer.util.mainWindow(), "ViewToolBar"),
slicer.util.findChild(slicer.util.mainWindow(), "CustomToolBar"),
]
keepToolbars = [slicer.util.findChild(slicer.util.mainWindow(), toolbarName) for toolbarName in exemptToolbars]
slicer.util.setToolbarsVisible(visible, keepToolbars)

def modifyWindowUI(self):
Expand Down

0 comments on commit 085453f

Please sign in to comment.