Book Image

Practical Maya Programming with Python

By : Robert Galanakis
Book Image

Practical Maya Programming with Python

By: Robert Galanakis

Overview of this book

Table of Contents (17 chapters)
Practical Maya Programming with Python
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Supporting PySide and PyQt


For the purposes of this book, there are two differences between PySide and PyQt. We will use the qtshim.py file to swap between the two depending on what is available. When the module is imported, it will choose between PySide and PyQt implementations, depending on what is available.

The qtshim.py module contains four attributes:

  • The QtCore and QtGui namespaces, pulled from the imported implementation.

  • The Signal class, which just aliases the PySide.QtCore.Signal or PyQt4.QtCore.pyqtSignal class.

  • The wrapinstance function which takes a pointer to a Qt object and returns the Qt object it points to. A pointer here is a long integer that refers to the memory location of the underlying Qt object. There is a significant difference between the implementation of wrapinstance between PySide and PyQt due to how their supporting libraries (shiboken and sip, respectively) work.

I'd suggest using a shim like qtshim to allow easy switching between implementations, and also because...