QScintilla/Editor.py

branch
maintenance
changeset 5885
5228afbb870f
parent 5752
1860eca908e4
parent 5881
13381dbbb81e
child 5948
6f958d5765f4
--- a/QScintilla/Editor.py	Fri Sep 01 12:08:49 2017 +0200
+++ b/QScintilla/Editor.py	Tue Oct 03 15:33:11 2017 +0200
@@ -381,10 +381,9 @@
         self.__setTextDisplay()
         
         # set the autocompletion and calltips function
-        self.__acHookFunction = None
         self.__completionListHookFunctions = {}
         self.__setAutoCompletion()
-        self.__ctHookFunction = None
+        
         self.__ctHookFunctions = {}
         self.__setCallTips()
         
@@ -4368,8 +4367,7 @@
         else:
             self.setAutoCompletionSource(QsciScintilla.AcsAll)
         if Preferences.getEditor("AutoCompletionEnabled"):
-            if self.__acHookFunction is None or \
-                    not self.__completionListHookFunctions:
+            if not self.__completionListHookFunctions:
                 self.setAutoCompletionThreshold(
                     Preferences.getEditor("AutoCompletionThreshold"))
             else:
@@ -4519,54 +4517,9 @@
         
         return False
     
-    #####################################################
-    ## old auto-completion hook interfaces (before 6.1.0)
-    #####################################################
-    
-    def setAutoCompletionHook(self, func):
-        """
-        Public method to set an autocompletion hook.
-        
-        @param func Function to be set to handle autocompletion. func
-            should be a function taking a reference to the editor and
-            a boolean indicating to complete a context.
-        """
-        if self.__acHookFunction is not None:
-            # there is another provider registered already
-            E5MessageBox.warning(
-                self,
-                self.tr("Activating Auto-Completion Provider"),
-                self.tr("""Auto-completion provider cannot be connected"""
-                        """ because there is already another one active."""
-                        """ Please check your configuration."""))
-            return
-        
-        if self.autoCompletionThreshold() > 0:
-            self.setAutoCompletionThreshold(0)
-        self.__acHookFunction = func
-        self.SCN_CHARADDED.connect(self.__charAdded)
-    
-    def unsetAutoCompletionHook(self):
-        """
-        Public method to unset a previously installed autocompletion hook.
-        """
-        self.SCN_CHARADDED.disconnect(self.__charAdded)
-        self.__acHookFunction = None
-        if self.autoCompletionThreshold() == 0:
-            self.setAutoCompletionThreshold(
-                Preferences.getEditor("AutoCompletionThreshold"))
-    
-    def autoCompletionHook(self):
-        """
-        Public method to get the autocompletion hook function.
-        
-        @return function set by setAutoCompletionHook()
-        """
-        return self.__acHookFunction
-    
-    ########################################################
-    ## new auto-completion hook interfaces (6.1.0 and later)
-    ########################################################
+    #################################################################
+    ## auto-completion hook interfaces
+    #################################################################
     
     def addCompletionListHook(self, key, func):
         """
@@ -4656,9 +4609,6 @@
                 completionsList.sort()
                 self.showUserList(EditorAutoCompletionListID,
                                   completionsList)
-        elif self.__acHookFunction is not None:
-            # for backward compatibility
-            self.__acHookFunction(self, context)
         elif not auto:
             self.autoCompleteQScintilla()
         elif self.autoCompletionSource() != QsciScintilla.AcsNone:
@@ -4702,14 +4652,13 @@
             (boolean)
         """
         return (self.acAPI or
-                self.__acHookFunction is not None or
                 bool(self.__completionListHookFunctions))
     
     def callTip(self):
         """
         Public method to show calltips.
         """
-        if bool(self.__ctHookFunctions) or self.__ctHookFunction is not None:
+        if bool(self.__ctHookFunctions):
             self.__callTip()
         else:
             super(Editor, self).callTip()
@@ -4759,9 +4708,6 @@
                 callTips.extend(self.__ctHookFunctions[key](self, pos, commas))
             callTips = list(set(callTips))
             callTips.sort()
-        else:
-            # for backward compatibility
-            callTips = self.__ctHookFunction(self, pos, commas)
         if len(callTips) == 0:
             if Preferences.getEditor("CallTipsScintillaOnFail"):
                 # try QScintilla calltips
@@ -4837,49 +4783,9 @@
                 ct = ct - ctshift
         return ct
     
-    ##############################################
-    ## old calltips hook interfaces (before 6.1.0)
-    ##############################################
-    
-    def setCallTipHook(self, func):
-        """
-        Public method to set a calltip hook.
-        
-        @param func Function to be set to determine calltips. func
-            should be a function taking a reference to the editor,
-            a position into the text and the amount of commas to the
-            left of the cursor. It should return the possible
-            calltips as a list of strings.
-        """
-        if self.__ctHookFunction is not None:
-            # there is another provider registered already
-            E5MessageBox.warning(
-                self,
-                self.tr("Activating Calltip Provider"),
-                self.tr("""Calltip provider cannot be connected"""
-                        """ because there is already another one active."""
-                        """ Please check your configuration."""))
-            return
-        
-        self.__ctHookFunction = func
-    
-    def unsetCallTipHook(self):
-        """
-        Public method to unset a calltip hook.
-        """
-        self.__ctHookFunction = None
-    
-    def callTipHook(self):
-        """
-        Public method to get the calltip hook function.
-        
-        @return function set by setCallTipHook()
-        """
-        return self.__ctHookFunction
-    
-    ########################################################
-    ## new auto-completion hook interfaces (6.1.0 and later)
-    ########################################################
+    #################################################################
+    ## call-tip hook interfaces
+    #################################################################
     
     def addCallTipHook(self, key, func):
         """
@@ -4937,7 +4843,6 @@
         @return flag indicating the availability of calltips (boolean)
         """
         return (self.acAPI or
-                self.__ctHookFunction is not None or
                 bool(self.__ctHookFunctions))
     
     #################################################################

eric ide

mercurial