eric6/Debugger/BreakPointModel.py

branch
jsonfiles
changeset 8009
29818ac4853c
parent 7923
91e843545d9a
child 8077
1fd8f611f26a
equal deleted inserted replaced
8006:c4110b8b5931 8009:29818ac4853c
4 # 4 #
5 5
6 """ 6 """
7 Module implementing the Breakpoint model. 7 Module implementing the Breakpoint model.
8 """ 8 """
9
10 import copy
9 11
10 from PyQt5.QtCore import pyqtSignal, Qt, QAbstractItemModel, QModelIndex 12 from PyQt5.QtCore import pyqtSignal, Qt, QAbstractItemModel, QModelIndex
11 13
12 14
13 class BreakPointModel(QAbstractItemModel): 15 class BreakPointModel(QAbstractItemModel):
225 cnt = len(self.breakpoints) 227 cnt = len(self.breakpoints)
226 self.beginInsertRows(QModelIndex(), cnt, cnt) 228 self.beginInsertRows(QModelIndex(), cnt, cnt)
227 self.breakpoints.append(bp) 229 self.breakpoints.append(bp)
228 self.endInsertRows() 230 self.endInsertRows()
229 231
232 def addBreakPoints(self, breakpoints):
233 """
234 Public method to add multiple breakpoints to the list.
235
236 @param breakpoints list of breakpoints with file name, line number,
237 condition, temporary flag, enabled flag and ignore count each
238 @type list of (str, int, str, bool, bool, int)
239 """
240 cnt = len(self.breakpoints)
241 self.beginInsertRows(QModelIndex(), cnt, cnt + len(breakpoints) - 1)
242 self.breakpoints += breakpoints
243 self.endInsertRows()
244
230 def setBreakPointByIndex(self, index, fn, line, properties): 245 def setBreakPointByIndex(self, index, fn, line, properties):
231 """ 246 """
232 Public method to set the values of a breakpoint given by index. 247 Public method to set the values of a breakpoint given by index.
233 248
234 @param index index of the breakpoint 249 @param index index of the breakpoint
319 """ 334 """
320 if index.isValid(): 335 if index.isValid():
321 return self.breakpoints[index.row()][:] # return a copy 336 return self.breakpoints[index.row()][:] # return a copy
322 else: 337 else:
323 return [] 338 return []
324 339
340 def getAllBreakpoints(self):
341 """
342 Public method to get a copy of the breakpoints.
343
344 @return list of breakpoints
345 @rtype list of list of [str, int, str, bool, bool, int]
346 """
347 return copy.deepcopy(self.breakpoints)
348
325 def getBreakPointIndex(self, fn, lineno): 349 def getBreakPointIndex(self, fn, lineno):
326 """ 350 """
327 Public method to get the index of a breakpoint given by filename and 351 Public method to get the index of a breakpoint given by filename and
328 line number. 352 line number.
329 353

eric ide

mercurial