[TD]add check for Gui up
This commit is contained in:
@@ -1887,6 +1887,14 @@ std::string DrawUtil::cleanFilespecBackslash(const std::string& filespec)
|
||||
return noBackslash;
|
||||
}
|
||||
|
||||
//! 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");
|
||||
}
|
||||
|
||||
|
||||
//============================
|
||||
// various debugging routines.
|
||||
|
||||
@@ -271,6 +271,7 @@ public:
|
||||
|
||||
static std::string cleanFilespecBackslash(const std::string& filespec);
|
||||
|
||||
static bool isGuiUp();
|
||||
|
||||
//debugging routines
|
||||
static void dumpVertexes(const char* text, const TopoDS_Shape& s);
|
||||
|
||||
Reference in New Issue
Block a user