From f67dc54fe1fa933b378b85a53218dff409eaa232 Mon Sep 17 00:00:00 2001 From: Kristoffer Richardsson Date: Tue, 17 Oct 2023 13:56:11 +0200 Subject: [PATCH 1/2] Do not allow floating toolboxes --- src/cfclient/ui/tab_toolbox.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/cfclient/ui/tab_toolbox.py b/src/cfclient/ui/tab_toolbox.py index debd4dbc06..c024a4aaff 100644 --- a/src/cfclient/ui/tab_toolbox.py +++ b/src/cfclient/ui/tab_toolbox.py @@ -69,6 +69,14 @@ def __init__(self, helper, tab_toolbox_name): self._dock_area = self._get_toolbox_area_config() + # Do not allow floating toolboxes, it seems to be buggy + self.dock_widget.setFeatures(QtWidgets.QDockWidget.DockWidgetFeature.DockWidgetClosable | + QtWidgets.QDockWidget.DockWidgetFeature.DockWidgetMovable) + # If floating is set in the config, change to right docking area + if self._dock_area == Qt.DockWidgetArea.NoDockWidgetArea: + self._dock_area = Qt.DockWidgetArea.RightDockWidgetArea + + def get_tab_toolbox_name(self): """Return the name that will be shown in the tab or toolbox""" return self.tab_toolbox_name @@ -90,7 +98,7 @@ def set_display_state(self, new_display_state): self.enable() def preferred_dock_area(self): - return Qt.DockWidgetArea(self._dock_area) + return self._dock_area def set_preferred_dock_area(self, area): self._dock_area = area @@ -159,7 +167,7 @@ def _get_toolbox_area_config(self): config = self._read_toolbox_area_config() if self.tab_toolbox_name in config.keys(): - result = config[self.tab_toolbox_name] + result = Qt.DockWidgetArea(config[self.tab_toolbox_name]) return result From 39a4e3b417a6afad3635826984f9ba94d62b23f0 Mon Sep 17 00:00:00 2001 From: Kristoffer Richardsson Date: Tue, 17 Oct 2023 14:03:28 +0200 Subject: [PATCH 2/2] Flake8 --- src/cfclient/ui/tab_toolbox.py | 1 - 1 file changed, 1 deletion(-) diff --git a/src/cfclient/ui/tab_toolbox.py b/src/cfclient/ui/tab_toolbox.py index c024a4aaff..0732d257f5 100644 --- a/src/cfclient/ui/tab_toolbox.py +++ b/src/cfclient/ui/tab_toolbox.py @@ -76,7 +76,6 @@ def __init__(self, helper, tab_toolbox_name): if self._dock_area == Qt.DockWidgetArea.NoDockWidgetArea: self._dock_area = Qt.DockWidgetArea.RightDockWidgetArea - def get_tab_toolbox_name(self): """Return the name that will be shown in the tab or toolbox""" return self.tab_toolbox_name