diff --git a/src/App/PropertyContainerPy.xml b/src/App/PropertyContainerPy.xml index 3b27ec44e..5180bf37b 100644 --- a/src/App/PropertyContainerPy.xml +++ b/src/App/PropertyContainerPy.xml @@ -23,6 +23,11 @@ Return the type of a named property. This can be (Hidden,ReadOnly,Output) or any combination. + + + Returns the C++ class name of a named property. + + Set the behaviour of the property in the property editor. diff --git a/src/App/PropertyContainerPyImp.cpp b/src/App/PropertyContainerPyImp.cpp index dd93c7ba8..4e019a5c3 100644 --- a/src/App/PropertyContainerPyImp.cpp +++ b/src/App/PropertyContainerPyImp.cpp @@ -64,8 +64,13 @@ PyObject* PropertyContainerPy::getTypeOfProperty(PyObject *args) if (!PyArg_ParseTuple(args, "s", &pstr)) // convert args: Python->C return NULL; // NULL triggers exception - short Type = getPropertyContainerPtr()->getPropertyType(pstr); + Property* prop = getPropertyContainerPtr()->getPropertyByName(pstr); + if (!prop) { + PyErr_Format(PyExc_AttributeError, "Property container has no property '%s'", pstr); + return 0; + } + short Type = prop->getType(); if (Type & Prop_Hidden) ret.append(Py::String("Hidden")); if (Type & Prop_ReadOnly) @@ -78,6 +83,22 @@ PyObject* PropertyContainerPy::getTypeOfProperty(PyObject *args) return Py::new_reference_to(ret); } +PyObject* PropertyContainerPy::getTypeIdOfProperty(PyObject *args) +{ + char *pstr; + if (!PyArg_ParseTuple(args, "s", &pstr)) // convert args: Python->C + return NULL; // NULL triggers exception + + Property* prop = getPropertyContainerPtr()->getPropertyByName(pstr); + if (!prop) { + PyErr_Format(PyExc_AttributeError, "Property container has no property '%s'", pstr); + return 0; + } + + Py::String str(prop->getTypeId().getName()); + return Py::new_reference_to(str); +} + PyObject* PropertyContainerPy::setEditorMode(PyObject *args) { char* name;