--- a/eric6/Debugger/VariablesViewer.py Sun Jan 17 13:53:08 2021 +0100 +++ b/eric6/Debugger/VariablesViewer.py Mon Feb 01 10:38:16 2021 +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 @@ -195,7 +199,7 @@ elif dtype == "Shiboken.EnumType": self.hasChildren = True - elif dtype in ['str', 'unicode']: + elif dtype == 'str': if VariableItem.rx_nonprintable.search(dvalue) is None: try: dvalue = ast.literal_eval(dvalue) @@ -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) @@ -792,6 +791,7 @@ variablesFilter = e5App().getObject("DebugUI").variablesFilter( self.__globalScope) e5App().getObject("DebugServer").remoteClientVariable( + e5App().getObject("DebugUI").getSelectedDebuggerId(), self.__globalScope, variablesFilter, pathlist, self.framenr) def setExpanded(self, index, state):