使用Pyside

时间:2018-12-27 03:30:44

标签: python maya pyside2

我使用Pyside为Maya制作了可停靠的GUI。我能够创建一个工作区,并使用uiScript标志运行运行为我的工具创建GUI窗口的脚本,但是我不知道如何在可停靠的工作区中托管我的GUI窗口。我最终得到两个浮动窗口,即工作区和GUI窗口。

def lightsTextureView():
    print "lightsTextureView"
    windowName = "OLP"
    if cmds.window(windowName,exists = True):
        cmds.deleteUI(windowName, wnd = True)
    pointer = mui.MQtUtil.mainWindow()
    parent = shiboken2.wrapInstance(long(pointer),QtWidgets.QWidget)
    window = QtWidgets.QMainWindow(parent)
    window.setObjectName(windowName)
    window.setWindowTitle(windowName)
    mainWidget = QtWidgets.QWidget()
    window.setCentralWidget(mainWidget)
    window.setFixedSize(250,200)
    window.setAttribute(QtCore.Qt.WA_DeleteOnClose)
    window.show()

def workspace_creation(self):
    workspaceName = "workspace"
    if cmds.workspaceControl(workspaceName,q = True, e = True):
        cmds.deleteUI(workspaceName)
    cmds.workspaceControl(workspaceName,label = workspaceName,uiScript = 'windowScript.lightsTextureView()')

0 个答案:

没有答案