Im having trouble getting the name of dynamicSidebarScroll_1/2 with the 
custom signal with self.sender() so I can tell if it was pressed on the 
first or second row. 

*http://pastebin.com/XrbGFEPh* <http://pastebin.com/XrbGFEPh>

class renderManagement(QtGui.QMainWindow):
    moveItemRequested_0 = QtCore.pyqtSignal() #### (str) here?
    moveItemRequested_1 = QtCore.pyqtSignal() ####    
    
    def __init__(self,parent=getMayaWindow()):
        self.moveItemRequested_0.connect(self.moveLightItemDown)
        self.moveItemRequested_1.connect(self.moveLightItemUp)
        
        def buildLightList(self):
        lightShapes = cmds.ls(lights=True)
        if lightShapes:
            lightTransforms = cmds.listRelatives(lightShapes, p=True)
            for i in lightTransforms:
                usableLights = ['spotLight1', 'spotLight2']
                if i in usableLights:
                    if i == 'spotLight1':
                    
                        global splitter_1
                        global dynamicSidebarScroll_1
                        
                        splitter_1 = QtGui.QSplitter(splitterWidget)
                        dynamicSidebarScroll_1 = 
QtGui.QScrollArea(splitter_1)
                        dynamicSidebarScroll_1.installEventFilter(self) ##
                        
                    if i ==    'spotLight2':
                        #
                        
    def eventFilter(self, obj, event):
        if event.type() == QEvent.KeyPress:
            if event.key() == QtCore.Qt.Key_Down:
                if obj == dynamicSidebarScroll_1:
                    print 'first row'                
                if obj == dynamicSidebarScroll_2:
                    print 'second row'
                self.moveItemRequested_0.emit() #obj
                return True        
            elif event.key() == QtCore.Qt.Key_Up:
                if obj == dynamicSidebarScroll_1:
                    print 'first row'                
                if obj == dynamicSidebarScroll_2:
                    print 'second row'
                self.moveItemRequested_1.emit() #obj
                return True
        return False        

    def moveLightItemDown(self): #obj
        print 'down'
        source = self.sender()
        if source == dynamicSidebarScroll_2:
            print 'first scroll'        
        if source == dynamicSidebarScroll_2:
            print 'second scroll'
        # indexOfWidget = insideTab_vertLayout.indexOf() #splitter_2
        # print indexOfWidget

-- 
view archives: http://groups.google.com/group/python_inside_maya
change your subscription settings: 
http://groups.google.com/group/python_inside_maya/subscribe

Reply via email to