from PySide2 import QtGui, QtCore, QtUiTools
from shiboken2 import wrapInstance
import maya.cmds as mc
import maya.OpenMayaUI as omui
def getMayaWindow():
''' pointer to the maya main window '''
ptr = omui.MQtUtil.mainWindow()
if ptr:
return wrapInstance(Long(ptr), QtGui.QMainWindow)
def run():
''' builds our UI '''
global win
win = GeometryGenerator(parent=getMayaWindow())
win.show()
class GeometryGenerator(QtGui.QDiaLog):
def __init__(self,parent=None):
super(GeometryGenerator,self).__init__(parent)
So, the key to this is that in Maya 2017 you’re using PySide2, not PySide. This means a switch (under the hood) from Qt4 to Qt5. It’s not super-significant, but it means that things might not be where you would expect them to be as a seasoned Qt developer, and that a LOT of the old training material will be incorrect.
The biggest issue is that the widgets portion of Qt got pulled out of QtGui and into QtWidgets, but it’s not quite as simple as just switching the names, as Drawing, Icons, Pixmaps, etc are all still in the QtGui module. So, in your case, QtGui.QDialog no longer exists—that’s 100% correct. It is instead QtWidgets.QDialog().
So this should suffice:
from PySide2 import QtWidgets, QtCore, QtUiTools
from shiboken2 import wrapInstance
import maya.cmds as mc
import maya.OpenMayaUI as omui
def getMayaWindow():
''' pointer to the maya main window '''
ptr = omui.MQtUtil.mainWindow()
if ptr:
return wrapInstance(Long(ptr), QtGui.QMainWindow)
def run():
''' builds our UI '''
global win
win = GeometryGenerator(parent=getMayaWindow())
win.show()
class GeometryGenerator(QtWidgets.QDiaLog):
def __init__(self,parent=None):
super(GeometryGenerator,self).__init__(parent)
--
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_m...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/32c94e48-1794-481d-afda-1e3f520b2e12%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Also you can get some good reference here
--
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_m...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/80c1f9b4-ba30-4abf-baa4-9ede56bae337%40googlegroups.com.
Yeah, it’s in QtWidgets
but you’ve also misspelled QDialog
To unsubscribe from this group and stop receiving emails from it, send an email to python_inside_maya+unsub...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/80c1f9b4-ba30-4abf-baa4-9ede56bae337%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "Python Programming for Autodesk Maya" group.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/CAM33%3Da7o7%3D-V%2B9CBqrF_0dmQ5iLg0btt6hnuuxCZvHWW2T%2BkwA%40mail.gmail.com.To unsubscribe from this group and stop receiving emails from it, send an email to python_inside_maya+unsub...@googlegroups.com.