Overloads the key press event to control keystroke modifications for \
        the console widget.
        
        :param      event | <QKeyEvent>
434581
def keyPressEvent(self, event):
        
        # enter || return keys will apply the command
        if event.key() in (Qt.Key_Return, Qt.Key_Enter):
            self.applyCommand()
            event.accept()
        
        # home key will move the cursor to the home position
        elif event.key() == Qt.Key_Home:
            self.gotoHome()
            event.accept()
        
        elif event.key() in (Qt.Key_Backspace, Qt.Key_Delete):
            super(XConsoleEdit, self).keyPressEvent(event)
            
            # update the completer
            cursor   = self.textCursor()
            text     = projex.text.nativestring(cursor.block().text())
            text     = text[:cursor.columnNumber()].split(' ')[-1]
            
            if not '.' in text:
                self.cancelCompletion()
            
        # period key will trigger a completion popup
        elif event.key() == Qt.Key_Period or \
             (Qt.Key_A <= event.key() <= Qt.Key_Z):
            super(XConsoleEdit, self).keyPressEvent(event)
            self.startCompletion(force=event.key() == Qt.Key_Period)
        
        # space, tab, backspace and delete will cancel the completion
        elif event.key() == Qt.Key_Space:
            self.cancelCompletion()
            super(XConsoleEdit, self).keyPressEvent(event)
        
        # left parenthesis will start method help
        elif event.key() == Qt.Key_ParenLeft:
            self.cancelCompletion()
            self.showMethodToolTip()
            super(XConsoleEdit, self).keyPressEvent(event)
        
        # Ctrl+Up will load previous commands
        elif event.key() == Qt.Key_Up:
            if self.commandLineInteraction() or \
               event.modifiers() & Qt.ControlModifier:
                self.insertPreviousCommand()
                event.accept()
            else:
                super(XConsoleEdit, self).keyPressEvent(event)
        
        # Ctrl+Down will load future commands
        elif event.key() == Qt.Key_Down:
            if self.commandLineInteraction() or \
               event.modifiers() & Qt.ControlModifier:
                self.insertNextCommand()
                event.accept()
            else:
                super(XConsoleEdit, self).keyPressEvent(event)
        
        # otherwise, handle the event like normal
        else:
            super(XConsoleEdit, self).keyPressEvent(event)
289312
def key_pressed_event(self, event):
        
        if event.key() == self.keys.ESCAPE:
            self.close()

        self.example.key_event(event.key(), self.keys.ACTION_PRESS)
1246152
function () {
        Event.on(this.id, "keydown",  this.handleKeyDown,  this, true);
        Event.on(this.id, "keypress", this.handleKeyPress, this, true);
    }
1337539
def keyPressEvent(self, event):
        
        if event.key() == Qt.Key_Return or event.key() == Qt.Key_Enter:
            if self.add_current_text_if_valid():
                self.selected()
                self.hide_completer()
        elif event.key() == Qt.Key_Escape:
            self.set_current_text(self.selected_text)
            self.hide_completer()
        else:
            QComboBox.keyPressEvent(self, event)
551054
def keyPressEvent(self, event):
        
        # emit the return pressed signal for this widget
        if event.key() in (Qt.Key_Return, Qt.Key_Enter) and \
           event.modifiers() == Qt.ControlModifier:
            self.acceptText()
            event.accept()
            return
        
        elif event.key() == Qt.Key_Tab:
            if self.tabsAsSpaces():
                count = 4 - (self.textCursor().columnNumber() % 4)
                self.insertPlainText(' ' * count)
                event.accept()
                return
        
        elif event.key() == Qt.Key_V and event.modifiers() == Qt.ControlModifier:
            self.paste()
            event.accept()
            return
        
        super(XTextEdit, self).keyPressEvent(event)
        
        if self.autoResizeToContents():
            self.resizeToContents()
855205
def postprocess_keyevent(self, event):
        """"""
        ShellBaseWidget.postprocess_keyevent(self, event)
        if QToolTip.isVisible():
            _event, _text, key, _ctrl, _shift = restore_keyevent(event)
            self.hide_tooltip_if_necessary(key)
777621
def keyPressEvent(self, event):
        """"""
        if event.key() in (Qt.Key_Enter, Qt.Key_Return):
            self.clicked()
        elif event.key() == Qt.Key_F2:
            self.rename()
        elif event.key() == Qt.Key_Delete:
            self.delete()
        elif event.key() == Qt.Key_Backspace:
            self.go_to_parent_directory()
        else:
            QTreeView.keyPressEvent(self, event)
