Implemented some code simplifications. release-2.2.0

Mon, 26 Apr 2021 17:47:56 +0200

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Mon, 26 Apr 2021 17:47:56 +0200
changeset 35
a3f1dcf94fe4
parent 34
a6d8718f37b5
child 36
b42faabc72fa

Implemented some code simplifications.

ChangeLog file | annotate | diff | comparison | revisions
PluginProjectWeb.py file | annotate | diff | comparison | revisions
PluginProjectWeb.zip file | annotate | diff | comparison | revisions
ProjectWeb/Documentation/source/Plugin_Project_Web.PluginProjectWeb.html file | annotate | diff | comparison | revisions
ProjectWeb/Documentation/source/Plugin_Project_Web.ProjectWeb.Html5Prettifier.html file | annotate | diff | comparison | revisions
ProjectWeb/Documentation/source/Plugin_Project_Web.ProjectWeb.Html5ToCss3Converter.html file | annotate | diff | comparison | revisions
ProjectWeb/Documentation/source/Plugin_Project_Web.ProjectWeb.Html5ToCss3ConverterParameterDialog.html file | annotate | diff | comparison | revisions
ProjectWeb/Documentation/source/Plugin_Project_Web.ProjectWeb.Html5ToJsConverter.html file | annotate | diff | comparison | revisions
ProjectWeb/Documentation/source/Plugin_Project_Web.ProjectWeb.Html5ToJsConverterParameterDialog.html file | annotate | diff | comparison | revisions
ProjectWeb/Html5Prettifier.py file | annotate | diff | comparison | revisions
ProjectWeb/Html5ToCss3Converter.py file | annotate | diff | comparison | revisions
ProjectWeb/Html5ToCss3ConverterParameterDialog.py file | annotate | diff | comparison | revisions
ProjectWeb/Html5ToJsConverter.py file | annotate | diff | comparison | revisions
ProjectWeb/Html5ToJsConverterParameterDialog.py file | annotate | diff | comparison | revisions
--- a/ChangeLog	Wed Dec 30 11:02:10 2020 +0100
+++ b/ChangeLog	Mon Apr 26 17:47:56 2021 +0200
@@ -1,5 +1,8 @@
 ChangeLog
 ---------
+Version 2.2.0:
+- implemented some code simplifications
+
 Version 2.1.0:
 - changed exec_() into exec()
 
--- a/PluginProjectWeb.py	Wed Dec 30 11:02:10 2020 +0100
+++ b/PluginProjectWeb.py	Mon Apr 26 17:47:56 2021 +0200
@@ -7,6 +7,7 @@
 Module implementing the Web project plugin.
 """
 
+import contextlib
 import os
 
 from PyQt5.QtCore import QObject, QTranslator
@@ -28,7 +29,7 @@
 author = "Detlev Offenbach <detlev@die-offenbachs.de>"
 autoactivate = True
 deactivateable = True
-version = "2.1.0"
+version = "2.2.0"
 className = "ProjectWebPlugin"
 packageName = "ProjectWeb"
 shortDescription = "Support for Web projects and web related tools."
@@ -54,7 +55,7 @@
         
         @param ui reference to the user interface object (UI.UserInterface)
         """
-        super(ProjectWebPlugin, self).__init__(ui)
+        super().__init__(ui)
         self.__ui = ui
         self.__initialize()
         
@@ -246,10 +247,8 @@
         
         @param editor reference to the editor (QScintilla.Editor)
         """
-        try:
+        with contextlib.suppress(KeyError):
             del self.__editors[editor]
-        except KeyError:
-            pass
     
     def __editorShowMenu(self, menuName, menu, editor):
         """
@@ -260,15 +259,17 @@
         @param menu reference to the menu (QMenu)
         @param editor reference to the editor
         """
-        if menuName == "Tools":
-            if self.__menu.menuAction() not in menu.actions():
-                # Re-add our menu
-                self.__editors[editor] = []
-                if not menu.isEmpty():
-                    act = menu.addSeparator()
-                    self.__editors[editor].append(act)
-                act = menu.addMenu(self.__menu)
+        if (
+            menuName == "Tools" and
+            self.__menu.menuAction() not in menu.actions()
+        ):
+            # Re-add our menu
+            self.__editors[editor] = []
+            if not menu.isEmpty():
+                act = menu.addSeparator()
                 self.__editors[editor].append(act)
+            act = menu.addMenu(self.__menu)
+            self.__editors[editor].append(act)
     
     def __html5ToCss3(self):
         """
