--- a/PluginProjectKivy.py Wed Jan 01 11:58:58 2020 +0100 +++ b/PluginProjectKivy.py Mon Jun 22 19:38:53 2020 +0200 @@ -7,8 +7,6 @@ Module implementing the Kivy project plug-in. """ -from __future__ import unicode_literals - import os import glob import fnmatch @@ -26,15 +24,15 @@ author = "Detlev Offenbach <detlev@die-offenbachs.de>" autoactivate = True deactivateable = True -version = "2.0.3" +version = "3.0.0" className = "ProjectKivyPlugin" packageName = "ProjectKivy" shortDescription = "Project support for Kivy projects." -longDescription = \ +longDescription = ( """This plugin implements project support for Kivy projects.""" +) needsRestart = False pyqtApi = 2 -python2Compatible = True # End-of-Header error = "" @@ -47,13 +45,12 @@ @param language language to get API file for (string) @return list of API filenames (list of string) """ - if language in ["Python2"]: - apisDir = \ - os.path.join(os.path.dirname(__file__), "ProjectKivy", "APIs") - apis = glob.glob(os.path.join(apisDir, '*.api')) + if language in ["Python3"]: + apisDir = os.path.join(os.path.dirname(__file__), + "ProjectKivy", "APIs") + return glob.glob(os.path.join(apisDir, '*.api')) else: - apis = [] - return apis + return [] class ProjectKivyPlugin(QObject): @@ -99,19 +96,15 @@ @return tuple of None and activation status (boolean) """ - try: - self.__e5project.registerProjectType( - "Kivy", self.tr("Kivy"), self.fileTypesCallback, - lexerAssociationCallback=self.lexerAssociationCallback, - progLanguages=["Python2"]) - except TypeError: - # for backward compatibility - self.__e5project.registerProjectType( - "Kivy", self.tr("Kivy"), self.fileTypesCallback, - lexerAssociationCallback=self.lexerAssociationCallback) + self.__e5project.registerProjectType( + "Kivy", self.tr("Kivy"), self.fileTypesCallback, + lexerAssociationCallback=self.lexerAssociationCallback, + progLanguages=["Python3"]) - from Project.ProjectBrowser import SourcesBrowserFlag, \ - FormsBrowserFlag, TranslationsBrowserFlag, OthersBrowserFlag + from Project.ProjectBrowser import ( + SourcesBrowserFlag, FormsBrowserFlag, TranslationsBrowserFlag, + OthersBrowserFlag + ) Preferences.setProjectBrowserFlagsDefault( "Kivy", SourcesBrowserFlag | @@ -174,14 +167,13 @@ @return dictionary with file type associations """ if self.__e5project.getProjectType() == "Kivy": - fileTypes = { + return { "*.kv": "SOURCES", "*.kivy": "SOURCES", "*.py": "SOURCES", } else: - fileTypes = {} - return fileTypes + return {} def lexerAssociationCallback(self, filename): """