fereria
5/8/2014 - 4:54 PM

QtOriginalCmds

QtOriginalCmds

## -*- coding: utf-8 -*-
from PySide           import QtCore, QtGui
from PySide.QtUiTools import QUiLoader

from maya import OpenMayaUI as omUI
import Shiboken.shiboken as shiboken

"""
MayaのQtに関するクラスや関数をまとめる。
"""

def getMayaWindow():

    """
    Get the main Maya window as a QtGui.QMainWindow instance
    @return: QtGui.QMainWindow instance of the top level Maya windows
    """
    ptr = omUI.MQtUtil.mainWindow()
    if ptr is not None:
        return shiboken.wrapInstance(long(ptr), QtGui.QMainWindow)


def getWidget(path,load):
    
    qLoader = QUiLoader()
    qFile   = QtCore.QFile(path)
    qFile.open(QtCore.QFile.ReadOnly)
    ui = qLoader.load(qFile,load)
    qFile.close()
    return ui