65 |
65 |
66 def setModel(self, model): |
66 def setModel(self, model): |
67 """ |
67 """ |
68 Public slot to set the breakpoint model. |
68 Public slot to set the breakpoint model. |
69 |
69 |
70 @param model reference to the breakpoint model (BreakPointModel) |
70 @param model reference to the breakpoint model |
|
71 @type BreakPointModel |
71 """ |
72 """ |
72 self.__model = model |
73 self.__model = model |
73 |
74 |
74 self.sortingModel = QSortFilterProxyModel() |
75 self.sortingModel = QSortFilterProxyModel() |
75 self.sortingModel.setDynamicSortFilter(True) |
76 self.sortingModel.setDynamicSortFilter(True) |
109 |
110 |
110 def __toSourceIndex(self, index): |
111 def __toSourceIndex(self, index): |
111 """ |
112 """ |
112 Private slot to convert an index to a source index. |
113 Private slot to convert an index to a source index. |
113 |
114 |
114 @param index index to be converted (QModelIndex) |
115 @param index index to be converted |
115 @return mapped index (QModelIndex) |
116 @type QModelIndex |
|
117 @return mapped index |
|
118 @rtype QModelIndex |
116 """ |
119 """ |
117 return self.sortingModel.mapToSource(index) |
120 return self.sortingModel.mapToSource(index) |
118 |
121 |
119 def __fromSourceIndex(self, sindex): |
122 def __fromSourceIndex(self, sindex): |
120 """ |
123 """ |
121 Private slot to convert a source index to an index. |
124 Private slot to convert a source index to an index. |
122 |
125 |
123 @param sindex source index to be converted (QModelIndex) |
126 @param sindex source index to be converted |
124 @return mapped index (QModelIndex) |
127 @type QModelIndex |
|
128 @return mapped index |
|
129 @rtype QModelIndex |
125 """ |
130 """ |
126 return self.sortingModel.mapFromSource(sindex) |
131 return self.sortingModel.mapFromSource(sindex) |
127 |
132 |
128 def __setRowSelected(self, index, selected=True): |
133 def __setRowSelected(self, index, selected=True): |
129 """ |
134 """ |
130 Private slot to select a complete row. |
135 Private slot to select a complete row. |
131 |
136 |
132 @param index index determining the row to be selected (QModelIndex) |
137 @param index index determining the row to be selected |
133 @param selected flag indicating the action (bool) |
138 @type QModelIndex |
|
139 @param selected flag indicating the action |
|
140 @type bool |
134 """ |
141 """ |
135 if not index.isValid(): |
142 if not index.isValid(): |
136 return |
143 return |
137 |
144 |
138 if selected: |
145 if selected: |
203 |
210 |
204 def __showContextMenu(self, coord): |
211 def __showContextMenu(self, coord): |
205 """ |
212 """ |
206 Private slot to show the context menu. |
213 Private slot to show the context menu. |
207 |
214 |
208 @param coord the position of the mouse pointer (QPoint) |
215 @param coord the position of the mouse pointer |
|
216 @type QPoint |
209 """ |
217 """ |
210 cnt = self.__getSelectedItemsCount() |
218 cnt = self.__getSelectedItemsCount() |
211 if cnt <= 1: |
219 if cnt <= 1: |
212 index = self.indexAt(coord) |
220 index = self.indexAt(coord) |
213 if index.isValid(): |
221 if index.isValid(): |
257 |
265 |
258 def __doubleClicked(self, index): |
266 def __doubleClicked(self, index): |
259 """ |
267 """ |
260 Private slot to handle the double clicked signal. |
268 Private slot to handle the double clicked signal. |
261 |
269 |
262 @param index index of the entry that was double clicked (QModelIndex) |
270 @param index index of the entry that was double clicked |
|
271 @type QModelIndex |
263 """ |
272 """ |
264 if index.isValid(): |
273 if index.isValid(): |
265 self.__editBreakpoint(index) |
274 self.__editBreakpoint(index) |
266 |
275 |
267 def __editBreak(self): |
276 def __editBreak(self): |
274 |
283 |
275 def __editBreakpoint(self, index): |
284 def __editBreakpoint(self, index): |
276 """ |
285 """ |
277 Private slot to edit a breakpoint. |
286 Private slot to edit a breakpoint. |
278 |
287 |
279 @param index index of breakpoint to be edited (QModelIndex) |
288 @param index index of breakpoint to be edited |
|
289 @type QModelIndex |
280 """ |
290 """ |
281 sindex = self.__toSourceIndex(index) |
291 sindex = self.__toSourceIndex(index) |
282 if sindex.isValid(): |
292 if sindex.isValid(): |
283 bp = self.__model.getBreakPointByIndex(sindex) |
293 bp = self.__model.getBreakPointByIndex(sindex) |
284 if not bp: |
294 if not bp: |
306 |
316 |
307 def __setBpEnabled(self, index, enabled): |
317 def __setBpEnabled(self, index, enabled): |
308 """ |
318 """ |
309 Private method to set the enabled status of a breakpoint. |
319 Private method to set the enabled status of a breakpoint. |
310 |
320 |
311 @param index index of breakpoint to be enabled/disabled (QModelIndex) |
321 @param index index of breakpoint to be enabled/disabled |
312 @param enabled flag indicating the enabled status to be set (boolean) |
322 @type QModelIndex |
|
323 @param enabled flag indicating the enabled status to be set |
|
324 @type bool |
313 """ |
325 """ |
314 sindex = self.__toSourceIndex(index) |
326 sindex = self.__toSourceIndex(index) |
315 if sindex.isValid(): |
327 if sindex.isValid(): |
316 self.__model.setBreakPointEnabledByIndex(sindex, enabled) |
328 self.__model.setBreakPointEnabledByIndex(sindex, enabled) |
317 |
329 |
419 |
431 |
420 def highlightBreakpoint(self, fn, lineno): |
432 def highlightBreakpoint(self, fn, lineno): |
421 """ |
433 """ |
422 Public slot to handle the clientLine signal. |
434 Public slot to handle the clientLine signal. |
423 |
435 |
424 @param fn filename of the breakpoint (string) |
436 @param fn filename of the breakpoint |
425 @param lineno line number of the breakpoint (integer) |
437 @type str |
|
438 @param lineno line number of the breakpoint |
|
439 @type int |
426 """ |
440 """ |
427 sindex = self.__model.getBreakPointIndex(fn, lineno) |
441 sindex = self.__model.getBreakPointIndex(fn, lineno) |
428 if sindex.isValid(): |
442 if sindex.isValid(): |
429 return |
443 return |
430 |
444 |
454 |
468 |
455 def __getSelectedItemsCount(self): |
469 def __getSelectedItemsCount(self): |
456 """ |
470 """ |
457 Private method to get the count of items selected. |
471 Private method to get the count of items selected. |
458 |
472 |
459 @return count of items selected (integer) |
473 @return count of items selected |
|
474 @rtype int |
460 """ |
475 """ |
461 count = len(self.selectedIndexes()) // (self.__model.columnCount() - 1) |
476 count = len(self.selectedIndexes()) // (self.__model.columnCount() - 1) |
462 # column count is 1 greater than selectable |
477 # column count is 1 greater than selectable |
463 return count |
478 return count |
464 |
479 |