Binary file PluginProjectWeb.zip has changed
--- a/ProjectWeb/Documentation/source/Plugin_Project_Web.PluginProjectWeb.html	Wed Dec 30 11:02:10 2020 +0100
+++ b/ProjectWeb/Documentation/source/Plugin_Project_Web.PluginProjectWeb.html	Mon Apr 26 17:47:56 2021 +0200
@@ -275,7 +275,7 @@
         Public method to activate this plugin.
 </p>
 <dl>
-<dt>Returns:</dt>
+<dt>Return:</dt>
 <dd>
 tuple of None and activation status (boolean)
 </dd>
@@ -295,7 +295,7 @@
         Public method to get the filetype associations of the Web project type.
 </p>
 <dl>
-<dt>Returns:</dt>
+<dt>Return:</dt>
 <dd>
 dictionary with file type associations
 </dd>
--- a/ProjectWeb/Documentation/source/Plugin_Project_Web.ProjectWeb.Html5Prettifier.html	Wed Dec 30 11:02:10 2020 +0100
+++ b/ProjectWeb/Documentation/source/Plugin_Project_Web.ProjectWeb.Html5Prettifier.html	Mon Apr 26 17:47:56 2021 +0200
@@ -124,7 +124,7 @@
 </dd>
 </dl>
 <dl>
-<dt>Returns:</dt>
+<dt>Return:</dt>
 <dd>
 prettified comment (string)
 </dd>
@@ -137,7 +137,7 @@
         Public method to prettify the HTML code.
 </p>
 <dl>
-<dt>Returns:</dt>
+<dt>Return:</dt>
 <dd>
 prettified HTML code (string)
 </dd>
@@ -157,7 +157,7 @@
 </dd>
 </dl>
 <dl>
-<dt>Returns:</dt>
+<dt>Return:</dt>
 <dd>
 prettified tag (string)
 </dd>
--- a/ProjectWeb/Documentation/source/Plugin_Project_Web.ProjectWeb.Html5ToCss3Converter.html	Wed Dec 30 11:02:10 2020 +0100
+++ b/ProjectWeb/Documentation/source/Plugin_Project_Web.ProjectWeb.Html5ToCss3Converter.html	Mon Apr 26 17:47:56 2021 +0200
@@ -132,7 +132,7 @@
         Private method to extract all classes of the HTML text.
 </p>
 <dl>
-<dt>Returns:</dt>
+<dt>Return:</dt>
 <dd>
 list of tuples containing the tag name and its classes
             as a blank separated string (list of tuples of two strings)
@@ -146,7 +146,7 @@
         Private method to extract all IDs of the HTML text.
 </p>
 <dl>
-<dt>Returns:</dt>
+<dt>Return:</dt>
 <dd>
 list of tuples containing the tag name and its ID
             (list of tuples of two strings)
@@ -160,7 +160,7 @@
         Private method to extract all tags of the HTML text.
 </p>
 <dl>
-<dt>Returns:</dt>
+<dt>Return:</dt>
 <dd>
 list of all tags (list of strings)
 </dd>
@@ -173,7 +173,7 @@
         Public method to get the converted CSS3 text.
 </p>
 <dl>
-<dt>Returns:</dt>
+<dt>Return:</dt>
 <dd>
 CSS3 text (string)
 </dd>
--- a/ProjectWeb/Documentation/source/Plugin_Project_Web.ProjectWeb.Html5ToCss3ConverterParameterDialog.html	Wed Dec 30 11:02:10 2020 +0100
+++ b/ProjectWeb/Documentation/source/Plugin_Project_Web.ProjectWeb.Html5ToCss3ConverterParameterDialog.html	Mon Apr 26 17:47:56 2021 +0200
@@ -105,7 +105,7 @@
         Public method to get the entered data.
 </p>
 <dl>
-<dt>Returns:</dt>
+<dt>Return:</dt>
 <dd>
 tuple of indentation string (string) and a flag indicating to
             use CSS placeholders (boolean)
--- a/ProjectWeb/Documentation/source/Plugin_Project_Web.ProjectWeb.Html5ToJsConverter.html	Wed Dec 30 11:02:10 2020 +0100
+++ b/ProjectWeb/Documentation/source/Plugin_Project_Web.ProjectWeb.Html5ToJsConverter.html	Mon Apr 26 17:47:56 2021 +0200
@@ -128,7 +128,7 @@
         Private method to extract all classes of the HTML text.
 </p>
 <dl>
-<dt>Returns:</dt>
+<dt>Return:</dt>
 <dd>
 list of tuples containing the tag name and its classes
             as a blank separated string (list of tuples of two strings)
@@ -142,7 +142,7 @@
         Private method to extract all IDs of the HTML text.
 </p>
 <dl>
-<dt>Returns:</dt>
+<dt>Return:</dt>
 <dd>
 list of tuples containing the tag name and its ID
             (list of tuples of two strings)
@@ -156,7 +156,7 @@
         Public method to get the converted JavaScript text.
 </p>
 <dl>
-<dt>Returns:</dt>
+<dt>Return:</dt>
 <dd>
 JavaScript text (string)
 </dd>
--- a/ProjectWeb/Documentation/source/Plugin_Project_Web.ProjectWeb.Html5ToJsConverterParameterDialog.html	Wed Dec 30 11:02:10 2020 +0100
+++ b/ProjectWeb/Documentation/source/Plugin_Project_Web.ProjectWeb.Html5ToJsConverterParameterDialog.html	Mon Apr 26 17:47:56 2021 +0200
@@ -105,7 +105,7 @@
         Public method to get the entered data.
 </p>
 <dl>
-<dt>Returns:</dt>
+<dt>Return:</dt>
 <dd>
 tuple of indentation string (string) and a flag indicating to
             enclose the code by 'script' tags (boolean)
--- a/ProjectWeb/Html5Prettifier.py	Wed Dec 30 11:02:10 2020 +0100
+++ b/ProjectWeb/Html5Prettifier.py	Mon Apr 26 17:47:56 2021 +0200
@@ -25,7 +25,7 @@
         @param html HTML text to be prettified (string)
         @param parent reference to the parent object (QObject)
         """
-        super(Html5Prettifier, self).__init__(parent)
+        super().__init__(parent)
         
         self.__html = html
         self.__indentWidth = Preferences.getEditor("IndentWidth")
--- a/ProjectWeb/Html5ToCss3Converter.py	Wed Dec 30 11:02:10 2020 +0100
+++ b/ProjectWeb/Html5ToCss3Converter.py	Mon Apr 26 17:47:56 2021 +0200
@@ -42,7 +42,7 @@
         @param html HTML text to be converted (string)
         @param parent reference to the parent object (QObject)
         """
-        super(Html5ToCss3Converter, self).__init__(parent)
+        super().__init__(parent)
         
         self.__html = html
     
--- a/ProjectWeb/Html5ToCss3ConverterParameterDialog.py	Wed Dec 30 11:02:10 2020 +0100
+++ b/ProjectWeb/Html5ToCss3ConverterParameterDialog.py	Mon Apr 26 17:47:56 2021 +0200
@@ -25,7 +25,7 @@
         
         @param parent reference to the parent widget (QWidget)
         """
-        super(Html5ToCss3ConverterParameterDialog, self).__init__(parent)
+        super().__init__(parent)
         self.setupUi(self)
         
         msh = self.minimumSizeHint()
--- a/ProjectWeb/Html5ToJsConverter.py	Wed Dec 30 11:02:10 2020 +0100
+++ b/ProjectWeb/Html5ToJsConverter.py	Mon Apr 26 17:47:56 2021 +0200
@@ -37,7 +37,7 @@
         @param html HTML text to be converted (string)
         @param parent reference to the parent object (QObject)
         """
-        super(Html5ToJsConverter, self).__init__(parent)
+        super().__init__(parent)
         
         self.__html = html
     
--- a/ProjectWeb/Html5ToJsConverterParameterDialog.py	Wed Dec 30 11:02:10 2020 +0100
+++ b/ProjectWeb/Html5ToJsConverterParameterDialog.py	Mon Apr 26 17:47:56 2021 +0200
@@ -25,7 +25,7 @@
         
         @param parent reference to the parent widget (QWidget)
         """
-        super(Html5ToJsConverterParameterDialog, self).__init__(parent)
+        super().__init__(parent)
         self.setupUi(self)
         
         msh = self.minimumSizeHint()

eric ide

mercurial