def _mouse_press_on_text(self, event): if event.button() == Qt.LeftButton: if self._copy_format_mode == TextEditor.READY_TO_FORMAT_COPY: self._copy_format_mode = TextEditor.COPY_FORMAT QTextEdit.mousePressEvent(self._view.text, event)