Ejemplo n.º 1
0
void DynamicProperty::addDynamicProperties(const PropertyContainer* cont)
{
    std::vector<std::string> names = cont->getDynamicPropertyNames();
    for (std::vector<std::string>::iterator it = names.begin(); it != names.end(); ++it) {
        App::Property* prop = cont->getDynamicPropertyByName(it->c_str());
        if (prop) {
            addDynamicProperty(
                prop->getTypeId().getName(),
                prop->getName(),
                prop->getGroup(),
                prop->getDocumentation(),
                prop->getType(),
                cont->isReadOnly(prop),
                cont->isHidden(prop));
        }
    }
}
PyObject*  PropertyContainerPy::getEditorMode(PyObject *args)
{
    char* name;
    if (!PyArg_ParseTuple(args, "s", &name))     // convert args: Python->C
        return NULL;                             // NULL triggers exception

    App::Property* prop = getPropertyContainerPtr()->getPropertyByName(name);
    Py::List ret;
    if (prop) {
        short Type =  prop->getType();
        if ((prop->testStatus(Property::ReadOnly)) || (Type & Prop_ReadOnly))
            ret.append(Py::String("ReadOnly"));
        if ((prop->testStatus(Property::Hidden)) || (Type & Prop_Hidden))
            ret.append(Py::String("Hidden"));
    }
    return Py::new_reference_to(ret);
}