src/eric7/Debugger/BreakPointModel.py

branch
eric7
changeset 11037
adfda913834a
parent 10683
779cda568acb
child 11046
478b4ce023dd
equal deleted inserted replaced
11036:326ae637285d 11037:adfda913834a
270 @param properties properties of the breakpoint 270 @param properties properties of the breakpoint
271 (tuple of condition, temporary flag, enabled flag, ignore count) 271 (tuple of condition, temporary flag, enabled flag, ignore count)
272 @type tuple of (str, bool, bool, int) 272 @type tuple of (str, bool, bool, int)
273 """ 273 """
274 bp = [fn, line] + list(properties) 274 bp = [fn, line] + list(properties)
275 cnt = len(self.breakpoints) 275 if bp not in self.breakpoints:
276 self.beginInsertRows(QModelIndex(), cnt, cnt) 276 # add it only, if not present already
277 self.breakpoints.append(bp) 277 cnt = len(self.breakpoints)
278 self.endInsertRows() 278 self.beginInsertRows(QModelIndex(), cnt, cnt)
279 self.breakpoints.append(bp)
280 self.endInsertRows()
279 281
280 def addBreakPoints(self, breakpoints): 282 def addBreakPoints(self, breakpoints):
281 """ 283 """
282 Public method to add multiple breakpoints to the list. 284 Public method to add multiple breakpoints to the list.
283 285
284 @param breakpoints list of breakpoints with file name, line number, 286 @param breakpoints list of breakpoints with file name, line number,
285 condition, temporary flag, enabled flag and ignore count each 287 condition, temporary flag, enabled flag and ignore count each
286 @type list of (str, int, str, bool, bool, int) 288 @type list of (str, int, str, bool, bool, int)
287 """ 289 """
288 cnt = len(self.breakpoints) 290 # eliminate redundant break points
289 self.beginInsertRows(QModelIndex(), cnt, cnt + len(breakpoints) - 1) 291 newBreakpoints = [b for b in set(breakpoints) if b not in self.breakpoints]
290 self.breakpoints += breakpoints 292
291 self.endInsertRows() 293 if newBreakpoints:
294 cnt = len(self.breakpoints)
295 self.beginInsertRows(QModelIndex(), cnt, cnt + len(newBreakpoints) - 1)
296 self.breakpoints += newBreakpoints
297 self.endInsertRows()
292 298
293 def setBreakPointByIndex(self, index, fn, line, properties): 299 def setBreakPointByIndex(self, index, fn, line, properties):
294 """ 300 """
295 Public method to set the values of a breakpoint given by index. 301 Public method to set the values of a breakpoint given by index.
296 302

eric ide

mercurial