As discussed in previous threads, here is my PSEP proposal for shiboken helper module.
Waiting for comments. -- Hugo Parente Lima INdT - Instituto Nokia de Tecnologia
PSEP: XXXX Title: Shiboken helper module Version: $Revision$ Last-Modified: $Date$ Author: Hugo Parente Lima <[email protected]> Status: Draft Type: Standards Track Content-Type: text/x-rst Created: 02-Aug-2011 Post-History: .. |maya| unicode:: Maya U+2122 Abstract ======== This PSEP describes a new module to access internal information related to our binding technology. Access to this internal information is required to e.g.: integrate PySide with Qt based programs that offer Python scripting like Maya or just for debug purposes. Rationale ========= The Python module named "shiboken", will offer the following functions: * isValid(obj) * wrapInstance(type, address) * hasOwnership(obj) * objectInfo(obj) More functions can be added in future PSEPs if needed. Some function description refer to "Shiboken based objects", wich means Python objects instances of any Python Type created using Shiboken. ``isValid(obj)`` Given a Python object, returns True if the object methods can be called without an exception being thrown. A Python wrapper becomes invalid when the underlying C++ object is destroyed or unreachable. ``wrapInstance(type, address)`` Creates a Python wrapper for a C++ object instantiated at a given memory address - the returned object type will be the same given by the user. The type must be a Shiboken type, the C++ object will not be destroyed when the returned Python object reach zero references. If the address is invalid or doesn't point to a C++ object of given type the behavior is undefined. ``hasOwnership(obj)`` Given a Python object, returns True if Python is responsible for deleting the underlying C++ object, False otherwise. If the object was not a Shiboken based object, a TypeError should be throw. ``objectInfo(obj)`` Returns a string with implementation defined information about the object, this method should be used **only** for debug purposes by developers creating their own bindings as this PSEP doesn't offer any guarantee that the string format will be the same across different versions. If the object was not a Shiboken based object, a TypeError should be throw. Discussion ========== Carlo Giesa wanted to do some integration of PySide with |maya| [#maya]_ and noticed that PySide doesn't have anything equivalent to PyQt4 ``sip.wrapinstance()``. David MartÃnez Martà filed a feature [#bug536]_ request for a function to return True or False if an object still valid or not. Thomas Pearl filed feature requests [#bug902]_ summarizing some functions that would appear in a helper module. References ========== .. [#bug536] `Bug 536 <http://bugs.pyside.org/show_bug.cgi?id=536>`_ - Add property to QObject that exposes is C++ reference is still valid. .. [#bug902] `Bug 902 <http://bugs.pyside.org/show_bug.cgi?id=902>`_ - Expose Shiboken functionality through a Python module. .. [#maya] A 3D Animation, Visual Effects & Compositing Software - http://usa.autodesk.com/maya/ Copyright ========= This document has been placed in the public domain. .. Local Variables: mode: indented-text indent-tabs-mode: nil sentence-end-double-space: t fill-column: 70 coding: utf-8 End:
signature.asc
Description: This is a digitally signed message part.
_______________________________________________ PySide mailing list [email protected] http://lists.pyside.org/listinfo/pyside
