From 792504f978441d0a7708ebdaabc4b4baf24fdff4 Mon Sep 17 00:00:00 2001 From: Marcelo Lira Date: Thu, 1 Dec 2011 17:32:48 -0300 Subject: Removed the remaining occurrences of Shiboken::makeTuple. --- PySide/QtCore/typesystem_core.xml | 60 ++++++---- PySide/QtDeclarative/pysideqmlregistertype.cpp | 18 ++- PySide/QtDeclarative/typesystem_declarative.xml | 4 +- PySide/QtGui/typesystem_gui_common.xml | 66 +++++++---- PySide/QtNetwork/typesystem_network.xml | 2 +- PySide/QtOpenGL/typesystem_opengl.xml | 4 +- PySide/QtXml/typesystem_xml.xml | 45 ++++---- PySide/typesystem_templates.xml | 146 +++++++++++++----------- 8 files changed, 209 insertions(+), 136 deletions(-) (limited to 'PySide') diff --git a/PySide/QtCore/typesystem_core.xml b/PySide/QtCore/typesystem_core.xml index 73f37f6fb..59325b009 100644 --- a/PySide/QtCore/typesystem_core.xml +++ b/PySide/QtCore/typesystem_core.xml @@ -937,7 +937,9 @@ static void msgHandlerCallback(QtMsgType type, const char* msg) { Shiboken::GilState state; - Shiboken::AutoDecRef arglist(Shiboken::makeTuple(type, msg)); + Shiboken::AutoDecRef arglist(PyTuple_New(2)); + PyTuple_SET_ITEM(arglist, 0, %CONVERTTOPYTHON[QtMsgType](type)); + PyTuple_SET_ITEM(arglist, 1, %CONVERTTOPYTHON[const char*](msg)); Shiboken::AutoDecRef ret(PyObject_CallObject(qtmsghandler, arglist)); } static void QtCoreModuleExit() @@ -1047,9 +1049,11 @@ - QPointF p; - %RETURN_TYPE retval = %CPPSELF.%FUNCTION_NAME(%ARGUMENT_NAMES, &p); - %PYARG_0 = Shiboken::makeTuple(retval, p); + QPointF p; + %RETURN_TYPE retval = %CPPSELF.%FUNCTION_NAME(%ARGUMENT_NAMES, &p); + %PYARG_0 = PyTuple_New(2); + PyTuple_SET_ITEM(%PYARG_0, 0, %CONVERTTOPYTHON[%RETURN_TYPE](retval)); + PyTuple_SET_ITEM(%PYARG_0, 1, %CONVERTTOPYTHON[QPointF](p)); @@ -1165,8 +1169,13 @@ int year, month, day; + %BEGIN_ALLOW_THREADS %CPPSELF.%FUNCTION_NAME(&year, &month, &day); - %PYARG_0 = Shiboken::makeTuple(year, month, day); + %END_ALLOW_THREADS + %PYARG_0 = PyTuple_New(3); + PyTuple_SET_ITEM(%PYARG_0, 0, %CONVERTTOPYTHON[int](year)); + PyTuple_SET_ITEM(%PYARG_0, 1, %CONVERTTOPYTHON[int](month)); + PyTuple_SET_ITEM(%PYARG_0, 2, %CONVERTTOPYTHON[int](day)); @@ -1178,8 +1187,12 @@ int yearNumber; + %BEGIN_ALLOW_THREADS int week = %CPPSELF.%FUNCTION_NAME(&yearNumber); - %PYARG_0 = Shiboken::makeTuple(week, yearNumber); + %END_ALLOW_THREADS + %PYARG_0 = PyTuple_New(2); + PyTuple_SET_ITEM(%PYARG_0, 0, %CONVERTTOPYTHON[int](week)); + PyTuple_SET_ITEM(%PYARG_0, 1, %CONVERTTOPYTHON[int](yearNumber)); @@ -1357,6 +1370,7 @@ } }; + @@ -1374,9 +1388,9 @@ - int a, b, c, d; - %CPPSELF.%FUNCTION_NAME(&a, &b, &c, &d); - %PYARG_0 = Shiboken::makeTuple(a, b, c, d); + + + @@ -1396,9 +1410,9 @@ - int a, b, c, d; - %CPPSELF.%FUNCTION_NAME(&a, &b, &c, &d); - %PYARG_0 = Shiboken::makeTuple(a, b, c, d); + + + @@ -1441,9 +1455,9 @@ - qreal a, b, c, d; - %CPPSELF.%FUNCTION_NAME(&a, &b, &c, &d); - %PYARG_0 = Shiboken::makeTuple(a, b, c, d); + + + @@ -1463,9 +1477,9 @@ - qreal a, b, c, d; - %CPPSELF.%FUNCTION_NAME(&a, &b, &c, &d); - %PYARG_0 = Shiboken::makeTuple(a, b, c, d); + + + @@ -3055,7 +3069,9 @@ qint64 pid; %RETURN_TYPE retval = %TYPE::%FUNCTION_NAME(%1, %2, %3, &pid); - %PYARG_0 = Shiboken::makeTuple(retval, pid); + %PYARG_0 = PyTuple_New(2); + PyTuple_SET_ITEM(%PYARG_0, 0, %CONVERTTOPYTHON[%RETURN_TYPE](retval)); + PyTuple_SET_ITEM(%PYARG_0, 1, %CONVERTTOPYTHON[qint64](pid)); @@ -3163,8 +3179,10 @@ - %PYARG_0 = Shiboken::makeTuple(%0, *result_out); - delete result_out; + %PYARG_0 = PyTuple_New(2); + PyTuple_SET_ITEM(%PYARG_0, 0, %CONVERTTOPYTHON[%RETURN_TYPE](%0)); + PyTuple_SET_ITEM(%PYARG_0, 1, %CONVERTTOPYTHON[long](*result_out)); + delete result_out; diff --git a/PySide/QtDeclarative/pysideqmlregistertype.cpp b/PySide/QtDeclarative/pysideqmlregistertype.cpp index 7dfd7a622..6c595167b 100644 --- a/PySide/QtDeclarative/pysideqmlregistertype.cpp +++ b/PySide/QtDeclarative/pysideqmlregistertype.cpp @@ -258,7 +258,10 @@ PyTypeObject PropertyListType = { void propListAppender(QDeclarativeListProperty* propList, QDeclarativeItem* item) { Shiboken::GilState state; - Shiboken::AutoDecRef args(Shiboken::makeTuple(propList->object, item)); + + Shiboken::AutoDecRef args(PyTuple_New(2)); + PyTuple_SET_ITEM(args, 0, Shiboken::Conversions::pointerToPython((SbkObjectType*)SbkPySide_QtCoreTypes[SBK_QOBJECT_IDX], propList->object)); + PyTuple_SET_ITEM(args, 1, Shiboken::Conversions::pointerToPython((SbkObjectType*)SbkPySide_QtDeclarativeTypes[SBK_QDECLARATIVEITEM_IDX], item)); DeclarativeListProperty* data = reinterpret_cast(propList->data); Shiboken::AutoDecRef retVal(PyObject_CallObject(data->append, args)); @@ -271,7 +274,9 @@ void propListAppender(QDeclarativeListProperty* propList, QDec int propListCount(QDeclarativeListProperty* propList) { Shiboken::GilState state; - Shiboken::AutoDecRef args(Shiboken::makeTuple(propList->object)); + + Shiboken::AutoDecRef args(PyTuple_New(1)); + PyTuple_SET_ITEM(args, 0, Shiboken::Conversions::pointerToPython((SbkObjectType*)SbkPySide_QtCoreTypes[SBK_QOBJECT_IDX], propList->object)); DeclarativeListProperty* data = reinterpret_cast(propList->data); Shiboken::AutoDecRef retVal(PyObject_CallObject(data->count, args)); @@ -289,7 +294,10 @@ int propListCount(QDeclarativeListProperty* propList) QDeclarativeItem* propListAt(QDeclarativeListProperty* propList, int index) { Shiboken::GilState state; - Shiboken::AutoDecRef args(Shiboken::makeTuple(propList->object, index)); + + Shiboken::AutoDecRef args(PyTuple_New(2)); + PyTuple_SET_ITEM(args, 0, Shiboken::Conversions::pointerToPython((SbkObjectType*)SbkPySide_QtCoreTypes[SBK_QOBJECT_IDX], propList->object)); + PyTuple_SET_ITEM(args, 1, Shiboken::Conversions::copyToPython(Shiboken::Conversions::PrimitiveTypeConverter(), &index)); DeclarativeListProperty* data = reinterpret_cast(propList->data); Shiboken::AutoDecRef retVal(PyObject_CallObject(data->at, args)); @@ -306,7 +314,9 @@ QDeclarativeItem* propListAt(QDeclarativeListProperty* propLis void propListClear(QDeclarativeListProperty* propList) { Shiboken::GilState state; - Shiboken::AutoDecRef args(Shiboken::makeTuple(propList->object)); + + Shiboken::AutoDecRef args(PyTuple_New(1)); + PyTuple_SET_ITEM(args, 0, Shiboken::Conversions::pointerToPython((SbkObjectType*)SbkPySide_QtCoreTypes[SBK_QOBJECT_IDX], propList->object)); DeclarativeListProperty* data = reinterpret_cast(propList->data); Shiboken::AutoDecRef retVal(PyObject_CallObject(data->clear, args)); diff --git a/PySide/QtDeclarative/typesystem_declarative.xml b/PySide/QtDeclarative/typesystem_declarative.xml index 58bce2ac0..91c2e487b 100644 --- a/PySide/QtDeclarative/typesystem_declarative.xml +++ b/PySide/QtDeclarative/typesystem_declarative.xml @@ -104,7 +104,9 @@ %BEGIN_ALLOW_THREADS %RETURN_TYPE ok_ = %CPPSELF.%FUNCTION_NAME(%1, %2, &errorString); %END_ALLOW_THREADS - %PYARG_0 = Shiboken::makeTuple(ok_, errorString); + %PYARG_0 = PyTuple_New(2); + PyTuple_SET_ITEM(%PYARG_0, 0, %CONVERTTOPYTHON[%RETURN_TYPE](ok_)); + PyTuple_SET_ITEM(%PYARG_0, 1, %CONVERTTOPYTHON[QString](errorString)); diff --git a/PySide/QtGui/typesystem_gui_common.xml b/PySide/QtGui/typesystem_gui_common.xml index 4ebccf62f..6922bcfa9 100644 --- a/PySide/QtGui/typesystem_gui_common.xml +++ b/PySide/QtGui/typesystem_gui_common.xml @@ -448,10 +448,12 @@ - %BEGIN_ALLOW_THREADS - %RETURN_TYPE %0 = %CPPSELF->::%TYPE::%FUNCTION_NAME(&%1, %2); - %END_ALLOW_THREADS - %PYARG_0 = Shiboken::makeTuple(%0, %1); + %BEGIN_ALLOW_THREADS + %RETURN_TYPE %0 = %CPPSELF->::%TYPE::%FUNCTION_NAME(&%1, %2); + %END_ALLOW_THREADS + %PYARG_0 = PyTuple_New(2); + PyTuple_SET_ITEM(%PYARG_0, 0, %CONVERTTOPYTHON[%RETURN_TYPE](%0)); + PyTuple_SET_ITEM(%PYARG_0, 1, %CONVERTTOPYTHON[%ARG1_TYPE](%1)); @@ -911,9 +913,11 @@ @@ -1296,7 +1300,9 @@ - + + + @@ -1321,7 +1327,9 @@ - + + + @@ -1775,9 +1783,11 @@ - QGraphicsItem *item_ = NULL; - %RETURN_TYPE retval_ = %CPPSELF.%FUNCTION_NAME(&item_); - %PYARG_0 = Shiboken::makeTuple(retval_, item_); + QGraphicsItem *item_ = NULL; + %RETURN_TYPE retval_ = %CPPSELF.%FUNCTION_NAME(&item_); + %PYARG_0 = PyTuple_New(2); + PyTuple_SET_ITEM(%PYARG_0, 0, %CONVERTTOPYTHON[%RETURN_TYPE](retval_)); + PyTuple_SET_ITEM(%PYARG_0, 1, %CONVERTTOPYTHON[QGraphicsItem*](item_)); @@ -3362,9 +3372,13 @@ - int a, b, c, d; - %CPPSELF.%FUNCTION_NAME(%1, &a, &b, &c, &d); - %PYARG_0 = Shiboken::makeTuple(a, b, c, d); + int a, b, c, d; + %CPPSELF.%FUNCTION_NAME(%1, &a, &b, &c, &d); + %PYARG_0 = PyTuple_New(4); + PyTuple_SET_ITEM(%PYARG_0, 0, %CONVERTTOPYTHON[int](a)); + PyTuple_SET_ITEM(%PYARG_0, 1, %CONVERTTOPYTHON[int](b)); + PyTuple_SET_ITEM(%PYARG_0, 2, %CONVERTTOPYTHON[int](c)); + PyTuple_SET_ITEM(%PYARG_0, 3, %CONVERTTOPYTHON[int](d)); @@ -4860,8 +4874,12 @@ - %RETURN_TYPE retval_ = %CPPSELF.%FUNCTION_NAME(%1, %2); - %PYARG_0 = Shiboken::makeTuple(retval_, %1); + %BEGIN_ALLOW_THREADS + %RETURN_TYPE retval_ = %CPPSELF.%FUNCTION_NAME(%1, %2); + %END_ALLOW_THREADS + %PYARG_0 = PyTuple_New(2); + PyTuple_SET_ITEM(%PYARG_0, 0, %CONVERTTOPYTHON[%RETURN_TYPE](retval_)); + PyTuple_SET_ITEM(%PYARG_0, 1, %CONVERTTOPYTHON[%ARG1_TYPE](%1)); @@ -5678,12 +5696,14 @@ diff --git a/PySide/QtNetwork/typesystem_network.xml b/PySide/QtNetwork/typesystem_network.xml index 87cb7d979..a8327cdd6 100644 --- a/PySide/QtNetwork/typesystem_network.xml +++ b/PySide/QtNetwork/typesystem_network.xml @@ -144,7 +144,7 @@ %RETURN_TYPE retval = %CPPSELF.%FUNCTION_NAME(data, %ARGUMENT_NAMES, &ha, &port); %END_ALLOW_THREADS QByteArray ba(data, retval); - PyObject* %PYARG_0 = PyTuple_New(3); + %PYARG_0 = PyTuple_New(3); PyTuple_SET_ITEM(%PYARG_0, 0, %CONVERTTOPYTHON[QByteArray](ba)); PyTuple_SET_ITEM(%PYARG_0, 1, %CONVERTTOPYTHON[QHostAddress](ha)); PyTuple_SET_ITEM(%PYARG_0, 2, %CONVERTTOPYTHON[quint16](port)); diff --git a/PySide/QtOpenGL/typesystem_opengl.xml b/PySide/QtOpenGL/typesystem_opengl.xml index 808ed2298..4c2604ab4 100644 --- a/PySide/QtOpenGL/typesystem_opengl.xml +++ b/PySide/QtOpenGL/typesystem_opengl.xml @@ -701,7 +701,9 @@ QByteArray ret; if (result) ret.append((const char*)data, %3); - %PYARG_0 = Shiboken::makeTuple(result, ret); + %PYARG_0 = PyTuple_New(2); + PyTuple_SET_ITEM(%PYARG_0, 0, %CONVERTTOPYTHON[bool](result)); + PyTuple_SET_ITEM(%PYARG_0, 1, %CONVERTTOPYTHON[QByteArray](ret)); delete[] data; diff --git a/PySide/QtXml/typesystem_xml.xml b/PySide/QtXml/typesystem_xml.xml index 1bf07debb..19b1520f7 100644 --- a/PySide/QtXml/typesystem_xml.xml +++ b/PySide/QtXml/typesystem_xml.xml @@ -33,14 +33,17 @@ @@ -269,13 +272,13 @@ - QXmlInputSource* _qxmlinputsource_arg_ = 0; - - %BEGIN_ALLOW_THREADS - %RETURN_TYPE %0 = %CPPSELF.%FUNCTION_NAME(%1, %2, _qxmlinputsource_arg_); - %END_ALLOW_THREADS - - %PYARG_0 = Shiboken::makeTuple(%0, _qxmlinputsource_arg_); + QXmlInputSource* _qxmlinputsource_arg_ = 0; + %BEGIN_ALLOW_THREADS + %RETURN_TYPE %0 = %CPPSELF.%FUNCTION_NAME(%1, %2, _qxmlinputsource_arg_); + %END_ALLOW_THREADS + %PYARG_0 = PyTuple_New(2); + PyTuple_SET_ITEM(%PYARG_0, 0, %CONVERTTOPYTHON[%RETURN_TYPE](%0)); + PyTuple_SET_ITEM(%PYARG_0, 1, %CONVERTTOPYTHON[QXmlInputSource*](_qxmlinputsource_arg_)); @@ -296,11 +299,13 @@ - QXmlInputSource* _qxmlinputsource_arg_ = 0; - %BEGIN_ALLOW_THREADS - %RETURN_TYPE %0 = %CPPSELF.%TYPE::%FUNCTION_NAME(%1, %2, _qxmlinputsource_arg_); - %END_ALLOW_THREADS - %PYARG_0 = Shiboken::makeTuple(%0, _qxmlinputsource_arg_); + QXmlInputSource* _qxmlinputsource_arg_ = 0; + %BEGIN_ALLOW_THREADS + %RETURN_TYPE %0 = %CPPSELF.%TYPE::%FUNCTION_NAME(%1, %2, _qxmlinputsource_arg_); + %END_ALLOW_THREADS + %PYARG_0 = PyTuple_New(2); + PyTuple_SET_ITEM(%PYARG_0, 0, %CONVERTTOPYTHON[%RETURN_TYPE](%0)); + PyTuple_SET_ITEM(%PYARG_0, 1, %CONVERTTOPYTHON[QXmlInputSource*](_qxmlinputsource_arg_)); diff --git a/PySide/typesystem_templates.xml b/PySide/typesystem_templates.xml index bf7abd14e..47615ad02 100644 --- a/PySide/typesystem_templates.xml +++ b/PySide/typesystem_templates.xml @@ -30,75 +30,80 @@ + + + - - - -