diff -r 62d9dc4eedd5 -r 89ff060ef0d9 PluginAssistantEric.py --- a/PluginAssistantEric.py Tue May 25 17:22:05 2021 +0200 +++ b/PluginAssistantEric.py Tue May 25 17:48:25 2021 +0200 @@ -9,9 +9,9 @@ import os -from PyQt5.QtCore import QObject, QTranslator, QCoreApplication +from PyQt6.QtCore import QObject, QTranslator, QCoreApplication -from E5Gui.E5Application import e5App +from EricWidgets.EricApplication import ericApp import Preferences @@ -22,7 +22,7 @@ author = "Detlev Offenbach <detlev@die-offenbachs.de>" autoactivate = True deactivateable = True -version = "5.3.0" +version = "1.0.0" className = "AssistantEricPlugin" packageName = "AssistantEric" shortDescription = "Alternative autocompletion and calltips provider." @@ -44,40 +44,45 @@ Module function to create the autocompletion configuration page. @param configDlg reference to the configuration dialog + @type ConfigurationWidget @return reference to the configuration page + @rtype QWidget """ global assistantEricPluginObject from AssistantEric.ConfigurationPages.AutoCompletionEricPage import ( AutoCompletionEricPage ) return AutoCompletionEricPage(assistantEricPluginObject) - + def createCallTipsPage(configDlg): """ Module function to create the calltips configuration page. @param configDlg reference to the configuration dialog + @type ConfigurationWidget @return reference to the configuration page + @rtype QWidget """ global assistantEricPluginObject from AssistantEric.ConfigurationPages.CallTipsEricPage import ( CallTipsEricPage ) return CallTipsEricPage(assistantEricPluginObject) - + def getConfigData(): """ Module function returning data as required by the configuration dialog. @return dictionary containing the relevant data + @rtype dict """ try: - usesDarkPalette = e5App().usesDarkPalette() + usesDarkPalette = ericApp().usesDarkPalette() except AttributeError: - from PyQt5.QtGui import QPalette - palette = e5App().palette() + from PyQt6.QtGui import QPalette + palette = ericApp().palette() lightness = palette.color(QPalette.ColorRole.Window).lightness() usesDarkPalette = lightness <= 128 iconSuffix = "dark" if usesDarkPalette else "light" @@ -113,7 +118,8 @@ """ Constructor - @param ui reference to the user interface object (UI.UserInterface) + @param ui reference to the user interface object + @type UserInterface """ QObject.__init__(self, ui) self.__ui = ui @@ -141,14 +147,15 @@ """ Private method to perform some checks on QSql. - @return flag indicating QSql is ok (boolean) + @return flag indicating QSql is ok + @rtype bool """ global error try: - from PyQt5.QtSql import QSqlDatabase + from PyQt6.QtSql import QSqlDatabase except ImportError: - error = self.tr("PyQt5.QtSql is not available.") + error = self.tr("PyQt6.QtSql is not available.") return False drivers = QSqlDatabase.drivers() @@ -162,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 bool """ global error error = "" # clear previous error @@ -176,7 +184,7 @@ from AssistantEric.Assistant import Assistant self.__object = Assistant(self, self.__ui) - e5App().registerPluginObject("AssistantEric", self.__object) + ericApp().registerPluginObject("AssistantEric", self.__object) self.__object.activate() @@ -186,7 +194,7 @@ """ Public method to deactivate this plugin. """ - e5App().unregisterPluginObject("AssistantEric") + ericApp().unregisterPluginObject("AssistantEric") self.__object.deactivate() @@ -206,7 +214,7 @@ loaded = translator.load(translation, locale_dir) if loaded: self.__translator = translator - e5App().installTranslator(self.__translator) + ericApp().installTranslator(self.__translator) else: print("Warning: translation file '{0}' could not be" " loaded.".format(translation)) @@ -214,10 +222,12 @@ def getPreferences(self, key): """ - Public method to retrieve the various refactoring settings. + Public method to retrieve the various settings. @param key the key of the value to get - @return the requested refactoring setting + @type str + @return value of the requested setting + @rtype Any """ if key in ["AutoCompletionEnabled", "AutoCompletionFollowHierarchy", "CalltipsEnabled", "CallTipsContextShown", @@ -230,10 +240,12 @@ def setPreferences(self, key, value): """ - Public method to store the various refactoring settings. + Public method to store the various settings. - @param key the key of the setting to be set (string) - @param value the value to be set + @param key the key of the setting to be set + @type str + @param value value to be set + @type Any """ Preferences.Prefs.settings.setValue( self.PreferencesKey + "/" + key, value)