QScintilla/Editor.py

changeset 4133
3d868439dddc
parent 4074
95c24977f68f
child 4142
7e138a214147
child 4171
97591cba48c0
--- a/QScintilla/Editor.py	Wed Feb 25 19:21:32 2015 +0100
+++ b/QScintilla/Editor.py	Fri Feb 27 19:43:04 2015 +0100
@@ -1561,7 +1561,7 @@
         
         # initialize the lexer APIs settings
         api = self.vm.getAPIsManager().getAPIs(self.apiLanguage)
-        if api is not None:
+        if api is not None and not api.isEmpty():
             self.lexer_.setAPIs(api.getQsciAPIs())
             self.acAPI = True
         else:
@@ -4627,6 +4627,23 @@
         """
         return self.__ctHookFunction
     
+    def canProvideCallTipps(self):
+        """
+        Public method to test the calltips availability.
+        
+        @return flag indicating the availability of calltips (boolean)
+        """
+        return self.acAPI or self.__ctHookFunction is not None
+    
+    def canProvideDynamicAutoCompletion(self):
+        """
+        Public method to test the dynamic auto-completion availability.
+        
+        @return flag indicating the availability of dynamic auto-completion
+            (boolean)
+        """
+        return self.acAPI or self.__acHookFunction is not None
+    
     #################################################################
     ## Methods needed by the context menu
     #################################################################
@@ -4749,10 +4766,10 @@
         Private slot called before the autocompletion menu is shown.
         """
         self.menuActs["acDynamic"].setEnabled(
-            self.acAPI or self.__acHookFunction is not None)
+            self.canProvideDynamicAutoCompletion())
         self.menuActs["acAPI"].setEnabled(self.acAPI)
         self.menuActs["acAPIDocument"].setEnabled(self.acAPI)
-        self.menuActs["calltip"].setEnabled(self.acAPI)
+        self.menuActs["calltip"].setEnabled(self.canProvideCallTipps())
         
         self.showMenu.emit("Autocompletion", self.autocompletionMenu, self)
         

eric ide

mercurial