I found the problem. You are actually telling it to insert the entire renderManagement instance into the layout. It crashes because its not possible, being the parent and a child. So maya crashes.
The reason this is happening is because you took a bit of a different route than my suggested code. In your code, you have the top level window being the eventFilter for all of the widgets, and emitted the single signal. When the signal gets to the slot, self.sender() is always the renderManagement instance. You check the string identifier that you passed along, but you actually pass the sender to the insertWidget call: ### obj = self.sender() if widget == '1': selected_splitter = self.splitter_1 elif widget == '2': selected_splitter = self.splitter_2 ... self.insideTab_vertLayout.insertWidget(idx, obj) ## You need to change that last line to: self.insideTab_vertLayout.insertWidget(idx, selected_splitter) I know I have been kind of hammering this in over the past replies, but I really need to point it out again. Something that makes it really complicated to debug is when you do too much in one class and have way too many objects in the same namespace. The goal I was going for with my code example was to move the LightItem into its own class, with its own object structure. Then you would have it watch the specific widget of that class that you want for the key press events, and would emit a custom signal from that widget. The renderManagement should just watch the signal of each LightItem and connect to the handler. That way you do not need to check a special arbitrary flag for which widget it was. The code remains generic and you can move the widget that actually emitted the signal. It was hard to spot the problem in this code because I had to look through so much content in that once class and figure out which widget was a parent to which. But I ended up finding the problem by printing what the object type was, just before inserting it: <moveScroll.renderManagement object at 0x11a498d40> I promise you, if you take the time to split out your code into reusable components and make the classes smaller, you will have a much easier time debugging crazy Qt weirdness. Hope that helps! On Oct 11, 2012, at 6:07 PM, Berg Jones wrote: > I took out all the the globals but no change. I wrote an example that shows > the problem. Setting up this layout with the multiple scroll areas for each > section was pretty difficult so it may be the problem... > > http://pastebin.com/V8bpwjzM > > > > > On Thursday, October 11, 2012 6:46:40 PM UTC-4, Justin Israel wrote: > It's hard to tell, but I would first address the fact that you are > using global references to all your objects to remove that as being > any factor. The problem with using globals is that they can just come > from anywhere. I can't look at this code and know where they really > live. > > The insertWidget call would most likely handle if you are adding a bad > type of object to the layout. > > yea I would probably have to look at the entire context of the code. > > > On Thu, Oct 11, 2012 at 3:35 PM, Berg Jones <berg...@gmail.com> wrote: > > 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 > > -- > 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