VultureChecker/EditWhiteListDialog.py

branch
eric7
changeset 90
6393ee6e7993
parent 85
6a17f25cefa1
child 99
ace98e6afc04
--- a/VultureChecker/EditWhiteListDialog.py	Mon Sep 19 18:06:19 2022 +0200
+++ b/VultureChecker/EditWhiteListDialog.py	Mon Sep 19 18:11:49 2022 +0200
@@ -17,10 +17,11 @@
     """
     Class implementing the whitelist edit dialog.
     """
+
     def __init__(self, whitelists, parent=None):
         """
         Constructor
-        
+
         @param whitelists dictionary containing the whitelists
         @type dict of list of str
         @param parent reference to the parent widget
@@ -28,7 +29,7 @@
         """
         super().__init__(parent)
         self.setupUi(self)
-        
+
         self.__lists = [
             self.classesList,
             self.functionsList,
@@ -39,7 +40,7 @@
             self.importsList,
             self.patternsList,
         ]
-        
+
         self.classesList.addItems(whitelists["class"])
         self.functionsList.addItems(whitelists["function"])
         self.methodsList.addItems(whitelists["method"])
@@ -48,16 +49,16 @@
         self.propertiesList.addItems(whitelists["property"])
         self.importsList.addItems(whitelists["import"])
         self.patternsList.addItems(whitelists["__patterns__"])
-        
+
         self.listsWidget.setCurrentIndex(self.listsWidget.count() - 1)
-    
+
     @pyqtSlot()
     def on_patternsList_itemSelectionChanged(self):
         """
         Private slot to react upon a change of selection in the patterns list.
         """
         self.__setButtonEnabledStates()
-    
+
     @pyqtSlot()
     def on_propertiesList_itemSelectionChanged(self):
         """
@@ -65,14 +66,14 @@
         list.
         """
         self.__setButtonEnabledStates()
-    
+
     @pyqtSlot()
     def on_variablesList_itemSelectionChanged(self):
         """
         Private slot to react upon a change of selection in the variables list.
         """
         self.__setButtonEnabledStates()
-    
+
     @pyqtSlot()
     def on_attributesList_itemSelectionChanged(self):
         """
@@ -80,46 +81,46 @@
         list.
         """
         self.__setButtonEnabledStates()
-    
+
     @pyqtSlot()
     def on_functionsList_itemSelectionChanged(self):
         """
         Private slot to react upon a change of selection in the functions list.
         """
         self.__setButtonEnabledStates()
-    
+
     @pyqtSlot()
     def on_methodsList_itemSelectionChanged(self):
         """
         Private slot to react upon a change of selection in the methods list.
         """
         self.__setButtonEnabledStates()
-    
+
     @pyqtSlot()
     def on_classesList_itemSelectionChanged(self):
         """
         Private slot to react upon a change of selection in the classes list.
         """
         self.__setButtonEnabledStates()
-    
+
     @pyqtSlot()
     def on_importsList_itemSelectionChanged(self):
         """
         Private slot to react upon a change of selection in the imports list.
         """
         self.__setButtonEnabledStates()
-    
+
     def __isPattern(self, name):
         """
         Private method to check, if a name is a wildcard pattern.
-        
+
         @param name name to be checked
         @type str
         @return flag indicating a wildcard pattern
         @rtype bool
         """
         return any(char in name for char in "*?[")
-    
+
     @pyqtSlot()
     def on_addButton_clicked(self):
         """
@@ -128,16 +129,19 @@
         name, ok = QInputDialog.getText(
             self,
             self.tr("Add to Whitelist"),
-            self.tr("Enter a name or wildcard pattern to be added to the"
-                    " current whitelist:"),
-            QLineEdit.EchoMode.Normal)
+            self.tr(
+                "Enter a name or wildcard pattern to be added to the"
+                " current whitelist:"
+            ),
+            QLineEdit.EchoMode.Normal,
+        )
         if ok and bool(name):
             curr = self.__lists[self.listsWidget.currentIndex()]
             if curr is self.patternsList or self.__isPattern(name):
                 self.patternsList.addItem(name)
             else:
                 curr.addItem(name)
-    
+
     @pyqtSlot()
     def on_removeButton_clicked(self):
         """
@@ -148,7 +152,7 @@
             row = curr.row(itm)
             curr.takeItem(row)
             del itm
-    
+
     @pyqtSlot()
     def on_removeAllButton_clicked(self):
         """
@@ -156,17 +160,17 @@
         """
         curr = self.__lists[self.listsWidget.currentIndex()]
         curr.clear()
-    
+
     @pyqtSlot(int)
     def on_listsWidget_currentChanged(self, index):
         """
         Private slot handling the selection of tab.
-        
+
         @param index index of the selected tab
         @type int
         """
         self.__setButtonEnabledStates()
-    
+
     def __setButtonEnabledStates(self):
         """
         Private slot to set the state of various buttons.
@@ -174,11 +178,11 @@
         curr = self.__lists[self.listsWidget.currentIndex()]
         self.removeButton.setEnabled(len(curr.selectedItems()) > 0)
         self.removeAllButton.setEnabled(curr.count() > 0)
-    
+
     def __getWhiteList(self, listWidget):
         """
         Private method to get the whitelisted names from a list widget.
-        
+
         @param listWidget reference to the list widget
         @type QListWidget
         @return whitelisted names
@@ -188,11 +192,11 @@
         for row in range(listWidget.count()):
             whitelist.append(listWidget.item(row).text())
         return whitelist
-    
+
     def getWhiteLists(self):
         """
         Public methods to retrieve the various whitelists.
-        
+
         @return dictionary containing the whitelists
         @rtype dict of list of str
         """

eric ide

mercurial