App: [skip ci] expose functions to Python to get status string of a feature and whether it's valid

This commit is contained in:
wmayer
2020-11-12 15:46:40 +01:00
parent 837cfa8f75
commit 85c1fa1739
2 changed files with 42 additions and 0 deletions

View File

@@ -397,6 +397,34 @@ PyObject* DocumentObjectPy::recompute(PyObject *args)
}
}
PyObject* DocumentObjectPy::isValid(PyObject *args)
{
if (!PyArg_ParseTuple(args, ""))
return nullptr;
try {
bool ok = getDocumentObjectPtr()->isValid();
return Py_BuildValue("O", (ok ? Py_True : Py_False));
}
catch (const Base::Exception& e) {
throw Py::RuntimeError(e.what());
}
}
PyObject* DocumentObjectPy::getStatusString(PyObject *args)
{
if (!PyArg_ParseTuple(args, ""))
return nullptr;
try {
Py::String text(getDocumentObjectPtr()->getStatusString());
return Py::new_reference_to(text);
}
catch (const Base::Exception& e) {
throw Py::RuntimeError(e.what());
}
}
PyObject* DocumentObjectPy::getSubObject(PyObject *args, PyObject *keywds)
{
PyObject *obj;