App: expose function getParent() to Python
This commit is contained in:
@@ -182,6 +182,15 @@ Return -1 if element visibility is not supported or element not found, 0 if invi
|
||||
in a single group, hence only a single return value.</UserDocu>
|
||||
</Documentation>
|
||||
</Methode>
|
||||
<Methode Name="getParent">
|
||||
<Documentation>
|
||||
<UserDocu>Returns the group the object is in or None if it is not part of a group.
|
||||
Note that an object can only be in a single group, hence only a single return
|
||||
value.
|
||||
The parent can be a simple group as with getParentGroup() or a
|
||||
GeoFeature group as with getParentGeoFeatureGroup().</UserDocu>
|
||||
</Documentation>
|
||||
</Methode>
|
||||
<Methode Name="getPathsByOutList">
|
||||
<Documentation>
|
||||
<UserDocu>Get all paths from this object to another object following the OutList.</UserDocu>
|
||||
|
||||
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user