15 |
15 |
16 from .EditWatchpointDialog import EditWatchpointDialog |
16 from .EditWatchpointDialog import EditWatchpointDialog |
17 |
17 |
18 import Utilities |
18 import Utilities |
19 |
19 |
|
20 |
20 class WatchPointViewer(QTreeView): |
21 class WatchPointViewer(QTreeView): |
21 """ |
22 """ |
22 Class implementing the watch expression viewer widget. |
23 Class implementing the watch expression viewer widget. |
23 |
24 |
24 Watch expressions will be shown with all their details. They can be modified through |
25 Watch expressions will be shown with all their details. They can be modified through |
25 the context menu of this widget. |
26 the context menu of this widget. |
26 """ |
27 """ |
27 def __init__(self, parent = None): |
28 def __init__(self, parent=None): |
28 """ |
29 """ |
29 Constructor |
30 Constructor |
30 |
31 |
31 @param parent the parent (QWidget) |
32 @param parent the parent (QWidget) |
32 """ |
33 """ |
33 QTreeView.__init__(self,parent) |
34 QTreeView.__init__(self, parent) |
34 self.setObjectName("WatchExpressionViewer") |
35 self.setObjectName("WatchExpressionViewer") |
35 |
36 |
36 self.__model = None |
37 self.__model = None |
37 |
38 |
38 self.setItemsExpandable(False) |
39 self.setItemsExpandable(False) |
147 |
148 |
148 self.backMenuActions = {} |
149 self.backMenuActions = {} |
149 self.backMenu = QMenu() |
150 self.backMenu = QMenu() |
150 self.backMenu.addAction(self.trUtf8("Add"), self.__addWatchPoint) |
151 self.backMenu.addAction(self.trUtf8("Add"), self.__addWatchPoint) |
151 self.backMenuActions["EnableAll"] = \ |
152 self.backMenuActions["EnableAll"] = \ |
152 self.backMenu.addAction(self.trUtf8("Enable all"), |
153 self.backMenu.addAction(self.trUtf8("Enable all"), |
153 self.__enableAllWatchPoints) |
154 self.__enableAllWatchPoints) |
154 self.backMenuActions["DisableAll"] = \ |
155 self.backMenuActions["DisableAll"] = \ |
155 self.backMenu.addAction(self.trUtf8("Disable all"), |
156 self.backMenu.addAction(self.trUtf8("Disable all"), |
156 self.__disableAllWatchPoints) |
157 self.__disableAllWatchPoints) |
157 self.backMenuActions["DeleteAll"] = \ |
158 self.backMenuActions["DeleteAll"] = \ |
158 self.backMenu.addAction(self.trUtf8("Delete all"), |
159 self.backMenu.addAction(self.trUtf8("Delete all"), |
159 self.__deleteAllWatchPoints) |
160 self.__deleteAllWatchPoints) |
160 self.backMenu.addSeparator() |
161 self.backMenu.addSeparator() |
161 self.backMenu.addAction(self.trUtf8("Configure..."), self.__configure) |
162 self.backMenu.addAction(self.trUtf8("Configure..."), self.__configure) |
162 self.backMenu.aboutToShow.connect(self.__showBackMenu) |
163 self.backMenu.aboutToShow.connect(self.__showBackMenu) |
163 |
164 |
164 self.multiMenu = QMenu() |
165 self.multiMenu = QMenu() |
165 self.multiMenu.addAction(self.trUtf8("Add"), self.__addWatchPoint) |
166 self.multiMenu.addAction(self.trUtf8("Add"), self.__addWatchPoint) |
166 self.multiMenu.addSeparator() |
167 self.multiMenu.addSeparator() |
167 self.multiMenu.addAction(self.trUtf8("Enable selected"), |
168 self.multiMenu.addAction(self.trUtf8("Enable selected"), |
168 self.__enableSelectedWatchPoints) |
169 self.__enableSelectedWatchPoints) |
169 self.multiMenu.addAction(self.trUtf8("Enable all"), self.__enableAllWatchPoints) |
170 self.multiMenu.addAction(self.trUtf8("Enable all"), self.__enableAllWatchPoints) |
170 self.multiMenu.addSeparator() |
171 self.multiMenu.addSeparator() |
171 self.multiMenu.addAction(self.trUtf8("Disable selected"), |
172 self.multiMenu.addAction(self.trUtf8("Disable selected"), |
172 self.__disableSelectedWatchPoints) |
173 self.__disableSelectedWatchPoints) |
173 self.multiMenu.addAction(self.trUtf8("Disable all"), self.__disableAllWatchPoints) |
174 self.multiMenu.addAction(self.trUtf8("Disable all"), self.__disableAllWatchPoints) |
174 self.multiMenu.addSeparator() |
175 self.multiMenu.addSeparator() |
175 self.multiMenu.addAction(self.trUtf8("Delete selected"), |
176 self.multiMenu.addAction(self.trUtf8("Delete selected"), |
176 self.__deleteSelectedWatchPoints) |
177 self.__deleteSelectedWatchPoints) |
177 self.multiMenu.addAction(self.trUtf8("Delete all"), self.__deleteAllWatchPoints) |
178 self.multiMenu.addAction(self.trUtf8("Delete all"), self.__deleteAllWatchPoints) |
178 self.multiMenu.addSeparator() |
179 self.multiMenu.addSeparator() |
179 self.multiMenu.addAction(self.trUtf8("Configure..."), self.__configure) |
180 self.multiMenu.addAction(self.trUtf8("Configure..."), self.__configure) |
180 |
181 |
203 Private slot to clear the selection. |
204 Private slot to clear the selection. |
204 """ |
205 """ |
205 for index in self.selectedIndexes(): |
206 for index in self.selectedIndexes(): |
206 self.__setRowSelected(index, False) |
207 self.__setRowSelected(index, False) |
207 |
208 |
208 def __findDuplicates(self, cond, special, showMessage = False, index = QModelIndex()): |
209 def __findDuplicates(self, cond, special, showMessage=False, index=QModelIndex()): |
209 """ |
210 """ |
210 Private method to check, if an entry already exists. |
211 Private method to check, if an entry already exists. |
211 |
212 |
212 @param cond condition to check (string) |
213 @param cond condition to check (string) |
213 @param special special condition to check (string) |
214 @param special special condition to check (string) |
279 dlg = EditWatchpointDialog( |
280 dlg = EditWatchpointDialog( |
280 (cond, temp, enabled, count, special), self) |
281 (cond, temp, enabled, count, special), self) |
281 if dlg.exec_() == QDialog.Accepted: |
282 if dlg.exec_() == QDialog.Accepted: |
282 cond, temp, enabled, count, special = dlg.getData() |
283 cond, temp, enabled, count, special = dlg.getData() |
283 if not self.__findDuplicates(cond, special, True, sindex): |
284 if not self.__findDuplicates(cond, special, True, sindex): |
284 self.__model.setWatchPointByIndex(sindex, |
285 self.__model.setWatchPointByIndex(sindex, |
285 cond, special, (temp, enabled, count)) |
286 cond, special, (temp, enabled, count)) |
286 self.__resizeColumns() |
287 self.__resizeColumns() |
287 self.__resort() |
288 self.__resort() |
288 |
289 |
289 def __setWpEnabled(self, index, enabled): |
290 def __setWpEnabled(self, index, enabled): |