Sat, 26 Dec 2020 22:49:27 +0100
Fixed double elements in first expanded list / tuple after the next step command and some update issues on lists.
eric6/DebugClients/Python/DebugVariables.py | file | annotate | diff | comparison | revisions | |
eric6/Debugger/VariablesViewer.py | file | annotate | diff | comparison | revisions |
--- a/eric6/DebugClients/Python/DebugVariables.py Sat Dec 26 11:39:35 2020 +0100 +++ b/eric6/DebugClients/Python/DebugVariables.py Sat Dec 26 22:49:27 2020 +0100 @@ -222,7 +222,7 @@ d = {} start = count = 0 for idx, value in enumerate(var): - d[str(idx)] = value + d[idx] = value count += 1 if count >= BatchSize: yield start, d
--- a/eric6/Debugger/VariablesViewer.py Sat Dec 26 11:39:35 2020 +0100 +++ b/eric6/Debugger/VariablesViewer.py Sat Dec 26 22:49:27 2020 +0100 @@ -79,6 +79,7 @@ self.currentCount = -1 # -1 indicates to (re)load children # Indicator that there are children self.hasChildren = False + self.populated = False # Indicator that item was at least once fully populated self.wasPopulated = False @@ -115,6 +116,9 @@ try: idx = dvar.index(" (ID:") dvar = dvar[:idx] + except AttributeError: + idx = dvar + dvar = str(dvar) except ValueError: pass @@ -239,16 +243,6 @@ @rtype int """ return self.childCount + self.methodCount - - @property - def populated(self): - """ - Public property returning a flag indicating if item is fully populated. - - @return item is fully populated - @rtype bool - """ - return self.currentCount >= (self.childCount + self.methodCount) class VariablesModel(QAbstractItemModel): @@ -375,17 +369,19 @@ elif itemStartIndex == -2: parent.wasPopulated = True parent.currentCount = parent.absolutCount + parent.populated = True # Remove items which are left over at the end of child list self.__cleanupParentList(parent, parentIdx) return elif itemStartIndex == -1: parent.methodCount = len(vlist) - idx = parent.childCount = parent.currentCount + 1 - parent.currentCount += 1 + len(vlist) + idx = max(parent.currentCount, 0) + parent.currentCount = idx + len(vlist) + parent.populated = True else: - idx = parent.currentCount + 1 - parent.currentCount += len(vlist) + idx = itemStartIndex + parent.currentCount = idx + len(vlist) # Sort items for Python versions where dict doesn't retain order vlist.sort(key=lambda x: x[0]) @@ -432,6 +428,7 @@ child.tooltip = newItem.tooltip child.currentCount = -1 + child.populated = False child.childCount = newItem.childCount # Highlight item because it has changed @@ -504,6 +501,7 @@ if child.currentCount >= 0: # Discard loaded elements and refresh if still expanded child.currentCount = -1 + child.populated = False row = parent.children.index(child) newParentIdx = self.index(row, 0, parentIdx) self.resetModifiedMarker( @@ -514,6 +512,7 @@ # Little quirk: Refresh all visible items to clear the changed marker if parentIdx == QModelIndex(): self.rootNode.currentCount = -1 + self.rootNode.populated = False idxStart = self.index(0, 0, QModelIndex()) idxEnd = self.index(0, 2, QModelIndex()) self.dataChanged.emit(idxStart, idxEnd)