Exemplo n.º 1
0
PyTypeObject* createScopedEnum(SbkObjectType* scope, const char* name, const char* fullName, const char* cppName, PyTypeObject* flagsType)
{
    PyTypeObject* enumType = createEnum(fullName, cppName, name, flagsType);
    if (enumType && PyDict_SetItemString(scope->super.ht_type.tp_dict, name, (PyObject*)enumType) < 0)
       return 0;
    if (flagsType && PyDict_SetItemString(scope->super.ht_type.tp_dict, flagsType->tp_name, (PyObject*)flagsType) < 0)
       return 0;
    return enumType;
}
Exemplo n.º 2
0
PyTypeObject* createGlobalEnum(PyObject* module, const char* name, const char* fullName, const char* cppName, PyTypeObject* flagsType)
{
    PyTypeObject* enumType = createEnum(fullName, cppName, name, flagsType);
    Shiboken::TypeResolver::createValueTypeResolver<int>("Qt::WindowType");
    Shiboken::TypeResolver::createValueTypeResolver<int>("WindowType");
    if (enumType && PyModule_AddObject(module, name, (PyObject*)enumType) < 0)
        return 0;
    if (flagsType && PyModule_AddObject(module, flagsType->tp_name, (PyObject*)flagsType) < 0)
        return 0;
    return enumType;
}
Exemplo n.º 3
0
void 
PropertyManager::addAttribute(wxPropertyGridManager *pg, std::unique_ptr<Attribute> &a) {

	switch (a->getType()) {

	case Enums::ENUM: createEnum(pg, a); break;
	case Enums::BOOL: createBool(pg, a); break;
	case Enums::BVEC4: createBVec4(pg, a); break;
	case Enums::INT: createInt(pg, a); break;
	case Enums::IVEC3: createIVec3(pg, a); break;
	case Enums::UINT: createUInt(pg, a); break;
	case Enums::UIVEC2: createUIVec2(pg, a); break;
	case Enums::UIVEC3: createUIVec3(pg, a); break;
	case Enums::FLOAT: createFloat(pg, a); break;
	case Enums::VEC2: createVec2(pg, a); break;
	case Enums::VEC3: createVec3(pg, a); break;
	case Enums::VEC4: createVec4(pg, a); break;
	case Enums::MAT3: createMat3(pg, a); break;
	case Enums::MAT4: createMat4(pg, a); break;
	case Enums::STRING: createString(pg, a); break;
	default: assert(false && "Missing datatype in property manager");

	}
}
Exemplo n.º 4
0
//-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~
void
PropertiesView::onAddProperty(I_PropertiesPublisher& _publisher, I_Property& _property)
{
    // Get the handle associated with this publisher.
    PropertiesHandle* const pHandle = m_propertiesMap[&_publisher];

    // TODO Fix:  pHandle is sometimes NULL.  Why?

    // The name is a concatenation of the property set name and the property name.
    std::stringstream name;
    name << pHandle->getPublisher().getPropertiesName();

    // Get the parent category
    // Use pParent now.
    //wxPropertyCategory* const pCategory = pHandle->getCategory();

    if (_property.getParent() != NULL)
    {
        // Append the parent name.  This gives us the fully qualified
        // parent name.
        name << "\\" << _property.getParent()->getFullName();
    }

    // Get the parent by name.
    wxPGProperty* pParent = m_pPropertyGrid->GetPropertyByName(std2wx(name.str()));

    // Make sure the parent is not NULL.  It should at least return the
    // top category.
    assert(pParent != NULL);

    // Now create the child name.
    name << "\\" << _property.getName();

    wxPGProperty* pChild = NULL;

    switch(_property.getType())
    {
    case I_Property::STRING_TYPE:
        // The first parameter is the label which is shown on the screen.
        // The second parameter is the label, which is the unqiue identifier of the property.
        pChild = new wxStringProperty(std2wx(_property.getName()), std2wx(name.str()), std2wx(_property.getValue()));
        break;
    case I_Property::ENUM_TYPE:
        pChild = createEnum(_property, name.str());
        break;
    case I_Property::CATEGORY_TYPE:
        pChild = createCategory(_property, name.str());
        break;
    default:
        throw Zen::Utility::runtime_exception("Error, invalid property type.");
    }

    pChild->SetClientData(&_property);
    pParent->AppendChild(pChild);

    // Assume a string value type for now.

    // TEST See how to get the property (name or label)
    wxPGProperty* pByName = m_pPropertyGrid->GetPropertyByName(std2wx(name.str()));
#if 0
    m_pPropertyGrid->Insert(pCategory,
        new wxStringProperty(_property.getName(), name.str(), _property.getValue()));
#endif
}