Skip to content

Commit c29e8ca

Browse files
committed
Disable dock close; add Show controls action
Prevent the Controls dock from being closed by the user (keep it movable/floatable) and replace the previous toggleViewAction with an explicit, checkable "Show controls" QAction in the View menu. The new action is synchronized with the dock's visibility (action toggled -> dock visibility; dock visibilityChanged -> action checked). Also minor reordering/cleanup of Appearance menu setup and comments.
1 parent 60da747 commit c29e8ca

1 file changed

Lines changed: 12 additions & 5 deletions

File tree

dlclivegui/gui/main_window.py

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -296,8 +296,9 @@ def _setup_ui(self) -> None:
296296
self.controls_dock.setObjectName("ControlsDock") # important for state saving
297297
self.controls_dock.setWidget(controls_widget)
298298
### Dock features
299-
self.controls_dock.setFeatures( # must not close independently
300-
QDockWidget.DockWidgetMovable | QDockWidget.DockWidgetFloatable | QDockWidget.DockWidgetClosable
299+
self.controls_dock.setFeatures(
300+
# must not be closable by user but visibility can be toggled from View -> Show controls
301+
QDockWidget.DockWidgetMovable | QDockWidget.DockWidgetFloatable # | QDockWidget.DockWidgetClosable
301302
)
302303
self.addDockWidget(Qt.LeftDockWidgetArea, self.controls_dock)
303304
self.setDockOptions(
@@ -390,10 +391,16 @@ def _build_menus(self) -> None:
390391

391392
# View menu
392393
view_menu = self.menuBar().addMenu("&View")
393-
view_menu.addAction(self.controls_dock.toggleViewAction())
394+
## Show/hide controls dock
395+
self.action_show_controls = QAction("Show controls", self, checkable=True)
396+
self.action_show_controls.setChecked(True)
397+
self.action_show_controls.toggled.connect(self.controls_dock.setVisible)
398+
self.controls_dock.visibilityChanged.connect(self.action_show_controls.setChecked)
399+
view_menu.addAction(self.action_show_controls)
400+
## --------------------
394401
view_menu.addSeparator()
395-
appearance_menu = view_menu.addMenu("Appearance")
396402
## Style actions
403+
appearance_menu = view_menu.addMenu("Appearance")
397404
self.action_dark_mode = QAction("Dark theme", self, checkable=True)
398405
self.action_light_mode = QAction("System theme", self, checkable=True)
399406
theme_group = QActionGroup(self)
@@ -402,7 +409,7 @@ def _build_menus(self) -> None:
402409
theme_group.addAction(self.action_light_mode)
403410
self.action_dark_mode.triggered.connect(lambda: self._apply_theme(AppStyle.DARK))
404411
self.action_light_mode.triggered.connect(lambda: self._apply_theme(AppStyle.SYS_DEFAULT))
405-
412+
# ----------------------
406413
appearance_menu.addAction(self.action_light_mode)
407414
appearance_menu.addAction(self.action_dark_mode)
408415
self._apply_theme(self._current_style)

0 commit comments

Comments
 (0)