QScintilla/Editor.py

changeset 4290
5d4f4230a5ed
parent 4288
1c9c1c12111a
child 4292
9dfee1559826
diff -r 6c1ab651c9ce -r 5d4f4230a5ed QScintilla/Editor.py
--- a/QScintilla/Editor.py	Wed Jun 24 19:45:21 2015 +0200
+++ b/QScintilla/Editor.py	Wed Jun 24 19:52:13 2015 +0200
@@ -33,6 +33,7 @@
 
 import Preferences
 import Utilities
+from Utilities import MouseUtilities
 
 import UI.PixmapCache
 
@@ -377,19 +378,6 @@
         self.__mouseClickHandlers = {}
         # dictionary with tuple of keyboard modifier and mouse button as key
         # and tuple of plug-in name and function as value
-        self.__modifier2String = {
-            Qt.ShiftModifier: self.tr("Shift"),
-            Qt.ControlModifier: self.tr("Ctrl"),
-            Qt.AltModifier: self.tr("Alt"),
-            Qt.MetaModifier: self.tr("Meta"),
-        }
-        self.__button2String = {
-            Qt.LeftButton: self.tr("Left Button"),
-            Qt.RightButton: self.tr("Right Button"),
-            Qt.MidButton: self.tr("Middle Button"),
-            Qt.XButton1: self.tr("X Button 1"),
-            Qt.XButton2: self.tr("X Button 2"),
-        }
         
         sh = self.sizeHint()
         if sh.height() < 300:
@@ -7585,25 +7573,6 @@
     ## Mouse click handler related methods
     #######################################################################
     
-    def __mouseClickToString(self, modifiers, button):
-        """
-        Private method to generate a display string for the given modifiers
-        and button combination.
-        
-        @param modifiers keyboard modifiers of the handler
-        @type Qt.KeyboardModifiers
-        @param button mouse button of the handler
-        @type Qt.MouseButton
-        @return display string
-        @rtype str
-        """
-        parts = []
-        for mod in sorted(self.__modifier2String.keys()):
-            if modifiers & mod:
-                parts.append(self.__modifier2String[mod])
-        parts.append(self.__button2String[button])
-        return "+".join(parts)
-    
     def mouseReleaseEvent(self, evt):
         """
         Protected method calling a registered mouse click handler function.
@@ -7647,7 +7616,8 @@
                 self.tr("""A mouse click handler for "{0}" was already"""
                         """ registered by "{1}". Aborting request by"""
                         """ "{2}"...""").format(
-                    self.__mouseClickToString(modifiers, button),
+                    MouseUtilities.MouseButtonModifier2String(
+                        modifiers, button),
                     self.__mouseClickHandlers[key][0],
                     name))
             return False

eric ide

mercurial