I recently had to port all our stuff to support both PySide *&* PySide2, 
ugh.  Since this thread is along those lines, this is the solution I came 
up with at the top of my modules since we have multiple versions of Maya 
running:

Simple example import section:

> import maya.cmds as mc
> MAYA_VER = int(mc.about(version=True))
> if MAYA_VER <= 2016:
>     from PySide.QtGui import QWidget, QMainWindow, QDialog, 
> QAbstractButton, QIcon
>     from shiboken import wrapInstance
>     import pysideuic
> else:
>     from PySide2.QtGui import QIcon
>     from PySide2.QtWidgets import QWidget, QMainWindow, QDialog, 
> QAbstractButton
>     from shiboken2 import wrapInstance
>     import pyside2uic as pysideuic


To make my life easier (similar to what Marcus said above) trying to figure 
out where the classes moved, I'd have these three tabs open:
http://doc.qt.io/qt-5/qtwidgets-module.html
http://doc.qt.io/qt-5/qtcore-module.html
http://doc.qt.io/qt-5/qtgui-module.html

So I'd select some class name, like 'QIcon', then do a search on each page 
looking for it:  That would quickly tell me which new qt5 module it lived 
in for those style imports.
Boy I can't wait util qt6! ;)

-- 
You received this message because you are subscribed to the Google Groups 
"Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to python_inside_maya+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/python_inside_maya/eb9f0cb8-63f0-411a-8a67-60e3fa339cf5%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to