Sun, 25 Apr 2021 16:57:01 +0200
Implemented some code simplifications.
--- a/ChangeLog Wed Dec 30 11:02:16 2020 +0100 +++ b/ChangeLog Sun Apr 25 16:57:01 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/PluginWizardDataUriEncoder.epj Sun Apr 25 16:57:01 2021 +0200 @@ -0,0 +1,263 @@ +{ + "header": { + "comment": "eric project file for project PluginWizardDataUriEncoder", + "copyright": "Copyright (C) 2021 Detlev Offenbach, detlevqdie-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, 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,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": "Plug-in implementing a wizard for the generation of code for base64 encoded data URIs.", + "DOCSTRING": "", + "DOCUMENTATIONPARMS": { + "ERIC4DOC": { + "cssFile": "%PYTHON%/eric6/CSSs/default.css", + "ignoreDirectories": [ + ".eric5project", + ".hg", + ".ropeproject", + "_eric5project", + "_ropeproject", + ".eric6project", + "_eric6project" + ], + "ignoreFilePatterns": [ + "Ui_*.py" + ], + "noempty": true, + "outputDirectory": "WizardDataUriEncoder/Documentation/source", + "qtHelpEnabled": false, + "useRecursion": true + } + }, + "EMAIL": "detlevqdie-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": [ + "WizardDataUriEncoder/DataUriEncoderWizardDialog.ui" + ], + "HASH": "2144bd61ef339d39bc1790af5e236aaa2a8828ac", + "IDLPARAMS": { + "DefinedNames": [], + "IncludeDirs": [], + "UndefinedNames": [] + }, + "INTERFACES": [], + "LEXERASSOCS": {}, + "MAINSCRIPT": "PluginWizardDataUriEncoder.py", + "MAKEPARAMS": { + "MakeEnabled": false, + "MakeExecutable": "", + "MakeFile": "", + "MakeParameters": "", + "MakeTarget": "", + "MakeTestOnly": true + }, + "MIXEDLANGUAGE": false, + "OTHERS": [ + ".hgignore", + "ChangeLog", + "PKGLIST", + "PluginWizardDataUriEncoder.e4p", + "PluginWizardDataUriEncoder.zip", + "WizardDataUriEncoder/Documentation/LICENSE.GPL3", + "WizardDataUriEncoder/Documentation/source", + "PluginWizardDataUriEncoder.epj" + ], + "OTHERTOOLSPARMS": {}, + "PACKAGERSPARMS": {}, + "PROGLANGUAGE": "Python3", + "PROJECTTYPE": "E6Plugin", + "PROJECTTYPESPECIFICDATA": {}, + "PROTOCOLS": [], + "RCCPARAMS": { + "CompressLevel": 0, + "CompressionDisable": false, + "CompressionThreshold": 70, + "PathPrefix": "" + }, + "RESOURCES": [], + "SOURCES": [ + "PluginWizardDataUriEncoder.py", + "WizardDataUriEncoder/DataUriEncoderWizardDialog.py", + "WizardDataUriEncoder/__init__.py", + "__init__.py" + ], + "SPELLEXCLUDES": "", + "SPELLLANGUAGE": "en_US", + "SPELLWORDS": "", + "TRANSLATIONEXCEPTIONS": [], + "TRANSLATIONPATTERN": "WizardDataUriEncoder/i18n/datauriencoder_%language%.ts", + "TRANSLATIONS": [ + "WizardDataUriEncoder/i18n/datauriencoder_de.qm", + "WizardDataUriEncoder/i18n/datauriencoder_de.ts", + "WizardDataUriEncoder/i18n/datauriencoder_en.qm", + "WizardDataUriEncoder/i18n/datauriencoder_en.ts", + "WizardDataUriEncoder/i18n/datauriencoder_es.qm", + "WizardDataUriEncoder/i18n/datauriencoder_es.ts", + "WizardDataUriEncoder/i18n/datauriencoder_ru.qm", + "WizardDataUriEncoder/i18n/datauriencoder_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/PluginWizardDataUriEncoder.py Wed Dec 30 11:02:16 2020 +0100 +++ b/PluginWizardDataUriEncoder.py Sun Apr 25 16:57:01 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 = "WizardDataUriEncoderPlugin" packageName = "WizardDataUriEncoder" shortDescription = "Wizard for the creation of code for a base64 data URI."
--- a/WizardDataUriEncoder/DataUriEncoderWizardDialog.py Wed Dec 30 11:02:16 2020 +0100 +++ b/WizardDataUriEncoder/DataUriEncoderWizardDialog.py Sun Apr 25 16:57:01 2021 +0200 @@ -54,7 +54,7 @@ @param parent reference to the parent widget (QWidget) """ - super(DataUriEncoderWizardDialog, self).__init__(parent) + super().__init__(parent) self.setupUi(self) self.buttonBox.button(QDialogButtonBox.Ok).setEnabled(False) @@ -144,13 +144,14 @@ return try: - output = '"{0}{1}{2}{3}"'.format( - 'data:' if self.dataCheckBox.isChecked() else '', - mimetype if self.dataCheckBox.isChecked() else '', - ';charset=utf-8;base64,' if self.dataCheckBox.isChecked() - else '', - base64.b64encode(open(filepath, "rb").read()).decode() - ) + with open(filepath, "rb") as f: + output = '"{0}{1}{2}{3}"'.format( + 'data:' if self.dataCheckBox.isChecked() else '', + mimetype if self.dataCheckBox.isChecked() else '', + ';charset=utf-8;base64,' if self.dataCheckBox.isChecked() + else '', + base64.b64encode(f.read()).decode() + ) except OSError as err: E5MessageBox.critical( self,
--- a/WizardDataUriEncoder/Documentation/source/Plugin_Wizard_DataUriEncoder.PluginWizardDataUriEncoder.html Wed Dec 30 11:02:16 2020 +0100 +++ b/WizardDataUriEncoder/Documentation/source/Plugin_Wizard_DataUriEncoder.PluginWizardDataUriEncoder.html Sun Apr 25 16:57:01 2021 +0200 @@ -85,10 +85,6 @@ <td>Private method to add the actions to the right menu.</td> </tr> <tr> -<td><a href="#WizardDataUriEncoderPlugin.__initialize">__initialize</a></td> -<td>Private slot to (re)initialize the plug-in.</td> -</tr> -<tr> <td><a href="#WizardDataUriEncoderPlugin.__loadTranslator">__loadTranslator</a></td> <td>Private method to load the translation file.</td> </tr> @@ -142,13 +138,6 @@ <p> Private method to add the actions to the right menu. </p> -<a NAME="WizardDataUriEncoderPlugin.__initialize" ID="WizardDataUriEncoderPlugin.__initialize"></a> -<h4>WizardDataUriEncoderPlugin.__initialize</h4> -<b>__initialize</b>(<i></i>) - -<p> - Private slot to (re)initialize the plug-in. -</p> <a NAME="WizardDataUriEncoderPlugin.__loadTranslator" ID="WizardDataUriEncoderPlugin.__loadTranslator"></a> <h4>WizardDataUriEncoderPlugin.__loadTranslator</h4> <b>__loadTranslator</b>(<i></i>) @@ -164,7 +153,7 @@ Public method to activate this plug-in. </p> <dl> -<dt>Returns:</dt> +<dt>Return:</dt> <dd> tuple of None and activation status (boolean) </dd>
--- a/WizardDataUriEncoder/Documentation/source/Plugin_Wizard_DataUriEncoder.WizardDataUriEncoder.DataUriEncoderWizardDialog.html Wed Dec 30 11:02:16 2020 +0100 +++ b/WizardDataUriEncoder/Documentation/source/Plugin_Wizard_DataUriEncoder.WizardDataUriEncoder.DataUriEncoderWizardDialog.html Sun Apr 25 16:57:01 2021 +0200 @@ -137,7 +137,7 @@ Private method to get the mime type from the user. </p> <dl> -<dt>Returns:</dt> +<dt>Return:</dt> <dd> entered mime type (string) </dd> @@ -150,7 +150,7 @@ Private method to get the start directory for selection dialogs. </p> <dl> -<dt>Returns:</dt> +<dt>Return:</dt> <dd> start directory (string) </dd> @@ -163,7 +163,7 @@ Public method to get the code. </p> <dl> -<dt>Returns:</dt> +<dt>Return:</dt> <dd> generated code (string) </dd>