summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHugo Parente Lima <hugo.pl@gmail.com>2011-02-03 18:31:39 -0200
committerHugo Parente Lima <hugo.pl@gmail.com>2012-03-08 16:53:53 -0300
commit143e81278c6d2337e7ff64baaec00d14e3df5841 (patch)
tree4ebf96d16a9a0a208f29748b6fb28a8490485eaf
parentc662028d3dbefcfb0abc2090ec6df3d4915bb1a6 (diff)
Export QTranslator::translate and QTranslator::load.
Reviewer: Renato Ara├║jo <renato.filho@openbossa.org> Lauro Moura <lauro.neto@openbossa.org>
-rw-r--r--PySide/QtCore/typesystem_core.xml22
1 files changed, 20 insertions, 2 deletions
diff --git a/PySide/QtCore/typesystem_core.xml b/PySide/QtCore/typesystem_core.xml
index 692cf9ad..51019778 100644
--- a/PySide/QtCore/typesystem_core.xml
+++ b/PySide/QtCore/typesystem_core.xml
@@ -2014,8 +2014,26 @@
<enum-type name="State"/>
</object-type>
<object-type name="QTranslator">
- <modify-function signature="translate(const char*,const char*,const char*,int)const" remove="all" />
- <modify-function signature="load(const uchar*, int)" remove="all" />
+ <modify-function signature="load(const uchar*, int)">
+ <modify-argument index="1">
+ <replace-type modified-type="PyObject" />
+ </modify-argument>
+ <modify-argument index="2">
+ <remove-argument />
+ </modify-argument>
+ <inject-code>
+ PyTypeObject* pyType = %PYARG_1->ob_type;
+ if (pyType->tp_as_buffer
+ &amp;&amp; pyType->tp_as_buffer->bf_getreadbuffer
+ &amp;&amp; pyType->tp_as_buffer->bf_getsegcount(%PYARG_1, 0) == 1) {
+ void* ptr;
+ Py_ssize_t size = pyType->tp_as_buffer->bf_getreadbuffer(%PYARG_1, 0, &amp;ptr);
+ %PYARG_0 = %CONVERTTOPYTHON[bool](%CPPSELF.%FUNCTION_NAME(const_cast&lt;const uchar*>((uchar*)ptr), size));
+ } else {
+ PyErr_SetString(PyExc_TypeError, "The object must support buffer protocol with just one segment.");
+ }
+ </inject-code>
+ </modify-function>
</object-type>
<object-type name="QWaitCondition">
<modify-function signature="wait(QMutex*, unsigned long)" allow-thread="yes"/>