I agree. I have a lot of redundancies. My coding style isn't that clean. 
I'm definitely going to look into fixing this once I have the functionality 
that I'm looking for with the small number of test lights. I can replace _1 
with _2.

Right now Im having a problem with maya hanging when I do the insertWidget 
command. I can post a longer code sample if that could help.

    def eventFilter(self, obj, event):
        if event.type() == QEvent.KeyPress:
            key = event.key()
            if key in (QtCore.Qt.Key_Up, QtCore.Qt.Key_Down):
                if obj == dynamicSidebarScroll_1:
                    self.moveRequested.emit(event.key(), '1')
                    return True
                if obj == dynamicSidebarScroll_2:
                    self.moveRequested.emit(event.key(), '2')
                    return True                    
                    
        return False
        
        
    def moveLightItem(self, direction, widget): #obj
        obj = self.sender()

        if widget == '1':
            selected_splitter = splitter_1
        elif widget == '2':
            selected_splitter = splitter_2            
            
        idx = insideTab_vertLayout.indexOf(selected_splitter) #obj
        
        print idx
        print 'Move in direction %s' % (direction)
        if direction == QtCore.Qt.Key_Up:
            print 'up press'
            idx = max(idx-1, 0)
        elif direction == QtCore.Qt.Key_Down:
            print 'down press'
            idx = min(idx+1, insideTab_vertLayout.count()-1)
            
        insideTab_vertLayout.insertWidget(idx, obj)    #obj

-- 
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