--- a/eric6/Debugger/WatchPointModel.py Mon Jan 25 20:07:51 2021 +0100 +++ b/eric6/Debugger/WatchPointModel.py Wed Jan 27 15:09:20 2021 +0100 @@ -7,6 +7,8 @@ Module implementing the Watch expression model. """ +import copy + from PyQt5.QtCore import pyqtSignal, Qt, QAbstractItemModel, QModelIndex @@ -169,11 +171,13 @@ """ Public method to add a new watch expression to the list. - @param cond expression of the watch expression (string) - @param special special condition of the watch expression (string) + @param cond expression of the watch expression + @type str + @param special special condition of the watch expression + @type str @param properties properties of the watch expression - (tuple of temporary flag (bool), enabled flag (bool), - ignore count (integer)) + (tuple of temporary flag, enabled flag, ignore count) + @type tuple of (bool, bool, int) """ wp = [cond, special] + list(properties) cnt = len(self.watchpoints) @@ -181,6 +185,19 @@ self.watchpoints.append(wp) self.endInsertRows() + def addWatchPoints(self, watchpoints): + """ + Public method to add multiple watch expressions to the list. + + @param watchpoints list of watch expressions with expression, special + condition, temporary flag, enabled flag and ignore count each + @type list of (str, str, bool, bool, int) + """ + cnt = len(self.watchpoints) + self.beginInsertRows(QModelIndex(), cnt, cnt + len(watchpoints) - 1) + self.watchpoints += watchpoints + self.endInsertRows() + def setWatchPointByIndex(self, index, cond, special, properties): """ Public method to set the values of a watch expression given by index. @@ -198,10 +215,7 @@ index2 = self.createIndex( row, len(self.watchpoints[row]), self.watchpoints[row]) self.dataAboutToBeChanged.emit(index1, index2) - i = 0 - for value in [cond, special] + list(properties): - self.watchpoints[row][i] = value - i += 1 + self.watchpoints[row] = [cond, special] + list(properties) self.dataChanged.emit(index1, index2) def setWatchPointEnabledByIndex(self, index, enabled): @@ -265,14 +279,23 @@ @param index index of the watch expression (QModelIndex) @return watch expression (list of six values (expression, - special condition, temporary flag, enabled flag, ignore count, - index)) + special condition, temporary flag, enabled flag, ignore count)) + @rtype tuple of (str, str, bool, bool, int) """ if index.isValid(): return self.watchpoints[index.row()][:] # return a copy else: return [] - + + def getAllWatchpoints(self): + """ + Public method to get the list of watchpoints. + + @return list of watchpoints + @rtype list of list of [str, str, bool, bool, int] + """ + return copy.deepcopy(self.watchpoints) + def getWatchPointIndex(self, cond, special=""): """ Public method to get the index of a watch expression given by