Hi.
I’m new to this forum and I really appreciate such a high-level and helping community.
I’m a beginner at programming with maya or PyQt (still an animation student) although i know a few other languages.
I create a few classes as a skeleton for future tools, but i’m stuck in my UI class :
Here is the piece of code that cause trouble :
class Window (QtGui.QMainWindow) :
''' Creates, edits and stylizes a window '''
def __init__(self, width, height, uiFile):
# creates the Maya Window
self.MWin = cmds.window(w=width, h=height)
#getting the path to the UI File
uiPath = os.path.join(cmds.internalVar(usd=True), 'esma', 'UIs', uiFile+'.ui')
#loads the UIFile that has a widget as root
widget = uic.loadUi(uiPath)
#finds the Maya Window
pyWin = mui.MQtUtil.findControl(self.MWin)
#Maya window to Qt Window
self.QWin = sip.wrapinstance(long(pyWin), QtGui.QMainWindow)
#sets the widget as centralWidget for the window
self.QWin.setCentralWidget(widget)
# creates a maya window (w:350, h:500) and passes "widget" as it's the widget.ui file that will be bind to it.
toolWindow = Window(350, 500, "widget")
cmds.showWindow(truc.MWin)
There.
The problem is that setting or even retrieving the centralWidget of a window makes maya FREEZE…
Just to clarify a bit : I want these windows to be dockable, that’s why I use the cmds.window and not a Nathan Hornes’ Window class type that I wasn’t able to dock in maya…
Maybe it’s a little fetched, and there is a way to handle windows created with PyQt in maya.cmds, but I don’t kno it. It’s the only solution I found after 16 hours researching the PyQT QMainWindow class, the MQtUtil class or the sip class… And it freezes ! :eek:
Thanks for your time and for the numerous great topics i find on this forum !