I want to add a attrFieldSliderGrp to my Qt window, I create the Qt UI
with QtDesinger, there is another file to load the .ui file, I get the
layout's path in maya with MQtUtil.fullName(), I got it.
The QVBoxLayout's name is "SDK_VL",
When used mc.setParent(layoutName)  I get a wrong feedback:
# Error: line 1: setParent: Object
'MayaWindow|SuperFaceJntUIObj|SDK_Layout' not found.
# Traceback (most recent call last):
#   File "<maya console>", line 1, in <module>
#   File "D:/workflow/MyPys/superFaceJnt.py", line 195, in <module>
#     main()
#   File "D:/workflow/MyPys/superFaceJnt.py", line 191, in main
#     d = MyForm(win)
#   File "D:/workflow/MyPys/superFaceJnt.py", line 32, in __init__
#     self.addWidget()
#   File "D:/workflow/MyPys/superFaceJnt.py", line 40, in addWidget
#     mc.setParent(SDK_layout)
# RuntimeError: setParent: Object
'MayaWindow|SuperFaceJntUIObj|SDK_Layout' not found. #
If I print the layout's name, I got:
MayaWindow|SuperFaceJntUIObj|SDK_VL

Here is my code:
import sys
import os

from PyQt4 import QtGui, QtCore, uic
import sip

import maya.cmds as mc
import maya.OpenMayaUI as mui

uifile = os.path.join(currentPath, 'superFaceJnt2.ui')
form_class, base_class = uic.loadUiType(uifile)

global app

class MyForm(form_class, base_class):
    def __init__(self, parent, **kwargs):
        QtGui.QWidget.__init__(self, parent, **kwargs)
        self.setupUi(self)
        self.addWidget()

    def addWidget(self):
        SDK_layout = mui.MQtUtil.fullName(long(sip.unwrapinstance(self.SDK_VL)))
        print SDK_layout
        mc.setParent(SDK_layout)
        #self.bn = mc.button()

def main():
    global app
    app = QtGui.QApplication.instance()
    ptr = mui.MQtUtil.mainWindow()
    win = sip.wrapinstance(long(ptr), QtCore.QObject)
    d = MyForm(win)
    d.show()

main()

I need HELP!!!
-- 
http://zhangyu.me
http://zhang-yu.appspot.com

-- 
view archives: http://groups.google.com/group/python_inside_maya
change your subscription settings: 
http://groups.google.com/group/python_inside_maya/subscribe

Reply via email to