(self, event)
onkeydown
onkeydown
onkeydown
def keyPressEvent(self, event):
        """ onkeydown
        """
        key = event.key()
        mod = event.modifiers()
        text = event.text()

        # caret movement
        if key == Qt.Key_Right:
            self.caret.move_right(len(self.data))
        elif key == Qt.Key_Left:
            self.caret.move_left()
        elif key == Qt.Key_Up:
            self.caret.move_up(self.bytes_per_line)
        elif key == Qt.Key_Down:
            self.caret.move_down(self.bytes_per_line, len(self.data))
        elif key == Qt.Key_PageUp:
            self.caret.move_up(self.visible_lines() * self.bytes_per_line)
        elif key == Qt.Key_PageDown:
            self.caret.move_down(self.visible_lines() * self.bytes_per_line,
                                 len(self.data))
        elif key == Qt.Key_Home:
            self.caret.position = 0
        elif key == Qt.Key_End:
            self.caret.position = len(self.data)

        if self.debug_panel is not None:
            if key == Qt.Key_G and mod & Qt.ControlModifier:  # CTRL + G
                self.debug_panel.on_cm_jump_to_address()
            elif key == Qt.Key_D and mod & Qt.ControlModifier:  # CTRL + D
                self.on_cm_show_asm()
            if not mod & Qt.ControlModifier:
                if text.lower() in self._hex_chars:
                    if not self._read_only and text:
                        self.modify_data(text.lower())
                elif text.isalpha() or text.isdigit() or text.isspace():
                    if not self._read_only:
                        if self.caret.mode == 'ascii':
                            self.modify_data(text)

        # repaint
        self._force_repaint()
def keyPressEvent ( self , event ) : key = event . key ( ) mod = event . modifiers ( ) text = event . text ( ) # caret movement if key == Qt . Key_Right : self . caret . move_right ( len ( self . data ) ) elif key == Qt . Key_Left : self . caret . move_left ( ) elif key == Qt . Key_Up : self . caret . move_up ( self . bytes_per_line ) elif key == Qt . Key_Down : self . caret . move_down ( self . bytes_per_line , len ( self . data ) ) elif key == Qt . Key_PageUp : self . caret . move_up ( self . visible_lines ( ) * self . bytes_per_line ) elif key == Qt . Key_PageDown : self . caret . move_down ( self . visible_lines ( ) * self . bytes_per_line , len ( self . data ) ) elif key == Qt . Key_Home : self . caret . position = 0 elif key == Qt . Key_End : self . caret . position = len ( self . data ) if self . debug_panel is not None : if key == Qt . Key_G and mod & Qt . ControlModifier : # CTRL + G self . debug_panel . on_cm_jump_to_address ( ) elif key == Qt . Key_D and mod & Qt . ControlModifier : # CTRL + D self . on_cm_show_asm ( ) if not mod & Qt . ControlModifier : if text . lower ( ) in self . _hex_chars : if not self . _read_only and text : self . modify_data ( text . lower ( ) ) elif text . isalpha ( ) or text . isdigit ( ) or text . isspace ( ) : if not self . _read_only : if self . caret . mode == 'ascii' : self . modify_data ( text ) # repaint self . _force_repaint ( )