24 |
20 |
25 |
21 |
26 class BreakPointViewer(QTreeView): |
22 class BreakPointViewer(QTreeView): |
27 """ |
23 """ |
28 Class implementing the Breakpoint viewer widget. |
24 Class implementing the Breakpoint viewer widget. |
29 |
25 |
30 Breakpoints will be shown with all their details. They can be modified |
26 Breakpoints will be shown with all their details. They can be modified |
31 through the context menu of this widget. |
27 through the context menu of this widget. |
32 |
28 |
33 @signal sourceFile(str, int) emitted to show the source of a breakpoint |
29 @signal sourceFile(str, int) emitted to show the source of a breakpoint |
34 """ |
30 """ |
|
31 |
35 sourceFile = pyqtSignal(str, int) |
32 sourceFile = pyqtSignal(str, int) |
36 |
33 |
37 def __init__(self, parent=None): |
34 def __init__(self, parent=None): |
38 """ |
35 """ |
39 Constructor |
36 Constructor |
40 |
37 |
41 @param parent the parent (QWidget) |
38 @param parent the parent (QWidget) |
42 """ |
39 """ |
43 super().__init__(parent) |
40 super().__init__(parent) |
44 self.setObjectName("BreakPointViewer") |
41 self.setObjectName("BreakPointViewer") |
45 |
42 |
46 self.__model = None |
43 self.__model = None |
47 |
44 |
48 self.setItemsExpandable(False) |
45 self.setItemsExpandable(False) |
49 self.setRootIsDecorated(False) |
46 self.setRootIsDecorated(False) |
50 self.setAlternatingRowColors(True) |
47 self.setAlternatingRowColors(True) |
51 self.setSelectionMode( |
48 self.setSelectionMode(QAbstractItemView.SelectionMode.ExtendedSelection) |
52 QAbstractItemView.SelectionMode.ExtendedSelection) |
49 self.setSelectionBehavior(QAbstractItemView.SelectionBehavior.SelectRows) |
53 self.setSelectionBehavior( |
50 |
54 QAbstractItemView.SelectionBehavior.SelectRows) |
|
55 |
|
56 self.setWindowTitle(self.tr("Breakpoints")) |
51 self.setWindowTitle(self.tr("Breakpoints")) |
57 |
52 |
58 self.setContextMenuPolicy(Qt.ContextMenuPolicy.CustomContextMenu) |
53 self.setContextMenuPolicy(Qt.ContextMenuPolicy.CustomContextMenu) |
59 self.customContextMenuRequested.connect(self.__showContextMenu) |
54 self.customContextMenuRequested.connect(self.__showContextMenu) |
60 self.doubleClicked.connect(self.__doubleClicked) |
55 self.doubleClicked.connect(self.__doubleClicked) |
61 |
56 |
62 self.__createPopupMenus() |
57 self.__createPopupMenus() |
63 |
58 |
64 def setModel(self, model): |
59 def setModel(self, model): |
65 """ |
60 """ |
66 Public slot to set the breakpoint model. |
61 Public slot to set the breakpoint model. |
67 |
62 |
68 @param model reference to the breakpoint model |
63 @param model reference to the breakpoint model |
69 @type BreakPointModel |
64 @type BreakPointModel |
70 """ |
65 """ |
71 self.__model = model |
66 self.__model = model |
72 |
67 |
73 self.sortingModel = QSortFilterProxyModel() |
68 self.sortingModel = QSortFilterProxyModel() |
74 self.sortingModel.setDynamicSortFilter(True) |
69 self.sortingModel.setDynamicSortFilter(True) |
75 self.sortingModel.setSourceModel(self.__model) |
70 self.sortingModel.setSourceModel(self.__model) |
76 super().setModel(self.sortingModel) |
71 super().setModel(self.sortingModel) |
77 |
72 |
78 header = self.header() |
73 header = self.header() |
79 header.setSortIndicator(0, Qt.SortOrder.AscendingOrder) |
74 header.setSortIndicator(0, Qt.SortOrder.AscendingOrder) |
80 header.setSortIndicatorShown(True) |
75 header.setSortIndicatorShown(True) |
81 header.setSectionsClickable(True) |
76 header.setSectionsClickable(True) |
82 |
77 |
83 self.setSortingEnabled(True) |
78 self.setSortingEnabled(True) |
84 |
79 |
85 self.__layoutDisplay() |
80 self.__layoutDisplay() |
86 |
81 |
87 def __layoutDisplay(self): |
82 def __layoutDisplay(self): |
88 """ |
83 """ |
89 Private slot to perform a layout operation. |
84 Private slot to perform a layout operation. |
90 """ |
85 """ |
91 self.__resizeColumns() |
86 self.__resizeColumns() |
92 self.__resort() |
87 self.__resort() |
93 |
88 |
94 def __resizeColumns(self): |
89 def __resizeColumns(self): |
95 """ |
90 """ |
96 Private slot to resize the view when items get added, edited or |
91 Private slot to resize the view when items get added, edited or |
97 deleted. |
92 deleted. |
98 """ |
93 """ |
99 self.header().resizeSections(QHeaderView.ResizeMode.ResizeToContents) |
94 self.header().resizeSections(QHeaderView.ResizeMode.ResizeToContents) |
100 self.header().setStretchLastSection(True) |
95 self.header().setStretchLastSection(True) |
101 |
96 |
102 def __resort(self): |
97 def __resort(self): |
103 """ |
98 """ |
104 Private slot to resort the tree. |
99 Private slot to resort the tree. |
105 """ |
100 """ |
106 self.model().sort(self.header().sortIndicatorSection(), |
101 self.model().sort( |
107 self.header().sortIndicatorOrder()) |
102 self.header().sortIndicatorSection(), self.header().sortIndicatorOrder() |
108 |
103 ) |
|
104 |
109 def __toSourceIndex(self, index): |
105 def __toSourceIndex(self, index): |
110 """ |
106 """ |
111 Private slot to convert an index to a source index. |
107 Private slot to convert an index to a source index. |
112 |
108 |
113 @param index index to be converted |
109 @param index index to be converted |
114 @type QModelIndex |
110 @type QModelIndex |
115 @return mapped index |
111 @return mapped index |
116 @rtype QModelIndex |
112 @rtype QModelIndex |
117 """ |
113 """ |
118 return self.sortingModel.mapToSource(index) |
114 return self.sortingModel.mapToSource(index) |
119 |
115 |
120 def __fromSourceIndex(self, sindex): |
116 def __fromSourceIndex(self, sindex): |
121 """ |
117 """ |
122 Private slot to convert a source index to an index. |
118 Private slot to convert a source index to an index. |
123 |
119 |
124 @param sindex source index to be converted |
120 @param sindex source index to be converted |
125 @type QModelIndex |
121 @type QModelIndex |
126 @return mapped index |
122 @return mapped index |
127 @rtype QModelIndex |
123 @rtype QModelIndex |
128 """ |
124 """ |
129 return self.sortingModel.mapFromSource(sindex) |
125 return self.sortingModel.mapFromSource(sindex) |
130 |
126 |
131 def __setRowSelected(self, index, selected=True): |
127 def __setRowSelected(self, index, selected=True): |
132 """ |
128 """ |
133 Private slot to select a complete row. |
129 Private slot to select a complete row. |
134 |
130 |
135 @param index index determining the row to be selected |
131 @param index index determining the row to be selected |
136 @type QModelIndex |
132 @type QModelIndex |
137 @param selected flag indicating the action |
133 @param selected flag indicating the action |
138 @type bool |
134 @type bool |
139 """ |
135 """ |
140 if not index.isValid(): |
136 if not index.isValid(): |
141 return |
137 return |
142 |
138 |
143 flags = ( |
139 flags = ( |
144 (QItemSelectionModel.SelectionFlag.ClearAndSelect | |
140 ( |
145 QItemSelectionModel.SelectionFlag.Rows) |
141 QItemSelectionModel.SelectionFlag.ClearAndSelect |
146 if selected else |
142 | QItemSelectionModel.SelectionFlag.Rows |
147 (QItemSelectionModel.SelectionFlag.Deselect | |
143 ) |
148 QItemSelectionModel.SelectionFlag.Rows) |
144 if selected |
|
145 else ( |
|
146 QItemSelectionModel.SelectionFlag.Deselect |
|
147 | QItemSelectionModel.SelectionFlag.Rows |
|
148 ) |
149 ) |
149 ) |
150 self.selectionModel().select(index, flags) |
150 self.selectionModel().select(index, flags) |
151 |
151 |
152 def __createPopupMenus(self): |
152 def __createPopupMenus(self): |
153 """ |
153 """ |
154 Private method to generate the popup menus. |
154 Private method to generate the popup menus. |
155 """ |
155 """ |
156 self.menu = QMenu() |
156 self.menu = QMenu() |
159 self.menu.addSeparator() |
159 self.menu.addSeparator() |
160 self.menu.addAction(self.tr("Enable"), self.__enableBreak) |
160 self.menu.addAction(self.tr("Enable"), self.__enableBreak) |
161 self.menu.addAction(self.tr("Enable all"), self.__enableAllBreaks) |
161 self.menu.addAction(self.tr("Enable all"), self.__enableAllBreaks) |
162 self.menu.addSeparator() |
162 self.menu.addSeparator() |
163 self.menu.addAction(self.tr("Disable"), self.__disableBreak) |
163 self.menu.addAction(self.tr("Disable"), self.__disableBreak) |
164 self.menu.addAction(self.tr("Disable all"), |
164 self.menu.addAction(self.tr("Disable all"), self.__disableAllBreaks) |
165 self.__disableAllBreaks) |
|
166 self.menu.addSeparator() |
165 self.menu.addSeparator() |
167 self.menu.addAction(self.tr("Delete"), self.__deleteBreak) |
166 self.menu.addAction(self.tr("Delete"), self.__deleteBreak) |
168 self.menu.addAction(self.tr("Delete all"), self.__deleteAllBreaks) |
167 self.menu.addAction(self.tr("Delete all"), self.__deleteAllBreaks) |
169 self.menu.addSeparator() |
168 self.menu.addSeparator() |
170 self.menu.addAction(self.tr("Goto"), self.__showSource) |
169 self.menu.addAction(self.tr("Goto"), self.__showSource) |
171 self.menu.addSeparator() |
170 self.menu.addSeparator() |
172 self.menu.addAction(self.tr("Clear Histories"), |
171 self.menu.addAction(self.tr("Clear Histories"), self.clearHistories) |
173 self.clearHistories) |
|
174 self.menu.addSeparator() |
172 self.menu.addSeparator() |
175 self.menu.addAction(self.tr("Configure..."), self.__configure) |
173 self.menu.addAction(self.tr("Configure..."), self.__configure) |
176 |
174 |
177 self.backMenuActions = {} |
175 self.backMenuActions = {} |
178 self.backMenu = QMenu() |
176 self.backMenu = QMenu() |
179 self.backMenu.addAction(self.tr("Add"), self.__addBreak) |
177 self.backMenu.addAction(self.tr("Add"), self.__addBreak) |
180 self.backMenuActions["EnableAll"] = self.backMenu.addAction( |
178 self.backMenuActions["EnableAll"] = self.backMenu.addAction( |
181 self.tr("Enable all"), |
179 self.tr("Enable all"), self.__enableAllBreaks |
182 self.__enableAllBreaks) |
180 ) |
183 self.backMenuActions["DisableAll"] = self.backMenu.addAction( |
181 self.backMenuActions["DisableAll"] = self.backMenu.addAction( |
184 self.tr("Disable all"), |
182 self.tr("Disable all"), self.__disableAllBreaks |
185 self.__disableAllBreaks) |
183 ) |
186 self.backMenuActions["DeleteAll"] = self.backMenu.addAction( |
184 self.backMenuActions["DeleteAll"] = self.backMenu.addAction( |
187 self.tr("Delete all"), |
185 self.tr("Delete all"), self.__deleteAllBreaks |
188 self.__deleteAllBreaks) |
186 ) |
189 self.backMenu.addSeparator() |
187 self.backMenu.addSeparator() |
190 self.backMenu.addAction(self.tr("Clear Histories"), |
188 self.backMenu.addAction(self.tr("Clear Histories"), self.clearHistories) |
191 self.clearHistories) |
|
192 self.backMenu.addSeparator() |
189 self.backMenu.addSeparator() |
193 self.backMenu.addAction(self.tr("Configure..."), self.__configure) |
190 self.backMenu.addAction(self.tr("Configure..."), self.__configure) |
194 self.backMenu.aboutToShow.connect(self.__showBackMenu) |
191 self.backMenu.aboutToShow.connect(self.__showBackMenu) |
195 |
192 |
196 self.multiMenu = QMenu() |
193 self.multiMenu = QMenu() |
197 self.multiMenu.addAction(self.tr("Add"), self.__addBreak) |
194 self.multiMenu.addAction(self.tr("Add"), self.__addBreak) |
198 self.multiMenu.addSeparator() |
195 self.multiMenu.addSeparator() |
199 self.multiMenu.addAction(self.tr("Enable selected"), |
196 self.multiMenu.addAction( |
200 self.__enableSelectedBreaks) |
197 self.tr("Enable selected"), self.__enableSelectedBreaks |
201 self.multiMenu.addAction(self.tr("Enable all"), |
198 ) |
202 self.__enableAllBreaks) |
199 self.multiMenu.addAction(self.tr("Enable all"), self.__enableAllBreaks) |
203 self.multiMenu.addSeparator() |
200 self.multiMenu.addSeparator() |
204 self.multiMenu.addAction(self.tr("Disable selected"), |
201 self.multiMenu.addAction( |
205 self.__disableSelectedBreaks) |
202 self.tr("Disable selected"), self.__disableSelectedBreaks |
206 self.multiMenu.addAction(self.tr("Disable all"), |
203 ) |
207 self.__disableAllBreaks) |
204 self.multiMenu.addAction(self.tr("Disable all"), self.__disableAllBreaks) |
208 self.multiMenu.addSeparator() |
205 self.multiMenu.addSeparator() |
209 self.multiMenu.addAction(self.tr("Delete selected"), |
206 self.multiMenu.addAction( |
210 self.__deleteSelectedBreaks) |
207 self.tr("Delete selected"), self.__deleteSelectedBreaks |
211 self.multiMenu.addAction(self.tr("Delete all"), |
208 ) |
212 self.__deleteAllBreaks) |
209 self.multiMenu.addAction(self.tr("Delete all"), self.__deleteAllBreaks) |
213 self.multiMenu.addSeparator() |
210 self.multiMenu.addSeparator() |
214 self.multiMenu.addAction(self.tr("Clear Histories"), |
211 self.multiMenu.addAction(self.tr("Clear Histories"), self.clearHistories) |
215 self.clearHistories) |
|
216 self.multiMenu.addSeparator() |
212 self.multiMenu.addSeparator() |
217 self.multiMenu.addAction(self.tr("Configure..."), self.__configure) |
213 self.multiMenu.addAction(self.tr("Configure..."), self.__configure) |
218 |
214 |
219 def __showContextMenu(self, coord): |
215 def __showContextMenu(self, coord): |
220 """ |
216 """ |
221 Private slot to show the context menu. |
217 Private slot to show the context menu. |
222 |
218 |
223 @param coord the position of the mouse pointer |
219 @param coord the position of the mouse pointer |
224 @type QPoint |
220 @type QPoint |
225 """ |
221 """ |
226 cnt = self.__getSelectedItemsCount() |
222 cnt = self.__getSelectedItemsCount() |
227 if cnt <= 1: |
223 if cnt <= 1: |
234 self.multiMenu.popup(coord) |
230 self.multiMenu.popup(coord) |
235 elif cnt == 1: |
231 elif cnt == 1: |
236 self.menu.popup(coord) |
232 self.menu.popup(coord) |
237 else: |
233 else: |
238 self.backMenu.popup(coord) |
234 self.backMenu.popup(coord) |
239 |
235 |
240 def __clearSelection(self): |
236 def __clearSelection(self): |
241 """ |
237 """ |
242 Private slot to clear the selection. |
238 Private slot to clear the selection. |
243 """ |
239 """ |
244 for index in self.selectedIndexes(): |
240 for index in self.selectedIndexes(): |
245 self.__setRowSelected(index, False) |
241 self.__setRowSelected(index, False) |
246 |
242 |
247 def __addBreak(self): |
243 def __addBreak(self): |
248 """ |
244 """ |
249 Private slot to handle the add breakpoint context menu entry. |
245 Private slot to handle the add breakpoint context menu entry. |
250 """ |
246 """ |
251 from .EditBreakpointDialog import EditBreakpointDialog |
247 from .EditBreakpointDialog import EditBreakpointDialog |
252 |
248 |
253 fnHistory, condHistory = self.__loadRecent() |
249 fnHistory, condHistory = self.__loadRecent() |
254 |
250 |
255 dlg = EditBreakpointDialog((fnHistory[0], None), None, |
251 dlg = EditBreakpointDialog( |
256 condHistory, self, modal=1, |
252 (fnHistory[0], None), |
257 addMode=1, filenameHistory=fnHistory) |
253 None, |
|
254 condHistory, |
|
255 self, |
|
256 modal=1, |
|
257 addMode=1, |
|
258 filenameHistory=fnHistory, |
|
259 ) |
258 if dlg.exec() == QDialog.DialogCode.Accepted: |
260 if dlg.exec() == QDialog.DialogCode.Accepted: |
259 fn, line, cond, temp, enabled, count = dlg.getAddData() |
261 fn, line, cond, temp, enabled, count = dlg.getAddData() |
260 if fn is not None: |
262 if fn is not None: |
261 if fn in fnHistory: |
263 if fn in fnHistory: |
262 fnHistory.remove(fn) |
264 fnHistory.remove(fn) |
263 fnHistory.insert(0, fn) |
265 fnHistory.insert(0, fn) |
264 |
266 |
265 if cond: |
267 if cond: |
266 if cond in condHistory: |
268 if cond in condHistory: |
267 condHistory.remove(cond) |
269 condHistory.remove(cond) |
268 condHistory.insert(0, cond) |
270 condHistory.insert(0, cond) |
269 |
271 |
270 self.__saveRecent(fnHistory, condHistory) |
272 self.__saveRecent(fnHistory, condHistory) |
271 |
273 |
272 self.__model.addBreakPoint(fn, line, (cond, temp, enabled, count)) |
274 self.__model.addBreakPoint(fn, line, (cond, temp, enabled, count)) |
273 self.__resizeColumns() |
275 self.__resizeColumns() |
274 self.__resort() |
276 self.__resort() |
275 |
277 |
276 def __doubleClicked(self, index): |
278 def __doubleClicked(self, index): |
277 """ |
279 """ |
278 Private slot to handle the double clicked signal. |
280 Private slot to handle the double clicked signal. |
279 |
281 |
280 @param index index of the entry that was double clicked |
282 @param index index of the entry that was double clicked |
281 @type QModelIndex |
283 @type QModelIndex |
282 """ |
284 """ |
283 if index.isValid(): |
285 if index.isValid(): |
284 sindex = self.__toSourceIndex(index) |
286 sindex = self.__toSourceIndex(index) |
285 bp = self.__model.getBreakPointByIndex(sindex) |
287 bp = self.__model.getBreakPointByIndex(sindex) |
286 if not bp: |
288 if not bp: |
287 return |
289 return |
288 |
290 |
289 fn, line = bp[:2] |
291 fn, line = bp[:2] |
290 self.sourceFile.emit(fn, line) |
292 self.sourceFile.emit(fn, line) |
291 |
293 |
292 def __editBreak(self): |
294 def __editBreak(self): |
293 """ |
295 """ |
294 Private slot to handle the edit breakpoint context menu entry. |
296 Private slot to handle the edit breakpoint context menu entry. |
295 """ |
297 """ |
296 index = self.currentIndex() |
298 index = self.currentIndex() |
297 if index.isValid(): |
299 if index.isValid(): |
298 self.__editBreakpoint(index) |
300 self.__editBreakpoint(index) |
299 |
301 |
300 def __editBreakpoint(self, index): |
302 def __editBreakpoint(self, index): |
301 """ |
303 """ |
302 Private slot to edit a breakpoint. |
304 Private slot to edit a breakpoint. |
303 |
305 |
304 @param index index of breakpoint to be edited |
306 @param index index of breakpoint to be edited |
305 @type QModelIndex |
307 @type QModelIndex |
306 """ |
308 """ |
307 sindex = self.__toSourceIndex(index) |
309 sindex = self.__toSourceIndex(index) |
308 if sindex.isValid(): |
310 if sindex.isValid(): |
309 bp = self.__model.getBreakPointByIndex(sindex) |
311 bp = self.__model.getBreakPointByIndex(sindex) |
310 if not bp: |
312 if not bp: |
311 return |
313 return |
312 |
314 |
313 fn, line, cond, temp, enabled, count = bp[:6] |
315 fn, line, cond, temp, enabled, count = bp[:6] |
314 fnHistory, condHistory = self.__loadRecent() |
316 fnHistory, condHistory = self.__loadRecent() |
315 |
317 |
316 from .EditBreakpointDialog import EditBreakpointDialog |
318 from .EditBreakpointDialog import EditBreakpointDialog |
|
319 |
317 dlg = EditBreakpointDialog( |
320 dlg = EditBreakpointDialog( |
318 (fn, line), (cond, temp, enabled, count), |
321 (fn, line), (cond, temp, enabled, count), condHistory, self, modal=True |
319 condHistory, self, modal=True) |
322 ) |
320 if dlg.exec() == QDialog.DialogCode.Accepted: |
323 if dlg.exec() == QDialog.DialogCode.Accepted: |
321 cond, temp, enabled, count = dlg.getData() |
324 cond, temp, enabled, count = dlg.getData() |
322 if cond: |
325 if cond: |
323 if cond in condHistory: |
326 if cond in condHistory: |
324 condHistory.remove(cond) |
327 condHistory.remove(cond) |
325 condHistory.insert(0, cond) |
328 condHistory.insert(0, cond) |
326 |
329 |
327 self.__saveRecent(fnHistory, condHistory) |
330 self.__saveRecent(fnHistory, condHistory) |
328 |
331 |
329 self.__model.setBreakPointByIndex( |
332 self.__model.setBreakPointByIndex( |
330 sindex, fn, line, (cond, temp, enabled, count)) |
333 sindex, fn, line, (cond, temp, enabled, count) |
|
334 ) |
331 self.__resizeColumns() |
335 self.__resizeColumns() |
332 self.__resort() |
336 self.__resort() |
333 |
337 |
334 def __setBpEnabled(self, index, enabled): |
338 def __setBpEnabled(self, index, enabled): |
335 """ |
339 """ |
336 Private method to set the enabled status of a breakpoint. |
340 Private method to set the enabled status of a breakpoint. |
337 |
341 |
338 @param index index of breakpoint to be enabled/disabled |
342 @param index index of breakpoint to be enabled/disabled |
339 @type QModelIndex |
343 @type QModelIndex |
340 @param enabled flag indicating the enabled status to be set |
344 @param enabled flag indicating the enabled status to be set |
341 @type bool |
345 @type bool |
342 """ |
346 """ |
343 sindex = self.__toSourceIndex(index) |
347 sindex = self.__toSourceIndex(index) |
344 if sindex.isValid(): |
348 if sindex.isValid(): |
345 self.__model.setBreakPointEnabledByIndex(sindex, enabled) |
349 self.__model.setBreakPointEnabledByIndex(sindex, enabled) |
346 |
350 |
347 def __enableBreak(self): |
351 def __enableBreak(self): |
348 """ |
352 """ |
349 Private slot to handle the enable breakpoint context menu entry. |
353 Private slot to handle the enable breakpoint context menu entry. |
350 """ |
354 """ |
351 index = self.currentIndex() |
355 index = self.currentIndex() |
440 index = self.currentIndex() |
444 index = self.currentIndex() |
441 sindex = self.__toSourceIndex(index) |
445 sindex = self.__toSourceIndex(index) |
442 bp = self.__model.getBreakPointByIndex(sindex) |
446 bp = self.__model.getBreakPointByIndex(sindex) |
443 if not bp: |
447 if not bp: |
444 return |
448 return |
445 |
449 |
446 fn, line = bp[:2] |
450 fn, line = bp[:2] |
447 self.sourceFile.emit(fn, line) |
451 self.sourceFile.emit(fn, line) |
448 |
452 |
449 def highlightBreakpoint(self, fn, lineno): |
453 def highlightBreakpoint(self, fn, lineno): |
450 """ |
454 """ |
451 Public slot to handle the clientLine signal. |
455 Public slot to handle the clientLine signal. |
452 |
456 |
453 @param fn filename of the breakpoint |
457 @param fn filename of the breakpoint |
454 @type str |
458 @type str |
455 @param lineno line number of the breakpoint |
459 @param lineno line number of the breakpoint |
456 @type int |
460 @type int |
457 """ |
461 """ |
458 sindex = self.__model.getBreakPointIndex(fn, lineno) |
462 sindex = self.__model.getBreakPointIndex(fn, lineno) |
459 if sindex.isValid(): |
463 if sindex.isValid(): |
460 return |
464 return |
461 |
465 |
462 index = self.__fromSourceIndex(sindex) |
466 index = self.__fromSourceIndex(sindex) |
463 if index.isValid(): |
467 if index.isValid(): |
464 self.__clearSelection() |
468 self.__clearSelection() |
465 self.__setRowSelected(index, True) |
469 self.__setRowSelected(index, True) |
466 |
470 |
467 def handleResetUI(self): |
471 def handleResetUI(self): |
468 """ |
472 """ |
469 Public slot to reset the breakpoint viewer. |
473 Public slot to reset the breakpoint viewer. |
470 """ |
474 """ |
471 self.__clearSelection() |
475 self.__clearSelection() |
472 |
476 |
473 def __showBackMenu(self): |
477 def __showBackMenu(self): |
474 """ |
478 """ |
475 Private slot to handle the aboutToShow signal of the background menu. |
479 Private slot to handle the aboutToShow signal of the background menu. |
476 """ |
480 """ |
477 if self.model().rowCount() == 0: |
481 if self.model().rowCount() == 0: |
484 self.backMenuActions["DeleteAll"].setEnabled(True) |
488 self.backMenuActions["DeleteAll"].setEnabled(True) |
485 |
489 |
486 def __getSelectedItemsCount(self): |
490 def __getSelectedItemsCount(self): |
487 """ |
491 """ |
488 Private method to get the count of items selected. |
492 Private method to get the count of items selected. |
489 |
493 |
490 @return count of items selected |
494 @return count of items selected |
491 @rtype int |
495 @rtype int |
492 """ |
496 """ |
493 count = len(self.selectedIndexes()) // (self.__model.columnCount() - 1) |
497 count = len(self.selectedIndexes()) // (self.__model.columnCount() - 1) |
494 # column count is 1 greater than selectable |
498 # column count is 1 greater than selectable |
495 return count |
499 return count |
496 |
500 |
497 def __configure(self): |
501 def __configure(self): |
498 """ |
502 """ |
499 Private method to open the configuration dialog. |
503 Private method to open the configuration dialog. |
500 """ |
504 """ |
501 ericApp().getObject("UserInterface").showPreferences( |
505 ericApp().getObject("UserInterface").showPreferences("debuggerGeneralPage") |
502 "debuggerGeneralPage") |
506 |
503 |
|
504 def __loadRecent(self): |
507 def __loadRecent(self): |
505 """ |
508 """ |
506 Private method to load the recently used file names and breakpoint |
509 Private method to load the recently used file names and breakpoint |
507 conditions. |
510 conditions. |
508 |
511 |
509 @return tuple containing the recently used file names and breakpoint |
512 @return tuple containing the recently used file names and breakpoint |
510 conditions |
513 conditions |
511 @rtype tuple of (list of str, list of str) |
514 @rtype tuple of (list of str, list of str) |
512 """ |
515 """ |
513 Preferences.Prefs.rsettings.sync() |
516 Preferences.Prefs.rsettings.sync() |
514 |
517 |
515 # load recently used file names |
518 # load recently used file names |
516 fnHistory = [] |
519 fnHistory = [] |
517 fnHistory.append('') |
520 fnHistory.append("") |
518 rs = Preferences.Prefs.rsettings.value(recentNameBreakpointFiles) |
521 rs = Preferences.Prefs.rsettings.value(recentNameBreakpointFiles) |
519 if rs is not None: |
522 if rs is not None: |
520 recent = [f |
523 recent = [f for f in Preferences.toList(rs) if pathlib.Path(f).exists()] |
521 for f in Preferences.toList(rs) |
524 fnHistory.extend(recent[: Preferences.getDebugger("RecentNumber")]) |
522 if pathlib.Path(f).exists()] |
525 |
523 fnHistory.extend( |
|
524 recent[:Preferences.getDebugger("RecentNumber")]) |
|
525 |
|
526 # load recently entered condition expressions |
526 # load recently entered condition expressions |
527 condHistory = [] |
527 condHistory = [] |
528 rs = Preferences.Prefs.rsettings.value(recentNameBreakpointConditions) |
528 rs = Preferences.Prefs.rsettings.value(recentNameBreakpointConditions) |
529 if rs is not None: |
529 if rs is not None: |
530 condHistory = Preferences.toList(rs)[ |
530 condHistory = Preferences.toList(rs)[ |
531 :Preferences.getDebugger("RecentNumber")] |
531 : Preferences.getDebugger("RecentNumber") |
532 |
532 ] |
|
533 |
533 return fnHistory, condHistory |
534 return fnHistory, condHistory |
534 |
535 |
535 def __saveRecent(self, fnHistory, condHistory): |
536 def __saveRecent(self, fnHistory, condHistory): |
536 """ |
537 """ |
537 Private method to save the list of recently used file names and |
538 Private method to save the list of recently used file names and |
538 breakpoint conditions. |
539 breakpoint conditions. |
539 |
540 |
540 @param fnHistory list of recently used file names |
541 @param fnHistory list of recently used file names |
541 @type list of str |
542 @type list of str |
542 @param condHistory list of recently used breakpoint conditions |
543 @param condHistory list of recently used breakpoint conditions |
543 @type list of str |
544 @type list of str |
544 """ |
545 """ |
545 recent = [f for f in fnHistory if f] |
546 recent = [f for f in fnHistory if f] |
546 Preferences.Prefs.rsettings.setValue(recentNameBreakpointFiles, recent) |
547 Preferences.Prefs.rsettings.setValue(recentNameBreakpointFiles, recent) |
547 Preferences.Prefs.rsettings.setValue(recentNameBreakpointConditions, |
548 Preferences.Prefs.rsettings.setValue( |
548 condHistory) |
549 recentNameBreakpointConditions, condHistory |
|
550 ) |
549 Preferences.Prefs.rsettings.sync() |
551 Preferences.Prefs.rsettings.sync() |
550 |
552 |
551 def clearHistories(self): |
553 def clearHistories(self): |
552 """ |
554 """ |
553 Public method to clear the recently used file names and breakpoint |
555 Public method to clear the recently used file names and breakpoint |
554 conditions. |
556 conditions. |
555 """ |
557 """ |