summaryrefslogtreecommitdiffstats
path: root/sources/pyside2/PySide2/QtScript/typesystem_script.xml
diff options
context:
space:
mode:
Diffstat (limited to 'sources/pyside2/PySide2/QtScript/typesystem_script.xml')
-rw-r--r--sources/pyside2/PySide2/QtScript/typesystem_script.xml44
1 files changed, 7 insertions, 37 deletions
diff --git a/sources/pyside2/PySide2/QtScript/typesystem_script.xml b/sources/pyside2/PySide2/QtScript/typesystem_script.xml
index d2d3e318..f87e4cfd 100644
--- a/sources/pyside2/PySide2/QtScript/typesystem_script.xml
+++ b/sources/pyside2/PySide2/QtScript/typesystem_script.xml
@@ -40,7 +40,7 @@
****************************************************************************/
-->
<typesystem package="PySide2.QtScript">
- <load-typesystem name="QtCore/typesystem_core.xml" generate="no" />
+ <load-typesystem name="QtCore/typesystem_core.xml" generate="no"/>
<object-type name="QScriptable"/>
<object-type name="QScriptClass">
@@ -62,7 +62,7 @@
<enum-type name="QObjectWrapOption" flags="QObjectWrapOptions"/>
<enum-type name="ValueOwnership"/>
<!-- Not supported BUG #957-->
- <modify-function signature="scriptValueFromQMetaObject()" remove="all" />
+ <modify-function signature="scriptValueFromQMetaObject()" remove="all"/>
</object-type>
<object-type name="QScriptExtensionInterface"/>
<object-type name="QScriptExtensionPlugin"/>
@@ -82,53 +82,23 @@
<enum-type name="ResolveFlag" flags="ResolveFlags"/>
<enum-type name="SpecialValue"/>
<add-function signature="__repr__" return-type="PyObject*">
- <inject-code class="target" position="beginning">
- if (%CPPSELF.isVariant() || %CPPSELF.isString()) {
- QString format = QString().sprintf("%s(\"%s\")",
- Py_TYPE(%PYSELF)->tp_name,
- qPrintable(%CPPSELF.toString()));
- %PYARG_0 = Shiboken::String::fromCString(qPrintable(format));
- } else {
- %PYARG_0 = Shiboken::String::fromCString(Py_TYPE(%PYSELF)->tp_name);
- }
- </inject-code>
+ <inject-code class="target" position="beginning" file="../glue/qtscript.cpp" snippet="qscriptvalue-repr"/>
</add-function>
<add-function signature="__mgetitem__">
- <inject-code>
- Shiboken::AutoDecRef key(PyObject_Str(_key));
- QVariant res = %CPPSELF.property(Shiboken::String::toCString(key.object())).toVariant();
- if (res.isValid()) {
- return %CONVERTTOPYTHON[QVariant](res);
- } else {
- PyObject* errorType = PyInt_Check(_key) ? PyExc_IndexError : PyExc_KeyError;
- PyErr_SetString(errorType, "Key not found.");
- return 0;
- }
- </inject-code>
+ <inject-code file="../glue/qtscript.cpp" snippet="qscriptvalue-mgetitem"/>
</add-function>
<add-function signature="__iter__()" return-type="PyObject*">
- <inject-code file="qscript_value_iterator_glue.cpp" />
+ <inject-code file="qscript_value_iterator_glue.cpp"/>
</add-function>
</value-type>
<object-type name="QScriptValueIterator">
<add-function signature="__iter__()" return-type="PyObject*">
<inject-code>
- <insert-template name="__iter__" />
+ <insert-template name="__iter__"/>
</inject-code>
</add-function>
<add-function signature="__next__()" return-type="PyObject*">
- <inject-code>
- if (%CPPSELF.hasNext()) {
- %CPPSELF.next();
- QString name = %CPPSELF.name();
- QVariant value = %CPPSELF.value().toVariant();
- %PYARG_0 = PyTuple_New(2);
- PyTuple_SET_ITEM(%PYARG_0, 0, %CONVERTTOPYTHON[QString](name));
- PyTuple_SET_ITEM(%PYARG_0, 1, %CONVERTTOPYTHON[QVariant](value));
- } else {
- PyErr_SetNone(PyExc_StopIteration);
- }
- </inject-code>
+ <inject-code file="../glue/qtscript.cpp" snippet="qscriptvalueiterator-next"/>
</add-function>
</object-type>
</typesystem>