## -*- coding: utf-8 -*-
#*----------------------------------------------*#
# 各種モジュール読み込み
#*----------------------------------------------*#
from PySide import QtCore, QtGui
from maya import OpenMayaUI as omUI
import shiboken
#*----------------------------------------------*#
# MAIN
#*----------------------------------------------*#
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)
class testUI(QtGui.QDialog):
def __init__(self):
QtGui.QDialog.__init__(self,getMayaWindow())
btn = QtGui.QPushButton("Hello World")
layout = QtGui.QVBoxLayout()
layout.addWidget(btn)
self.setLayout(layout)
def main():
mainWindow = getMayaWindow()
nowExists = mainWindow.findChildren(testUI)
for i in nowExists:
i.close()
win = testUI()
win.show()
main()