Mon, 09 Oct 2017 19:23:14 +0200
Removed bckward compatibility for eric6 before 6.1.0.
--- a/AssistantEric/APIsManager.py Sun Apr 23 17:27:36 2017 +0200 +++ b/AssistantEric/APIsManager.py Mon Oct 09 19:23:14 2017 +0200 @@ -996,6 +996,7 @@ try: forms = self.__project.getProjectFiles("FORMS") except AttributeError: + # backward compatibility < 16.12 forms = self.__project.pdata["FORMS"] for fn in forms: ofn = os.path.splitext(fn)[0] @@ -1227,6 +1228,7 @@ try: return QScintilla.Lexers.getSupportedApiLanguages() except AttributeError: + # backward compatibility < 16.12 return [lang for lang in QScintilla.Lexers.getSupportedLanguages().keys() if lang != "Guessed" and not lang.startswith("Pygments|")] @@ -1249,40 +1251,6 @@ if msg: self.__mw.statusBar().showMessage(msg, 2000) - def __apiPreparationFinished(self, language): - """ - Private slot handling the preparation finished signal of an API object. - - @param language language of the API (string) - """ - if language == ApisNameProject: - language = self.tr("Project") - self.__showMessage(self.tr("Preparation of '{0}' APIs finished.") - .format(language)) - - def __apiPreparationStarted(self, language): - """ - Private slot handling the preparation started signal of an API object. - - @param language language of the API (string) - """ - if language == ApisNameProject: - language = self.tr("Project") - self.__showMessage(self.tr("Preparation of '{0}' APIs started.") - .format(language)) - - def __apiPreparationCancelled(self, language): - """ - Private slot handling the preparation cancelled signal of an API - object. - - @param language language of the API (string) - """ - if language == ApisNameProject: - language = self.tr("Project") - self.__showMessage(self.tr("Preparation of '{0}' APIs cancelled.") - .format(language)) - def __apiPreparationStatus(self, language, status, filename): """ Private slot handling the preparation status signal of an API object.
--- a/AssistantEric/Assistant.py Sun Apr 23 17:27:36 2017 +0200 +++ b/AssistantEric/Assistant.py Mon Oct 09 19:23:14 2017 +0200 @@ -19,12 +19,9 @@ from .APIsManager import APIsManager, ApisNameProject -import Preferences - AcsAPIs = 0x0001 AcsDocument = 0x0002 AcsProject = 0x0004 -AcsOther = 0x1000 class Assistant(QObject): @@ -49,7 +46,6 @@ self.__apisManager = APIsManager(self.__ui, self) self.__editors = [] - self.__completingContext = False self.__lastContext = None self.__lastFullContext = None @@ -126,7 +122,7 @@ try: language = editor.getApiLanguage() except AttributeError: - # backward compatibility + # backward compatibility < 16.12 language = editor.apiLanguage if language: projectType = self.__getProjectType(editor) @@ -142,20 +138,10 @@ editor.editorSaved.disconnect( self.__apisManager.getAPIs(ApisNameProject).editorSaved) self.__editors.remove(editor) - try: - if editor.getCompletionListHook("Assistant"): - self.__unsetAutoCompletionHook(editor) - except AttributeError: - # old interface (before 6.1.0) - if editor.autoCompletionHook() == self.autocomplete: - self.__unsetAutoCompletionHook(editor) - try: - if editor.getCallTipHook("Assistant"): - self.__unsetCalltipsHook(editor) - except AttributeError: - # old interface (before 6.1.0) - if editor.callTipHook() == self.calltips: - self.__unsetCalltipsHook(editor) + if editor.getCompletionListHook("Assistant"): + self.__unsetAutoCompletionHook(editor) + if editor.getCallTipHook("Assistant"): + self.__unsetCalltipsHook(editor) def __preferencesChanged(self): """ @@ -185,40 +171,6 @@ ## auto-completion methods below ################################# - def __completionListSelected(self, userListId, txt): - """ - Private slot to handle the selection from the completion list. - - @param userListId the ID of the user list (should be 1) (integer) - @param txt the selected text (string) - """ - from QScintilla.Editor import EditorAutoCompletionListID - - editor = self.sender() - if userListId == EditorAutoCompletionListID: - lst = txt.split() - if len(lst) > 1: - txt = lst[0] - self.__lastFullContext = lst[1][1:].split(")")[0] - else: - self.__lastFullContext = None - - if Preferences.getEditor("AutoCompletionReplaceWord"): - editor.selectCurrentWord() - editor.removeSelectedText() - line, col = editor.getCursorPosition() - else: - line, col = editor.getCursorPosition() - wLeft = editor.getWordLeft(line, col) - if not txt.startswith(wLeft): - editor.selectCurrentWord() - editor.removeSelectedText() - line, col = editor.getCursorPosition() - elif wLeft: - txt = txt[len(wLeft):] - editor.insert(txt) - editor.setCursorPosition(line, col + len(txt)) - def __recordSelectedContext(self, userListId, txt): """ Private slot to handle the selection from the completion list to @@ -242,13 +194,8 @@ @param editor reference to the editor (QScintilla.Editor) """ - try: - editor.userListActivated.connect(self.__recordSelectedContext) - editor.addCompletionListHook("Assistant", self.getCompletionsList) - except AttributeError: - # old interface (before 6.1.0) - editor.userListActivated.connect(self.__completionListSelected) - editor.setAutoCompletionHook(self.autocomplete) + editor.userListActivated.connect(self.__recordSelectedContext) + editor.addCompletionListHook("Assistant", self.getCompletionsList) def __unsetAutoCompletionHook(self, editor): """ @@ -256,32 +203,8 @@ @param editor reference to the editor (QScintilla.Editor) """ - try: - editor.userListActivated.disconnect(self.__recordSelectedContext) - editor.removeCompletionListHook("Assistant") - except AttributeError: - # old interface (before 6.1.0) - editor.unsetAutoCompletionHook() - editor.userListActivated.disconnect(self.__completionListSelected) - - def autocomplete(self, editor, context): - """ - Public method to determine the autocompletion proposals. - - @param editor reference to the editor object, that called this method - (QScintilla.Editor) - @param context flag indicating to autocomplete a context (boolean) - """ - from QScintilla.Editor import EditorAutoCompletionListID - - if editor.isListActive(): - editor.cancelList() - - completionsList = self.getCompletionsList(editor, context) - if len(completionsList) > 0: - completionsList.sort() - editor.showUserList(EditorAutoCompletionListID, - completionsList) + editor.userListActivated.disconnect(self.__recordSelectedContext) + editor.removeCompletionListHook("Assistant") def getCompletionsList(self, editor, context): """ @@ -295,7 +218,7 @@ try: language = editor.getApiLanguage() except AttributeError: - # backward compatibility + # backward compatibility < 16.12 language = editor.apiLanguage completeFromDocumentOnly = False @@ -309,7 +232,6 @@ projectType = self.__getProjectType(editor) line, col = editor.getCursorPosition() - self.__completingContext = context sep = "" if language and context: wc = re.sub("\w", "", editor.wordCharacters()) @@ -754,11 +676,7 @@ @param editor reference to the editor (QScintilla.Editor) """ - try: - editor.addCallTipHook("Assistant", self.calltips) - except AttributeError: - # old interface (before 6.1.0) - editor.setCallTipHook(self.calltips) + editor.addCallTipHook("Assistant", self.calltips) def __unsetCalltipsHook(self, editor): """ @@ -766,11 +684,7 @@ @param editor reference to the editor (QScintilla.Editor) """ - try: - editor.removeCallTipHook("Assistant") - except AttributeError: - # old interface (before 6.1.0) - editor.unsetCallTipHook() + editor.removeCallTipHook("Assistant") def calltips(self, editor, pos, commas): """ @@ -785,7 +699,7 @@ try: language = editor.getApiLanguage() except AttributeError: - # backward compatibility + # backward compatibility < 16.12 language = editor.apiLanguage completeFromDocumentOnly = False
--- a/AssistantEric/Documentation/source/Plugin_Assistant_Eric.AssistantEric.APIsManager.html Sun Apr 23 17:27:36 2017 +0200 +++ b/AssistantEric/Documentation/source/Plugin_Assistant_Eric.AssistantEric.APIsManager.html Mon Oct 09 19:23:14 2017 +0200 @@ -67,15 +67,6 @@ <td><a href="#APIsManager.__init__">APIsManager</a></td> <td>Constructor</td> </tr><tr> -<td><a href="#APIsManager.__apiPreparationCancelled">__apiPreparationCancelled</a></td> -<td>Private slot handling the preparation cancelled signal of an API object.</td> -</tr><tr> -<td><a href="#APIsManager.__apiPreparationFinished">__apiPreparationFinished</a></td> -<td>Private slot handling the preparation finished signal of an API object.</td> -</tr><tr> -<td><a href="#APIsManager.__apiPreparationStarted">__apiPreparationStarted</a></td> -<td>Private slot handling the preparation started signal of an API object.</td> -</tr><tr> <td><a href="#APIsManager.__apiPreparationStatus">__apiPreparationStatus</a></td> <td>Private slot handling the preparation status signal of an API object.</td> </tr><tr> @@ -112,37 +103,6 @@ <dd> reference to the parent object (QObject) </dd> -</dl><a NAME="APIsManager.__apiPreparationCancelled" ID="APIsManager.__apiPreparationCancelled"></a> -<h4>APIsManager.__apiPreparationCancelled</h4> -<b>__apiPreparationCancelled</b>(<i>language</i>) -<p> - Private slot handling the preparation cancelled signal of an API - object. -</p><dl> -<dt><i>language</i></dt> -<dd> -language of the API (string) -</dd> -</dl><a NAME="APIsManager.__apiPreparationFinished" ID="APIsManager.__apiPreparationFinished"></a> -<h4>APIsManager.__apiPreparationFinished</h4> -<b>__apiPreparationFinished</b>(<i>language</i>) -<p> - Private slot handling the preparation finished signal of an API object. -</p><dl> -<dt><i>language</i></dt> -<dd> -language of the API (string) -</dd> -</dl><a NAME="APIsManager.__apiPreparationStarted" ID="APIsManager.__apiPreparationStarted"></a> -<h4>APIsManager.__apiPreparationStarted</h4> -<b>__apiPreparationStarted</b>(<i>language</i>) -<p> - Private slot handling the preparation started signal of an API object. -</p><dl> -<dt><i>language</i></dt> -<dd> -language of the API (string) -</dd> </dl><a NAME="APIsManager.__apiPreparationStatus" ID="APIsManager.__apiPreparationStatus"></a> <h4>APIsManager.__apiPreparationStatus</h4> <b>__apiPreparationStatus</b>(<i>language, status, filename</i>)
--- a/AssistantEric/Documentation/source/Plugin_Assistant_Eric.AssistantEric.Assistant.html Sun Apr 23 17:27:36 2017 +0200 +++ b/AssistantEric/Documentation/source/Plugin_Assistant_Eric.AssistantEric.Assistant.html Mon Oct 09 19:23:14 2017 +0200 @@ -26,7 +26,7 @@ </p> <h3>Global Attributes</h3> <table> -<tr><td>AcsAPIs</td></tr><tr><td>AcsDocument</td></tr><tr><td>AcsOther</td></tr><tr><td>AcsProject</td></tr> +<tr><td>AcsAPIs</td></tr><tr><td>AcsDocument</td></tr><tr><td>AcsProject</td></tr> </table> <h3>Classes</h3> <table> @@ -61,9 +61,6 @@ <td><a href="#Assistant.__init__">Assistant</a></td> <td>Constructor</td> </tr><tr> -<td><a href="#Assistant.__completionListSelected">__completionListSelected</a></td> -<td>Private slot to handle the selection from the completion list.</td> -</tr><tr> <td><a href="#Assistant.__editorClosed">__editorClosed</a></td> <td>Private slot called, when an editor was closed.</td> </tr><tr> @@ -112,9 +109,6 @@ <td><a href="#Assistant.activate">activate</a></td> <td>Public method to perform actions upon activation.</td> </tr><tr> -<td><a href="#Assistant.autocomplete">autocomplete</a></td> -<td>Public method to determine the autocompletion proposals.</td> -</tr><tr> <td><a href="#Assistant.calltips">calltips</a></td> <td>Public method to return a list of calltips.</td> </tr><tr> @@ -145,19 +139,6 @@ <dd> parent (QObject) </dd> -</dl><a NAME="Assistant.__completionListSelected" ID="Assistant.__completionListSelected"></a> -<h4>Assistant.__completionListSelected</h4> -<b>__completionListSelected</b>(<i>userListId, txt</i>) -<p> - Private slot to handle the selection from the completion list. -</p><dl> -<dt><i>userListId</i></dt> -<dd> -the ID of the user list (should be 1) (integer) -</dd><dt><i>txt</i></dt> -<dd> -the selected text (string) -</dd> </dl><a NAME="Assistant.__editorClosed" ID="Assistant.__editorClosed"></a> <h4>Assistant.__editorClosed</h4> <b>__editorClosed</b>(<i>editor</i>) @@ -431,21 +412,7 @@ <b>activate</b>(<i></i>) <p> Public method to perform actions upon activation. -</p><a NAME="Assistant.autocomplete" ID="Assistant.autocomplete"></a> -<h4>Assistant.autocomplete</h4> -<b>autocomplete</b>(<i>editor, context</i>) -<p> - Public method to determine the autocompletion proposals. -</p><dl> -<dt><i>editor</i></dt> -<dd> -reference to the editor object, that called this method - (QScintilla.Editor) -</dd><dt><i>context</i></dt> -<dd> -flag indicating to autocomplete a context (boolean) -</dd> -</dl><a NAME="Assistant.calltips" ID="Assistant.calltips"></a> +</p><a NAME="Assistant.calltips" ID="Assistant.calltips"></a> <h4>Assistant.calltips</h4> <b>calltips</b>(<i>editor, pos, commas</i>) <p>
--- a/ChangeLog Sun Apr 23 17:27:36 2017 +0200 +++ b/ChangeLog Mon Oct 09 19:23:14 2017 +0200 @@ -1,5 +1,9 @@ ChangeLog --------- +Version 4.0.0: +- bug fixes +- removed bckward compatibility for eric6 before 6.1.0 + Version 3.2.3: - bug fixes
--- a/PluginAssistantEric.py Sun Apr 23 17:27:36 2017 +0200 +++ b/PluginAssistantEric.py Mon Oct 09 19:23:14 2017 +0200 @@ -24,7 +24,7 @@ author = "Detlev Offenbach <detlev@die-offenbachs.de>" autoactivate = True deactivateable = True -version = "3.2.3" +version = "4.0.0" className = "AssistantEricPlugin" packageName = "AssistantEric" shortDescription = "Alternative autocompletion and calltips provider."
--- a/PluginEricAssistant.e4p Sun Apr 23 17:27:36 2017 +0200 +++ b/PluginEricAssistant.e4p Mon Oct 09 19:23:14 2017 +0200 @@ -8,7 +8,7 @@ <ProgLanguage mixed="0">Python3</ProgLanguage> <ProjectType>E6Plugin</ProjectType> <Description>Plugin implementing an alternative autocompletion and calltips provider.</Description> - <Version>3.x</Version> + <Version>4.x</Version> <Author>Detlev Offenbach</Author> <Email>detlev@die-offenbachs.de</Email> <TranslationPattern>AssistantEric/i18n/assistant_%language%.ts</TranslationPattern>