Filters the events for the editors to control how the cursor
        flows between them.
        
        :param      object | <QtCore.QObject>
                    event  | <QtCore.QEvent>

        :return     <bool> | consumed
503133
def eventFilter(self, object, event):
        
        index = self.indexOf(object)
        pressed = event.type() == event.KeyPress
        released = event.type() == event.KeyRelease
        
        if index == -1 or \
           not (pressed or released) or \
           self.isEditorHandlingBlocked():
            return super(XSerialEdit, self).eventFilter(object, event)
        
        text = nativestring(event.text()).strip()
        
        # handle Ctrl+C (copy)
        if event.key() == QtCore.Qt.Key_C and \
           event.modifiers() == QtCore.Qt.ControlModifier and \
           pressed:
            self.copy()
            return True
        
        # handle Ctrl+X (cut)
        elif event.key() == QtCore.Qt.Key_X and \
             event.modifiers() == QtCore.Qt.ControlModifier and \
             pressed:
            if not self.isReadOnly():
                self.cut()
            return True
        
        # handle Ctrl+A (select all)
        elif event.key() == QtCore.Qt.Key_A and \
             event.modifiers() == QtCore.Qt.ControlModifier and \
             pressed:
            self.selectAll()
            return True
        
        # handle Ctrl+V (paste)
        elif event.key() == QtCore.Qt.Key_V and \
             event.modifiers() == QtCore.Qt.ControlModifier and \
             pressed:
            if not self.isReadOnly():
                self.paste()
            return True
        
        # ignore tab movements
        elif event.key() in (QtCore.Qt.Key_Tab, QtCore.Qt.Key_Backtab):
            pass
        
        # delete all selected text
        elif event.key() == QtCore.Qt.Key_Backspace:
            sel_text = self.selectedText()
            if sel_text and not self.isReadOnly():
                self.clearSelection()
                return True
        
        # ignore modified keys
        elif not released:
            return super(XSerialEdit, self).eventFilter(object, event)
        
        # move to the previous editor
        elif object.cursorPosition() == 0:
            if event.key() in (QtCore.Qt.Key_Backspace, QtCore.Qt.Key_Left):
                self.goBack()
        
        # move to next editor
        elif object.cursorPosition() == object.maxLength():
            valid_chars = string.ascii_letters + string.digits
            valid_text = text != '' and text in valid_chars
            
            if valid_text or event.key() == QtCore.Qt.Key_Right:
                self.goForward()
        
        return super(XSerialEdit, self).eventFilter(object, event)
1346913
def dropEvent( self, event ):
        
        filt = self.dragDropFilter()
        if ( not filt ):
            super(XCalendarWidget, self).dropEvent(event)
            return
        
        filt(self, event)
348515
def mouseMoveEvent(self, event):
        
        line_number = self.editor.get_linenumber_from_mouse_event(event)
        block = self.editor.document().findBlockByNumber(line_number-1)
        data = block.userData()

        # this disables pyflakes messages if there is an active drag/selection
        # operation
        check = self._released == -1
        if data and data.code_analysis and check:
            self.editor.show_code_analysis_results(line_number,
                                                   data)
        else:
            self.editor.hide_tooltip()

        if event.buttons() == Qt.LeftButton:
            self._released = line_number
            self.editor.select_lines(self._pressed, self._released)
589820
def mouseDoubleClickEvent(self, event):
        
        if self.isEditable():
            self.beginEdit()
        
        super(XLabel, self).mouseDoubleClickEvent(event)
1364509
def focusInEvent(self, event):
        
        super(XLineEdit, self).focusInEvent(event)
        
        self._focusedIn = True
298722
def eventFilter(self, widget, event):
        
        if event.type() == QEvent.MouseButtonPress:
            if event.button() == Qt.LeftButton:
                self.sig_canvas_clicked.emit(self)
        return super(FigureThumbnail, self).eventFilter(widget, event)
1018767
def eventFilter(self, object, event):
        
        if event.type() in (event.Move, event.Resize):
            if self.isVisible():
                self.rebuild()
            elif object.isVisible():
                self.setVisible(True)
        
        return False
597151
def eventFilter( self, object, event ):
        
        if ( event.type() == event.Resize and \
             self.currentMode() == XOrbBrowserWidget.Mode.Thumbnail and \
             self.isGroupingActive() ):
            size = QSize(event.size().width() - 20, 22)
            for row in range(object.count()):
                item = object.item(row)
                if ( isinstance(item, GroupListWidgetItem) ):
                    item.setSizeHint(size)
        return False
