eric7/PipInterface/PipLicensesDialog.py

branch
eric7
changeset 9108
19a57544f32c
parent 9103
8ac26b4c4316
child 9192
a763d57e23bc
diff -r 8e9525a780ae -r 19a57544f32c eric7/PipInterface/PipLicensesDialog.py
--- 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):

eric ide

mercurial