App: expose function getParent() to Python

This commit is contained in:
wmayer
2023-05-15 23:40:25 +02:00
parent 41e6758bc0
commit 1ade42e634
2 changed files with 27 additions and 0 deletions

View File

@@ -673,6 +673,24 @@ PyObject* DocumentObjectPy::getParentGeoFeatureGroup(PyObject *args)
}
}
PyObject* DocumentObjectPy::getParent(PyObject *args)
{
if (!PyArg_ParseTuple(args, ""))
return nullptr;
try {
auto grp = getDocumentObjectPtr()->getFirstParent();
if(!grp) {
Py_INCREF(Py_None);
return Py_None;
}
return grp->getPyObject();
}
catch (const Base::Exception& e) {
throw Py::RuntimeError(e.what());
}
}
Py::Boolean DocumentObjectPy::getMustExecute() const
{
try {