[ui] GraphEditor: only connect compatible attributes

This commit is contained in:
Fabien Castan 2020-12-28 15:29:10 +01:00
parent 85044e50cb
commit 5fb6a5fb0f
3 changed files with 35 additions and 18 deletions

View file

@ -227,6 +227,9 @@ class AddEdgeCommand(GraphCommand):
self.dstAttr = dst.getFullName()
self.setText("Connect '{}'->'{}'".format(self.srcAttr, self.dstAttr))
if src.baseType != dst.baseType:
raise ValueError("Attribute types are not compatible and cannot be connected: '{}'({})->'{}'({})".format(self.srcAttr, src.baseType, self.dstAttr, dst.baseType))
def redoImpl(self):
self.graph.addEdge(self.graph.attribute(self.srcAttr), self.graph.attribute(self.dstAttr))
return True