Skip to content

DataTreeWidget exception with multivalue Terminal (flowchart)#1362

Merged
j9ac9k merged 1 commit intopyqtgraph:masterfrom
bruchar1:make-terminal-sortable
Oct 13, 2020
Merged

DataTreeWidget exception with multivalue Terminal (flowchart)#1362
j9ac9k merged 1 commit intopyqtgraph:masterfrom
bruchar1:make-terminal-sortable

Conversation

@bruchar1
Copy link
Copy Markdown
Contributor

Fix exception in DataTreeWidget when clicking on a node with multivalue Terminal connected

The problem is that data for multi value Terminal is {Terminal: value}, but Terminal object is not sortable.
Adding the < operator to Terminal solve the problem.

To reproduce the problem: build a Flowchart with a connected multivalue Node Terminal, and click on the Node. An exception occurs in DataTreeWidget

Traceback (most recent call last):
  File "pyqtgraph\flowchart\Flowchart.py", line 910, in selectionChanged
self.selectedTree.setData(data, hideRoot=True)
  File "pyqtgraph\widgets\DataTreeWidget.py", line 35, in setData
self.buildTree(data, self.invisibleRootItem(), hideRoot=hideRoot)
  File "pyqtgraph\widgets\DataTreeWidget.py", line 72, in buildTree
self.buildTree(data, node, asUnicode(key), path=path+(key,))
  File "pyqtgraph\widgets\DataTreeWidget.py", line 72, in buildTree
self.buildTree(data, node, asUnicode(key), path=path+(key,))
  File "pyqtgraph\widgets\DataTreeWidget.py", line 50, in buildTree
typeStr, desc, childs, widget = self.parse(data)
  File "pyqtgraph\widgets\DataTreeWidget.py", line 96, in parse
childs = OrderedDict(sorted(data.items()))
TypeError
:
'<' not supported between instances of 'Terminal' and 'Terminal'

@j9ac9k
Copy link
Copy Markdown
Member

j9ac9k commented Oct 13, 2020

Hi @bruchar1 sorry it's taken me so long to get to this. This looks good to me. Merging.

Thanks for the PR.

@j9ac9k j9ac9k merged commit 539394e into pyqtgraph:master Oct 13, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants