Completed the mouse click handler support.

Tue, 23 Jun 2015 19:10:18 +0200

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Tue, 23 Jun 2015 19:10:18 +0200
changeset 4287
12274edd3050
parent 4286
255f56eb7f05
child 4288
1c9c1c12111a

Completed the mouse click handler support.

APIs/Python3/eric6.api file | annotate | diff | comparison | revisions
Documentation/Help/source.qch file | annotate | diff | comparison | revisions
Documentation/Source/eric6.QScintilla.Editor.html file | annotate | diff | comparison | revisions
QScintilla/Editor.py file | annotate | diff | comparison | revisions
--- a/APIs/Python3/eric6.api	Mon Jun 22 19:50:05 2015 +0200
+++ b/APIs/Python3/eric6.api	Tue Jun 23 19:10:18 2015 +0200
@@ -7071,6 +7071,8 @@
 eric6.QScintilla.Editor.Editor.getLanguage?4(normalized=True, forPygments=False)
 eric6.QScintilla.Editor.Editor.getLexer?4()
 eric6.QScintilla.Editor.Editor.getMenu?4(menuName)
+eric6.QScintilla.Editor.Editor.getMouseClickHandler?4(modifiers, button)
+eric6.QScintilla.Editor.Editor.getMouseClickHandlers?4(name)
 eric6.QScintilla.Editor.Editor.getNoName?4()
 eric6.QScintilla.Editor.Editor.getSearchText?4(selectionOnly=False)
 eric6.QScintilla.Editor.Editor.getSharingStatus?4()
@@ -7124,6 +7126,7 @@
 eric6.QScintilla.Editor.Editor.menuToggleBreakpoint?4()
 eric6.QScintilla.Editor.Editor.modificationStatusChanged?7
 eric6.QScintilla.Editor.Editor.mousePressEvent?4(event)
+eric6.QScintilla.Editor.Editor.mouseReleaseEvent?4(evt)
 eric6.QScintilla.Editor.Editor.newBreakpointWithProperties?4(line, properties)
 eric6.QScintilla.Editor.Editor.nextBookmark?4()
 eric6.QScintilla.Editor.Editor.nextChange?4()
@@ -7151,6 +7154,8 @@
 eric6.QScintilla.Editor.Editor.removeCallTipHook?4(key)
 eric6.QScintilla.Editor.Editor.removeClone?4(editor)
 eric6.QScintilla.Editor.Editor.removeCompletionListHook?4(key)
+eric6.QScintilla.Editor.Editor.removeMouseClickHandler?4(modifiers, button)
+eric6.QScintilla.Editor.Editor.removeMouseClickHandlers?4(name)
 eric6.QScintilla.Editor.Editor.resizeEvent?4(evt)
 eric6.QScintilla.Editor.Editor.revertToUnmodified?4()
 eric6.QScintilla.Editor.Editor.saveFile?4(saveas=False, path=None)
@@ -7166,6 +7171,7 @@
 eric6.QScintilla.Editor.Editor.setCallTipHook?4(func)
 eric6.QScintilla.Editor.Editor.setLanguage?4(filename, initTextDisplay=True, propagate=True, pyname="")
 eric6.QScintilla.Editor.Editor.setMonospaced?4(on)
+eric6.QScintilla.Editor.Editor.setMouseClickHandler?4(name, modifiers, button, function)
 eric6.QScintilla.Editor.Editor.setNoName?4(noName)
 eric6.QScintilla.Editor.Editor.setSearchIndicator?4(startPos, indicLength)
 eric6.QScintilla.Editor.Editor.setSpellingForProject?4()
Binary file Documentation/Help/source.qch has changed
--- a/Documentation/Source/eric6.QScintilla.Editor.html	Mon Jun 22 19:50:05 2015 +0200
+++ b/Documentation/Source/eric6.QScintilla.Editor.html	Tue Jun 23 19:10:18 2015 +0200
@@ -813,10 +813,10 @@
 <td>Public method to get a reference to the main context menu or a submenu.</td>
 </tr><tr>
 <td><a href="#Editor.getMouseClickHandler">getMouseClickHandler</a></td>
-<td></td>
+<td>Public method to get a registered mouse click handler.</td>
 </tr><tr>
 <td><a href="#Editor.getMouseClickHandlers">getMouseClickHandlers</a></td>
-<td></td>
+<td>Public method to get all registered mouse click handlers of a plug-in.</td>
 </tr><tr>
 <td><a href="#Editor.getNoName">getNoName</a></td>
 <td>Public method to get the display string for an unnamed editor.</td>
@@ -1047,10 +1047,10 @@
 <td>Public method to remove a previously registered completion list provider.</td>
 </tr><tr>
 <td><a href="#Editor.removeMouseClickHandler">removeMouseClickHandler</a></td>
-<td></td>
+<td>Public method to un-registered a mouse click handler.</td>
 </tr><tr>
 <td><a href="#Editor.removeMouseClickHandlers">removeMouseClickHandlers</a></td>
-<td></td>
+<td>Public method to un-registered all mouse click handlers of a plug-in.</td>
 </tr><tr>
 <td><a href="#Editor.resizeEvent">resizeEvent</a></td>
 <td>Protected method handling resize events.</td>
@@ -3242,17 +3242,48 @@
 <h4>Editor.getMouseClickHandler</h4>
 <b>getMouseClickHandler</b>(<i>modifiers, button</i>)
 <p>
