ViewManager/ViewManager.py

changeset 6932
8a3df4c6ac9a
parent 6931
faac36ec9d76
--- a/ViewManager/ViewManager.py	Sun Apr 07 19:55:21 2019 +0200
+++ b/ViewManager/ViewManager.py	Mon Apr 08 19:08:44 2019 +0200
@@ -12,7 +12,7 @@
 import os
 
 from PyQt5.QtCore import pyqtSignal, pyqtSlot, QSignalMapper, QTimer, \
-    QFileInfo, QRegExp, Qt, QCoreApplication
+    QFileInfo, QRegExp, Qt, QCoreApplication, QPoint
 from PyQt5.QtGui import QColor, QKeySequence, QPalette, QPixmap
 from PyQt5.QtWidgets import QLineEdit, QToolBar, QWidgetAction, QDialog, \
     QApplication, QMenu, QComboBox, QWidget
@@ -122,6 +122,8 @@
         editor's text
     @signal editorLineChanged(str,int) emitted to signal a change of an
         editor's current line (line is given one based)
+    @signal editorDoubleClickedEd(Editor, position, buttons) emitted to signal
+        a mouse double click in an editor
     """
     changeCaption = pyqtSignal(str)
     editorChanged = pyqtSignal(str)
@@ -145,6 +147,7 @@
     editorLanguageChanged = pyqtSignal(Editor)
     editorTextChanged = pyqtSignal(Editor)
     editorLineChanged = pyqtSignal(str, int)
+    editorDoubleClickedEd = pyqtSignal(Editor, QPoint, int)
     
     def __init__(self):
         """
@@ -4742,6 +4745,9 @@
             self.__lastEditPositionAvailable)
         editor.zoomValueChanged.connect(
             lambda v: self.zoomValueChanged(v, editor))
+        editor.mouseDoubleClick.connect(
+            lambda pos, buttons: self.__editorDoubleClicked(editor, pos,
+                                                            buttons))
         
         editor.languageChanged.connect(
             lambda: self.editorLanguageChanged.emit(editor))
@@ -6914,7 +6920,23 @@
         eol = editor.getEolIndicator()
         self.__setSbFile(fn, line, pos, enc, lang, eol)
         self.cursorChanged.emit(editor)
-        
+    
+    def __editorDoubleClicked(self, editor, pos, buttons):
+        """
+        Private slot handling mouse double clicks of an editor.
+        
+        Note: This method is simply a multiplexer to re-emit the signal
+        with the editor prepended.
+        
+        @param editor reference to the editor, that emitted the signal
+        @type Editor
+        @param pos position of the double click
+        @type QPoint
+        @param buttons mouse buttons that were double clicked
+        @type Qt.MouseButtons
+        """
+        self.editorDoubleClickedEd.emit(editor, pos, buttons)
+    
     def __breakpointToggled(self, editor):
         """
         Private slot to handle the breakpointToggled signal.

eric ide

mercurial