QScintilla/QsciScintillaCompat.py

branch
Py2 comp.
changeset 3178
f25fc1364c88
parent 3161
06f57a834adf
parent 3176
51feb6174cc2
child 3484
645c12de6b0c
--- a/QScintilla/QsciScintillaCompat.py	Wed Jan 01 14:39:32 2014 +0100
+++ b/QScintilla/QsciScintillaCompat.py	Sun Jan 05 23:22:17 2014 +0100
@@ -490,6 +490,16 @@
         """
         return self.getSelection()[0] != -1
     
+    def hasSelectedText(self):
+        """
+        Public method to indicate the presence of selected text.
+        
+        This is an overriding method to cope with a bug in QsciScintilla.
+        
+        @return flag indicating the presence of selected text (boolean)
+        """
+        return bool(self.selectedText())
+    
     def selectionIsRectangle(self):
         """
         Public method to check, if the current selection is rectangular.
@@ -701,7 +711,7 @@
             pass
     
     ###########################################################################
-    # methods to perform searches in target range
+    ## methods to perform searches in target range
     ###########################################################################
     
     def positionFromPoint(self, point):
@@ -877,7 +887,7 @@
         self.__targetSearchStart = start + len(r)
     
     ###########################################################################
-    # indicator handling methods
+    ## indicator handling methods
     ###########################################################################
     
     def indicatorDefine(self, indicator, style, color):
@@ -1042,7 +1052,7 @@
             self.SendScintilla(QsciScintilla.SCI_FINDINDICATORHIDE)
     
     ###########################################################################
-    # methods to perform folding related stuff
+    ## methods to perform folding related stuff
     ###########################################################################
     
     def __setFoldMarker(self, marknr, mark=QsciScintilla.SC_MARK_EMPTY):
@@ -1143,7 +1153,7 @@
                            QsciScintilla.SC_MARKNUM_FOLDEREND, backColor)
     
     ###########################################################################
-    # interface methods to the standard keyboard command set
+    ## interface methods to the standard keyboard command set
     ###########################################################################
     
     def clearKeys(self):
@@ -1161,7 +1171,7 @@
         self.standardCommands().clearAlternateKeys()
 
     ###########################################################################
-    # specialized event handlers
+    ## specialized event handlers
     ###########################################################################
     
     def focusOutEvent(self, event):
@@ -1186,9 +1196,37 @@
         @return result of the event handling (boolean)
         """
         return QsciScintillaBase.event(self, evt)
+    
+    # TODO: adjust this once we have a working QScintilla version
+    if "inputMethodEvent" in QsciScintillaBase.__dict__ and \
+            QSCINTILLA_VERSION() < 0x020900:
+        def inputMethodEvent(self, evt):
+            """
+            Protected method to cope with a glitch in some Qscintilla versions
+            handling input events.
+            
+            Note: This simply disables the Qscintilla behavior.
+            
+            @param evt reference to the input method event object
+                (QInputMethodEvent)
+            """
+            pass
+        
+        def inputMethodQuery(self, query):
+            """
+            Protected method to cope with a glitch in some Qscintilla versions
+            handling input events.
+            
+            Note: This simply disables the Qscintilla behavior.
+            
+            @param query reference to the input method query object
+                (Qt.InputMethodQuery)
+            @return object containing the requested information
+            """
+            return None
 
     ###########################################################################
-    # interface methods to the mini editor
+    ## interface methods to the mini editor
     ###########################################################################
 
     def getFileName(self):
@@ -1207,7 +1245,7 @@
                 return ""
     
     ###########################################################################
-    # replacements for buggy methods
+    ## replacements for buggy methods
     ###########################################################################
     
     def showUserList(self, id, lst):
@@ -1226,7 +1264,7 @@
                            self._encodeString(self.UserSeparator.join(lst)))
     
     ###########################################################################
-    # utility methods
+    ## utility methods
     ###########################################################################
     
     def _encodeString(self, string):
@@ -1245,7 +1283,7 @@
                 return string.encode("latin-1")
     
     ###########################################################################
-    # methods below have been added to QScintilla starting with version 2.5
+    ## methods below have been added to QScintilla starting with version 2.5
     ###########################################################################
     
     if "positionFromLineIndex" not in QsciScintilla.__dict__:

eric ide

mercurial