PyObject* PropertyContainerPy::setEditorMode(PyObject *args) { char* name; short type; if (PyArg_ParseTuple(args, "sh", &name, &type)) { App::Property* prop = getPropertyContainerPtr()->getPropertyByName(name); if (!prop) { PyErr_Format(PyExc_AttributeError, "Property container has no property '%s'", name); return 0; } unsigned long status = prop->getStatus(); prop->setStatus(Property::ReadOnly,(type & 1) > 0); prop->setStatus(Property::Hidden,(type & 2) > 0); if (status != prop->getStatus()) GetApplication().signalChangePropertyEditor(*prop); Py_Return; } PyErr_Clear(); PyObject *iter; if (PyArg_ParseTuple(args, "sO", &name, &iter)) { if (PyTuple_Check(iter) || PyList_Check(iter)) { Py::Sequence seq(iter); App::Property* prop = getPropertyContainerPtr()->getPropertyByName(name); if (!prop) { PyErr_Format(PyExc_AttributeError, "Property container has no property '%s'", name); return 0; } // reset all bits first unsigned long status = prop->getStatus(); prop->setStatus(Property::ReadOnly, false); prop->setStatus(Property::Hidden, false); for (Py::Sequence::iterator it = seq.begin();it!=seq.end();++it) { std::string str = (std::string)Py::String(*it); if (str == "ReadOnly") prop->setStatus(Property::ReadOnly, true); else if (str == "Hidden") prop->setStatus(Property::Hidden, true); } if (status != prop->getStatus()) GetApplication().signalChangePropertyEditor(*prop); Py_Return; } } PyErr_SetString(PyExc_TypeError, "First argument must be str, second can be int, list or tuple"); return 0; }