src/eric7/Debugger/WatchPointModel.py

branch
eric7
changeset 11037
adfda913834a
parent 10683
779cda568acb
child 11046
478b4ce023dd
--- a/src/eric7/Debugger/WatchPointModel.py	Sun Nov 03 18:16:47 2024 +0100
+++ b/src/eric7/Debugger/WatchPointModel.py	Mon Nov 04 11:39:18 2024 +0100
@@ -232,10 +232,12 @@
         @type tuple of (bool, bool, int)
         """
         wp = [cond, special] + list(properties)
-        cnt = len(self.watchpoints)
-        self.beginInsertRows(QModelIndex(), cnt, cnt)
-        self.watchpoints.append(wp)
-        self.endInsertRows()
+        if wp not in self.watchpoints:
+            # add it only, if not present already
+            cnt = len(self.watchpoints)
+            self.beginInsertRows(QModelIndex(), cnt, cnt)
+            self.watchpoints.append(wp)
+            self.endInsertRows()
 
     def addWatchPoints(self, watchpoints):
         """
@@ -245,10 +247,14 @@
             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()
+        # eliminate redundant break points
+        newWatchpoints = [w for w in set(watchpoints) if w not in self.watchpoints]
+
+        if newWatchpoints:
+            cnt = len(self.watchpoints)
+            self.beginInsertRows(QModelIndex(), cnt, cnt + len(newWatchpoints) - 1)
+            self.watchpoints += newWatchpoints
+            self.endInsertRows()
 
     def setWatchPointByIndex(self, index, cond, special, properties):
         """

eric ide

mercurial