Hi,
just want to explain better the problem I'm having. While I'm
getting my selection list showing up properly(Staying a fixed size, and
leaving room for the buttons) I have not been able to get my buttons to
display below the list, or the QHBoxLayout that I've used. Would appreciate
any help. Attached is an updated script.
> Thank you
> Gann Boon Bay
>
--
You received this message because you are subscribed to the Google Groups
"Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/python_inside_maya/58fc06d9-7afe-4ad8-9157-601aef82813a%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
from PyQt4 import QtCore, QtGui
import cPickle
import maya.OpenMayaUI
import maya.OpenMaya as api
import maya.cmds as cmds
import testtree
import sip
def mayaMainWindow():
'''Returns the Maya window as a QMainWindow instance.'''
ptr = maya.OpenMayaUI.MQtUtil.mainWindow()
if ptr is not None:
return sip.wrapinstance( long(ptr), QtCore.QObject )
class Selector( QtGui.QMainWindow ):
def __init__( self, parent=mayaMainWindow() ):
super( Selector, self ).__init__( parent )
self.setWindowTitle("SelectionUI")
self.resize(250,600)
self.setObjectName('SelectorUI')
sel=cmds.ls(sl=True)[0]
nodes=[]
nodes = cmds.listRelatives(sel, allDescendents=True)
nodes.append(sel)
nodes.reverse()
rootNode = testtree.getNodeType(nodes[0])
childNode0 = testtree.getNodeType(nodes[1], rootNode)
childNode1 = testtree.getNodeType(nodes[2], childNode0)
childNode2 = testtree.getNodeType(nodes[3], childNode1)
childNode3 = testtree.getNodeType(nodes[4], childNode2)
lightNode1 = testtree.getNodeType('pointLight1', rootNode)
model=testtree.SceneGraphModel(rootNode)
self.layout = QtGui.QHBoxLayout()
treeview_layout=QtGui.QHBoxLayout(parent)
treeview_layout.setContentsMargins(10,10,10,10)
self.tree=QtGui.QTreeView()
self.tree.setModel(model)
self.tree.setAlternatingRowColors(True)
self.tree.setMaximumHeight(300)
treeview_layout.addWidget(self.tree)
label=QtGui.QLabel("SelectionUI")
self.layout.addWidget(label)
button_layout = QtGui.QHBoxLayout()
button_layout.addStretch()
self.refresh_button = QtGui.QPushButton("Refresh")
self.cancel_button = QtGui.QPushButton("Cancel")
button_layout.addWidget(self.refresh_button)
button_layout.addWidget(self.cancel_button)
self.layout.addLayout(treeview_layout)
self.layout.addLayout(button_layout)
self.setCentralWidget( self.tree )
self.setLayout(self.layout)
self.setLayout(button_layout)
self.show()