Sat, 24 Apr 2021 11:43:22 +0200
- implemented some code simplifications
--- a/ChangeLog Wed Dec 30 11:02:07 2020 +0100 +++ b/ChangeLog Sat Apr 24 11:43:22 2021 +0200 @@ -1,5 +1,8 @@ ChangeLog --------- +Version 3.2.0: +- implemented some code simplifications + Version 3.1.0: - changed exec_() into exec()
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/PluginDjangoTagsMenu.epj Sat Apr 24 11:43:22 2021 +0200 @@ -0,0 +1,273 @@ +{ + "header": { + "comment": "eric project file for project PluginDjangoTagsMenu", + "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": true + }, + "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, 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,Y119,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": "This plug-in adds a menu to select various tag templates to the Django menu.", + "DOCSTRING": "", + "DOCUMENTATIONPARMS": { + "ERIC4DOC": { + "cssFile": "%PYTHON%/eric6/CSSs/default.css", + "ignoreDirectories": [ + ".eric5project", + ".ropeproject", + "_eric5project", + "_ropeproject", + ".hg", + ".eric6project" + ], + "ignoreFilePatterns": [ + "Ui_*.py" + ], + "outputDirectory": "ProjectDjangoTagsMenu/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": [ + "ProjectDjangoTagsMenu/FindTemplateTagDialog.ui", + "ProjectDjangoTagsMenu/IeCommentDialog.ui", + "ProjectDjangoTagsMenu/IfTagInputDialog.ui", + "ProjectDjangoTagsMenu/LoremTagInputDialog.ui", + "ProjectDjangoTagsMenu/MultiLineInputDialog.ui", + "ProjectDjangoTagsMenu/TimezoneSelectionDialog.ui" + ], + "HASH": "fac07f0675a7c77618ebfac9d2cbbfb763f751f3", + "IDLPARAMS": { + "DefinedNames": [], + "IncludeDirs": [], + "UndefinedNames": [] + }, + "INTERFACES": [], + "LEXERASSOCS": {}, + "MAINSCRIPT": "PluginProjectDjangoTagsMenu.py", + "MAKEPARAMS": { + "MakeEnabled": false, + "MakeExecutable": "", + "MakeFile": "", + "MakeParameters": "", + "MakeTarget": "", + "MakeTestOnly": true + }, + "MIXEDLANGUAGE": 0, + "OTHERS": [ + ".hgignore", + "ChangeLog", + "PKGLIST", + "PluginDjangoTagsMenu.e4p", + "PluginProjectDjangoTagsMenu.zip", + "ProjectDjangoTagsMenu/Documentation/LICENSE.GPL3", + "ProjectDjangoTagsMenu/Documentation/source", + "PluginDjangoTagsMenu.epj" + ], + "OTHERTOOLSPARMS": {}, + "PACKAGERSPARMS": {}, + "PROGLANGUAGE": "Python3", + "PROJECTTYPE": "E6Plugin", + "PROJECTTYPESPECIFICDATA": {}, + "PROTOCOLS": [], + "RCCPARAMS": { + "CompressLevel": 0, + "CompressionDisable": false, + "CompressionThreshold": 70, + "PathPrefix": "" + }, + "RESOURCES": [], + "SOURCES": [ + "PluginProjectDjangoTagsMenu.py", + "ProjectDjangoTagsMenu/DjangoTagInputDialog.py", + "ProjectDjangoTagsMenu/DjangoTagsMenuHandler.py", + "ProjectDjangoTagsMenu/FindTemplateTagDialog.py", + "ProjectDjangoTagsMenu/IeCommentDialog.py", + "ProjectDjangoTagsMenu/IfTagInputDialog.py", + "ProjectDjangoTagsMenu/LoremTagInputDialog.py", + "ProjectDjangoTagsMenu/MultiLineInputDialog.py", + "ProjectDjangoTagsMenu/TimezoneSelectionDialog.py", + "ProjectDjangoTagsMenu/__init__.py", + "__init__.py" + ], + "SPELLEXCLUDES": "", + "SPELLLANGUAGE": "en_US", + "SPELLWORDS": "", + "TRANSLATIONEXCEPTIONS": [], + "TRANSLATIONPATTERN": "ProjectDjangoTagsMenu/i18n/djangotagsmenu_%language%.ts", + "TRANSLATIONS": [ + "ProjectDjangoTagsMenu/i18n/djangotagsmenu_de.qm", + "ProjectDjangoTagsMenu/i18n/djangotagsmenu_de.ts", + "ProjectDjangoTagsMenu/i18n/djangotagsmenu_en.qm", + "ProjectDjangoTagsMenu/i18n/djangotagsmenu_en.ts", + "ProjectDjangoTagsMenu/i18n/djangotagsmenu_es.qm", + "ProjectDjangoTagsMenu/i18n/djangotagsmenu_es.ts", + "ProjectDjangoTagsMenu/i18n/djangotagsmenu_ru.qm", + "ProjectDjangoTagsMenu/i18n/djangotagsmenu_ru.ts" + ], + "TRANSLATIONSBINPATH": "", + "UICPARAMS": { + "Package": "", + "PackagesRoot": "", + "RcSuffix": "" + }, + "VCS": "Mercurial", + "VCSOPTIONS": { + "add": [ + "" + ], + "checkout": [ + "" + ], + "commit": [ + "" + ], + "diff": [ + "" + ], + "export": [ + "" + ], + "global": [ + "" + ], + "history": [ + "" + ], + "log": [ + "" + ], + "remove": [ + "" + ], + "status": [ + "" + ], + "tag": [ + "" + ], + "update": [ + "" + ] + }, + "VCSOTHERDATA": {}, + "VERSION": "0.x" + } +} \ No newline at end of file
--- a/PluginProjectDjangoTagsMenu.py Wed Dec 30 11:02:07 2020 +0100 +++ b/PluginProjectDjangoTagsMenu.py Sat Apr 24 11:43:22 2021 +0200 @@ -21,7 +21,7 @@ author = "Detlev Offenbach <detlev@die-offenbachs.de>" autoactivate = True deactivateable = True -version = "3.1.0" +version = "3.2.0" className = "ProjectDjangoTagsMenuPlugin" packageName = "ProjectDjangoTagsMenu" shortDescription = "Tags menu for Django projects." @@ -46,7 +46,7 @@ @param ui reference to the user interface object (UI.UserInterface) """ - super(ProjectDjangoTagsMenuPlugin, self).__init__(ui) + super().__init__(ui) self.__ui = ui self.__translator = None
--- a/ProjectDjangoTagsMenu/DjangoTagInputDialog.py Wed Dec 30 11:02:07 2020 +0100 +++ b/ProjectDjangoTagsMenu/DjangoTagInputDialog.py Sat Apr 24 11:43:22 2021 +0200 @@ -27,7 +27,7 @@ @param parent reference to the parent widget (QWidget) @exception RuntimeError raised to signal too many labels were given """ - super(DjangoTagInputDialog, self).__init__(parent) + super().__init__(parent) if len(labels) == 0 or len(labels) > 5: raise RuntimeError( @@ -36,15 +36,13 @@ self.__inputs = [] self.__topLayout = QVBoxLayout(self) - index = 0 - for label in labels: + for index, label in enumerate(labels): self.__topLayout.addWidget(QLabel(label, self)) entry = E5ClearableLineEdit(self) if defaults and index < len(defaults): entry.setText(defaults[index]) self.__inputs.append(entry) self.__topLayout.addWidget(entry) - index += 1 self.__buttonBox = QDialogButtonBox( QDialogButtonBox.Ok | QDialogButtonBox.Cancel, Qt.Horizontal, self)
--- a/ProjectDjangoTagsMenu/DjangoTagsMenuHandler.py Wed Dec 30 11:02:07 2020 +0100 +++ b/ProjectDjangoTagsMenu/DjangoTagsMenuHandler.py Sat Apr 24 11:43:22 2021 +0200 @@ -32,7 +32,7 @@ @param ui reference to the user interface object (UI.UserInterface) @param parent reference to the parent object (QObject) """ - super(DjangoTagsMenuHandler, self).__init__(parent) + super().__init__(parent) self.__ui = ui self.__findDialog = None @@ -726,10 +726,6 @@ templateText = "{{% block {0} %}} {1} {{% endblock %}}".format( data[0], selectedText) replace = True - elif tag == "comment": - templateText = "{{% comment %}} {0} {{% endcomment %}}".format( - selectedText) - replace = True elif tag == "csrf_token": templateText = "{% csrf_token %}" elif tag == "cycle": @@ -1346,13 +1342,13 @@ ## Comments ## #################################################### + elif tag in ("comment", "multilinecommentselect"): + templateText = "{{% comment %}} {0} {{% endcomment %}}".format( + selectedText) + replace = True elif tag == "singlelinecommentselect": templateText = '{{# {0} #}}'.format(selectedText) replace = True - elif tag == "multilinecommentselect": - templateText = '{{% comment %}} {0} {{% endcomment %}}'.format( - selectedText) - replace = True elif tag == "singlelinecommentdialog": data, ok = DjangoTagInputDialog.getText( None,
--- a/ProjectDjangoTagsMenu/Documentation/source/Plugin_Project_Django_Tags_Menu.PluginProjectDjangoTagsMenu.html Wed Dec 30 11:02:07 2020 +0100 +++ b/ProjectDjangoTagsMenu/Documentation/source/Plugin_Project_Django_Tags_Menu.PluginProjectDjangoTagsMenu.html Sat Apr 24 11:43:22 2021 +0200 @@ -209,7 +209,7 @@ Public method to activate this plugin. </p> <dl> -<dt>Returns:</dt> +<dt>Return:</dt> <dd> tuple of None and activation status (boolean) </dd>
--- a/ProjectDjangoTagsMenu/Documentation/source/Plugin_Project_Django_Tags_Menu.ProjectDjangoTagsMenu.DjangoTagInputDialog.html Wed Dec 30 11:02:07 2020 +0100 +++ b/ProjectDjangoTagsMenu/Documentation/source/Plugin_Project_Django_Tags_Menu.ProjectDjangoTagsMenu.DjangoTagInputDialog.html Sat Apr 24 11:43:22 2021 +0200 @@ -125,7 +125,7 @@ Public method to retrieve the entered data. </p> <dl> -<dt>Returns:</dt> +<dt>Return:</dt> <dd> tuple containing the text of all entries (tuple of string) </dd> @@ -158,7 +158,7 @@ </dd> </dl> <dl> -<dt>Returns:</dt> +<dt>Return:</dt> <dd> tuple of a tuple containing the text of all entries (tuple of string) and a flag indicating the acceptance
--- a/ProjectDjangoTagsMenu/Documentation/source/Plugin_Project_Django_Tags_Menu.ProjectDjangoTagsMenu.DjangoTagsMenuHandler.html Wed Dec 30 11:02:07 2020 +0100 +++ b/ProjectDjangoTagsMenu/Documentation/source/Plugin_Project_Django_Tags_Menu.ProjectDjangoTagsMenu.DjangoTagsMenuHandler.html Sat Apr 24 11:43:22 2021 +0200 @@ -193,7 +193,7 @@ </dd> </dl> <dl> -<dt>Returns:</dt> +<dt>Return:</dt> <dd> tuple of generated template text (string), a flag indicating to perform a replace operation (boolean) @@ -207,7 +207,7 @@ Private method to initialize the comments menu. </p> <dl> -<dt>Returns:</dt> +<dt>Return:</dt> <dd> generated menu (QMenu) </dd> @@ -220,7 +220,7 @@ Private method to initialize the filters menu. </p> <dl> -<dt>Returns:</dt> +<dt>Return:</dt> <dd> generated menu (QMenu) </dd> @@ -233,7 +233,7 @@ Private method to initialize the humanize menu. </p> <dl> -<dt>Returns:</dt> +<dt>Return:</dt> <dd> generated menu (QMenu) </dd> @@ -246,7 +246,7 @@ Private method to initialize the static menu. </p> <dl> -<dt>Returns:</dt> +<dt>Return:</dt> <dd> generated menu (QMenu) </dd> @@ -259,7 +259,7 @@ Private method to initialize the static menu. </p> <dl> -<dt>Returns:</dt> +<dt>Return:</dt> <dd> generated menu (QMenu) </dd> @@ -272,7 +272,7 @@ Private method to initialize the static menu. </p> <dl> -<dt>Returns:</dt> +<dt>Return:</dt> <dd> generated menu (QMenu) </dd> @@ -285,7 +285,7 @@ Private method to initialize the tags menu. </p> <dl> -<dt>Returns:</dt> +<dt>Return:</dt> <dd> generated menu (QMenu) </dd> @@ -298,7 +298,7 @@ Private method to initialize the static menu. </p> <dl> -<dt>Returns:</dt> +<dt>Return:</dt> <dd> generated menu (QMenu) </dd> @@ -311,7 +311,7 @@ Private method to initialize the web design menu. </p> <dl> -<dt>Returns:</dt> +<dt>Return:</dt> <dd> generated menu (QMenu) </dd>
--- a/ProjectDjangoTagsMenu/Documentation/source/Plugin_Project_Django_Tags_Menu.ProjectDjangoTagsMenu.IeCommentDialog.html Wed Dec 30 11:02:07 2020 +0100 +++ b/ProjectDjangoTagsMenu/Documentation/source/Plugin_Project_Django_Tags_Menu.ProjectDjangoTagsMenu.IeCommentDialog.html Sat Apr 24 11:43:22 2021 +0200 @@ -109,7 +109,7 @@ Public method to retrieve the entered data. </p> <dl> -<dt>Returns:</dt> +<dt>Return:</dt> <dd> tuple of condition (string) and version (integer) </dd> @@ -129,7 +129,7 @@ </dd> </dl> <dl> -<dt>Returns:</dt> +<dt>Return:</dt> <dd> formatted tag (string) and a flag indicating the acceptance state (boolean)
--- a/ProjectDjangoTagsMenu/Documentation/source/Plugin_Project_Django_Tags_Menu.ProjectDjangoTagsMenu.IfTagInputDialog.html Wed Dec 30 11:02:07 2020 +0100 +++ b/ProjectDjangoTagsMenu/Documentation/source/Plugin_Project_Django_Tags_Menu.ProjectDjangoTagsMenu.IfTagInputDialog.html Sat Apr 24 11:43:22 2021 +0200 @@ -109,7 +109,7 @@ Public method to retrieve the tag. </p> <dl> -<dt>Returns:</dt> +<dt>Return:</dt> <dd> tag (string) </dd>
--- a/ProjectDjangoTagsMenu/Documentation/source/Plugin_Project_Django_Tags_Menu.ProjectDjangoTagsMenu.LoremTagInputDialog.html Wed Dec 30 11:02:07 2020 +0100 +++ b/ProjectDjangoTagsMenu/Documentation/source/Plugin_Project_Django_Tags_Menu.ProjectDjangoTagsMenu.LoremTagInputDialog.html Sat Apr 24 11:43:22 2021 +0200 @@ -105,7 +105,7 @@ Public method to get the generated tag string. </p> <dl> -<dt>Returns:</dt> +<dt>Return:</dt> <dd> tag string (string) </dd>
--- a/ProjectDjangoTagsMenu/Documentation/source/Plugin_Project_Django_Tags_Menu.ProjectDjangoTagsMenu.MultiLineInputDialog.html Wed Dec 30 11:02:07 2020 +0100 +++ b/ProjectDjangoTagsMenu/Documentation/source/Plugin_Project_Django_Tags_Menu.ProjectDjangoTagsMenu.MultiLineInputDialog.html Sat Apr 24 11:43:22 2021 +0200 @@ -117,7 +117,7 @@ Public method to retrieve the multi line text. </p> <dl> -<dt>Returns:</dt> +<dt>Return:</dt> <dd> multi line text (string) </dd> @@ -150,7 +150,7 @@ </dd> </dl> <dl> -<dt>Returns:</dt> +<dt>Return:</dt> <dd> multi line text (string) and a flag indicating the acceptance state (boolean)
--- a/ProjectDjangoTagsMenu/Documentation/source/Plugin_Project_Django_Tags_Menu.ProjectDjangoTagsMenu.TimezoneSelectionDialog.html Wed Dec 30 11:02:07 2020 +0100 +++ b/ProjectDjangoTagsMenu/Documentation/source/Plugin_Project_Django_Tags_Menu.ProjectDjangoTagsMenu.TimezoneSelectionDialog.html Sat Apr 24 11:43:22 2021 +0200 @@ -128,7 +128,7 @@ Public method to retrieve the data. </p> <dl> -<dt>Returns:</dt> +<dt>Return:</dt> <dd> selected time zone (string) </dd> @@ -169,7 +169,7 @@ </dd> </dl> <dl> -<dt>Returns:</dt> +<dt>Return:</dt> <dd> tuple of selected time zone (string) and flag indicating the acceptance state (boolean)
--- a/ProjectDjangoTagsMenu/FindTemplateTagDialog.py Wed Dec 30 11:02:07 2020 +0100 +++ b/ProjectDjangoTagsMenu/FindTemplateTagDialog.py Sat Apr 24 11:43:22 2021 +0200 @@ -28,7 +28,7 @@ @param parent reference to the parent widget (QWidget) """ - super(FindTemplateTagDialog, self).__init__(parent) + super().__init__(parent) self.setupUi(self) self.__completer = QCompleter((
--- a/ProjectDjangoTagsMenu/IeCommentDialog.py Wed Dec 30 11:02:07 2020 +0100 +++ b/ProjectDjangoTagsMenu/IeCommentDialog.py Sat Apr 24 11:43:22 2021 +0200 @@ -22,7 +22,7 @@ @param parent reference to the parent widget (QWidget) """ - super(IeCommentDialog, self).__init__(parent) + super().__init__(parent) self.setupUi(self) for condStr, condData in [("==", ""), ("<=", " lte"), ("<", " lt"),
--- a/ProjectDjangoTagsMenu/IfTagInputDialog.py Wed Dec 30 11:02:07 2020 +0100 +++ b/ProjectDjangoTagsMenu/IfTagInputDialog.py Sat Apr 24 11:43:22 2021 +0200 @@ -23,7 +23,7 @@ @param parent reference to the parent widget (QWidget) """ - super(IfTagInputDialog, self).__init__(parent) + super().__init__(parent) self.setupUi(self) self.buttonBox.button(QDialogButtonBox.Ok).setEnabled(False)
--- a/ProjectDjangoTagsMenu/LoremTagInputDialog.py Wed Dec 30 11:02:07 2020 +0100 +++ b/ProjectDjangoTagsMenu/LoremTagInputDialog.py Sat Apr 24 11:43:22 2021 +0200 @@ -22,7 +22,7 @@ @param parent reference to the parent widget (QWidget) """ - super(LoremTagInputDialog, self).__init__(parent) + super().__init__(parent) self.setupUi(self) msh = self.minimumSizeHint()
--- a/ProjectDjangoTagsMenu/MultiLineInputDialog.py Wed Dec 30 11:02:07 2020 +0100 +++ b/ProjectDjangoTagsMenu/MultiLineInputDialog.py Sat Apr 24 11:43:22 2021 +0200 @@ -24,7 +24,7 @@ @param default default value for the entry field (string) @param parent reference to the parent widget (QWidget) """ - super(MultiLineInputDialog, self).__init__(parent) + super().__init__(parent) self.setupUi(self) def getData(self):
--- a/ProjectDjangoTagsMenu/TimezoneSelectionDialog.py Wed Dec 30 11:02:07 2020 +0100 +++ b/ProjectDjangoTagsMenu/TimezoneSelectionDialog.py Sat Apr 24 11:43:22 2021 +0200 @@ -514,7 +514,7 @@ @param parent reference to the parent widget (QWidget) """ - super(TimezoneSelectionDialog, self).__init__(parent) + super().__init__(parent) self.setupUi(self) self.buttonBox.button(QDialogButtonBox.Ok).setEnabled(False)