DataTreeWidget: sorting crashfix (#1419)

This commit is contained in:
iam-git 2020-10-25 01:58:51 +02:00 committed by GitHub
parent 0dacc57e02
commit 451075b448
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -93,7 +93,10 @@ class DataTreeWidget(QtGui.QTreeWidget):
if isinstance(data, OrderedDict):
childs = data
else:
childs = OrderedDict(sorted(data.items()))
try:
childs = OrderedDict(sorted(data.items()))
except TypeError: # if sorting falls
childs = OrderedDict(data.items())
elif isinstance(data, (list, tuple)):
desc = "length=%d" % len(data)
childs = OrderedDict(enumerate(data))
@ -121,4 +124,4 @@ class DataTreeWidget(QtGui.QTreeWidget):
desc = asUnicode(data)
return typeStr, desc, childs, widget