#include <Events_InfoMessage.h>
+// Have to be included before std headers
+#include <Python.h>
+
#include <algorithm>
#include <iostream>
const std::shared_ptr<ModelAPI_AttributeSelectionList> & theAttribute)
{
theAttribute->clear();
+
+ if(!theValue.empty()) {
+ std::string aSelectionType;
+ const ModelHighAPI_Selection& aSelection = theValue.front();
+ theAttribute->setSelectionType(aSelection.shapeType());
+ }
+
for (auto it = theValue.begin(); it != theValue.end(); ++it)
it->appendToList(theAttribute);
}
}
}
return "For document '" + theDocName +
- "' the number of features becomes smaller, there is no feature '" + aLostName + "'";
+ "' the number of features is decreased, there is no feature '" + aLostName + "'";
}
}
return ""; // ok
std::string anError = storeFeatures(
aSession->moduleDocument()->kind(), aSession->moduleDocument(), aStore, false);
if (!anError.empty()) {
- Events_InfoMessage anError("checkPythonDump", anError);
- anError.send();
+ Events_InfoMessage anErrorMsg(std::string("checkPythonDump"), anError);
+ anErrorMsg.send();
return false;
}
// close all before importation of the script
aSession->closeAll();
// execute the dumped
- Config_ModuleReader::loadScript("check_dump");
+ PyGILState_STATE gstate = PyGILState_Ensure(); /* acquire python thread */
+ PyObject* PyFileObject = PyFile_FromString("./check_dump.py", "r");
+ PyRun_SimpleFileEx(PyFile_AsFile(PyFileObject), "./check_dump.py", 1);
+ PyGILState_Release(gstate); /* release python thread */
// compare with the stored data
anError = storeFeatures(
aSession->moduleDocument()->kind(), aSession->moduleDocument(), aStore, true);
if (!anError.empty()) {
std::cout<<anError<<std::endl;
- Events_InfoMessage anError("checkPythonDump", anError);
- anError.send();
+ Events_InfoMessage anErrorMsg(std::string("checkPythonDump"), anError);
+ anErrorMsg.send();
return false;
}