Debugger/ExceptionsFilterDialog.py

changeset 0
de9c2efb9d02
child 12
1d8dd9706f46
equal deleted inserted replaced
-1:000000000000 0:de9c2efb9d02
1 # -*- coding: utf-8 -*-
2
3 # Copyright (c) 2002 - 2009 Detlev Offenbach <detlev@die-offenbachs.de>
4 #
5
6 """
7 Module implementing the exceptions filter dialog.
8 """
9
10 from PyQt4.QtCore import *
11 from PyQt4.QtGui import *
12
13 from Ui_ExceptionsFilterDialog import Ui_ExceptionsFilterDialog
14
15 class ExceptionsFilterDialog(QDialog, Ui_ExceptionsFilterDialog):
16 """
17 Class implementing the exceptions filter dialog.
18 """
19 def __init__(self, excList, ignore, parent=None):
20 """
21 Constructor
22
23 @param excList list of exceptions to be edited (list of strings)
24 @param ignore flag indicating the ignore exceptions mode (boolean)
25 @param parent the parent widget (QWidget)
26 """
27 QDialog.__init__(self, parent)
28 self.setupUi(self)
29 self.setModal(True)
30
31 self.exceptionList.addItems(excList)
32
33 if ignore:
34 self.setWindowTitle(self.trUtf8("Ignored Exceptions"))
35 self.exceptionList.setToolTip(self.trUtf8("List of ignored exceptions"))
36
37 self.okButton = self.buttonBox.button(QDialogButtonBox.Ok)
38
39 @pyqtSlot()
40 def on_exceptionList_itemSelectionChanged(self):
41 """
42 Private slot to handle the change of the selection.
43 """
44 self.deleteButton.setEnabled(len(self.exceptionList.selectedItems()) > 0)
45
46 @pyqtSlot()
47 def on_deleteButton_clicked(self):
48 """
49 Private slot to delete the currently selected exception of the listbox.
50 """
51 itm = self.exceptionList.takeItem(self.exceptionList.currentRow())
52 del itm
53
54 @pyqtSlot()
55 def on_deleteAllButton_clicked(self):
56 """
57 Private slot to delete all exceptions of the listbox.
58 """
59 while self.exceptionList.count() > 0:
60 itm = self.exceptionList.takeItem(0)
61 del itm
62
63 @pyqtSlot()
64 def on_addButton_clicked(self):
65 """
66 Private slot to handle the Add button press.
67 """
68 exception = self.exceptionEdit.text()
69 if exception:
70 self.exceptionList.addItem(exception)
71 self.exceptionEdit.clear()
72
73 def on_exceptionEdit_textChanged(self, txt):
74 """
75 Private slot to handle the textChanged signal of exceptionEdit.
76
77 This slot sets the enabled status of the add button and sets the forms
78 default button.
79
80 @param txt the text entered into exceptionEdit (string)
81 """
82 if not txt:
83 self.okButton.setDefault(True)
84 self.addButton.setDefault(False)
85 self.addButton.setEnabled(False)
86 else:
87 self.okButton.setDefault(False)
88 self.addButton.setDefault(True)
89 self.addButton.setEnabled(True)
90
91 def getExceptionsList(self):
92 """
93 Public method to retrieve the list of exception types.
94
95 @return list of exception types (list of strings)
96 """
97 excList = []
98 for row in range(0, self.exceptionList.count()):
99 itm = self.exceptionList.item(row)
100 excList.append(itm.text())
101 return excList

eric ide

mercurial