diff -r 1584892147ef -r e677d82706d4 PluginRefactoringRope.py --- a/PluginRefactoringRope.py Wed Sep 27 19:02:58 2017 +0200 +++ b/PluginRefactoringRope.py Wed Sep 27 19:30:16 2017 +0200 @@ -90,6 +90,7 @@ Module function returning data as required by the configuration dialog. @return dictionary containing the relevant data + @rtype dict """ data = { "ropeAutoCompletionPage": [ @@ -129,7 +130,8 @@ """ Constructor - @param ui reference to the user interface object (UI.UserInterface) + @param ui reference to the user interface object + @type UI.UserInterface """ QObject.__init__(self, ui) self.__ui = ui @@ -167,7 +169,8 @@ """ Public method to activate this plugin. - @return tuple of None and activation status (boolean) + @return tuple of None and activation status + @rtype tuple of (None, bool) """ global refactoringRopePluginObject refactoringRopePluginObject = self @@ -248,6 +251,7 @@ Public method to retrieve the various refactoring settings. @param key the key of the value to get + @type str @return the requested refactoring setting """ if key in ["CodeAssistEnabled", "CodeAssistCalltipsEnabled", @@ -262,7 +266,8 @@ """ Public method to store the various refactoring settings. - @param key the key of the setting to be set (string) + @param key the key of the setting to be set + @type str @param value the value to be set """ Preferences.Prefs.settings.setValue( @@ -284,41 +289,18 @@ self.__disconnectMouseClickHandler(editor) self.__connectMouseClickHandler(editor) - # TODO: get this info from CodeAssistClient or Server - def __determineLanguages(self): - """ - Private method to determine the valid language strings. - - @return list of valid language strings (list of string) - """ - langs = [] - - interpreter = Preferences.getDebugger("PythonInterpreter") - if interpreter and Utilities.isinpath(interpreter): - langs.extend(["Python", "Python2", "Pygments|Python"]) - - interpreter = Preferences.getDebugger("Python3Interpreter") - if interpreter and Utilities.isinpath(interpreter): - langs.extend(["Python3", "Pygments|Python 3"]) - - return langs - - # TODO: move this to CodeAssistServer def __editorOpened(self, editor): """ Private slot called, when a new editor was opened. @param editor reference to the new editor (QScintilla.Editor) """ - langs = self.__determineLanguages() - - if editor.getLanguage() in langs: + if self.__codeAssistServer.isSupportedLanguage(editor.getLanguage()): self.__connectEditor(editor) editor.languageChanged.connect(self.__editorLanguageChanged) self.__editors.append(editor) - # TODO: move this to CodeAssistServer def __editorClosed(self, editor): """ Private slot called, when an editor was closed. @@ -330,7 +312,6 @@ self.__disconnectEditor(editor) self.__editors.remove(editor) - # TODO: move this to CodeAssistServer def __editorLanguageChanged(self, language): """ Private slot to handle the language change of an editor. @@ -338,9 +319,8 @@ @param language programming language of the editor (string) """ editor = self.sender() - langs = self.__determineLanguages() - if language in langs: + if self.__codeAssistServer.isSupportedLanguage(language): if editor.getCompletionListHook("rope") is None or \ editor.getCallTipHook("rope") is None: self.__connectEditor(editor) @@ -356,7 +336,6 @@ editor.editorAboutToBeSaved.connect(self.__editorAboutToBeSaved) editor.editorSaved.connect(self.__editorSaved) - # TODO: move this to CodeAssistServer if self.getPreferences("CodeAssistEnabled"): self.__setAutoCompletionHook(editor) if self.getPreferences("CodeAssistCalltipsEnabled"): @@ -393,7 +372,6 @@ # just ignore it pass - # TODO: move this to CodeAssistServer if editor.getCompletionListHook("rope"): self.__unsetAutoCompletionHook(editor) if editor.getCallTipHook("rope"): @@ -401,7 +379,6 @@ self.__disconnectMouseClickHandler(editor) - # TODO: move this to CodeAssistServer def __disconnectMouseClickHandler(self, editor): """ Private method to disconnect the mouse click handler from an editor. @@ -410,7 +387,6 @@ """ editor.removeMouseClickHandlers("rope") - # TODO: move this to CodeAssistServer def __setAutoCompletionHook(self, editor): """ Private method to set the autocompletion hook. @@ -419,7 +395,6 @@ """ editor.addCompletionListHook("rope", self.getCompletionsList) - # TODO: move this to CodeAssistServer def __unsetAutoCompletionHook(self, editor): """ Private method to unset the autocompletion hook. @@ -428,7 +403,6 @@ """ editor.removeCompletionListHook("rope") - # TODO: move this to CodeAssistServer def getCompletionsList(self, editor, context): """ Public method to get a list of possible completions. @@ -472,7 +446,6 @@ self.__refactoringServer.reportChanged(filename, "") self.__codeAssistServer.reportChanged(filename, "") - # TODO: move this to CodeAssistServer def __setCalltipsHook(self, editor): """ Private method to set the calltip hook. @@ -481,7 +454,6 @@ """ editor.addCallTipHook("rope", self.codeAssistCallTip) - # TODO: move this to CodeAssistServer def __unsetCalltipsHook(self, editor): """ Private method to unset the calltip hook. @@ -490,7 +462,6 @@ """ editor.removeCallTipHook("rope") - # TODO: move this to CodeAssistServer def codeAssistCallTip(self, editor, pos, commas): """ Public method to return a list of calltips.