15 |
15 |
16 class ExceptionsFilterDialog(QDialog, Ui_ExceptionsFilterDialog): |
16 class ExceptionsFilterDialog(QDialog, Ui_ExceptionsFilterDialog): |
17 """ |
17 """ |
18 Class implementing the exceptions filter dialog. |
18 Class implementing the exceptions filter dialog. |
19 """ |
19 """ |
|
20 |
20 def __init__(self, excList, ignore, parent=None): |
21 def __init__(self, excList, ignore, parent=None): |
21 """ |
22 """ |
22 Constructor |
23 Constructor |
23 |
24 |
24 @param excList list of exceptions to be edited (list of strings) |
25 @param excList list of exceptions to be edited (list of strings) |
25 @param ignore flag indicating the ignore exceptions mode (boolean) |
26 @param ignore flag indicating the ignore exceptions mode (boolean) |
26 @param parent the parent widget (QWidget) |
27 @param parent the parent widget (QWidget) |
27 """ |
28 """ |
28 super().__init__(parent) |
29 super().__init__(parent) |
29 self.setupUi(self) |
30 self.setupUi(self) |
30 self.setModal(True) |
31 self.setModal(True) |
31 |
32 |
32 self.exceptionList.addItems(excList) |
33 self.exceptionList.addItems(excList) |
33 |
34 |
34 if ignore: |
35 if ignore: |
35 self.setWindowTitle(self.tr("Ignored Exceptions")) |
36 self.setWindowTitle(self.tr("Ignored Exceptions")) |
36 self.exceptionList.setToolTip( |
37 self.exceptionList.setToolTip(self.tr("List of ignored exceptions")) |
37 self.tr("List of ignored exceptions")) |
38 |
38 |
39 self.okButton = self.buttonBox.button(QDialogButtonBox.StandardButton.Ok) |
39 self.okButton = self.buttonBox.button( |
40 |
40 QDialogButtonBox.StandardButton.Ok) |
|
41 |
|
42 @pyqtSlot() |
41 @pyqtSlot() |
43 def on_exceptionList_itemSelectionChanged(self): |
42 def on_exceptionList_itemSelectionChanged(self): |
44 """ |
43 """ |
45 Private slot to handle the change of the selection. |
44 Private slot to handle the change of the selection. |
46 """ |
45 """ |
47 self.deleteButton.setEnabled( |
46 self.deleteButton.setEnabled(len(self.exceptionList.selectedItems()) > 0) |
48 len(self.exceptionList.selectedItems()) > 0) |
47 |
49 |
|
50 @pyqtSlot() |
48 @pyqtSlot() |
51 def on_deleteButton_clicked(self): |
49 def on_deleteButton_clicked(self): |
52 """ |
50 """ |
53 Private slot to delete the currently selected exception of the listbox. |
51 Private slot to delete the currently selected exception of the listbox. |
54 """ |
52 """ |
55 itm = self.exceptionList.takeItem(self.exceptionList.currentRow()) |
53 itm = self.exceptionList.takeItem(self.exceptionList.currentRow()) |
56 del itm |
54 del itm |
57 |
55 |
58 @pyqtSlot() |
56 @pyqtSlot() |
59 def on_deleteAllButton_clicked(self): |
57 def on_deleteAllButton_clicked(self): |
60 """ |
58 """ |
61 Private slot to delete all exceptions of the listbox. |
59 Private slot to delete all exceptions of the listbox. |
62 """ |
60 """ |
63 while self.exceptionList.count() > 0: |
61 while self.exceptionList.count() > 0: |
64 itm = self.exceptionList.takeItem(0) # __IGNORE_WARNING__ |
62 itm = self.exceptionList.takeItem(0) # __IGNORE_WARNING__ |
65 del itm |
63 del itm |
66 |
64 |
67 @pyqtSlot() |
65 @pyqtSlot() |
68 def on_addButton_clicked(self): |
66 def on_addButton_clicked(self): |
69 """ |
67 """ |
71 """ |
69 """ |
72 exception = self.exceptionEdit.text() |
70 exception = self.exceptionEdit.text() |
73 if exception: |
71 if exception: |
74 self.exceptionList.addItem(exception) |
72 self.exceptionList.addItem(exception) |
75 self.exceptionEdit.clear() |
73 self.exceptionEdit.clear() |
76 |
74 |
77 def on_exceptionEdit_textChanged(self, txt): |
75 def on_exceptionEdit_textChanged(self, txt): |
78 """ |
76 """ |
79 Private slot to handle the textChanged signal of exceptionEdit. |
77 Private slot to handle the textChanged signal of exceptionEdit. |
80 |
78 |
81 This slot sets the enabled status of the add button and sets the forms |
79 This slot sets the enabled status of the add button and sets the forms |
82 default button. |
80 default button. |
83 |
81 |
84 @param txt the text entered into exceptionEdit (string) |
82 @param txt the text entered into exceptionEdit (string) |
85 """ |
83 """ |
86 if not txt: |
84 if not txt: |
87 self.okButton.setDefault(True) |
85 self.okButton.setDefault(True) |
88 self.addButton.setDefault(False) |
86 self.addButton.setDefault(False) |
89 self.addButton.setEnabled(False) |
87 self.addButton.setEnabled(False) |
90 else: |
88 else: |
91 self.okButton.setDefault(False) |
89 self.okButton.setDefault(False) |
92 self.addButton.setDefault(True) |
90 self.addButton.setDefault(True) |
93 self.addButton.setEnabled(True) |
91 self.addButton.setEnabled(True) |
94 |
92 |
95 def getExceptionsList(self): |
93 def getExceptionsList(self): |
96 """ |
94 """ |
97 Public method to retrieve the list of exception types. |
95 Public method to retrieve the list of exception types. |
98 |
96 |
99 @return list of exception types (list of strings) |
97 @return list of exception types (list of strings) |
100 """ |
98 """ |
101 excList = [] |
99 excList = [] |
102 for row in range(0, self.exceptionList.count()): |
100 for row in range(0, self.exceptionList.count()): |
103 itm = self.exceptionList.item(row) |
101 itm = self.exceptionList.item(row) |