I'm having a bit of trouble figuring out where to start with your code example, because it is kind of doing a mixture of things. You shouldn't need to explicitly create cases to handle each object since they will all be same type. Also I am not clear what you are doing with the globals, but I would ditch them.
I figured it would just be easiest if I worked up a stand-alone example of my previous suggestions... https://gist.github.com/3867879 This will create the concept of your RenderManagement widget, and a LightItem class. You add them all to the layout and then watch their notifications for move events. On Wed, Oct 10, 2012 at 11:36 AM, Berg Jones <bergjo...@gmail.com> wrote: > 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 > > 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_1: > > 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 -- view archives: http://groups.google.com/group/python_inside_maya change your subscription settings: http://groups.google.com/group/python_inside_maya/subscribe