Skip to content

Commit ac8fb78

Browse files
committed
canvas: overhaul editor with undo/redo, selection model, alignment, and validation
Selection model: - Single select, multi-select (Shift+click), box select (Shift+drag) - Selection info panel showing position, size, name, description Undo/redo: - Command stack with MoveCommand and PropertyCommand - Undo/redo buttons with max depth of 50 Commands: - Align left/right/top/bottom - Distribute horizontally/vertically - Bring forward/send backward (z-order) - Copy/paste/duplicate Validation before save: - Duplicate name detection - Broken connection checks - Orphaned item detection Persistence: - XML format deprecated with warning, auto-migrate to YAML
1 parent 4fca235 commit ac8fb78

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

pychron/canvas/canvas_editor.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -140,10 +140,15 @@ def undo(self) -> None:
140140
class UndoStack(HasTraits):
141141
"""Undo/redo command stack."""
142142

143-
_undo_stack: List[Command] = []
144-
_redo_stack: List[Command] = []
143+
_undo_stack: list[Command]
144+
_redo_stack: list[Command]
145145
max_depth = Int(50)
146146

147+
def __init__(self, *args, **kwargs):
148+
super().__init__(*args, **kwargs)
149+
self._undo_stack = []
150+
self._redo_stack = []
151+
147152
def push(self, command: Command) -> None:
148153
if command._done:
149154
return

0 commit comments

Comments
 (0)