--- a/PluginAssistantEric.py Sun May 22 11:33:46 2011 +0200 +++ b/PluginAssistantEric.py Sat Jul 30 10:46:53 2011 +0200 @@ -23,7 +23,7 @@ author = "Detlev Offenbach <detlev@die-offenbachs.de>" autoactivate = True deactivateable = True -version = "2.1.2" +version = "2.2.0" className = "AssistantEricPlugin" packageName = "AssistantEric" shortDescription = "Alternative autocompletion and calltips provider." @@ -37,6 +37,7 @@ assistantEricPluginObject = None + def createAutoCompletionPage(configDlg): """ Module function to create the autocompletion configuration page. @@ -49,6 +50,7 @@ page = AutoCompletionEricPage(assistantEricPluginObject) return page + def createCallTipsPage(configDlg): """ Module function to create the calltips configuration page. @@ -61,6 +63,7 @@ page = CallTipsEricPage(assistantEricPluginObject) return page + def getConfigData(): """ Module function returning data as required by the configuration dialog. @@ -68,18 +71,19 @@ @return dictionary containing the relevant data """ return { - "ericAutoCompletionPage" : \ - [QApplication.translate("AssistantEricPlugin", "Eric"), - os.path.join("AssistantEric", "ConfigurationPages", + "ericAutoCompletionPage": \ + [QApplication.translate("AssistantEricPlugin", "Eric"), + os.path.join("AssistantEric", "ConfigurationPages", "eric.png"), createAutoCompletionPage, "editorAutocompletionPage", None], - "ericCallTipsPage" : \ - [QApplication.translate("AssistantEricPlugin", "Eric"), - os.path.join("AssistantEric", "ConfigurationPages", + "ericCallTipsPage": \ + [QApplication.translate("AssistantEricPlugin", "Eric"), + os.path.join("AssistantEric", "ConfigurationPages", "eric.png"), createCallTipsPage, "editorCalltipsPage", None], } + def prepareUninstall(): """ Module function to prepare for an uninstallation. @@ -87,6 +91,7 @@ assistant = AssistantEricPlugin(None) assistant.prepareUninstall() + class AssistantEricPlugin(QObject): """ Class implementing the Eric assistant plugin. @@ -101,13 +106,11 @@ self.__ui = ui self.__initialize() - self.__newStyle = ui.versionIsNewer("5.0.99", "20100811") - self.__defaults = { - "AutoCompletionEnabled" : False, - "AutoCompletionSource" : AcsAPIs | AcsProject, - "CalltipsEnabled" : False, - "CallTipsContextShown" : 1, + "AutoCompletionEnabled": False, + "AutoCompletionSource": AcsAPIs | AcsProject, + "CalltipsEnabled": False, + "CallTipsContextShown": 1, } self.__translator = None @@ -119,6 +122,19 @@ """ self.__object = None + def __checkUiVersion(self): + """ + Private method to check, if the IDE has a suitable version. + + @return flag indicating a suitable version (boolean) + """ + global error + + suitable = self.__ui.versionIsNewer("5.0.99", "20100811") + if not suitable: + error = self.trUtf8("Your version of eric5 is not supported.") + return suitable + def __checkQSql(self): """ Private method to perform some checks on QSql. @@ -149,7 +165,8 @@ global error error = "" # clear previous error - if not self.__checkQSql(): + if not self.__checkUiVersion() or \ + not self.__checkQSql(): return None, False global assistantEricPluginObject @@ -157,7 +174,7 @@ from AssistantEric.Assistant import Assistant - self.__object = Assistant(self, self.__newStyle, self.__ui) + self.__object = Assistant(self, self.__ui) e5App().registerPluginObject("AssistantEric", self.__object) self.__object.activate()