DataTreeWidget: sorting crashfix (#1419)
This commit is contained in:
parent
0dacc57e02
commit
451075b448
@ -93,7 +93,10 @@ class DataTreeWidget(QtGui.QTreeWidget):
|
|||||||
if isinstance(data, OrderedDict):
|
if isinstance(data, OrderedDict):
|
||||||
childs = data
|
childs = data
|
||||||
else:
|
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)):
|
elif isinstance(data, (list, tuple)):
|
||||||
desc = "length=%d" % len(data)
|
desc = "length=%d" % len(data)
|
||||||
childs = OrderedDict(enumerate(data))
|
childs = OrderedDict(enumerate(data))
|
||||||
@ -121,4 +124,4 @@ class DataTreeWidget(QtGui.QTreeWidget):
|
|||||||
desc = asUnicode(data)
|
desc = asUnicode(data)
|
||||||
|
|
||||||
return typeStr, desc, childs, widget
|
return typeStr, desc, childs, widget
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user