129 "attribute": self.tr("Attribute"), |
129 "attribute": self.tr("Attribute"), |
130 "variable": self.tr("Variable"), |
130 "variable": self.tr("Variable"), |
131 "class": self.tr("Class"), |
131 "class": self.tr("Class"), |
132 "import": self.tr("Import"), |
132 "import": self.tr("Import"), |
133 } |
133 } |
|
134 |
|
135 self.__allTypesFilter = self.tr("All Types") |
134 |
136 |
135 def __createErrorItem(self, filename, message): |
137 def __createErrorItem(self, filename, message): |
136 """ |
138 """ |
137 Private slot to create a new error item in the result list. |
139 Private slot to create a new error item in the result list. |
138 |
140 |
204 @type str or list of str |
206 @type str or list of str |
205 """ |
207 """ |
206 self.cancelled = False |
208 self.cancelled = False |
207 self.__errorItem = None |
209 self.__errorItem = None |
208 self.resultList.clear() |
210 self.resultList.clear() |
|
211 self.typeFilterComboBox.clear() |
209 |
212 |
210 self.buttonBox.button(QDialogButtonBox.StandardButton.Close).setEnabled(False) |
213 self.buttonBox.button(QDialogButtonBox.StandardButton.Close).setEnabled(False) |
211 self.buttonBox.button(QDialogButtonBox.StandardButton.Cancel).setEnabled(True) |
214 self.buttonBox.button(QDialogButtonBox.StandardButton.Cancel).setEnabled(True) |
212 self.buttonBox.button(QDialogButtonBox.StandardButton.Cancel).setDefault(True) |
215 self.buttonBox.button(QDialogButtonBox.StandardButton.Cancel).setDefault(True) |
213 QApplication.processEvents() |
216 QApplication.processEvents() |
660 if lastFileItem is None or lastFileName != item.filename: |
665 if lastFileItem is None or lastFileName != item.filename: |
661 lastFileItem = self.__createFileItem(item.filename) |
666 lastFileItem = self.__createFileItem(item.filename) |
662 lastFileName = item.filename |
667 lastFileName = item.filename |
663 |
668 |
664 self.__createResultItem(lastFileItem, item) |
669 self.__createResultItem(lastFileItem, item) |
|
670 |
|
671 # add to type filters if not already present |
|
672 try: |
|
673 translatedType = self.__translatedTypes[item.typ] |
|
674 except KeyError: |
|
675 translatedType = item.typ |
|
676 typeFilters.add(translatedType) |
|
677 |
|
678 blocked = self.typeFilterComboBox.blockSignals(True) |
|
679 self.typeFilterComboBox.addItem(self.__allTypesFilter) |
|
680 self.typeFilterComboBox.addItems(sorted(typeFilters)) |
|
681 self.typeFilterComboBox.blockSignals(blocked) |
665 |
682 |
666 def __createResultItem(self, parent, item): |
683 def __createResultItem(self, parent, item): |
667 """ |
684 """ |
668 Private method to create a result item. |
685 Private method to create a result item. |
669 |
686 |
793 self.__data["WhiteLists"][key] = whitelist[:] |
810 self.__data["WhiteLists"][key] = whitelist[:] |
794 changed = True |
811 changed = True |
795 |
812 |
796 if changed: |
813 if changed: |
797 self.__project.setData("CHECKERSPARMS", "Vulture", self.__data) |
814 self.__project.setData("CHECKERSPARMS", "Vulture", self.__data) |
|
815 |
|
816 @pyqtSlot(str) |
|
817 def on_typeFilterComboBox_currentTextChanged(self, typeFilter): |
|
818 """ |
|
819 Private slot to handle the selection of a type filter. |
|
820 |
|
821 @param typeFilter type of the selected filter entry |
|
822 @type str |
|
823 """ |
|
824 if typeFilter == self.__allTypesFilter: |
|
825 for row in range(self.resultList.topLevelItemCount()): |
|
826 fileItem = self.resultList.topLevelItem(row) |
|
827 fileItem.setHidden(False) |
|
828 for result in range(fileItem.childCount()): |
|
829 resultItem = fileItem.child(result) |
|
830 resultItem.setHidden(False) |
|
831 |
|
832 else: |
|
833 for row in range(self.resultList.topLevelItemCount()): |
|
834 fileItem = self.resultList.topLevelItem(row) |
|
835 visibleResults = 0 |
|
836 for result in range(fileItem.childCount()): |
|
837 resultItem = fileItem.child(result) |
|
838 if resultItem.text(3) == typeFilter: |
|
839 visibleResults += 1 |
|
840 resultItem.setHidden(False) |
|
841 else: |
|
842 resultItem.setHidden(True) |
|
843 fileItem.setHidden(visibleResults == 0) |