Duplicate components from the sheet and tree popups, with links between them
Ctrl+click picks out several boxes on the sheet, and Ctrl/Shift+click several rows in the tree. Copies are named on from their original (Add1 -> Add2), sit one step right and down, and keep the links that ran between the copied components. One undo step; on a device the originals are read back in full and the copies made there. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -263,6 +263,25 @@ class AddComponentCommand:
|
||||
self.parent.insert(self.index, self.element)
|
||||
|
||||
|
||||
class CompositeCommand:
|
||||
"""Several commands taken as one step, such as a duplicate: its copies and its links.
|
||||
|
||||
Undone last-first, so links go before the components they run between.
|
||||
"""
|
||||
|
||||
def __init__(self, commands, label="edit"):
|
||||
self.commands = list(commands)
|
||||
self.label = label
|
||||
|
||||
def undo(self):
|
||||
for command in reversed(self.commands):
|
||||
command.undo()
|
||||
|
||||
def redo(self):
|
||||
for command in self.commands:
|
||||
command.redo()
|
||||
|
||||
|
||||
class AddLinkCommand:
|
||||
"""Adding a single link to the <links> section."""
|
||||
|
||||
|
||||
Reference in New Issue
Block a user