Added array ports and junctions
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
from PySide6.QtCore import QPointF
|
||||
from PySide6.QtGui import QUndoCommand
|
||||
|
||||
from bedit.core.model import Annotation, Component, Connection, Port
|
||||
from bedit.core.model import Annotation, Component, Connection, Junction, Port
|
||||
|
||||
|
||||
class AddComponentCommand(QUndoCommand):
|
||||
@@ -76,6 +76,32 @@ class AddConnectionCommand(QUndoCommand):
|
||||
self.controller._remove_connection(self.owner_id, self.connection.id)
|
||||
|
||||
|
||||
class SplitConnectionCommand(QUndoCommand):
|
||||
def __init__(
|
||||
self,
|
||||
controller,
|
||||
owner_id: str,
|
||||
original: Connection,
|
||||
junction: Junction,
|
||||
first: Connection,
|
||||
second: Connection,
|
||||
) -> None:
|
||||
super().__init__("Add connection junction")
|
||||
self.controller, self.owner_id = controller, owner_id
|
||||
self.original, self.junction = original, junction
|
||||
self.first, self.second = first, second
|
||||
|
||||
def redo(self) -> None:
|
||||
self.controller._split_connection(
|
||||
self.owner_id, self.original.id, self.junction, self.first, self.second
|
||||
)
|
||||
|
||||
def undo(self) -> None:
|
||||
self.controller._restore_split_connection(
|
||||
self.owner_id, self.original, self.junction.id, self.first.id, self.second.id
|
||||
)
|
||||
|
||||
|
||||
class AddAnnotationCommand(QUndoCommand):
|
||||
def __init__(self, controller, owner_id: str, annotation: Annotation) -> None:
|
||||
super().__init__(f"Draw {annotation.kind}")
|
||||
|
||||
Reference in New Issue
Block a user