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 

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:

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 
For more options, visit https://groups.google.com/d/optout.

Reply via email to