--- a/PluginProjectKivy.py Thu May 27 18:09:18 2021 +0200 +++ b/PluginProjectKivy.py Thu May 27 18:21:00 2021 +0200 @@ -11,9 +11,9 @@ import glob import fnmatch -from PyQt5.QtCore import QObject, QTranslator +from PyQt6.QtCore import QObject, QTranslator -from E5Gui.E5Application import e5App +from EricWidgets.EricApplication import ericApp import Preferences @@ -24,7 +24,7 @@ author = "Detlev Offenbach <detlev@die-offenbachs.de>" autoactivate = True deactivateable = True -version = "3.0.0" +version = "1.0.0" className = "ProjectKivyPlugin" packageName = "ProjectKivy" shortDescription = "Project support for Kivy projects." @@ -42,8 +42,10 @@ """ Module function to return the API files made available by this plugin. - @param language language to get API file for (string) - @return list of API filenames (list of string) + @param language language to get API file for + @type str + @return list of API filenames + @rtype list of str """ if language in ["Python3"]: apisDir = os.path.join(os.path.dirname(__file__), @@ -75,7 +77,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 @@ -88,15 +91,16 @@ """ Private slot to (re)initialize the plugin. """ - self.__e5project = e5App().getObject("Project") + self.__ericProject = ericApp().getObject("Project") def activate(self): """ Public method to activate this plugin. - @return tuple of None and activation status (boolean) + @return tuple of None and activation status + @rtype bool """ - self.__e5project.registerProjectType( + self.__ericProject.registerProjectType( "Kivy", self.tr("Kivy"), self.fileTypesCallback, lexerAssociationCallback=self.lexerAssociationCallback, progLanguages=["Python3"]) @@ -131,7 +135,7 @@ """ Public method to deactivate this plugin. """ - self.__e5project.unregisterProjectType("Kivy") + self.__ericProject.unregisterProjectType("Kivy") import QScintilla.Lexers QScintilla.Lexers.unregisterLexer("Kivy") @@ -154,7 +158,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)) @@ -165,8 +169,9 @@ Public method get the filetype associations of the Kivy project type. @return dictionary with file type associations + @rtype dict """ - if self.__e5project.getProjectType() == "Kivy": + if self.__ericProject.getProjectType() == "Kivy": return { "*.kv": "SOURCES", "*.kivy": "SOURCES", @@ -180,9 +185,11 @@ Public method to get the lexer association of the Kivy project type for a file. - @param filename name of the file (string) - @return name of the lexer (string) (Pygments lexers are prefixed with + @param filename name of the file + @type str + @return name of the lexer (Pygments lexers are prefixed with 'Pygments|') + @rtype str """ for pattern, language in self.lexerAssociations.items(): if fnmatch.fnmatch(filename, pattern): @@ -194,8 +201,10 @@ """ Public method to instantiate a Pygments Kivy lexer object. - @param parent reference to the parent object (QObject) - @return reference to the instanciated lexer object (QsciLexer) + @param parent reference to the parent object + @type QObject + @return reference to the instanciated lexer object + @rtype QsciLexer """ from QScintilla.Lexers.LexerPygments import LexerPygments lexer = LexerPygments(parent, name="Kivy")