Corrected some code style issues and a glitch in the package license dialog filter function. eric7

Tue, 31 May 2022 10:49:02 +0200

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Tue, 31 May 2022 10:49:02 +0200
branch
eric7
changeset 9108
19a57544f32c
parent 9107
8e9525a780ae
child 9109
d4810c927c7b

Corrected some code style issues and a glitch in the package license dialog filter function.

eric7/PipInterface/PipLicensesDialog.py file | annotate | diff | comparison | revisions
eric7/PipInterface/PipPackagesWidget.py file | annotate | diff | comparison | revisions
eric7/Plugins/WizardPlugins/InputDialogWizard/InputDialogWizardDialog.py file | annotate | diff | comparison | revisions
eric7/Project/PropertiesDialog.py file | annotate | diff | comparison | revisions
scripts/install.py file | annotate | diff | comparison | revisions
scripts/uninstall.py file | annotate | diff | comparison | revisions
--- a/eric7/PipInterface/PipLicensesDialog.py	Tue May 31 09:59:42 2022 +0200
+++ b/eric7/PipInterface/PipLicensesDialog.py	Tue May 31 10:49:02 2022 +0200
@@ -8,6 +8,7 @@
 """
 
 import os
+import re
 
 from PyQt6.QtCore import pyqtSlot, Qt
 from PyQt6.QtWidgets import QDialog, QDialogButtonBox, QTreeWidgetItem
@@ -142,21 +143,27 @@
         self.__saveCSVButton.setEnabled(enable)
     
     @pyqtSlot(str)
-    def __filterPackagesByLicense(self, license):
+    def __filterPackagesByLicense(self, licenseName):
         """
         Private slot to filter the list of packages by license.
         
-        @param license license name
+        @param licenseName license name
         @type str
         """
+        pattern = r"\b{0}".format(re.escape(licenseName))
+        if not licenseName.endswith((")", "]", "}")):
+            pattern += r"\b"
+        regexp = re.compile(pattern)
         for row in range(self.licensesList.topLevelItemCount()):
             itm = self.licensesList.topLevelItem(row)
-            if license == self.__allFilter:
+            if licenseName == self.__allFilter:
                 itm.setHidden(False)
             else:
-                itm.setHidden(license not in itm.text(
-                    PipLicensesDialog.LicensesLicenseColumn
-                ))
+                itm.setHidden(
+                    regexp.search(
+                        itm.text(PipLicensesDialog.LicensesLicenseColumn)
+                    ) is None
+                )
     
     @pyqtSlot()
     def __saveAsCSV(self):
--- a/eric7/PipInterface/PipPackagesWidget.py	Tue May 31 09:59:42 2022 +0200
+++ b/eric7/PipInterface/PipPackagesWidget.py	Tue May 31 10:49:02 2022 +0200
@@ -985,10 +985,11 @@
                 ])
             except KeyError:
                 description = ""
-            if "released" in result:
-                date = result["released"]
-            else:
-                date = result["created"]
+            date = (
+                result["released"]
+                if "released" in result else
+                result["created"]
+            )
             itm = QTreeWidgetItem(
                 self.searchResultList, [
                     result['name'].strip(),
--- a/eric7/Plugins/WizardPlugins/InputDialogWizard/InputDialogWizardDialog.py	Tue May 31 09:59:42 2022 +0200
+++ b/eric7/Plugins/WizardPlugins/InputDialogWizard/InputDialogWizardDialog.py	Tue May 31 10:49:02 2022 +0200
@@ -193,7 +193,7 @@
                         os.linesep, istring, self.eTextDefault.text())
             code += '{0}){0}'.format(estring)
         elif self.rMultiLineText.isChecked():
-            code +='getMultiLineText({0}{1}'.format(os.linesep, istring)
+            code += 'getMultiLineText({0}{1}'.format(os.linesep, istring)
             code += '{0},{1}{2}'.format(parent, os.linesep, istring)
             code += 'self.tr("{0}"),{1}{2}'.format(
                 self.eCaption.text(), os.linesep, istring)
--- a/eric7/Project/PropertiesDialog.py	Tue May 31 09:59:42 2022 +0200
+++ b/eric7/Project/PropertiesDialog.py	Tue May 31 10:49:02 2022 +0200
@@ -55,10 +55,6 @@
             getSupportedDocstringTypes()
         ):
             self.docstringStyleComboBox.addItem(docstringStyle, docstringType)
-##        
-##        self.testingFrameworkComboBox.addItem(self.tr("None"), "")
-##        for framework in sorted(FrameworkNames):
-##            self.testingFrameworkComboBox.addItem(framework, framework)
         
         self.project = project
         self.newProject = new
--- a/scripts/install.py	Tue May 31 09:59:42 2022 +0200
+++ b/scripts/install.py	Tue May 31 10:49:02 2022 +0200
@@ -510,7 +510,7 @@
         "eric7_pluginuninstall", "eric7_qregularexpression", "eric7_re",
         "eric7_shell", "eric7_snap", "eric7_sqlbrowser", "eric7_testing",
         "eric7_tray", "eric7_trpreviewer", "eric7_uipreviewer",
-         "eric7_virtualenv", "eric7",
+        "eric7_virtualenv", "eric7",
         # obsolete scripts below
         "eric7_unittest",
     ]
--- a/scripts/uninstall.py	Tue May 31 09:59:42 2022 +0200
+++ b/scripts/uninstall.py	Tue May 31 10:49:02 2022 +0200
@@ -127,7 +127,7 @@
         "eric7_pluginuninstall", "eric7_qregularexpression", "eric7_re",
         "eric7_shell", "eric7_snap", "eric7_sqlbrowser", "eric7_testing",
         "eric7_tray", "eric7_trpreviewer", "eric7_uipreviewer",
-         "eric7_virtualenv", "eric7",
+        "eric7_virtualenv", "eric7",
         # obsolete scripts below
         "eric7_unittest",
     ]

eric ide

mercurial