[ui] Value of current edge iteration and TaskManager protected

This commit is contained in:
Aurore LAFAURIE 2024-08-26 17:25:34 +02:00
parent 0d397b4baf
commit 0d346ab2da
3 changed files with 17 additions and 8 deletions

View file

@ -764,24 +764,22 @@ class UIGraph(QObject):
return False
return True
@Slot(Edge)
@Slot(Edge, result=Edge)
def expandForLoop(self, currentEdge):
""" Expand 'node' by creating all its output nodes. """
with self.groupedGraphModification("Expand For Loop Node"):
listAttribute = currentEdge.src.root
dst = currentEdge.dst
# First, replace the edge with the first element of the list
currentEdge = self.replaceEdge(currentEdge, listAttribute.at(0), dst)
srcIndex = listAttribute.index(currentEdge.src)
dst = currentEdge.dst
for i in range(1, len(listAttribute)):
duplicates = self.duplicateNodesFrom(dst.node)
newNode = duplicates[0]
previousEdge = self.graph.edge(newNode.attribute(dst.name))
self.replaceEdge(previousEdge, listAttribute.at(i), previousEdge.dst)
# Last, replace the edge with the first element of the list
return self.replaceEdge(currentEdge, listAttribute.at(0), dst)
@Slot(Edge)
def collapseForLoop(self, currentEdge):
""" Collapse 'node' by removing all its output nodes. """