This is an updated version for Maya 2016.5' PyQt build instructions.
This is an updated version of the Maya 2016 build instructions for PyQt and PySide (here). The very good news is that with Maya 2014 & onward, there is no more need to build PySide as it is coming by default in Maya :)
libxml, openSSL, OpenAL, python2.7, qt-4.8.5-64 / Maya 2014/2015, qt-4.8.6-64 / Maya 2016 and tbb are also coming by default in the Maya include and lib folder, so unless you have a very specific need, you would not need to rebuild any of those libraries like before. Note as well that there is a 'C:\Program Files\Autodesk\Maya2016\support\opensource' folder now which contains some of the community source. http://www.autodesk.com/lgplsource is also a location you want to remember for future.
I'll come back later with instructions to rebuild Qt itself for those who needs to, but again you do not need to build Qt to build PyQt anymore.
Maya 2016.x also includes most of the tools we need to build PyQt without the need of compiling Qt source & tools - so in this post we will see the easy way to build PyQt.
Download SIP and PyQt source from 'http://www.riverbankcomputing.co.uk' - here I downloaded 'sip-4.16.7' and 'PyQt-win-gpl-4.11.3' (Note that you do not have to use these versions if you prefer using an older version, all you need is to use a version compatible with Qt4.8.6). Unzip them in one folder, then you should get something like this:
Mac
/Users/cyrille/Documents/_Maya2016Scripts/sip-4.18
/Users/cyrille/Documents/_Maya2016Scripts/PyQt-mac-gpl-4.11.4
'/Users/cyrille/Documents/_Maya2016Scripts' being my local folder. Now the instructions, and bash scripts to build that stuff.
Follow the instructions from the API docs to setup your environment (Developer Resources > API Guide > Setting up your build environment > Mac OS X environment, in the Maya Documentation)
Untar the /devkit/include/qt-4.8.6-include.tar.gz into /devkit/include/Qt
Copy /Resources/qt.conf into /bin/qt.conf and edit it like this:
[Paths] Prefix= Libraries=../MacOS Binaries=../bin Headers=../../../devkit/include/Qt Data=.. Plugins=../qt-plugins Translations=../qt-translations
Untar the qt-4.8.6-64-mkspecs.tar.gz into $MAYA_LOCATION/Maya.app/Contents/mkspecs. And make sure the qconfig.pri looks like this:
qconfig.pri
#configuration CONFIG += release def_files_disabled exceptions no_mocdepend stl x86_64 qt #qt_framework QT_ARCH = macosx QT_EDITION = OpenSource QT_CONFIG += minimal-config small-config medium-config large-config full-config no-pkg-config dwarf2 phonon phonon-backend accessibility opengl reduce_exports ipv6 getaddrinfo ipv6ifname getifaddrs png no-freetype system-zlib nis cups iconv openssl corewlan concurrent xmlpatterns multimedia audio-backend svg script scripttools declarative release x86_64 qt #qt_framework #versioning QT_VERSION = 4.8.6 QT_MAJOR_VERSION = 4 QT_MINOR_VERSION = 8 QT_PATCH_VERSION = 6 #namespaces QT_LIBINFIX = QT_NAMESPACE = QT_NAMESPACE_MAC_CRC =
You also need to create copy of the Qt lib files as fake .dylib files from the /MacOS directory. The script below will tell what to do when you first run it. I removed the lengthy 'if' from the script on that page, since I now posted the scripts on github.
Build & Install SIP running this scripts from the github repo
Build & Install PyQt running this scripts from the github repo
Note: In the shipping version of Maya 2016.5, PyQT will fail to execute because of a hidden phonon symbol. There is a QTBUG reference at https://bugreports.qt.io/browse/QTBUG-37209 which would support the change in compiler - exporting symbol issue. There is a Qt source change suggested for the CLANG build to export symbols. You can get the fixed file from here in the meantime, but note that it would break the digital signature of Maya on OSX. Copy the file binaries/phonon into '/Applications/Autodesk/maya2016.5/Maya.app/Contents/MacOS' and restart Maya.
You're done! go to the testing paragraph at the end of the article.
Download the scripts from github here.
Linux
/home/cyrille/Documents/_Maya2016Scripts/sip-4.18
/home/cyrille/Documents/_Maya2016Scripts/PyQt-mac-gpl-4.11.4
'/home/cyrille/Documents/_Maya2016Scripts' being my local folder. Now the instructions, and bash scripts to build that stuff.
Follow the instructions from the API docs to setup your environment (Developer Resources > API Guide > Setting up your build environment > Linux environments (64 bit), in the Maya Documentation).
Edit your qt.conf file (/usr/autodesk/maya2016.5-x64/bin) like below
[Paths]
Prefix=
Libraries=../lib
Binaries=../bin
Headers=../include/Qt
Data=../
Plugins=../qt-plugins
Translations=../qt-translations
Untar the /include/qt-4.8.6-include.tar.gz into /include/Qt
Untart the /mkspecs/qt-4.8.6-mkspecs.tar.gz into /mkspecs
Make qmake, moc executables from the Maya bin directory
sudo chmod aog+x /usr/autodesk/maya2016.5-x64/bin/moc sudo chmod aog+x /usr/autodesk/maya2016.5-x64/bin/qmake
Build & Install SIP running this script from the github repo
Build & Install PyQt running this script from the github repo
You're done! go to the testing paragraph at the end of the article.
Download the scripts from github here.
Windows
D:\__sdkext\_Maya2016 Scripts\sip-4.18
D:\__sdkext\_Maya2016 Scripts\PyQt-win-gpl-4.11.4
'D:\__sdkext\_Maya2016 Scripts' being my local folder. Now the instructions and scripts to build that stuff.
Follow the instructions from the API docs to setup your environment (Developer Resources > API Guide > Setting up your build environment > Windows environment (64‐bit), in the Maya Documentation)
Edit your qt.conf file (C:\Program Files\Autodesk\Maya2016.5\bin) like below
[Paths]
Prefix=
Libraries=../lib
Binaries=../bin
Headers=../include/Qt
Data=../
Plugins=../qt-plugins
Translations=../qt-translations
Unzip the /include/qt-4.8.6-64-include.tar.gz into /include/Qt
Unzip the /mkspecs/qt-4.8.6-64-mkspecs.tar.gz into /mkspecs
Build & Install SIP running this script from the github repo
Build & Install PyQt running this script from the github repo
Note that I had issues building PyQT on Windows this time. When the makefile was building 'pylupdate', it hangs forever, and complains about an undefined macro <?, grrrr.... The reason is that pyQT makefile now uses that macro which means use the first build dependency file. But nmake does not seems to like it, so I added some code to bypass the makefile rule. See below the call to '%QTDIR%\bin\moc.exe -o moc_translator.cpp translator.h'
You're done! go to the testing paragraph at the end of the article.
Download the scripts from github here.
Testing
Copy and paste this example in the Maya Script Editor (in a Python tab), and execute the code:
import sys from PyQt4 import QtGui class Example(QtGui.QWidget): def __init__(self): super(Example, self).__init__() self.initUI() def initUI(self): self.btn = QtGui.QPushButton('Dialog', self) self.btn.move(20, 20) self.btn.clicked.connect(self.showDialog) self.le = QtGui.QLineEdit(self) self.le.move(130, 22) self.setGeometry(300, 300, 290, 150) self.setWindowTitle('Input dialog') self.show() def showDialog(self): text, ok = QtGui.QInputDialog.getText(self, 'Input Dialog', 'Enter your name:') if ok: self.le.setText(str(text)) ex = Example()
If you see the dialog is showing, you are all set :)
Comments
You can follow this conversation by subscribing to the comment feed for this post.