638794
public void keyPressed(KeyEvent event)
    {
        lastKeyName = event.getName();
        lastCode = Integer.valueOf(event.getCode());
        if (!keys.contains(lastCode))
        {
            keys.add(lastCode);
        }
    }
308432
def event(self, event):
        
        if event.type() == QEvent.KeyPress and event.key() == Qt.Key_Tab:
            return False
        return QWidget.event(self, event)
1103799
def on_key_pressed(self, event):
        

        return

        # TODO

        if event.keysym == "Up":
            self.manager.set_joystick(0.0, -1.0, 0)
        elif event.keysym == "Down":
            self.manager.set_joystick(0.0, 1.0, 0)
        elif event.keysym == "Left":
            self.manager.set_joystick(-1.0, 0.0, 0)
        elif event.keysym == "Right":
            self.manager.set_joystick(1.0, 0.0, 0)

        elif event.char == " ":
            mode = self.manager.get_mode()
            if mode == self.manager.MODE_DISABLED:
                self.manager.set_mode(self.manager.MODE_OPERATOR_CONTROL)
            else:
                self.manager.set_mode(self.manager.MODE_DISABLED)
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)
1116865
def keyReleaseEvent(self, event):
        
        if self.isReadOnly():
            return
        initial_state = event.isAccepted()
        event.ignore()
        self.key_released.emit(event)
        if not event.isAccepted():
            event.setAccepted(initial_state)
            super(CodeEdit, self).keyReleaseEvent(event)
1021086
def mouseReleaseEvent(self, event):
        
        if event.button() == Qt.LeftButton:
            self._drag_origin = None
        widget = self.widget
        type(widget).mouseReleaseEvent(widget, event)
818795
def onKeyPressInCanvas(self, event):
        ''''''
        char_map = { 'w':'move 1', 'a':'strafe -1', 's':'move -1', 'd':'strafe 1', ' ':'jump 1' }
        keysym_map = { 'continuous': { 'Left':'turn -1', 'Right':'turn 1', 'Up':'pitch -1', 'Down':'pitch 1', 'Shift_L':'crouch 1',
                                       'Shift_R':'crouch 1', 
                                       '1':'hotbar.1 1', '2':'hotbar.2 1', '3':'hotbar.3 1', '4':'hotbar.4 1', '5':'hotbar.5 1',
                                       '6':'hotbar.6 1', '7':'hotbar.7 1', '8':'hotbar.8 1', '9':'hotbar.9 1' },
                       'discrete':   { 'Left':'turn -1', 'Right':'turn 1', 'Up':'move 1', 'Down':'move -1', 
                                       '1':'hotbar.1 1', '2':'hotbar.2 1', '3':'hotbar.3 1', '4':'hotbar.4 1', '5':'hotbar.5 1',
                                       '6':'hotbar.6 1', '7':'hotbar.7 1', '8':'hotbar.8 1', '9':'hotbar.9 1' } }
        if event.char == '/':
            self.command_entry.focus_set() # interlude to allow user to type command
        elif event.char.lower() in char_map:
            self.agent_host.sendCommand( char_map[ event.char.lower() ] )
        elif event.keysym in keysym_map[self.action_space]:
            self.agent_host.sendCommand( keysym_map[self.action_space][ event.keysym ] )
133035
def keyPressEvent( self, event ):
        
        if ( event.key() == Qt.Key_Backtab ):
            self.unindentSelection()
        else:
            super(XScintillaEdit, self).keyPressEvent(event)
893011
def keyPressEvent( self, event ):
        
        # otherwise, eat all other key press events until the 
        # view mode is released
        if ( self.inViewMode() ):
            event.accept()
        
        # when the user presses the space bar, put
        # the scene into view editing mode
        elif ( event.key() == Qt.Key_Space ):
            self.setViewMode(True)
            event.accept()
        
        # cancel the connection if escape is pressed
        elif ( event.key() == Qt.Key_Escape ):
            self.finishConnection(False)
            event.accept()
        
        # otherwise, run the standard key press event
        else:
            super(XNodeScene, self).keyPressEvent(event)
1011654
function (event) {
            var browser = ariaCoreBrowser;
            if (browser.isAndroid && browser.isChrome && !event.isSpecialKey && event.keyCode == 229) {
                event.charCode = 0;
                this._handleKey(event);
            }
            this.$TextInput._dom_onkeyup.call(this, event);
        }