コード例 #1
0
PyObject* py_showTransferFunctionEditor(PyObject* self, PyObject* args) {
    static PythonParameterParser tester;

    std::string path;
    if (tester.parse(args, path) == -1) {
        return nullptr;
    }

    Property* theProperty =
        InviwoApplication::getPtr()->getProcessorNetwork()->getProperty(splitString(path, '.'));

    if (!theProperty) {
        std::string msg =
            std::string("showTransferFunctionEditor() no property with path: ") + path;
        PyErr_SetString(PyExc_TypeError, msg.c_str());
        return nullptr;
    }

    if (!dynamic_cast<TransferFunctionProperty*>(theProperty)) {
        std::string msg =
            std::string("showTransferFunctionEditor() not a transfer function property: ") +
            theProperty->getClassIdentifier();
        PyErr_SetString(PyExc_TypeError, msg.c_str());
        return nullptr;
    }

    for (auto w : theProperty->getWidgets()) {
        auto tfw = dynamic_cast<TransferFunctionPropertyWidgetQt*>(w);
        if (tfw) {
            tfw->openTransferFunctionDialog();
        }
    }
    Py_RETURN_NONE;
}
コード例 #2
0
ファイル: pythonqtmethods.cpp プロジェクト: Ojaswi/inviwo
PyObject* py_showTransferFunctionEditor(PyObject* /*self*/, PyObject* args) {
    PyShowPropertyWidgetMethod p;
    if (!p.testParams(args)) {
        return nullptr;
    }
    std::string path = std::string(PyValueParser::parse<std::string>(PyTuple_GetItem(args, 0)));
    Property* theProperty =
        InviwoApplication::getPtr()->getProcessorNetwork()->getProperty(splitString(path, '.'));

    if (!theProperty) {
        std::string msg =
            std::string("showTransferFunctionEditor() no property with path: ") + path;
        PyErr_SetString(PyExc_TypeError, msg.c_str());
        return nullptr;
    }

    if (!dynamic_cast<TransferFunctionProperty*>(theProperty)) {
        std::string msg =
            std::string("showTransferFunctionEditor() not a transfer function property: ") +
            theProperty->getClassIdentifier();
        PyErr_SetString(PyExc_TypeError, msg.c_str());
        return nullptr;
    }

    for (auto w : theProperty->getWidgets()) {
        auto tfw = dynamic_cast<TransferFunctionPropertyWidgetQt*>(w);
        if (tfw) {
            tfw->openTransferFunctionDialog();
        }
    }
    Py_RETURN_NONE;
}