Add locked keyword to Document::addProperty
This commit is contained in:
committed by
Kacper Donat
parent
fec9d5bc5a
commit
73708391fb
@@ -215,9 +215,10 @@ class Document(PropertyContainer):
|
||||
attr: int = 0,
|
||||
read_only: bool = False,
|
||||
hidden: bool = False,
|
||||
locked: bool = False,
|
||||
) -> "Document":
|
||||
"""
|
||||
addProperty(type: string, name: string, group="", doc="", attr=0, read_only=False, hidden=False) -- Add a generic property.
|
||||
addProperty(type: string, name: string, group="", doc="", attr=0, read_only=False, hidden=False, locked=False) -- Add a generic property.
|
||||
"""
|
||||
...
|
||||
|
||||
|
||||
@@ -49,20 +49,21 @@ PyObject* DocumentPy::addProperty(PyObject* args, PyObject* kwd)
|
||||
char* sDoc {nullptr};
|
||||
short attr = 0;
|
||||
std::string sDocStr;
|
||||
PyObject *ro = Py_False, *hd = Py_False;
|
||||
PyObject *ro = Py_False, *hd = Py_False, *lk = Py_False;
|
||||
PyObject* enumVals = nullptr;
|
||||
static const std::array<const char*, 9> kwlist {"type",
|
||||
static const std::array<const char*, 10> kwlist {"type",
|
||||
"name",
|
||||
"group",
|
||||
"doc",
|
||||
"attr",
|
||||
"read_only",
|
||||
"hidden",
|
||||
"locked",
|
||||
"enum_vals",
|
||||
nullptr};
|
||||
if (!Base::Wrapped_ParseTupleAndKeywords(args,
|
||||
kwd,
|
||||
"ss|sethO!O!O",
|
||||
"ss|sethO!O!O!O",
|
||||
kwlist,
|
||||
&sType,
|
||||
&sName,
|
||||
@@ -74,6 +75,8 @@ PyObject* DocumentPy::addProperty(PyObject* args, PyObject* kwd)
|
||||
&ro,
|
||||
&PyBool_Type,
|
||||
&hd,
|
||||
&PyBool_Type,
|
||||
&lk,
|
||||
&enumVals)) {
|
||||
return nullptr;
|
||||
}
|
||||
@@ -90,6 +93,7 @@ PyObject* DocumentPy::addProperty(PyObject* args, PyObject* kwd)
|
||||
attr,
|
||||
Base::asBoolean(ro),
|
||||
Base::asBoolean(hd));
|
||||
prop->setStatus(Property::LockDynamic, Base::asBoolean(lk));
|
||||
|
||||
// enum support
|
||||
auto* propEnum = dynamic_cast<App::PropertyEnumeration*>(prop);
|
||||
|
||||
Reference in New Issue
Block a user