[TechDraw] Improve readability of DrawTemplatePyImp.cpp

This commit is contained in:
Benjamin Bræstrup Sayoc
2023-04-05 16:20:26 +02:00
committed by WandererFan
parent b9227bc15d
commit 4b5eeb351f

View File

@@ -49,18 +49,18 @@ int DrawTemplatePy::setCustomAttributes(const char* attr, PyObject* obj)
{
// search in PropertyList
App::Property *prop = getDrawTemplatePtr()->getPropertyByName(attr);
if (prop) {
// Read-only attributes must not be set over its Python interface
short Type = getDrawTemplatePtr()->getPropertyType(prop);
if (Type & App::Prop_ReadOnly) {
std::stringstream s;
s << "Object attribute '" << attr << "' is read-only";
throw Py::AttributeError(s.str());
}
prop->setPyObject(obj);
return 1;
if (!prop) {
return 0;
}
return 0;
// Read-only attributes must not be set over its Python interface
short Type = getDrawTemplatePtr()->getPropertyType(prop);
if (Type & App::Prop_ReadOnly) {
std::stringstream s;
s << "Object attribute '" << attr << "' is read-only";
throw Py::AttributeError(s.str());
}
prop->setPyObject(obj);
return 1;
}