Hi all, I try to migrate some stuff I had been doing from PyQt in Maya2015 
to PySide2 in Maya2017.

So first trouble for me is the way the .UI files are being loaded.  I saw 
an example in devkit folder "devkit\pythonScripts\createNodeUI.py" and it 
actually works.

But I am used to create most of my non dynamic signals inside Signal Editor 
in QT Designer, and the way the UI is loaded in the example, doesn't allow 
the connections to be made from qt designer, I try to load the UI directly 
to self, instead of self.ui but it doesn't even gives any error.

Any help is appreciated!! thanks!

This is example I only created a button in Qt designer with a connection to 
myFunc()

# Copyright 2015 Autodesk, Inc. All rights reserved.
# 
# Use of this software is subject to the terms of the Autodesk
# license agreement provided at the time of installation or download,
# or which otherwise accompanies this software in either electronic
# or hard copy form.

from maya import cmds
from maya import mel
from maya import OpenMayaUI as omui 

try:
  from PySide2.QtCore import * 
  from PySide2.QtGui import * 
  from PySide2.QtWidgets import *
  from PySide2.QtUiTools import *
  from shiboken2 import wrapInstance 
except ImportError:
  from PySide.QtCore import * 
  from PySide.QtGui import * 
  from PySide.QtUiTools import *
  from shiboken import wrapInstance 


import os.path


mayaMainWindowPtr = omui.MQtUtil.mainWindow() 
mayaMainWindow = wrapInstance(long(mayaMainWindowPtr), QWidget) 

class CreateNodeUI(QWidget):
    def __init__(self, *args, **kwargs):
        super(CreateNodeUI,self).__init__(*args, **kwargs)
        self.setParent(mayaMainWindow)
        self.setWindowFlags( Qt.Window )
        self.initUI()
        
    def initUI(self):
        loader = QUiLoader()
        file = QFile("C:\\test2.ui")
        file.open(QFile.ReadOnly)
        self.ui = loader.load(file, parentWidget=self)
        file.close()


    def myFunc(self):
        print "Clicked Button"



def main():
    ui = CreateNodeUI()
    ui.show()
    return ui


if __name__ == '__main__':
    main()

-- 
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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/python_inside_maya/7ad88c15-1c4f-4781-97d9-1bb2977bbd09%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to