diff options
author | Renato Filho <renato.filho@openbossa.org> | 2011-07-27 17:54:27 -0300 |
---|---|---|
committer | Hugo Parente Lima <hugo.pl@gmail.com> | 2012-03-08 16:54:40 -0300 |
commit | d68d90a1445b7ba7f5d86ae133516bb48107b3c3 (patch) | |
tree | 642bbab6d1bd9636165f0340e4b94543177053ab /PySide/QtScript | |
parent | 75bf7f24b8962a58bddaac3a216abd5c78b898c2 (diff) |
Implement a more detailed __repr__ function for QScriptValue.
Fixes bug #922.
Diffstat (limited to 'PySide/QtScript')
-rw-r--r-- | PySide/QtScript/typesystem_script.xml | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/PySide/QtScript/typesystem_script.xml b/PySide/QtScript/typesystem_script.xml index 8c7ac10b2..738c44bda 100644 --- a/PySide/QtScript/typesystem_script.xml +++ b/PySide/QtScript/typesystem_script.xml @@ -49,6 +49,16 @@ <enum-type name="PropertyFlag" flags="PropertyFlags"/> <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\")", ((PyObject*)%PYSELF)->ob_type->tp_name, qPrintable(%CPPSELF.toString())); + %PYARG_0 = PyString_FromString(qPrintable(format)); + } else { + %PYARG_0 = PyObject_Str((PyObject*)%PYSELF); + } + </inject-code> + </add-function> <add-function signature="__mgetitem__"> <inject-code> Shiboken::AutoDecRef key(PyObject_Str(_key)); |