Skip to content

Instantly share code, notes, and snippets.

@pumacamargo
Created February 6, 2014 19:49
Show Gist options
  • Save pumacamargo/8851304 to your computer and use it in GitHub Desktop.
Save pumacamargo/8851304 to your computer and use it in GitHub Desktop.
from PyQt4 import QtGui, QtCore, uic
import maya.cmds as cmds
import sip, os
uiFile = os.path.join(os.path.dirname(__file__), "designer_selectWindow_2.ui")
windowTitle = "Scene Manip"
windowObject = "pySceneManipWin"
def getMainWindow():
import maya.OpenMayaUI as mui
pointer = mui.MQtUtil.mainWindow()
return sip.wrapinstance(long(pointer), QtCore.QObject)
class SceneManipWin(QtGui.QMainWindow):
def __init__(self, parent=None):
super(SceneManipWin, self).__init__(parent)
#Loads the contents of the UI file into self
uic.loadUi(uiFile, self)
#Sets the window title
self.setObjectName(windowObject)
self.setWindowTitle(windowTitle)
self.mainWidget = QtGui.QWidget()
self.setCentralWidget(self.mainWidget)
self.mainWidget.setLayout(self.mainGrid)#mainGrid is in the ui file
def mayaRun():
if cmds.window(windowObject, q=True, exists=True):
cmds.deleteUI(windowObject)
global gui
gui = SceneManipWin(getMainWindow())
gui.show()
mayaRun()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment