Skip to content

Instantly share code, notes, and snippets.

@pumacamargo
Created February 6, 2014 19:26
Show Gist options
  • Save pumacamargo/8850932 to your computer and use it in GitHub Desktop.
Save pumacamargo/8850932 to your computer and use it in GitHub Desktop.
from PyQt4 import QtGui, QtCore #QtCore added
import maya.cmds as cmds #######Added
import sip
windowTitle = "Scene Manip"#######Added
windowObject = "pySceneManipWin"#######Added
def getMainWindow():#######Added
import maya.OpenMayaUI as mui#######Added
pointer = mui.MQtUtil.mainWindow()#######Added
return sip.wrapinstance(long(pointer), QtCore.QObject)#######Added
class SceneManipWin(QtGui.QMainWindow): #QWidget changed to QMainWindow
def __init__(self, parent=None):# parent=None added
super(SceneManipWin, self).__init__(parent) #parent added
self.setObjectName(windowObject)#######Added
self.setWindowTitle(windowTitle)#######Added
self.mainWidget = QtGui.QWidget()#######Added
self.setCentralWidget(self.mainWidget)#######Added
#Building a layout
self.gridLayout = QtGui.QGridLayout()
self.mainWidget.setLayout(self.gridLayout)#self.setLayout(self.gridLayout) TO self.mainWidget.setLayout(self.gridLayout)
#Objects for our window
self.label = QtGui.QLabel("Work Area")
self.fillList_pb = QtGui.QPushButton("Fill List")
self.sceneSelect_pb = QtGui.QPushButton("Select in Scene")
self.gridLayout.addWidget(self.label)
self.gridLayout.addWidget(self.fillList_pb)
self.gridLayout.addWidget(self.sceneSelect_pb)
def mayaRun():
if cmds.window(windowObject, q=True, exists=True): #####Added
cmds.deleteUI(windowObject) #########Added
global gui
gui = SceneManipWin(getMainWindow()) #### getMainWindow Added
gui.show()
mayaRun()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment