Prepare For Qt5

Written by frank rueter on .

If you have written PySide code for Nuke, this article is for you

 

Nuke 11 will update some core libraries to conform to the VFX Platform 2017.

Consequently it will ship with QT 5 and PySide2.

This is a significant change and existing PySide code is likely to need adjustments to be forward compatible.

 
From Nuke 11's release notes (reposted with permission from the Foundry):

You may experience issues when importing PySide modules into their Python scripts due to the migration from PySide 1.2.2 to PySide 2.0.
In some cases you can just change calls to:

import PySide.some_module

to

try:
    import PySide.Some_module
except:
    import PySide2.Some_module

However, the definition of some classes has moved between modules in PySide 2.0. This particularly affects any Widget related classes, which have been moved from QtGui to QtWidgets, however there are other cases where this may be experienced.

If you experience any problems with this, please refer to the Qt 5.6.1 documentation [...]

For simple code the above may be an option.

For more complex code you can check out the Qt.py project

Qt.py tries to provide a layer that does the switching between PySide and PySide2 for you, so that your code stays compatible with both PySide and PySide2, in our case this means Nuke 10 and Nuke 11+.

And don't forget to post in the Nuke Python forum for more help as well. There are many experienced users there that can help with this transition.

Qt.py users include:
Frederik Averpil has written a nice little overview here.

We have 2628 guests and 73 members online