Small ammendment to the mouse click handler functions of the editor.

Sat, 27 Jun 2015 10:42:27 +0200

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Sat, 27 Jun 2015 10:42:27 +0200
changeset 4299
93219cb8f66b
parent 4298
4e7a0e2c20fc
child 4300
10ce7c7943a6

Small ammendment to the mouse click handler functions of the editor.

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
Binary file Documentation/Help/source.qch has changed
--- a/Documentation/Source/eric6.QScintilla.Editor.html	Fri Jun 26 19:21:16 2015 +0200
+++ b/Documentation/Source/eric6.QScintilla.Editor.html	Sat Jun 27 10:42:27 2015 +0200
@@ -4124,10 +4124,10 @@
 <dt><i>name</i> (str)</dt>
 <dd>
 name of the plug-in (or 'internal') setting this handler
-</dd><dt><i>modifiers</i> (Qt.KeyboardModifiers)</dt>
+</dd><dt><i>modifiers</i> (Qt.KeyboardModifiers or int)</dt>
 <dd>
 keyboard modifiers of the handler
-</dd><dt><i>button</i> (Qt.MouseButton)</dt>
+</dd><dt><i>button</i> (Qt.MouseButton or int)</dt>
 <dd>
 mouse button of the handler
 </dd><dt><i>function</i> (func)</dt>
--- a/QScintilla/Editor.py	Fri Jun 26 19:21:16 2015 +0200
+++ b/QScintilla/Editor.py	Sat Jun 27 10:42:27 2015 +0200
@@ -7600,30 +7600,33 @@
         @param name name of the plug-in (or 'internal') setting this handler
         @type str
         @param modifiers keyboard modifiers of the handler
-        @type Qt.KeyboardModifiers
+        @type Qt.KeyboardModifiers or int
         @param button mouse button of the handler
-        @type Qt.MouseButton
+        @type Qt.MouseButton or int
         @param function handler function
         @type func
         @return flag indicating success
         @rtype bool
         """
-        key = (int(modifiers), int(button))
-        if key in self.__mouseClickHandlers:
-            E5MessageBox.warning(
-                self,
-                self.tr("Register Mouse Click Handler"),
-                self.tr("""A mouse click handler for "{0}" was already"""
-                        """ registered by "{1}". Aborting request by"""
-                        """ "{2}"...""").format(
-                    MouseUtilities.MouseButtonModifier2String(
-                        modifiers, button),
-                    self.__mouseClickHandlers[key][0],
-                    name))
-            return False
-        
-        self.__mouseClickHandlers[key] = (name, function)
-        return True
+        if int(button):
+            key = (int(modifiers), int(button))
+            if key in self.__mouseClickHandlers:
+                E5MessageBox.warning(
+                    self,
+                    self.tr("Register Mouse Click Handler"),
+                    self.tr("""A mouse click handler for "{0}" was already"""
+                            """ registered by "{1}". Aborting request by"""
+                            """ "{2}"...""").format(
+                        MouseUtilities.MouseButtonModifier2String(
+                            modifiers, button),
+                        self.__mouseClickHandlers[key][0],
+                        name))
+                return False
+            
+            self.__mouseClickHandlers[key] = (name, function)
+            return True
+        
+        return False
     
     def getMouseClickHandler(self, modifiers, button):
         """

eric ide

mercurial