diff --git a/src/Mod/TechDraw/App/AppTechDrawPy.cpp b/src/Mod/TechDraw/App/AppTechDrawPy.cpp index c2d574f4b5..15529bba1d 100644 --- a/src/Mod/TechDraw/App/AppTechDrawPy.cpp +++ b/src/Mod/TechDraw/App/AppTechDrawPy.cpp @@ -44,8 +44,6 @@ #include #include -#include - #include #include #include @@ -74,7 +72,6 @@ #include "GeometryObject.h" #include "ProjectionAlgos.h" #include "TechDrawExport.h" -#include "CosmeticVertexPy.h" #include "DrawLeaderLinePy.h" namespace TechDraw { diff --git a/src/Mod/TechDraw/App/DrawUtil.cpp b/src/Mod/TechDraw/App/DrawUtil.cpp index 60a7bd92d2..09d98c7b12 100644 --- a/src/Mod/TechDraw/App/DrawUtil.cpp +++ b/src/Mod/TechDraw/App/DrawUtil.cpp @@ -1890,9 +1890,8 @@ std::string DrawUtil::cleanFilespecBackslash(const std::string& filespec) //! returns true if the Gui module and its event loop are active. bool DrawUtil::isGuiUp() { - std::string pyCommand{"import FreeCAD\nguiState = FreeCAD.GuiUp"}; - std::string result{Base::Interpreter().runStringWithKey(pyCommand.c_str(), "guiState", "None")}; - return (result == "1"); + auto* app = QCoreApplication::instance(); + return (app != nullptr) && app->inherits("QApplication"); }