--- a/QScintilla/Editor.py Sun Oct 15 17:21:51 2017 +0200 +++ b/QScintilla/Editor.py Sun Oct 15 19:40:26 2017 +0200 @@ -4553,6 +4553,7 @@ ## auto-completion hook interfaces ################################################################# + # TODO: document this hook in chapter 6.2 of plug-in document def addCompletionListHook(self, key, func, async=False): """ Public method to set an auto-completion list provider. @@ -4591,6 +4592,7 @@ else: self.__completionListHookFunctions[key] = func + # TODO: document this hook in chapter 6.2 of plug-in document def removeCompletionListHook(self, key): """ Public method to remove a previously registered completion list @@ -4611,6 +4613,7 @@ self.setAutoCompletionThreshold( Preferences.getEditor("AutoCompletionThreshold")) + # TODO: document this hook in chapter 6.2 of plug-in document def getCompletionListHook(self, key): """ Public method to get the registered completion list provider. @@ -4683,6 +4686,7 @@ self, context) self.completionsListReady(completions, self.__acText) + # TODO: document this hook in chapter 6.2 of plug-in document def completionsListReady(self, completions, acText): """ Public method to show the completions determined by a completions @@ -4780,6 +4784,70 @@ bool(self.__completionListHookFunctions) or bool(self.__completionListAsyncHookFunctions)) + ################################################################# + ## call-tip hook interfaces + ################################################################# + + # TODO: document this hook in chapter 6.2 of plug-in document + def addCallTipHook(self, key, func): + """ + Public method to set a calltip provider. + + @param key name of the provider + @type str + @param func function providing 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. + @type function(editor, int, int) -> list of str + """ + if key in self.__ctHookFunctions: + # it was already registered + E5MessageBox.warning( + self, + self.tr("Call-Tips Provider"), + self.tr("""The call-tips provider '{0}' was already""" + """ registered. Ignoring duplicate request.""") + .format(key)) + return + + self.__ctHookFunctions[key] = func + + # TODO: document this hook in chapter 6.2 of plug-in document + def removeCallTipHook(self, key): + """ + Public method to remove a previously registered calltip provider. + + @param key name of the provider + @type str + """ + if key in self.__ctHookFunctions: + del self.__ctHookFunctions[key] + + # TODO: document this hook in chapter 6.2 of plug-in document + def getCallTipHook(self, key): + """ + Public method to get the registered calltip provider. + + @param key name of the provider + @type str + @return function providing calltips + @rtype function or None + """ + if key in self.__ctHookFunctions: + return self.__ctHookFunctions[key] + else: + return None + + def canProvideCallTipps(self): + """ + Public method to test the calltips availability. + + @return flag indicating the availability of calltips (boolean) + """ + return (self.acAPI or + bool(self.__ctHookFunctions)) def callTip(self): """ Public method to show calltips. @@ -4909,67 +4977,6 @@ ct = ct - ctshift return ct - ################################################################# - ## call-tip hook interfaces - ################################################################# - - def addCallTipHook(self, key, func): - """ - Public method to set a calltip provider. - - @param key name of the provider - @type str - @param func function providing 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. - @type function(editor, int, int) -> list of str - """ - if key in self.__ctHookFunctions: - # it was already registered - E5MessageBox.warning( - self, - self.tr("Call-Tips Provider"), - self.tr("""The call-tips provider '{0}' was already""" - """ registered. Ignoring duplicate request.""") - .format(key)) - return - - self.__ctHookFunctions[key] = func - - def removeCallTipHook(self, key): - """ - Public method to remove a previously registered calltip provider. - - @param key name of the provider - @type str - """ - if key in self.__ctHookFunctions: - del self.__ctHookFunctions[key] - - def getCallTipHook(self, key): - """ - Public method to get the registered calltip provider. - - @param key name of the provider - @type str - @return function providing calltips - @rtype function or None - """ - if key in self.__ctHookFunctions: - return self.__ctHookFunctions[key] - else: - return None - - def canProvideCallTipps(self): - """ - Public method to test the calltips availability. - - @return flag indicating the availability of calltips (boolean) - """ - return (self.acAPI or - bool(self.__ctHookFunctions)) ################################################################# ## Methods needed by the code documentation viewer @@ -4985,7 +4992,7 @@ @param charNumber value of the character entered (integer) """ char = chr(charNumber) - if char == "(" and Preferences.getEditor("ShowInfoOnOpenBracket"): + if char == "(" and Preferences.getEditor("ShowInfoOnOpenParenthesis"): self.vm.showEditorInfo(self) #################################################################