Mon, 26 Apr 2021 17:41:12 +0200
- removed support for obsolete eric6 versions
- implemented some code simplifications
--- a/ChangeLog Wed Dec 30 11:02:09 2020 +0100 +++ b/ChangeLog Mon Apr 26 17:41:12 2021 +0200 @@ -1,5 +1,9 @@ ChangeLog --------- +Version 4.0.0: +- removed support for obsolete eric6 versions +- implemented some code simplifications + Version 3.1.0: - changed exec_() into exec()
--- a/PluginProjectPyramid.py Wed Dec 30 11:02:09 2020 +0100 +++ b/PluginProjectPyramid.py Mon Apr 26 17:41:12 2021 +0200 @@ -26,7 +26,7 @@ author = "Detlev Offenbach <detlev@die-offenbachs.de>" autoactivate = True deactivateable = True -version = "3.1.0" +version = "4.0.0" className = "ProjectPyramidPlugin" packageName = "ProjectPyramid" shortDescription = "Project support for Pyramid projects." @@ -63,14 +63,12 @@ try: usesDarkPalette = e5App().usesDarkPalette() except AttributeError: + # code for eric < 20.4 from PyQt5.QtGui import QPalette palette = e5App().palette() lightness = palette.color(QPalette.Window).lightness() usesDarkPalette = lightness <= 128 - if usesDarkPalette: - iconSuffix = "dark" - else: - iconSuffix = "light" + iconSuffix = "dark" if usesDarkPalette else "light" return { "pyramidPage": [ @@ -176,14 +174,12 @@ try: usesDarkPalette = e5App().usesDarkPalette() except AttributeError: + # code for eric < 20.4 from PyQt5.QtGui import QPalette palette = e5App().palette() lightness = palette.color(QPalette.Window).lightness() usesDarkPalette = lightness <= 128 - if usesDarkPalette: - iconSuffix = "dark" - else: - iconSuffix = "light" + iconSuffix = "dark" if usesDarkPalette else "light" self.__object = Project(self, iconSuffix, self.__ui) self.__object.initActions() @@ -194,20 +190,12 @@ self.__supportedVariants = self.__object.supportedPythonVariants() if self.__supportedVariants: - try: - self.__e5project.registerProjectType( - "Pyramid", self.tr("Pyramid"), - self.fileTypesCallback, - lexerAssociationCallback=self.lexerAssociationCallback, - binaryTranslationsCallback=self.binaryTranslationsCallback, - progLanguages=self.__supportedVariants[:]) - except TypeError: - # for backward compatibility - self.__e5project.registerProjectType( - "Pyramid", self.tr("Pyramid"), - self.fileTypesCallback, - lexerAssociationCallback=self.lexerAssociationCallback, - binaryTranslationsCallback=self.binaryTranslationsCallback) + self.__e5project.registerProjectType( + "Pyramid", self.tr("Pyramid"), + self.fileTypesCallback, + lexerAssociationCallback=self.lexerAssociationCallback, + binaryTranslationsCallback=self.binaryTranslationsCallback, + progLanguages=self.__supportedVariants[:]) from Project.ProjectBrowser import ( SourcesBrowserFlag, FormsBrowserFlag, TranslationsBrowserFlag, @@ -406,9 +394,8 @@ if key in ["VirtualEnvironmentNamePy3"]: self.__reregisterProjectType() - elif key == "TranslationsEditor": - if self.__object: - self.__object.registerOpenHook() + elif key == "TranslationsEditor" and self.__object: + self.__object.registerOpenHook() def __reregisterProjectType(self): """
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/PluginPyramid.epj Mon Apr 26 17:41:12 2021 +0200 @@ -0,0 +1,291 @@ +{ + "header": { + "comment": "eric project file for project PluginPyramid", + "copyright": "Copyright (C) 2021 Detlev Offenbach, detlev@die-offenbachs.de" + }, + "project": { + "AUTHOR": "Detlev Offenbach", + "CHECKERSPARMS": { + "Pep8Checker": { + "AnnotationsChecker": { + "AllowUntypedDefs": false, + "AllowUntypedNested": false, + "DispatchDecorators": [ + "singledispatch", + "singledispatchmethod" + ], + "MaximumComplexity": 3, + "MaximumLength": 7, + "MinimumCoverage": 75, + "MypyInitReturn": false, + "OverloadDecorators": [ + "overload" + ], + "SuppressDummyArgs": false, + "SuppressNoneReturning": false + }, + "BlankLines": [ + 2, + 1 + ], + "BuiltinsChecker": { + "bytes": [ + "unicode" + ], + "chr": [ + "unichr" + ], + "str": [ + "unicode" + ] + }, + "CommentedCodeChecker": { + "Aggressive": false, + "WhiteList": [ + "pylint", + "pyright", + "noqa", + "type:\\s*ignore", + "fmt:\\s*(on|off)", + "TODO", + "FIXME", + "WARNING", + "NOTE", + "TEST", + "DOCU", + "XXX", + "- " + ] + }, + "CopyrightAuthor": "", + "CopyrightMinFileSize": 0, + "DocstringType": "eric", + "EnabledCheckerCategories": "C, D, E, M, N, S, Y, W", + "ExcludeFiles": "*/Ui_*.py, */*_rc.py", + "ExcludeMessages": "C101,E265,E266,E305,E402,M201,M301,M302,M303,M304,M305,M306,M307,M308,M311,M312,M313,M314,M315,M321,M701,M702,M811,M834,N802,N803,N807,N808,N821,W293,W504,Y401,Y402", + "FixCodes": "", + "FixIssues": false, + "FutureChecker": "", + "HangClosing": false, + "IncludeMessages": "", + "LineComplexity": 25, + "LineComplexityScore": 10, + "MaxCodeComplexity": 10, + "MaxDocLineLength": 79, + "MaxLineLength": 79, + "NoFixCodes": "E501", + "RepeatMessages": true, + "SecurityChecker": { + "CheckTypedException": false, + "HardcodedTmpDirectories": [ + "/tmp", + "/var/tmp", + "/dev/shm", + "~/tmp" + ], + "InsecureHashes": [ + "md4", + "md5", + "sha", + "sha1" + ], + "InsecureSslProtocolVersions": [ + "PROTOCOL_SSLv2", + "SSLv2_METHOD", + "SSLv23_METHOD", + "PROTOCOL_SSLv3", + "PROTOCOL_TLSv1", + "SSLv3_METHOD", + "TLSv1_METHOD" + ], + "WeakKeySizeDsaHigh": "1024", + "WeakKeySizeDsaMedium": "2048", + "WeakKeySizeEcHigh": "160", + "WeakKeySizeEcMedium": "224", + "WeakKeySizeRsaHigh": "1024", + "WeakKeySizeRsaMedium": "2048" + }, + "ShowIgnored": false, + "ValidEncodings": "latin-1, utf-8" + } + }, + "DESCRIPTION": "Plugin implementing support for Pyramid projects.", + "DOCSTRING": "", + "DOCUMENTATIONPARMS": { + "ERIC4DOC": { + "cssFile": "%PYTHON%/eric6/CSSs/default.css", + "ignoreDirectories": [ + ".eric5project", + ".hg", + ".ropeproject", + ".eric6project" + ], + "ignoreFilePatterns": [ + "Ui_*" + ], + "outputDirectory": "ProjectPyramid/Documentation/source", + "qtHelpEnabled": false, + "useRecursion": true + } + }, + "EMAIL": "detlev@die-offenbachs.de", + "EOL": 1, + "FILETYPES": { + "*.idl": "INTERFACES", + "*.py": "SOURCES", + "*.py3": "SOURCES", + "*.pyw": "SOURCES", + "*.pyw3": "SOURCES", + "*.qm": "TRANSLATIONS", + "*.qrc": "RESOURCES", + "*.ts": "TRANSLATIONS", + "*.ui": "FORMS", + "*.ui.h": "FORMS", + "Ui_*.py": "__IGNORE__" + }, + "FORMS": [ + "ProjectPyramid/ConfigurationPage/PyramidPage.ui", + "ProjectPyramid/CreateParametersDialog.ui", + "ProjectPyramid/DistributionTypeSelectionDialog.ui", + "ProjectPyramid/FormSelectionDialog.ui", + "ProjectPyramid/PyramidDialog.ui", + "ProjectPyramid/PyramidRoutesDialog.ui" + ], + "HASH": "16b809c49f4985b2bd6959b37c5612f6b30e89b4", + "IDLPARAMS": { + "DefinedNames": [], + "IncludeDirs": [], + "UndefinedNames": [] + }, + "INTERFACES": [], + "LEXERASSOCS": {}, + "MAINSCRIPT": "PluginProjectPyramid.py", + "MAKEPARAMS": { + "MakeEnabled": false, + "MakeExecutable": "", + "MakeFile": "", + "MakeParameters": "", + "MakeTarget": "", + "MakeTestOnly": true + }, + "MIXEDLANGUAGE": false, + "OTHERS": [ + ".hgignore", + "ChangeLog", + "PKGLIST", + "PluginProjectPyramid.zip", + "PluginPyramid.e4p", + "ProjectPyramid/APIs/Chameleon-2.9.2.api", + "ProjectPyramid/APIs/Chameleon-2.9.2.bas", + "ProjectPyramid/APIs/Mako-0.7.2.api", + "ProjectPyramid/APIs/Mako-0.7.bas", + "ProjectPyramid/APIs/MarkupSafe-0.15.api", + "ProjectPyramid/APIs/MarkupSafe-0.bas", + "ProjectPyramid/APIs/PasteDeploy-1.5.0.api", + "ProjectPyramid/APIs/PasteDeploy-1.5.bas", + "ProjectPyramid/APIs/Pyramid-1.3.3.api", + "ProjectPyramid/APIs/Pyramid-1.3.bas", + "ProjectPyramid/APIs/Translationstring-1.1.api", + "ProjectPyramid/APIs/Translationstring-1.bas", + "ProjectPyramid/APIs/Venusian-1.0a6.api", + "ProjectPyramid/APIs/Venusian-1.bas", + "ProjectPyramid/APIs/WebOb-1.2.2.api", + "ProjectPyramid/APIs/WebOb-1.2.bas", + "ProjectPyramid/Documentation/LICENSE.GPL3", + "ProjectPyramid/Documentation/source", + "ProjectPyramid/icons/pyramid-dark.svg", + "ProjectPyramid/icons/pyramid-light.svg", + "ProjectPyramid/icons/pyramid64-dark.svg", + "ProjectPyramid/icons/pyramid64-light.svg", + "PluginPyramid.epj" + ], + "OTHERTOOLSPARMS": {}, + "PACKAGERSPARMS": {}, + "PROGLANGUAGE": "Python3", + "PROJECTTYPE": "E6Plugin", + "PROJECTTYPESPECIFICDATA": {}, + "PROTOCOLS": [], + "RCCPARAMS": { + "CompressLevel": 0, + "CompressionDisable": false, + "CompressionThreshold": 70, + "PathPrefix": "" + }, + "RESOURCES": [], + "SOURCES": [ + "PluginProjectPyramid.py", + "ProjectPyramid/ConfigurationPage/PyramidPage.py", + "ProjectPyramid/ConfigurationPage/__init__.py", + "ProjectPyramid/CreateParametersDialog.py", + "ProjectPyramid/DistributionTypeSelectionDialog.py", + "ProjectPyramid/FormSelectionDialog.py", + "ProjectPyramid/Project.py", + "ProjectPyramid/PyramidDialog.py", + "ProjectPyramid/PyramidRoutesDialog.py", + "ProjectPyramid/__init__.py", + "__init__.py" + ], + "SPELLEXCLUDES": "", + "SPELLLANGUAGE": "en_US", + "SPELLWORDS": "", + "TRANSLATIONEXCEPTIONS": [], + "TRANSLATIONPATTERN": "ProjectPyramid/i18n/pyramid_%language%.ts", + "TRANSLATIONS": [ + "ProjectPyramid/i18n/pyramid_de.qm", + "ProjectPyramid/i18n/pyramid_de.ts", + "ProjectPyramid/i18n/pyramid_en.qm", + "ProjectPyramid/i18n/pyramid_en.ts", + "ProjectPyramid/i18n/pyramid_es.qm", + "ProjectPyramid/i18n/pyramid_es.ts", + "ProjectPyramid/i18n/pyramid_ru.qm", + "ProjectPyramid/i18n/pyramid_ru.ts" + ], + "TRANSLATIONSBINPATH": "", + "UICPARAMS": { + "Package": "", + "PackagesRoot": "", + "RcSuffix": "" + }, + "VCS": "Mercurial", + "VCSOPTIONS": { + "add": [ + "" + ], + "checkout": [ + "" + ], + "commit": [ + "" + ], + "diff": [ + "" + ], + "export": [ + "" + ], + "global": [ + "" + ], + "history": [ + "" + ], + "log": [ + "" + ], + "remove": [ + "" + ], + "status": [ + "" + ], + "tag": [ + "" + ], + "update": [ + "" + ] + }, + "VCSOTHERDATA": {}, + "VERSION": "2.x" + } +} \ No newline at end of file
--- a/ProjectPyramid/ConfigurationPage/PyramidPage.py Wed Dec 30 11:02:09 2020 +0100 +++ b/ProjectPyramid/ConfigurationPage/PyramidPage.py Mon Apr 26 17:41:12 2021 +0200 @@ -34,7 +34,7 @@ @param plugin reference to the plugin object """ - super(PyramidPage, self).__init__() + super().__init__() self.setupUi(self) self.setObjectName("PyramidPage")
--- a/ProjectPyramid/CreateParametersDialog.py Wed Dec 30 11:02:09 2020 +0100 +++ b/ProjectPyramid/CreateParametersDialog.py Mon Apr 26 17:41:12 2021 +0200 @@ -28,7 +28,7 @@ @param project reference to the project object (Project) @param parent reference to the parent widget (QWidget) """ - super(CreateParametersDialog, self).__init__(parent) + super().__init__(parent) self.setupUi(self) self.__okButton = self.buttonBox.button(QDialogButtonBox.Ok)
--- a/ProjectPyramid/DistributionTypeSelectionDialog.py Wed Dec 30 11:02:09 2020 +0100 +++ b/ProjectPyramid/DistributionTypeSelectionDialog.py Mon Apr 26 17:41:12 2021 +0200 @@ -33,7 +33,7 @@ @param projectPath path of the Pyramid project (string) @param parent reference to the parent widget (QWidget) """ - super(DistributionTypeSelectionDialog, self).__init__(parent) + super().__init__(parent) self.setupUi(self) errMsg = ""
--- a/ProjectPyramid/Documentation/source/Plugin_Project_Pyramid.PluginProjectPyramid.html Wed Dec 30 11:02:09 2020 +0100 +++ b/ProjectPyramid/Documentation/source/Plugin_Project_Pyramid.PluginProjectPyramid.html Mon Apr 26 17:41:12 2021 +0200 @@ -212,7 +212,7 @@ Public method to activate this plugin. </p> <dl> -<dt>Returns:</dt> +<dt>Return:</dt> <dd> tuple of None and activation status (boolean) </dd> @@ -233,7 +233,7 @@ </dd> </dl> <dl> -<dt>Returns:</dt> +<dt>Return:</dt> <dd> name of the binary translation file (string) </dd> @@ -254,7 +254,7 @@ type. </p> <dl> -<dt>Returns:</dt> +<dt>Return:</dt> <dd> dictionary with file type associations </dd> @@ -274,7 +274,7 @@ </dd> </dl> <dl> -<dt>Returns:</dt> +<dt>Return:</dt> <dd> the requested setting </dd> @@ -294,7 +294,7 @@ </dd> </dl> <dl> -<dt>Returns:</dt> +<dt>Return:</dt> <dd> reference to the menu (QMenu) or None, if no menu with the given name exists @@ -308,7 +308,7 @@ Public method to get the names of all menus. </p> <dl> -<dt>Returns:</dt> +<dt>Return:</dt> <dd> menu names (list of string) </dd> @@ -328,7 +328,7 @@ </dd> </dl> <dl> -<dt>Returns:</dt> +<dt>Return:</dt> <dd> the requested setting </dd> @@ -349,7 +349,7 @@ </dd> </dl> <dl> -<dt>Returns:</dt> +<dt>Return:</dt> <dd> name of the lexer (string) (Pygments lexers are prefixed with 'Pygments|') @@ -391,7 +391,7 @@ </dd> </dl> <dl> -<dt>Returns:</dt> +<dt>Return:</dt> <dd> list of API filenames (list of string) </dd> @@ -414,7 +414,7 @@ </dd> </dl> <dl> -<dt>Returns:</dt> +<dt>Return:</dt> <dd> reference to the configuration page </dd> @@ -430,7 +430,7 @@ Module function returning data as required by the configuration dialog. </p> <dl> -<dt>Returns:</dt> +<dt>Return:</dt> <dd> dictionary containing the relevant data </dd>
--- a/ProjectPyramid/Documentation/source/Plugin_Project_Pyramid.ProjectPyramid.CreateParametersDialog.html Wed Dec 30 11:02:09 2020 +0100 +++ b/ProjectPyramid/Documentation/source/Plugin_Project_Pyramid.ProjectPyramid.CreateParametersDialog.html Mon Apr 26 17:41:12 2021 +0200 @@ -133,7 +133,7 @@ </dd> </dl> <dl> -<dt>Returns:</dt> +<dt>Return:</dt> <dd> prepared scaffold text </dd> @@ -159,7 +159,7 @@ Public method to get the data. </p> <dl> -<dt>Returns:</dt> +<dt>Return:</dt> <dd> tuple giving the scaffold (string), the project name (string), a flag indicating to overwrite existing files (boolean) and a flag
--- a/ProjectPyramid/Documentation/source/Plugin_Project_Pyramid.ProjectPyramid.DistributionTypeSelectionDialog.html Wed Dec 30 11:02:09 2020 +0100 +++ b/ProjectPyramid/Documentation/source/Plugin_Project_Pyramid.ProjectPyramid.DistributionTypeSelectionDialog.html Mon Apr 26 17:41:12 2021 +0200 @@ -114,7 +114,7 @@ Public method to retrieve the checked formats. </p> <dl> -<dt>Returns:</dt> +<dt>Return:</dt> <dd> list of selected formats (list of string) </dd>
--- a/ProjectPyramid/Documentation/source/Plugin_Project_Pyramid.ProjectPyramid.FormSelectionDialog.html Wed Dec 30 11:02:09 2020 +0100 +++ b/ProjectPyramid/Documentation/source/Plugin_Project_Pyramid.ProjectPyramid.FormSelectionDialog.html Mon Apr 26 17:41:12 2021 +0200 @@ -109,7 +109,7 @@ Public method to get the template text. </p> <dl> -<dt>Returns:</dt> +<dt>Return:</dt> <dd> text of the template (string) </dd>
--- a/ProjectPyramid/Documentation/source/Plugin_Project_Pyramid.ProjectPyramid.Project.html Wed Dec 30 11:02:09 2020 +0100 +++ b/ProjectPyramid/Documentation/source/Plugin_Project_Pyramid.ProjectPyramid.Project.html Mon Apr 26 17:41:12 2021 +0200 @@ -351,7 +351,7 @@ projects (= top level dirs). </p> <dl> -<dt>Returns:</dt> +<dt>Return:</dt> <dd> list of projects (list of string) </dd> @@ -372,7 +372,7 @@ </dd> </dl> <dl> -<dt>Returns:</dt> +<dt>Return:</dt> <dd> path of the debugger environment (string) </dd> @@ -393,7 +393,7 @@ </dd> </dl> <dl> -<dt>Returns:</dt> +<dt>Return:</dt> <dd> list of full executable names, if the executable file is accessible via the searchpath defined by the PATH environment @@ -408,7 +408,7 @@ Private method to create the path to the initialization script. </p> <dl> -<dt>Returns:</dt> +<dt>Return:</dt> <dd> path to the initialization script (string) </dd> @@ -428,7 +428,7 @@ </dd> </dl> <dl> -<dt>Returns:</dt> +<dt>Return:</dt> <dd> extracted locale (string) or None </dd> @@ -449,7 +449,7 @@ </dd> </dl> <dl> -<dt>Returns:</dt> +<dt>Return:</dt> <dd> path of the virtual environment (string) </dd> @@ -481,7 +481,7 @@ </dd> </dl> <dl> -<dt>Returns:</dt> +<dt>Return:</dt> <dd> flag indicating a suitable command </dd> @@ -507,7 +507,7 @@ </dd> </dl> <dl> -<dt>Returns:</dt> +<dt>Return:</dt> <dd> normalized file names (list of string) </dd> @@ -520,7 +520,7 @@ Private method to get the name of the current Pyramid project. </p> <dl> -<dt>Returns:</dt> +<dt>Return:</dt> <dd> name of the project (string) </dd> @@ -548,7 +548,7 @@ </dd> </dl> <dl> -<dt>Returns:</dt> +<dt>Return:</dt> <dd> file names belonging to the current site (list of string) </dd> @@ -575,7 +575,7 @@ Private method to calculate the full path of the Pyramid project. </p> <dl> -<dt>Returns:</dt> +<dt>Return:</dt> <dd> path of the project (string) </dd> @@ -744,7 +744,7 @@ </dd> </dl> <dl> -<dt>Returns:</dt> +<dt>Return:</dt> <dd> reference to the menu (QMenu) or None, if no menu with the given name exists @@ -758,7 +758,7 @@ Public method to get the names of all menus. </p> <dl> -<dt>Returns:</dt> +<dt>Return:</dt> <dd> menu names (list of string) </dd> @@ -783,7 +783,7 @@ </dd> </dl> <dl> -<dt>Returns:</dt> +<dt>Return:</dt> <dd> full pyramid command (string) </dd> @@ -796,7 +796,7 @@ Public method to get the Pyramid version as a tuple. </p> <dl> -<dt>Returns:</dt> +<dt>Return:</dt> <dd> Pyramid version </dd> @@ -815,7 +815,7 @@ Public method to get the Pyramid version as a string. </p> <dl> -<dt>Returns:</dt> +<dt>Return:</dt> <dd> Pyramid version </dd> @@ -834,7 +834,7 @@ Public method to build the Python command. </p> <dl> -<dt>Returns:</dt> +<dt>Return:</dt> <dd> python command (string) </dd> @@ -854,7 +854,7 @@ Public slot to initialize the Pyramid menu. </p> <dl> -<dt>Returns:</dt> +<dt>Return:</dt> <dd> the menu generated (QMenu) </dd> @@ -874,7 +874,7 @@ </dd> </dl> <dl> -<dt>Returns:</dt> +<dt>Return:</dt> <dd> tuple of two entries giving an indication, if the console is spawning (boolean) and the (possibly) cleaned console command @@ -946,7 +946,7 @@ Public method to get the supported Python variants. </p> <dl> -<dt>Returns:</dt> +<dt>Return:</dt> <dd> list of supported Python variants (list of strings) </dd> @@ -1098,7 +1098,7 @@ </dd> </dl> <dl> -<dt>Returns:</dt> +<dt>Return:</dt> <dd> tuple of successful start and process id (boolean, integer) </dd>
--- a/ProjectPyramid/Documentation/source/Plugin_Project_Pyramid.ProjectPyramid.PyramidDialog.html Wed Dec 30 11:02:09 2020 +0100 +++ b/ProjectPyramid/Documentation/source/Plugin_Project_Pyramid.ProjectPyramid.PyramidDialog.html Mon Apr 26 17:41:12 2021 +0200 @@ -242,7 +242,7 @@ Public method to check for a normal process termination. </p> <dl> -<dt>Returns:</dt> +<dt>Return:</dt> <dd> flag indicating normal process termination (boolean) </dd> @@ -256,7 +256,7 @@ error messages. </p> <dl> -<dt>Returns:</dt> +<dt>Return:</dt> <dd> flag indicating normal process termination (boolean) </dd> @@ -323,7 +323,7 @@ </dd> </dl> <dl> -<dt>Returns:</dt> +<dt>Return:</dt> <dd> flag indicating a successful start of the first process (boolean) @@ -356,7 +356,7 @@ </dd> </dl> <dl> -<dt>Returns:</dt> +<dt>Return:</dt> <dd> flag indicating a successful start of the process </dd>
--- a/ProjectPyramid/Documentation/source/Plugin_Project_Pyramid.ProjectPyramid.PyramidRoutesDialog.html Wed Dec 30 11:02:09 2020 +0100 +++ b/ProjectPyramid/Documentation/source/Plugin_Project_Pyramid.ProjectPyramid.PyramidRoutesDialog.html Mon Apr 26 17:41:12 2021 +0200 @@ -268,7 +268,7 @@ </dd> </dl> <dl> -<dt>Returns:</dt> +<dt>Return:</dt> <dd> flag indicating a successful start of the process </dd>
--- a/ProjectPyramid/FormSelectionDialog.py Wed Dec 30 11:02:09 2020 +0100 +++ b/ProjectPyramid/FormSelectionDialog.py Mon Apr 26 17:41:12 2021 +0200 @@ -23,7 +23,7 @@ @param parent reference to the parent widget (QWidget) """ - super(FormSelectionDialog, self).__init__(parent) + super().__init__(parent) self.setupUi(self) self.__templates = {
--- a/ProjectPyramid/Project.py Wed Dec 30 11:02:09 2020 +0100 +++ b/ProjectPyramid/Project.py Mon Apr 26 17:41:12 2021 +0200 @@ -10,6 +10,7 @@ import os import re import configparser +import contextlib from PyQt5.QtCore import QObject, QFileInfo, QTimer, QUrl from PyQt5.QtGui import QDesktopServices @@ -51,14 +52,16 @@ if args is None: args = [] - if cmd.endswith(('gnome-terminal', 'konsole', 'xfce4-terminal', - 'mate-terminal')): - if '-e' in args: - index = args.index('-e') + 1 - cargs = ' '.join(args[index:]) - args[index:] = [cargs] + if ( + cmd.endswith(('gnome-terminal', 'konsole', 'xfce4-terminal', + 'mate-terminal')) and + '-e' in args + ): + index = args.index('-e') + 1 + cargs = ' '.join(args[index:]) + args[index:] = [cargs] - super(QProcess, self).start(cmd, args, mode) + super().start(cmd, args, mode) @staticmethod def startDetached(cmd, args=None, path=''): @@ -74,12 +77,14 @@ if args is None: args = [] - if cmd.endswith(('gnome-terminal', 'konsole', 'xfce4-terminal', - 'mate-terminal')): - if '-e' in args: - index = args.index('-e') + 1 - cargs = ' '.join(args[index:]) - args[index:] = [cargs] + if ( + cmd.endswith(('gnome-terminal', 'konsole', 'xfce4-terminal', + 'mate-terminal')) and + '-e' in args + ): + index = args.index('-e') + 1 + cargs = ' '.join(args[index:]) + args[index:] = [cargs] return QProcessPyQt.startDetached(cmd, args, path) @@ -99,7 +104,7 @@ @param parent parent @type QObject """ - super(Project, self).__init__(parent) + super().__init__(parent) self.__plugin = plugin self.__iconSuffix = iconSuffix @@ -587,9 +592,8 @@ return [] cur_path = os.path.join(os.curdir, file) - if os.path.exists(cur_path): - if os.access(cur_path, os.X_OK): - paths.append(cur_path) + if os.path.exists(cur_path) and os.access(cur_path, os.X_OK): + paths.append(cur_path) path = os.getenv('PATH') @@ -818,7 +822,7 @@ lines = f.read().splitlines() for line in lines: if line.startswith("__requires__"): - ## sample: __requires__ = 'pyramid==1.4' + #- sample: __requires__ = 'pyramid==1.4' vers = line.strip().split()[-1][1:-1].split("==")[1] self.__pyramidVersion = vers except OSError: @@ -999,19 +1003,16 @@ else: self.__currentProject = project - if self.__currentProject is None: - curProject = self.tr("None") - else: - curProject = self.__currentProject + curProject = ( + self.tr("None") + if self.__currentProject is None else + self.__currentProject + ) self.selectProjectAct.setText( self.tr('&Current Pyramid Project ({0})').format(curProject)) if self.__currentProject is None: - try: - self.__e5project.setTranslationPattern("") - except AttributeError: - # backward compatibility - self.__e5project.pdata["TRANSLATIONPATTERN"] = [] + self.__e5project.setTranslationPattern("") else: lowerProject = self.__project().lower() config = configparser.ConfigParser() @@ -1024,17 +1025,10 @@ domain = config.get("init_catalog", "domain") except (configparser.NoOptionError, configparser.NoSectionError): domain = lowerProject - try: - self.__e5project.setTranslationPattern( - os.path.join(project, outputDir, "%language%", - "LC_MESSAGES", "{0}.po".format(domain)) - ) - except AttributeError: - # backward compatibility - self.__e5project.pdata["TRANSLATIONPATTERN"] = [ - os.path.join(project, outputDir, "%language%", - "LC_MESSAGES", "{0}.po".format(domain)) - ] + self.__e5project.setTranslationPattern( + os.path.join(project, outputDir, "%language%", + "LC_MESSAGES", "{0}.po".format(domain)) + ) if self.__currentProject is None: self.initializeDbAct.setEnabled(False) @@ -1500,11 +1494,9 @@ self.tr('No "output_file" option found in setup.cfg.')) return - try: + with contextlib.suppress(OSError): path = os.path.join(projectPath, os.path.dirname(potFile)) os.makedirs(path) - except OSError: - pass cmd = self.getPythonCommand() args = []
--- a/ProjectPyramid/PyramidDialog.py Wed Dec 30 11:02:09 2020 +0100 +++ b/ProjectPyramid/PyramidDialog.py Mon Apr 26 17:41:12 2021 +0200 @@ -43,7 +43,7 @@ (string) @keyparam parent parent widget (QWidget) """ - super(PyramidDialog, self).__init__(parent) + super().__init__(parent) self.setupUi(self) self.buttonBox.button(QDialogButtonBox.Close).setEnabled(False) @@ -296,4 +296,4 @@ self.intercept = False evt.accept() return - super(PyramidDialog, self).keyPressEvent(evt) + super().keyPressEvent(evt)
--- a/ProjectPyramid/PyramidRoutesDialog.py Wed Dec 30 11:02:09 2020 +0100 +++ b/ProjectPyramid/PyramidRoutesDialog.py Mon Apr 26 17:41:12 2021 +0200 @@ -34,7 +34,7 @@ (ProjectPyramid.Project.Project) @param parent reference to the parent widget (QWidget) """ - super(PyramidRoutesDialog, self).__init__(parent) + super().__init__(parent) self.setupUi(self) self.buttonBox.button(QDialogButtonBox.Close).setEnabled(False) @@ -250,4 +250,4 @@ self.intercept = False evt.accept() return - super(PyramidRoutesDialog, self).keyPressEvent(evt) + super().keyPressEvent(evt)