[graph] ListAttribute: replace '__getitem__ by 'at'

__getitem__ is spuriously called when the object is used inside a Qt model and exposed to QML, leading to unexpected behaviors
This commit is contained in:
Yann Lanthony 2018-04-04 17:29:04 +02:00 committed by Yann Lanthony
parent a5cda66670
commit 2cd724f957
4 changed files with 25 additions and 22 deletions

View file

@ -259,7 +259,7 @@ class UIGraph(QObject):
if isinstance(dst, graph.ListAttribute):
with self.groupedGraphModification("Insert and Add Edge on {}".format(dst.fullName())):
self.appendAttribute(dst)
self.push(commands.AddEdgeCommand(self._graph, src, dst[-1]))
self.push(commands.AddEdgeCommand(self._graph, src, dst.at(-1)))
else:
self.push(commands.AddEdgeCommand(self._graph, src, dst))