Exemplo n.º 1
0
 def mousePressEvent(self, event):
     """Reimplement Qt method"""
     if sys.platform.startswith('linux') and event.button() == Qt.MidButton:
         self.calltip_widget.hide()
         if self.has_selected_text():
             self.remove_selected_text()
         self.setFocus()
         event = QMouseEvent(QEvent.MouseButtonPress, event.pos(),
                             Qt.LeftButton, Qt.LeftButton, Qt.NoModifier)
         QPlainTextEdit.mousePressEvent(self, event)
         QPlainTextEdit.mouseReleaseEvent(self, event)
         # Send selection text to clipboard to be able to use
         # the paste method and avoid the strange Issue 1445
         #
         # Note: This issue seems a focusing problem but it
         # seems really hard to track
         mode_clip = QClipboard.Clipboard
         mode_sel = QClipboard.Selection
         text_clip = QApplication.clipboard().text(mode=mode_clip)
         text_sel = QApplication.clipboard().text(mode=mode_sel)
         QApplication.clipboard().setText(text_sel, mode=mode_clip)
         self.paste()
         QApplication.clipboard().setText(text_clip, mode=mode_clip)
     else:
         self.calltip_widget.hide()
         QPlainTextEdit.mousePressEvent(self, event)
Exemplo n.º 2
0
 def mousePressEvent(self, event):
     """Reimplement Qt method"""
     if sys.platform.startswith('linux') and event.button() == Qt.MidButton:
         self.calltip_widget.hide()
         if self.has_selected_text():
             self.remove_selected_text()
         self.setFocus()
         event = QMouseEvent(QEvent.MouseButtonPress, event.pos(),
                             Qt.LeftButton, Qt.LeftButton, Qt.NoModifier)
         QPlainTextEdit.mousePressEvent(self, event)
         QPlainTextEdit.mouseReleaseEvent(self, event)
         # Send selection text to clipboard to be able to use
         # the paste method and avoid the strange Issue 1445
         #
         # Note: This issue seems a focusing problem but it
         # seems really hard to track
         mode_clip = QClipboard.Clipboard
         mode_sel = QClipboard.Selection
         text_clip = QApplication.clipboard().text(mode=mode_clip)
         text_sel = QApplication.clipboard().text(mode=mode_sel)
         QApplication.clipboard().setText(text_sel, mode=mode_clip)
         self.paste()
         QApplication.clipboard().setText(text_clip, mode=mode_clip)
     else:
         self.calltip_widget.hide()
         QPlainTextEdit.mousePressEvent(self, event)
Exemplo n.º 3
0
 def mousePressEvent(self, event):
     """Reimplement Qt method"""
     if os.name != 'posix' and event.button() == Qt.MidButton:
         self.signature_widget.hide()
         self.setFocus()
         event = QMouseEvent(QEvent.MouseButtonPress, event.pos(),
                             Qt.LeftButton, Qt.LeftButton, Qt.NoModifier)
         QPlainTextEdit.mousePressEvent(self, event)
         QPlainTextEdit.mouseReleaseEvent(self, event)
         self.paste()
     else:
         self.signature_widget.hide()
         QPlainTextEdit.mousePressEvent(self, event)
Exemplo n.º 4
0
 def mousePressEvent(self, event):
     """
     Re-implemented to handle the mouse press event.
     event: the mouse press event (QMouseEvent)
     """
     if event.button() == Qt.MidButton:
         text = self.get_selected_text()
         # Simulating left mouse button:
         event = QMouseEvent(QMouseEvent.MouseButtonPress, event.pos(),
                             Qt.LeftButton, Qt.LeftButton, Qt.NoModifier)
         ConsoleBaseWidget.mousePressEvent(self, event)
         if self.new_input_line:
             self.on_new_line()
         self.insert_text(text)
         event.accept()
     else:
         ConsoleBaseWidget.mousePressEvent(self, event)