| 476 | Py_Return; |
| 477 | } |
| 478 | PY_CATCH |
| 479 | } |
| 480 | |
| 481 | PyObject* PropertyContainerPy::getEnumerationsOfProperty(PyObject* args) |
| 482 | { |
| 483 | char* pstr {}; |
| 484 | if (!PyArg_ParseTuple(args, "s", &pstr)) { |
| 485 | return nullptr; |
| 486 | } |
| 487 | |
| 488 | Property* prop = getPropertyContainerPtr()->getPropertyByName(pstr); |
| 489 | if (!prop) { |
| 490 | PyErr_Format(PyExc_AttributeError, "Property container has no property '%s'", pstr); |
| 491 | return nullptr; |
| 492 | } |
| 493 | |
| 494 | PropertyEnumeration* enumProp = freecad_cast<PropertyEnumeration*>(prop); |
| 495 | if (!enumProp) { |
| 496 | Py_Return; |
| 497 | } |
| 498 | |
| 499 | std::vector<std::string> enumerations = enumProp->getEnumVector(); |
| 500 | Py::List ret; |
| 501 | for (const auto& it : enumerations) { |
| 502 | ret.append(Py::String(it)); |
| 503 | } |
| 504 | return Py::new_reference_to(ret); |
| 505 | } |
| 506 | |
| 507 | Py::List PropertyContainerPy::getPropertiesList() const |
| 508 | { |
nothing calls this directly
no test coverage detected