From 3e77ebc0f6c2c746773d51fd8e4b7ec4d95d4c45 Mon Sep 17 00:00:00 2001 From: Yann Lanthony Date: Mon, 25 Nov 2024 17:18:46 +0100 Subject: [PATCH] [ui] Graph: Add `clearSelectedNodesData` method Convenient function to directly work on the current node selection. --- meshroom/ui/graph.py | 15 +++++++++------ meshroom/ui/qml/GraphEditor/GraphEditor.qml | 2 +- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/meshroom/ui/graph.py b/meshroom/ui/graph.py index 5b8f92b174..7fc9c9c19f 100644 --- a/meshroom/ui/graph.py +++ b/meshroom/ui/graph.py @@ -813,21 +813,24 @@ def collapseForLoop(self, currentEdge): # update the edges from allSrc allSrc = [e.src for e in self._graph.edges.values()] + @Slot() + def clearSelectedNodesData(self): + """Clear data from all selected nodes.""" + self.clearData(self.iterSelectedNodes()) - @Slot(QObject) - def clearData(self, nodes): + @Slot(list) + def clearData(self, nodes: list[Node]): """ Clear data from 'nodes'. """ - nodes = self.filterNodes(nodes) for n in nodes: n.clearData() - @Slot(QObject) - def clearDataFrom(self, nodes): + @Slot(list) + def clearDataFrom(self, nodes: list[Node]): """ Clear data from all nodes starting from 'nodes' to graph leaves. Args: - nodes (list[Node]): the nodes to start from. + nodes: The nodes to start from. """ self.clearData(self._graph.dfsOnDiscover(startNodes=nodes, reverse=True, dependenciesOnly=True)[0]) diff --git a/meshroom/ui/qml/GraphEditor/GraphEditor.qml b/meshroom/ui/qml/GraphEditor/GraphEditor.qml index 28df01751a..4b2dd55086 100755 --- a/meshroom/ui/qml/GraphEditor/GraphEditor.qml +++ b/meshroom/ui/qml/GraphEditor/GraphEditor.qml @@ -810,7 +810,7 @@ Item { if (deleteFollowing) uigraph.clearDataFrom(uigraph.selectedNodes); else - uigraph.clearData(uigraph.selectedNodes); + uigraph.clearSelectedNodesData(); dataDeleted(); } onClosed: destroy()