eric6/Debugger/VariablesViewer.py

branch
Variables Viewer
changeset 6993
d375f251496a
parent 6988
87ad87ef1910
child 6994
681ed8916e69
diff -r 87ad87ef1910 -r d375f251496a eric6/Debugger/VariablesViewer.py
--- a/eric6/Debugger/VariablesViewer.py	Thu May 02 22:58:33 2019 +0200
+++ b/eric6/Debugger/VariablesViewer.py	Fri May 03 22:55:23 2019 +0200
@@ -75,6 +75,8 @@
         self.currentCount = -1  # -1 indicates to (re)load childs
         # Indicator that there are childs
         self.hasChilds = False
+        # Indicator that item was at least once fully populated
+        self.wasPopulated = False
         
         self.childs = []
         # Flag to prevent endless reloading of current item while waiting on
@@ -83,6 +85,7 @@
         
         # Set of childs items, which are displayed the first time or changed
         self.newItems = set()
+        self.changedItems = set()
         # Name including its ID if it's a dict, set, etc.
         self.nameWithId = dvar
         
@@ -286,6 +289,8 @@
         self.beginResetModel()
         self.rootNode.childs = []
         self.rootNode.newItems.clear()
+        self.rootNode.changedItems.clear()
+        self.rootNode.wasPopulated = False
         if reset:
             self.openItems = []
             self.closedItems = []
@@ -360,6 +365,7 @@
             return
             
         elif itemStartIndex == -2:
+            parent.wasPopulated = True
             parent.currentCount = parent.absolutCount
             # Remove items which are left over at the end of child list
             self.__cleanupParentList(parent, parentIdx)
@@ -378,6 +384,7 @@
         # Now update the table
         endIndex = idx + len(vlist)
         newChild = None
+        knownChildsCount = len(parent.childs)
         while idx < endIndex:
             # Fetch next old item from last cycle
             try:
@@ -397,8 +404,13 @@
             if child is None or newChild and sort < child.sort:
                 self.beginInsertRows(parentIdx, idx, idx)
                 parent.childs.insert(idx, newItem)
-                parent.newItems.add(newItem)
+                if knownChildsCount <= idx and not parent.wasPopulated:
+                    parent.newItems.add(newItem)
+                    knownChildsCount += 1
+                else:
+                    parent.changedItems.add(newItem)
                 self.endInsertRows()
+                
                 idx += 1
                 newChild = None
                 continue
@@ -415,7 +427,7 @@
                     child.childCount = newItem.childCount
                     
                     # Highlight item because it has changed
-                    parent.newItems.add(child)
+                    parent.changedItems.add(child)
                     
                     changedIndexStart = self.index(idx, 0, parentIdx)
                     changedIndexEnd = self.index(idx, 2, parentIdx)
@@ -430,9 +442,11 @@
             parent.childs.remove(child)
             self.endRemoveRows()
             # idx stay unchanged
+            knownChildsCount -= 1
         
         # Remove items which are left over at the end of child list
         if itemStartIndex == -1:
+            parent.wasPopulated = True
             self.__cleanupParentList(parent, parentIdx)
         
         # Request data for any expanded node
@@ -468,8 +482,8 @@
         else:
             parent = self.rootNode
         
-        if parent.newItems:
-            parent.newItems.clear()
+        parent.newItems.clear()
+        parent.changedItems.clear()
         
         pll = len(pathlist)
         posPaths = {x for x in self.openItems if len(x) > pll}
@@ -634,11 +648,16 @@
                 return ['None', '', '', ''][column]
         
         elif role == Qt.BackgroundRole:
-            if node in node.parent.newItems:
+            if node in node.parent.changedItems:
                 color = QColor('#70FF66')
                 # Set Alpha chanel to get alternating row colors done by Qt
                 color.setAlpha(40)
                 return QBrush(color)
+            elif node in node.parent.newItems:
+                color = QColor('#FFEEAA')
+                # Set Alpha chanel to get alternating row colors done by Qt
+                color.setAlpha(40)
+                return QBrush(color)
         
         elif role == Qt.ToolTipRole:
             if column == 0:

eric ide

mercurial