def onSelectionChange( self ): ''' Function called by the scripted event in componentsGUI(). Updates the componentGUI whenever the user selects a different object. ''' selList = cmds.ls( selection=1, long=True ) if not self.selectedLockActive: clearLayout( self.componentsLayout ) if len( selList ) == 1: shortName = selList[0].split( '|' ) selName = shortName[ len(shortName)-1 ] self.selectedLabel.setText( selName ) self.SELECTED_OBJECT_LONGNAME = selList[0] componentsClassList = Components.getComponents( self.SELECTED_OBJECT_LONGNAME ) # Add the component node GUI widgets to the component section. if componentsClassList is not None: for nodeName in componentsClassList: component = componentsClassList[ nodeName ] nodeName = nodeName componentClass = Components.str_to_class( component ) componentGui = componentClass( component ).componentGui( nodeName, parent=self ) self.componentsLayout.addWidget( componentGui ) elif len( selList ) > 1: if not self.selectedLockActive: self.SELECTED_OBJECT_LONGNAME = None self.selectedLabel.setText( 'select only one module bit' ) else: if not self.selectedLockActive: self.SELECTED_OBJECT_LONGNAME = None self.selectedLabel.setText( 'nothing selected' )
def updateCards( self ): ''' Updates the character cards. ''' # Clear the lattice list first. clearLayout( self.scrollLayout ) presetsPath = '{0}{1}/'.format( XMLUtility.FRAME_PRESETS_PATH, 'characters' ) latticePresets = XMLUtility.getXMLInFolder( presetsPath ) for lattice in latticePresets: description = 'From here you can search these documents. Enter your search words into the box below and click /"search/".' self.scrollLayout.addWidget( QTWidgets.latticeCard( 'characters', lattice, description, parent=self.scrollLayout ) )
def updateCards( self ): # Clear the lattice list first. clearLayout( self.scrollLayout ) # Get all the active toggle buttons. for index in xrange( self.togLayout.count() ): button = self.togLayout.itemAt( index ).widget() if isinstance( button, QtGui.QToolButton ): if button.isChecked(): buttonType = button.text() presetsPath = '{0}{1}/'.format( XMLUtility.FRAME_PRESETS_PATH, buttonType ) latticePresets = XMLUtility.getXMLInFolder( presetsPath ) for lattice in latticePresets: description = 'From here you can search these documents. Enter your search words into the box below and click /"search/".' self.scrollLayout.addWidget( latticeCard( buttonType, lattice, description, parent=self.scrollLayout ) )
def update_gui( self ): ''' Updates the gui based on the combo box selection. ''' currentComboIndex = self.combo_menu.currentIndex() currentComboText = self.combo_menu.currentText() if self.sub_layout.count() is not 0: clearLayout( self.sub_layout ) buildClass = {0:UIBitsTools.UIBitsTools, 1:UIComponentsTools.UIComponentsTools, 2:UILatticesTools.UILatticeTools, 3:UICharactersTools.UICharacterTools} guiClass = buildClass[ currentComboIndex ] self.sub_layout.addWidget( guiClass() ) if currentComboIndex == 1: # Set the script job number so we can delete it outside of the # component GUI. The script job can hang around if the main GUI # is closed using the X while the component section is active. componentsToolsUI = self.sub_layout.itemAt( 0 ).widget() self.SCRIPT_JOB_NUMBER = componentsToolsUI.SCRIPT_JOB_NUMBER