1068021
def dragEnterEvent( self, event ):
        
        filt = self.dragDropFilter()
        if ( filt and filt(self, event) ):
            return
            
        super(XTableWidget, self).dragEnterEvent(event)
622161
def eventFilter( self, object, event ):
        
        if event.type() == event.KeyPress:
            if event.key() == Qt.Key_Escape:
                self.rejectEdit()
                return True
            
            elif event.key() in (Qt.Key_Return, Qt.Key_Enter):
                self.acceptEdit()
                return True
        
        elif event.type() == event.FocusOut:
            self.acceptEdit()
        
        return False
300934
def eventFilter( self, object, event ):
        
        if event.type() == event.Resize:
            self.resize(event.size())
            
        elif event.type() == event.Move:
            self.move(event.pos())
        
        elif event.type() == event.Close:
            self.setParent(None)
            self.deleteLater()
        
        return False
445396
def dragMoveEvent( self, event ):
        
        filt = self.dragDropFilter()
        if not filt:
            super(XTreeWidget, self).dragMoveEvent(event)
            return
        
        filt(self, event)
772385
def eventFilter(self, object, event):
        
        if event.type() != event.KeyPress:
            return super(XRichTextEdit, self).eventFilter(object, event)
        
        cursor    = object.textCursor()
        curr_list = cursor.currentList()
        
        # make sure we're in a current list
        if not curr_list:
            return super(XRichTextEdit, self).eventFilter(object, event)
        
        # unindent for Backtab (Shift+Tab)
        if event.key() == Qt.Key_Backtab:
            delta = -1
        
        # indent for Tab
        elif event.key() == Qt.Key_Tab:
            delta = 1
        
        # otherwise, don't bother calculating
        else:
            return super(XRichTextEdit, self).eventFilter(object, event)
        
        # look for the proper list to move to
        curr_block      = cursor.block()
        curr_indent     = curr_list.format().indent()
        curr_style      = curr_list.format().style()
        prev_block      = curr_block
        next_block      = curr_block
        add_to_list     = None
        add_to_indent   = curr_indent + delta
        
        while prev_block or next_block:
            if prev_block:
                prev_block = prev_block.previous()
                prev_list  = prev_block.textList()
                
                if not prev_list:
                    prev_block = None
                
                else:
                    prev_indent = prev_list.format().indent()
                    
                    if prev_indent == add_to_indent:
                        add_to_list = prev_list
                        break
                    
            if next_block:
                next_block = next_block.next()
                next_list  = next_block.textList()
                
                if not next_list:
                    next_block = None
                
                else:
                    next_indent = next_list.format().indent()
                    
                    if next_indent == add_to_indent:
                        add_to_list = next_list
                        break
        
        if add_to_list is None and 0 < delta:
            if curr_style in (QTextListFormat.ListCircle,
                              QTextListFormat.ListDisc,
                              QTextListFormat.ListSquare):
                self.insertUnorderedList()
            else:
                self.insertOrderedList()
        
        elif add_to_list:
            add_to_list.add(curr_block)
        
        return True
510010
function (editor) {
        var self = this, editors = self.editors;

        // Add named and index editor instance
        editors[editor.id] = editor;
        editors.push(editor);

        toggleGlobalEvents(editors, true);

        // Doesn't call setActive method since we don't want
        // to fire a bunch of activate/deactivate calls while initializing
        self.activeEditor = editor;

        self.fire('AddEditor', { editor: editor });

        if (!beforeUnloadDelegate) {
          beforeUnloadDelegate = function () {
            self.fire('BeforeUnload');
          };

          DOM.bind(window, 'beforeunload', beforeUnloadDelegate);
        }

        return editor;
      }
990267
def dragMoveEvent( self, event ):
        
        filt = self.dragDropFilter()
        if ( filt and filt(self, event) ):
            return
        
        super(XTableWidget, self).dragMoveEvent(event)
583743
def mousePressEvent(self, event):
        
        # ignore events when the scene is in view mode
        scene = self.scene()
        if scene and scene.inViewMode():
            event.ignore()
            return

        # block the selection signals
        if scene:
            scene.blockSelectionSignals(True)

            # clear the selection
            if ( not (self.isSelected() or
                              event.modifiers() == Qt.ControlModifier) ):
                for item in scene.selectedItems():
                    if item != self:
                        item.setSelected(False)

        # try to start the connection
        super(XNodeConnection, self).mousePressEvent(event)
308432
def event(self, event):
        
        if event.type() == QEvent.KeyPress and event.key() == Qt.Key_Tab:
            return False
        return QWidget.event(self, event)