[TechDraw] Improve readability of DrawTemplatePyImp.cpp
This commit is contained in:
committed by
WandererFan
parent
b9227bc15d
commit
4b5eeb351f
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user