-
-</p><p>
-
-</p><a NAME="Editor.getMouseClickHandlers" ID="Editor.getMouseClickHandlers"></a>
+        Public method to get a registered mouse click handler.
+</p><dl>
+<dt><i>modifiers</i> (Qt.KeyboardModifiers)</dt>
+<dd>
+keyboard modifiers of the handler
+</dd><dt><i>button</i> (Qt.MouseButton)</dt>
+<dd>
+mouse button of the handler
+</dd>
+</dl><dl>
+<dt>Returns:</dt>
+<dd>
+plug-in name and registered function
+</dd>
+</dl><dl>
+<dt>Return Type:</dt>
+<dd>
+tuple of str and func
+</dd>
+</dl><a NAME="Editor.getMouseClickHandlers" ID="Editor.getMouseClickHandlers"></a>
 <h4>Editor.getMouseClickHandlers</h4>
 <b>getMouseClickHandlers</b>(<i>name</i>)
 <p>
-
-</p><p>
-
-</p><a NAME="Editor.getNoName" ID="Editor.getNoName"></a>
+        Public method to get all registered mouse click handlers of
+        a plug-in.
+</p><dl>
+<dt><i>name</i> (str)</dt>
+<dd>
+name of the plug-in
+</dd>
+</dl><dl>
+<dt>Returns:</dt>
+<dd>
+registered mouse click handlers as list of modifiers,
+            mouse button and function
+</dd>
+</dl><dl>
+<dt>Return Type:</dt>
+<dd>
+list of tuple of (Qt.KeyboardModifiers, Qt.MouseButton,func)
+</dd>
+</dl><a NAME="Editor.getNoName" ID="Editor.getNoName"></a>
 <h4>Editor.getNoName</h4>
 <b>getNoName</b>(<i></i>)
 <p>
@@ -3755,9 +3786,9 @@
 <p>
         Protected method calling a registered mouse click handler function.
 </p><dl>
-<dt><i>evt</i></dt>
-<dd>
-event object (QMouseEvent)
+<dt><i>evt</i> (QMouseEvent)</dt>
+<dd>
+event object
 </dd>
 </dl><a NAME="Editor.newBreakpointWithProperties" ID="Editor.newBreakpointWithProperties"></a>
 <h4>Editor.newBreakpointWithProperties</h4>
@@ -3931,17 +3962,27 @@
 <h4>Editor.removeMouseClickHandler</h4>
 <b>removeMouseClickHandler</b>(<i>modifiers, button</i>)
 <p>
-
-</p><p>
-
-</p><a NAME="Editor.removeMouseClickHandlers" ID="Editor.removeMouseClickHandlers"></a>
+        Public method to un-registered a mouse click handler.
+</p><dl>
+<dt><i>modifiers</i> (Qt.KeyboardModifiers)</dt>
+<dd>
+keyboard modifiers of the handler
+</dd><dt><i>button</i> (Qt.MouseButton)</dt>
+<dd>
+mouse button of the handler
+</dd>
+</dl><a NAME="Editor.removeMouseClickHandlers" ID="Editor.removeMouseClickHandlers"></a>
 <h4>Editor.removeMouseClickHandlers</h4>
 <b>removeMouseClickHandlers</b>(<i>name</i>)
 <p>
-
-</p><p>
-
-</p><a NAME="Editor.resizeEvent" ID="Editor.resizeEvent"></a>
+        Public method to un-registered all mouse click handlers of
+        a plug-in.
+</p><dl>
+<dt><i>name</i> (str)</dt>
+<dd>
+name of the plug-in
+</dd>
+</dl><a NAME="Editor.resizeEvent" ID="Editor.resizeEvent"></a>
 <h4>Editor.resizeEvent</h4>
 <b>resizeEvent</b>(<i>evt</i>)
 <p>
--- a/QScintilla/Editor.py	Mon Jun 22 19:50:05 2015 +0200
+++ b/QScintilla/Editor.py	Tue Jun 23 19:10:18 2015 +0200
@@ -40,8 +40,6 @@
 TemplateCompletionListID = 2
 
 
-# TODO: implement a mouse click handler usable by plug-ins
-# e.g. for 'got to function definition'
 class Editor(QsciScintillaCompat):
     """
     Class implementing the editor component of the eric6 IDE.
@@ -7691,10 +7689,28 @@
     
     def removeMouseClickHandler(self, modifiers, button):
         """
-        
-        """
+        Public method to un-registered a mouse click handler.
+        
+        @param modifiers keyboard modifiers of the handler
+        @type Qt.KeyboardModifiers
+        @param button mouse button of the handler
+        @type Qt.MouseButton
+        """
+        key = (modifiers, button)
+        if key in self.__mouseClickHandlers:
+            del self.__mouseClickHandlers[key]
     
     def removeMouseClickHandlers(self, name):
         """
-        
-        """
+        Public method to un-registered all mouse click handlers of
+        a plug-in.
+        
+        @param name name of the plug-in
+        @type str
+        """
+        keys = []
+        for key in self.__mouseClickHandlers:
+            if self.__mouseClickHandlers[key][0] == name:
+                keys.append(key)
+        for key in keys:
+            del self.__mouseClickHandlers[key]

eric ide

mercurial