(self, event)
onmousedown
onmousedown
onmousedown
def mousePressEvent(self, event):
        """ onmousedown
        """

        # context menu
        if event.button() == Qt.RightButton and self.debug_panel is not None:
            self._on_context_menu(event)
            return

        # empty
        if self.data is None:
            return

        # not left then nothing todo
        if event.button() != Qt.LeftButton:
            return

        loc_x = event.pos().x()
        loc_y = event.pos().y()
        if 0 <= loc_x <= self._offset_width:
            if 0 <= loc_y <= self._header_height:
                if self._hex_style == 'upper':
                    self._hex_style = 'lower'
                else:
                    self._hex_style = 'upper'
                self.app.prefs.put('dwarf_ui_hexstyle', self._hex_style)
                self.update()

        if loc_y <= self._header_height:
            return

        cur = self.pixel_to_caret(loc_x, loc_y)
        if cur is not None:
            if not self._is_selecting:
                self._is_selecting = True
                self.selection.active = True

            if self.selection.active:
                self.selection.active = False
                self.selection.start = self.selection.end = cur.position
                self.viewport().update()
            self._blink = False
            self.viewport().update(self.caret_to_asciicol(self.caret))
            self.viewport().update(self.caret_to_hexcol(self.caret))
            self.caret = cur
def mousePressEvent ( self , event ) : # context menu if event . button ( ) == Qt . RightButton and self . debug_panel is not None : self . _on_context_menu ( event ) return # empty if self . data is None : return # not left then nothing todo if event . button ( ) != Qt . LeftButton : return loc_x = event . pos ( ) . x ( ) loc_y = event . pos ( ) . y ( ) if 0 <= loc_x <= self . _offset_width : if 0 <= loc_y <= self . _header_height : if self . _hex_style == 'upper' : self . _hex_style = 'lower' else : self . _hex_style = 'upper' self . app . prefs . put ( 'dwarf_ui_hexstyle' , self . _hex_style ) self . update ( ) if loc_y <= self . _header_height : return cur = self . pixel_to_caret ( loc_x , loc_y ) if cur is not None : if not self . _is_selecting : self . _is_selecting = True self . selection . active = True if self . selection . active : self . selection . active = False self . selection . start = self . selection . end = cur . position self . viewport ( ) . update ( ) self . _blink = False self . viewport ( ) . update ( self . caret_to_asciicol ( self . caret ) ) self . viewport ( ) . update ( self . caret_to_hexcol ( self . caret ) ) self . caret = cur