mirror of
https://github.com/alicevision/Meshroom.git
synced 2025-07-11 05:47:22 +02:00
[ui][commands] add MoveNodeCommand
add undoable command to move a Node to a target position
This commit is contained in:
parent
e2155ba962
commit
ac4772fc57
2 changed files with 30 additions and 0 deletions
|
@ -258,6 +258,23 @@ class ListAttributeRemoveCommand(GraphCommand):
|
|||
listAttribute.insert(self.index, self.value)
|
||||
|
||||
|
||||
class MoveNodeCommand(GraphCommand):
|
||||
""" Move a node to a given position. """
|
||||
def __init__(self, graph, node, position, parent=None):
|
||||
super(MoveNodeCommand, self).__init__(graph, parent)
|
||||
self.nodeName = node.name
|
||||
self.oldPosition = node.position
|
||||
self.newPosition = position
|
||||
self.setText("Move {}".format(self.nodeName))
|
||||
|
||||
def redoImpl(self):
|
||||
self.graph.node(self.nodeName).position = self.newPosition
|
||||
return True
|
||||
|
||||
def undoImpl(self):
|
||||
self.graph.node(self.nodeName).position = self.oldPosition
|
||||
|
||||
|
||||
class UpgradeNodeCommand(GraphCommand):
|
||||
"""
|
||||
Perform node upgrade on a CompatibilityNode.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue