def bitsGUI( self ): col = cmds.columnLayout( adjustableColumn=True, columnAttach=('both', 5), parent=self.fillArea ) cmds.separator( style='none', height=4, width=413 ) # Primitives section. cmds.text( label='BIT PRIMITIVES', height=20, font='boldLabelFont', backgroundColor=[0.2,0.2,0.2] ) cmds.separator( style='none', height=5 ) cmds.gridLayout( numberOfColumns=5, cellWidthHeight=( 50, 50 ) ) cmds.button( label='Sphere', command=lambda b, a1='glSphere': cmds.makeGLBit( objecttype=a1 ) ) cmds.button( label='Box', command=lambda b, a1='glBox': cmds.makeGLBit( objecttype=a1 ) ) cmds.button( label='Cylinder', command=lambda b, a1='glCylinder': cmds.makeGLBit( objecttype=a1 ) ) cmds.button( label='Cone', command=lambda b, a1='glCone': cmds.makeGLBit( objecttype=a1 ) ) cmds.button( label='Torus', command=lambda b, a1='glTorus': cmds.makeGLBit( objecttype=a1 ) ) cmds.setParent( '..' )#gridLayout cmds.separator( style='none', height=10 ) # Transform section. cmds.text( label='TRANSFORM TOOLS', height=20, font='boldLabelFont', backgroundColor=[0.2,0.2,0.2] ) cmds.separator( style='none', height=5 ) cmds.gridLayout( numberOfColumns=3, cellWidthHeight=( 50, 50 ) ) cmds.iconTextButton( annotation='match translation', style='iconOnly', image1='icon_match_translation.png', command=lambda a1='tran': TransformUtility.matchTransforms(a1) ) cmds.iconTextButton( annotation='match rotation', style='iconOnly', image1='icon_match_rotation.png', label='match rotation', command=lambda a1='rot': TransformUtility.matchTransforms(a1) ) cmds.iconTextButton( annotation='match all', style='iconOnly', image1='icon_match_all.png', label='match all', command=lambda a1='all': TransformUtility.matchTransforms(a1) ) cmds.setParent( '..' )#gridLayout cmds.separator( style='none', height=10 ) cmds.setParent( '..' )#col
def doIt( self, *args ): # ui settings. self.winWidth = 306 self.winHeight = 400 self.iconWidth = 32 self.iconHeight = 32 # clean up old uis before opening a new one. try: cmds.deleteUI( self.winName ) except: pass self.mainWindow = cmds.window( self.winName, title=self.winTitle, sizeable=False, resizeToFitChildren=False ) cmds.frameLayout( borderVisible=False, labelVisible=False ) self.conTools = cmds.columnLayout( height=self.winHeight/3 ) cmds.text( label='Controller Tools', width=self.winWidth, wordWrap=True, align='center', font='boldLabelFont', backgroundColor=(0.15,0.15,0.15) ) cmds.separator( style='none', height=4 ) self.conGrid = cmds.gridLayout( numberOfColumns=4, numberOfRows=2, cellWidthHeight=(self.winWidth/4, 50) ) cmds.button( label='Make Control', command='cmds.rigController()' ) cmds.button( label='Make From XML', command='XMLUtility.createControlFromXML()' ) cmds.button( label='Apply XML', command='XMLUtility.applyXMLtoControl()' ) cmds.button( label='Save XML', command='XMLUtility.createControlXML()' ) cmds.button( label='Make Deformer', command='makeDeformerMesh()') cmds.button( label='Apply Deformer', command='applyDeformerMesh()') cmds.setParent( '..' )#self.conGrid cmds.separator( style='none', height=20 ) cmds.text( label='Position Tools', width=self.winWidth, wordWrap=True, align='center', font='boldLabelFont', backgroundColor=(0.15,0.15,0.15) ) cmds.separator( style='none', height=4 ) self.transGrid = cmds.gridLayout( numberOfColumns=3, cellWidthHeight=(self.winWidth/3, 50) ) cmds.button( label='Match Translation', command=lambda *args: TransformUtility.matchTransforms( 'tran' ) ) cmds.button( label='Match Rotation', command=lambda *args: TransformUtility.matchTransforms( 'rot' ) ) cmds.button( label='Match All', command=lambda *args: TransformUtility.matchTransforms( 'all' ) ) cmds.setParent( '..' )#self.transGrid cmds.setParent( '..' )#self.conTools cmds.setParent( '..' )#framelayout # show the ui. cmds.showWindow( self.winName )
def doIt( self, *args ): # Window settings. self.winWidth = 206 self.winHeight = 400 self.iconWidth = 32 self.iconHeight = 32 # Window colors self.rowColors = [[0.4,0.4,0.4],[0.5,0.5,0.5]] # Clean up old uis before opening a new one. try: cmds.deleteUI( self.winName ) except: pass # Setup the form layout. self.mainWindow = cmds.window( self.winName, title=self.winTitle, sizeable=False, resizeToFitChildren=False ) self.form = cmds.formLayout() self.tabs = cmds.tabLayout( innerMarginWidth=5, innerMarginHeight=5 ) # Attach the tabs layout to the form layout. cmds.formLayout( self.form, edit=True, attachForm=( (self.tabs, 'top', 0), (self.tabs, 'left', 0), (self.tabs, 'bottom', 0), (self.tabs, 'right', 0) ) ) # Create each of the tabs. # TAB: META NODES: START self.tabMeta = cmds.rowColumnLayout( numberOfRows=2, width=self.winWidth ) self.colMeta = cmds.rowColumnLayout( numberOfColumns=1, height=self.winHeight/2 ) cmds.text( label='Meta Nodes', width=self.winWidth, wordWrap=True, align='center', font='boldLabelFont', backgroundColor=(0.15,0.15,0.15) ) cmds.separator( style='none', height=4 ) self.gridMeta = cmds.gridLayout( numberOfColumns=4, cellWidthHeight=( 50, 50 ) ) cmds.button( label='Basic', command=lambda b, a1='frameModule': metaNode.MetaNode( inNodeMetaType=a1 ) ) cmds.button( label='Character', command=lambda b, a1=False: metaNode.MetaCharacter( doModel=a1 ) ) cmds.setParent( '..' )#self.gridMeta cmds.setParent( '..' )#self.colMeta self.colMetaTools = cmds.rowColumnLayout( numberOfColumns=1 ) cmds.text( label='Tools', width=self.winWidth, wordWrap=True, align='center', font='boldLabelFont', backgroundColor=(0.15,0.15,0.15) ) cmds.separator( style='none', height=4 ) self.rowMetaTools = cmds.rowColumnLayout( numberOfRows=1 ) cmds.button( label='Meta Node List', annotation='meta node list', command=lambda b: SelectMetaUI.selectMetaUI() ) cmds.setParent( '..' )#self.rowMetaTools cmds.setParent( '..' )#self.colMetaTools cmds.setParent( '..' )#self.tabMeta # TAB: META NODES: END # TAB: BITS, START self.tabBits = cmds.rowColumnLayout( numberOfRows=3, width=self.winWidth ) self.bitsCol = cmds.rowColumnLayout( numberOfColumns=1, height=self.winHeight/3 ) cmds.text( label='Bit Primitives', width=self.winWidth, wordWrap=True, align='center', font='boldLabelFont', backgroundColor=(0.15,0.15,0.15) ) cmds.separator( style='none', height=4 ) self.bitsGrid = cmds.gridLayout( numberOfColumns=4, cellWidthHeight=( 50, 50 ) ) cmds.button( label='Sphere', command=lambda b, a1='glSphere': cmds.makeGLBit( objecttype=a1 ) ) cmds.button( label='Box', command=lambda b, a1='glBox': cmds.makeGLBit( objecttype=a1 ) ) cmds.button( label='Cylinder', command=lambda b, a1='glCylinder': cmds.makeGLBit( objecttype=a1 ) ) cmds.button( label='Cone', command=lambda b, a1='glCone': cmds.makeGLBit( objecttype=a1 ) ) cmds.button( label='Torus', command=lambda b, a1='glTorus': cmds.makeGLBit( objecttype=a1 ) ) cmds.setParent( '..' )#self.bitsGrid cmds.setParent( '..' )#self.bitsCol self.toolsCol = cmds.rowColumnLayout( numberOfColumns=1 ) cmds.text( label='Transform Tools', width=self.winWidth, wordWrap=True, align='center', font='boldLabelFont', backgroundColor=(0.15,0.15,0.15) ) cmds.separator( style='none', height=4 ) self.toolRow = cmds.rowColumnLayout( numberOfRows=1 ) cmds.iconTextButton( annotation='match translation', style='iconOnly', width=self.winWidth/3, image1='icon_match_translation.png', command=lambda a1='tran': TransformUtility.matchTransforms(a1) ) cmds.iconTextButton( annotation='match rotation', style='iconOnly', width=self.winWidth/3, image1='icon_match_rotation.png', label='match rotation', command=lambda a1='rot': TransformUtility.matchTransforms(a1) ) cmds.iconTextButton( annotation='match all', style='iconOnly', width=self.winWidth/3, image1='icon_match_all.png', label='match all', command=lambda a1='all': TransformUtility.matchTransforms(a1) ) cmds.setParent( '..' )#self.toolRow cmds.setParent( '..' )#self.toolsCol self.childCol = cmds.rowColumnLayout( numberOfColumns=1 ) cmds.text( label='General Tools', width=self.winWidth, wordWrap=True, align='center', font='boldLabelFont', backgroundColor=(0.15,0.15,0.15) ) cmds.separator( style='none', height=4 ) self.childRow = cmds.rowColumnLayout( numberOfColumns=2 ) cmds.button( label='Add Child', command=lambda b: NodeUtility.setBitChild() ) cmds.button( label='Remove Child', command=lambda b: NodeUtility.deleteBitChild() ) cmds.button( label='Copy Settings', command=lambda b: NodeUtility.copyBitSettings() ) cmds.setParent( '..' )#self.childRow cmds.setParent( '..' )#self.childCol cmds.setParent( '..' )#self.tabBits # TAB: BITS, END # TAB: ATTRIBUTES, START self.tabAttrs = cmds.rowColumnLayout( numberOfRows=2 ) # Top self.attrTop = cmds.rowColumnLayout( numberOfColumns=1 ) cmds.text( label='Attribute List', width=self.winWidth, wordWrap=True, align='center', font='boldLabelFont', backgroundColor=(0.15,0.15,0.15) ) cmds.separator( style='none', height=4 ) # Top rows. self.attrList = cmds.scrollLayout( horizontalScrollBarThickness=16, verticalScrollBarThickness=16, height=150 ) self.fillAttrList() cmds.setParent( '..' )#attrList # Bottom buttons cmds.rowColumnLayout( numberOfColumns=2 ) #cmds.button( label='Add Custom Attribute' ) cmds.button( label='Delete Attributes', command=lambda b: deleteAttrUI.createDeleteAttrUI() ) cmds.button( label='Add Selected', command=lambda b: self.addAttrsFromList() ) cmds.separator( style='none', height=10 ) cmds.setParent( '..' )#button columns cmds.setParent( '..' )#self.attrTop self.attrPresets = cmds.rowColumnLayout( numberOfColumns=1 ) cmds.text( label='Attribute Presets', width=self.winWidth, wordWrap=True, align='center', font='boldLabelFont', backgroundColor=(0.15,0.15,0.15) ) cmds.separator( style='none', height=4 ) self.presets = cmds.gridLayout( numberOfColumns=4, cellWidthHeight=( 50, 50 ) ) self.fillAttrPresets() cmds.setParent( '..' )#self.presets cmds.setParent( '..' )#self.attrPresets cmds.setParent( '..' )#self.tabAttrs # TAB: ATTRIBUTES, END # TAB: XML: START self.tabXML = cmds.rowColumnLayout( numberOfRows=2, width=self.winWidth ) self.colXML = cmds.rowColumnLayout( numberOfColumns=1, height=self.winHeight/2 ) cmds.text( label='XML Tools', width=self.winWidth, wordWrap=True, align='center', font='boldLabelFont', backgroundColor=(0.15,0.15,0.15) ) cmds.separator( style='none', height=4 ) cmds.button( label='Save Frame Module XML', command=lambda b: FrameUtility.createFrameModuleXML() ) cmds.setParent( '..' )#self.colXML cmds.setParent( '..' )#self.tabXML # TAB: XML: END # Added the tabs to the tab layout. cmds.tabLayout( self.tabs, edit=True, tabLabel=( (self.tabMeta, 'Metas'), (self.tabBits, 'Bits'), (self.tabAttrs, 'Attributes'), (self.tabXML, 'XML') ) ) # Show the window. cmds.showWindow( self.winName )
def build_bits_gui( self ): ''' Build the bits GUI sub-layout. ''' # Build bits controls # Primitive buttons. self.sphere_btn = QtGui.QToolButton( self ) self.sphere_btn.setStyleSheet( 'border:0' ) self.sphere_btn.setAutoRaise( True ) self.sphere_btn.setIcon( QtGui.QIcon( ':/riggingUI/icons/bit_sphere.png' ) ) self.sphere_btn.setIconSize( QtCore.QSize(32,32) ) self.sphere_btn.setText( 'Sphere' ) self.sphere_btn.clicked.connect( self.primitive_buttons ) self.box_btn = QtGui.QToolButton( self ) self.box_btn.setStyleSheet( 'border:0' ) self.box_btn.setAutoRaise( True ) self.box_btn.setIcon( QtGui.QIcon( ':/riggingUI/icons/bit_box.png' ) ) self.box_btn.setIconSize( QtCore.QSize(32,32) ) self.box_btn.setText( 'Box' ) self.box_btn.clicked.connect( self.primitive_buttons ) self.cylinder_btn = QtGui.QToolButton( self ) self.cylinder_btn.setStyleSheet( 'border:0' ) self.cylinder_btn.setAutoRaise( True ) self.cylinder_btn.setIcon( QtGui.QIcon( ':/riggingUI/icons/bit_cylinder.png' ) ) self.cylinder_btn.setIconSize( QtCore.QSize(32,32) ) self.cylinder_btn.setText( 'Cylinder' ) self.cylinder_btn.clicked.connect( self.primitive_buttons ) self.cone_btn = QtGui.QToolButton( self ) self.cone_btn.setStyleSheet( 'border:0' ) self.cone_btn.setAutoRaise( True ) self.cone_btn.setIcon( QtGui.QIcon( ':/riggingUI/icons/bit_cone.png' ) ) self.cone_btn.setIconSize( QtCore.QSize(32,32) ) self.cone_btn.setText( 'Cone' ) self.cone_btn.clicked.connect( self.primitive_buttons ) self.torus_btn = QtGui.QToolButton( self ) self.torus_btn.setStyleSheet( 'border:0' ) self.torus_btn.setAutoRaise( True ) self.torus_btn.setIcon( QtGui.QIcon( ':/riggingUI/icons/bit_torus.png' ) ) self.torus_btn.setIconSize( QtCore.QSize(32,32) ) self.torus_btn.setText( 'Torus' ) self.torus_btn.clicked.connect( self.primitive_buttons ) # Bit tools. self.match_translation_btn = QtGui.QPushButton( 'Match Translation' ) self.match_translation_btn.setIcon( QtGui.QIcon( ':/riggingUI/icons/icon_match_translation.png' ) ) self.match_translation_btn.setIconSize( QtCore.QSize(16,16) ) self.match_translation_btn.setStyleSheet( 'text-align: left; padding: 4px' ) self.match_translation_btn.clicked.connect( lambda a='tran':TransformUtility.matchTransforms( a ) ) self.match_rotation_btn = QtGui.QPushButton( 'Match Rotation' ) self.match_rotation_btn.setIcon( QtGui.QIcon( ':/riggingUI/icons/icon_match_rotation.png' ) ) self.match_rotation_btn.setIconSize( QtCore.QSize(16,16) ) self.match_rotation_btn.setStyleSheet( 'text-align: left; padding: 4px' ) self.match_rotation_btn.clicked.connect( lambda a='rot':TransformUtility.matchTransforms( a ) ) self.match_all_btn = QtGui.QPushButton( 'Match All' ) self.match_all_btn.setIcon( QtGui.QIcon( ':/riggingUI/icons/icon_match_all.png' ) ) self.match_all_btn.setIconSize( QtCore.QSize(16,16) ) self.match_all_btn.setStyleSheet( 'text-align: left; padding: 4px' ) self.match_all_btn.clicked.connect( lambda a='all':TransformUtility.matchTransforms( a ) ) self.copy_bit_settings_btn = QtGui.QPushButton( 'Copy Bit Settings' ) self.copy_bit_settings_btn.setIcon( QtGui.QIcon( ':/riggingUI/icons/bit_copy_settings.png' ) ) self.copy_bit_settings_btn.setIconSize( QtCore.QSize(16,16) ) self.copy_bit_settings_btn.setStyleSheet( 'text-align: left; padding: 4px' ) self.copy_bit_settings_btn.clicked.connect( lambda:FrameUtility.copyBitSettings() ) self.add_child_btn = QtGui.QPushButton( 'Add Child' ) self.add_child_btn.setIcon( QtGui.QIcon( ':/riggingUI/icons/bit_add_child.png' ) ) self.add_child_btn.setIconSize( QtCore.QSize(16,16) ) self.add_child_btn.setStyleSheet( 'text-align: left; padding: 4px' ) self.add_child_btn.clicked.connect( lambda:FrameUtility.setBitChild() ) self.delete_child_btn = QtGui.QPushButton( 'Delete Child' ) self.delete_child_btn.setIcon( QtGui.QIcon( ':/riggingUI/icons/bit_delete_child.png' ) ) self.delete_child_btn.setIconSize( QtCore.QSize(16,16) ) self.delete_child_btn.setStyleSheet( 'text-align: left; padding: 4px' ) self.delete_child_btn.clicked.connect( lambda:FrameUtility.deleteBitChild() ) # Build bits layout. # Primitive buttons bit_primitives_header = QtGui.QLabel() bit_primitives_header.setText( 'Bit Primitives' ) bit_primitives_header.setAlignment( QtCore.Qt.AlignCenter ) bit_primitives_header.setStyleSheet( 'font:bold; font-size:14px; background-color:#2B2B30' ) primitive_frame = QtGui.QFrame() primitive_frame.setFrameShadow( QtGui.QFrame.Sunken ) primitive_frame.setFrameShape( QtGui.QFrame.Box ) primitive_frame.setLineWidth( 1 ) #self.primitive_groupbox.setStyleSheet( 'border:4px; border-style:outset' ) primitive_layout = QtGui.QHBoxLayout() primitive_layout.addWidget( self.sphere_btn ) primitive_layout.addWidget( self.box_btn ) primitive_layout.addWidget( self.cylinder_btn ) primitive_layout.addWidget( self.cone_btn ) primitive_layout.addWidget( self.torus_btn ) primitive_frame.setLayout( primitive_layout ) # Bit tools. bit_tools_header = QtGui.QLabel() bit_tools_header.setText( 'Bit Tools' ) bit_tools_header.setAlignment( QtCore.Qt.AlignCenter ) bit_tools_header.setStyleSheet( 'font:bold; font-size:14px; background-color:#2B2B30' ) bit_tools_grid = QtGui.QGridLayout() bit_tools_grid.setColumnMinimumWidth( 0, 100 ) bit_tools_grid.setColumnMinimumWidth( 1, 100 ) bit_tools_grid.setColumnMinimumWidth( 2, 100 ) bit_tools_grid.setSpacing( 2 ) bit_tools_grid.setContentsMargins( 0,0,0,0 ) # widget, row, col bit_tools_grid.addWidget( self.match_translation_btn, 0, 0 ) bit_tools_grid.addWidget( self.match_rotation_btn, 0, 1 ) bit_tools_grid.addWidget( self.match_all_btn, 0, 2 ) bit_tools_grid.addWidget( self.copy_bit_settings_btn, 1, 0 ) bit_tools_grid.addWidget( self.add_child_btn, 1, 1 ) bit_tools_grid.addWidget( self.delete_child_btn, 1, 2 ) # Added the bits widgets to the sub-layout of the main window. self.sub_layout.addWidget( bit_primitives_header ) self.sub_layout.addWidget( primitive_frame ) self.sub_layout.addWidget( bit_tools_header ) self.sub_layout.addLayout( bit_tools_grid )
def __init__( self ): super( UIBitsTools, self ).__init__() layout = QtGui.QVBoxLayout( self ) # Build bits controls # Presets moduleRootBtn = QTWidgets.imageButton( 'Create Module', ':/riggingUI/icons/preset_module.png', [32,32] ) moduleRootBtn.clicked.connect( lambda a=1:self.preset_buttons(a) ) characterRootBtn = QTWidgets.imageButton( 'Create Character', ':/riggingUI/icons/preset_character.png', [32,32] ) characterRootBtn.clicked.connect( lambda a=2:self.preset_buttons(a) ) # Primitive buttons. sphereBtn = QTWidgets.imageButton( 'Sphere', ':/riggingUI/icons/bit_sphere.png', [32,32] ) sphereBtn.clicked.connect( self.primitive_buttons ) boxBtn = QTWidgets.imageButton( 'Box', ':/riggingUI/icons/bit_box.png', [32,32] ) boxBtn.clicked.connect( self.primitive_buttons ) cylinderBtn = QTWidgets.imageButton( 'Cylinder', ':/riggingUI/icons/bit_cylinder.png', [32,32] ) cylinderBtn.clicked.connect( self.primitive_buttons ) coneBtn = QTWidgets.imageButton( 'Cone', ':/riggingUI/icons/bit_cone.png', [32,32] ) coneBtn.clicked.connect( self.primitive_buttons ) torusBtn = QTWidgets.imageButton( 'Torus', ':/riggingUI/icons/bit_torus.png', [32,32] ) torusBtn.clicked.connect( self.primitive_buttons ) # Bit tools. matchTranslationBtn = QTWidgets.imageTextButton( 'Match Translation', ':/riggingUI/icons/icon_match_translation.png', [16,16] ) matchTranslationBtn.clicked.connect( lambda a='tran':TransformUtility.matchTransforms( a ) ) matchRotationBtn = QTWidgets.imageTextButton( 'Match Rotation', ':/riggingUI/icons/icon_match_rotation.png', [16,16] ) matchRotationBtn.clicked.connect( lambda a='rot':TransformUtility.matchTransforms( a ) ) matchAllBtn = QTWidgets.imageTextButton( 'Match All', ':/riggingUI/icons/icon_match_all.png', [16,16] ) matchAllBtn.clicked.connect( lambda a='all':TransformUtility.matchTransforms( a ) ) copyBitSettingsBtn = QTWidgets.imageTextButton( 'Copy Bit Settings', ':/riggingUI/icons/bit_copy_settings.png', [16,16] ) copyBitSettingsBtn.clicked.connect( lambda:NodeUtility.copyBitSettings() ) addChildBtn = QTWidgets.imageTextButton( 'Add Child', ':/riggingUI/icons/bit_add_child.png', [16,16] ) addChildBtn.clicked.connect( lambda:NodeUtility.setBitChild() ) deleteChildBtn = QTWidgets.imageTextButton( 'Delete Child', ':/riggingUI/icons/bit_delete_child.png', [16,16] ) deleteChildBtn.clicked.connect( lambda:NodeUtility.deleteBitChild() ) # Build bits layout. # Presets. presetsHeader = QTWidgets.basicLabel( 'Bit Presets', 'bold', 14, 'white', '2B2B30' ) presetsHeader.setMinimumHeight( 30 ) presetsHeader.setAlignment( QtCore.Qt.AlignCenter ) presetsFrame = QTWidgets.basicFrame() presetsLayout = QtGui.QHBoxLayout() presetsLayout.addWidget( moduleRootBtn ) presetsLayout.addWidget( characterRootBtn ) presetsFrame.setLayout( presetsLayout ) # Primitive buttons bitPrimitivesHeader = QTWidgets.basicLabel( 'Bit Primitives', 'bold', 14, 'white', '2B2B30' ) bitPrimitivesHeader.setMinimumHeight( 30 ) bitPrimitivesHeader.setAlignment( QtCore.Qt.AlignCenter ) primitiveFrame = QTWidgets.basicFrame() primitiveLayout = QtGui.QHBoxLayout() primitiveLayout.addWidget( sphereBtn ) primitiveLayout.addWidget( boxBtn ) primitiveLayout.addWidget( cylinderBtn ) primitiveLayout.addWidget( coneBtn ) primitiveLayout.addWidget( torusBtn ) primitiveFrame.setLayout( primitiveLayout ) # Bit tools. bitToolsHeader = QTWidgets.basicLabel( 'Bit Tools', 'bold', 14, 'white', '2B2B30' ) bitToolsHeader.setMinimumHeight( 30 ) bitToolsHeader.setAlignment( QtCore.Qt.AlignCenter ) bitToolsGrid = QtGui.QGridLayout() bitToolsGrid.setColumnMinimumWidth( 0, 100 ) bitToolsGrid.setColumnMinimumWidth( 1, 100 ) bitToolsGrid.setColumnMinimumWidth( 2, 100 ) bitToolsGrid.setSpacing( 2 ) bitToolsGrid.setContentsMargins( 0,0,0,0 ) # widget, row, col bitToolsGrid.addWidget( matchTranslationBtn, 0, 0 ) bitToolsGrid.addWidget( matchRotationBtn, 0, 1 ) bitToolsGrid.addWidget( matchAllBtn, 0, 2 ) bitToolsGrid.addWidget( copyBitSettingsBtn, 1, 0 ) bitToolsGrid.addWidget( addChildBtn, 1, 1 ) bitToolsGrid.addWidget( deleteChildBtn, 1, 2 ) # Added the bits widgets to the sub-layout of the main window. layout.addWidget( presetsHeader ) layout.addWidget( presetsFrame ) layout.addWidget( bitPrimitivesHeader ) layout.addWidget( primitiveFrame ) layout.addWidget( bitToolsHeader ) layout.addLayout( bitToolsGrid )