From b09289471d89aaac126c3852ba4e29265f493c7f Mon Sep 17 00:00:00 2001 From: wmayer Date: Fri, 5 Apr 2024 00:31:50 +0200 Subject: [PATCH] Gui: Fix broken toolbars layout due to MaterialWorkbench The explicit activation of the MaterialWorkbench breaks the toolbars layout for every start. When fixing it manually it will be broken again after the next start. Because the core doesn't depend on the Material module it's a no-go to add an explicit runtime dependency to the corresponding workbench. Since the Part module depends on the Materials module and the PartGui on MatGui the correct way is to let Part an PartGui load their dependencies. --- src/Gui/StartupProcess.cpp | 3 --- src/Mod/Part/App/AppPart.cpp | 8 ++++++++ src/Mod/Part/Gui/AppPartGui.cpp | 1 + 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/src/Gui/StartupProcess.cpp b/src/Gui/StartupProcess.cpp index 0e9b23e327..9c5e7e571b 100644 --- a/src/Gui/StartupProcess.cpp +++ b/src/Gui/StartupProcess.cpp @@ -451,9 +451,6 @@ void StartupPostProcess::showMainWindow() void StartupPostProcess::activateWorkbench() { - // Always activate the material workbench - guiApp.activateWorkbench("MaterialWorkbench"); - // Activate the correct workbench std::string start = App::Application::Config()["StartWorkbench"]; Base::Console().Log("Init: Activating default workbench %s\n", start.c_str()); diff --git a/src/Mod/Part/App/AppPart.cpp b/src/Mod/Part/App/AppPart.cpp index cce743971c..62b29c7b0e 100644 --- a/src/Mod/Part/App/AppPart.cpp +++ b/src/Mod/Part/App/AppPart.cpp @@ -200,6 +200,14 @@ PyObject* Part::PartExceptionOCCDimensionError; PyMOD_INIT_FUNC(Part) { + // load dependent module + try { + Base::Interpreter().runString("import Materials"); + } + catch(const Base::Exception& e) { + PyErr_SetString(PyExc_ImportError, e.what()); + PyMOD_Return(nullptr); + } Base::Console().Log("Module: Part\n"); // This is highly experimental and we should keep an eye on it diff --git a/src/Mod/Part/Gui/AppPartGui.cpp b/src/Mod/Part/Gui/AppPartGui.cpp index 9de0d18578..a224a3806d 100644 --- a/src/Mod/Part/Gui/AppPartGui.cpp +++ b/src/Mod/Part/Gui/AppPartGui.cpp @@ -123,6 +123,7 @@ PyMOD_INIT_FUNC(PartGui) // load needed modules try { Base::Interpreter().runString("import Part"); + Base::Interpreter().runString("import MatGui"); } catch(const Base::Exception& e) { PyErr_SetString(PyExc_ImportError, e.what());