src/eric7/Debugger/WatchPointModel.py

branch
eric7
changeset 11037
adfda913834a
parent 10683
779cda568acb
child 11046
478b4ce023dd
equal deleted inserted replaced
11036:326ae637285d 11037:adfda913834a
230 @param properties properties of the watch expression 230 @param properties properties of the watch expression
231 (tuple of temporary flag, enabled flag, ignore count) 231 (tuple of temporary flag, enabled flag, ignore count)
232 @type tuple of (bool, bool, int) 232 @type tuple of (bool, bool, int)
233 """ 233 """
234 wp = [cond, special] + list(properties) 234 wp = [cond, special] + list(properties)
235 cnt = len(self.watchpoints) 235 if wp not in self.watchpoints:
236 self.beginInsertRows(QModelIndex(), cnt, cnt) 236 # add it only, if not present already
237 self.watchpoints.append(wp) 237 cnt = len(self.watchpoints)
238 self.endInsertRows() 238 self.beginInsertRows(QModelIndex(), cnt, cnt)
239 self.watchpoints.append(wp)
240 self.endInsertRows()
239 241
240 def addWatchPoints(self, watchpoints): 242 def addWatchPoints(self, watchpoints):
241 """ 243 """
242 Public method to add multiple watch expressions to the list. 244 Public method to add multiple watch expressions to the list.
243 245
244 @param watchpoints list of watch expressions with expression, special 246 @param watchpoints list of watch expressions with expression, special
245 condition, temporary flag, enabled flag and ignore count each 247 condition, temporary flag, enabled flag and ignore count each
246 @type list of (str, str, bool, bool, int) 248 @type list of (str, str, bool, bool, int)
247 """ 249 """
248 cnt = len(self.watchpoints) 250 # eliminate redundant break points
249 self.beginInsertRows(QModelIndex(), cnt, cnt + len(watchpoints) - 1) 251 newWatchpoints = [w for w in set(watchpoints) if w not in self.watchpoints]
250 self.watchpoints += watchpoints 252
251 self.endInsertRows() 253 if newWatchpoints:
254 cnt = len(self.watchpoints)
255 self.beginInsertRows(QModelIndex(), cnt, cnt + len(newWatchpoints) - 1)
256 self.watchpoints += newWatchpoints
257 self.endInsertRows()
252 258
253 def setWatchPointByIndex(self, index, cond, special, properties): 259 def setWatchPointByIndex(self, index, cond, special, properties):
254 """ 260 """
255 Public method to set the values of a watch expression given by index. 261 Public method to set the values of a watch expression given by index.
256 262

eric ide

mercurial