diff --git a/gaphor/SysML/blocks/proxyport.py b/gaphor/SysML/blocks/proxyport.py index 48e14b621..e1da792eb 100644 --- a/gaphor/SysML/blocks/proxyport.py +++ b/gaphor/SysML/blocks/proxyport.py @@ -3,7 +3,6 @@ from typing import Optional from gaphas.connector import Handle, LinePort, Position from gaphas.geometry import Rectangle, distance_rectangle_point -from gaphas.matrix import Matrix from gaphor.core.modeling import Presentation from gaphor.diagram.presentation import Named, postload_connect @@ -36,8 +35,6 @@ def text_position(position): class ProxyPortItem(Presentation[sysml.ProxyPort], Named): def __init__(self, diagram, id=None): super().__init__(diagram, id) - self._matrix = Matrix() - self._matrix_i2c = Matrix() self._connections = diagram.connections h1 = Handle(connectable=True) @@ -59,14 +56,6 @@ class ProxyPortItem(Presentation[sysml.ProxyPort], Named): self.watch("subject[NamedElement].name") self.update_shapes() - @property - def matrix(self) -> Matrix: - return self._matrix - - @property - def matrix_i2c(self) -> Matrix: - return self._matrix_i2c - def handles(self): return self._handles diff --git a/gaphor/UML/actions/activitynodes.py b/gaphor/UML/actions/activitynodes.py index ca4be02d8..6af18e393 100644 --- a/gaphor/UML/actions/activitynodes.py +++ b/gaphor/UML/actions/activitynodes.py @@ -6,7 +6,6 @@ import math from gaphas.constraint import constraint from gaphas.geometry import Rectangle, distance_line_point from gaphas.item import Handle, LinePort -from gaphas.matrix import Matrix from gaphas.state import observed, reversible_property from gaphas.util import path_ellipse @@ -218,8 +217,6 @@ class ForkNodeItem(Presentation[UML.ForkNode], Named): def __init__(self, diagram, id=None): super().__init__(diagram, id=id) - self._matrix = Matrix() - self._matrix_i2c = Matrix() h1, h2 = Handle(), Handle() self._handles = [h1, h2] @@ -250,14 +247,6 @@ class ForkNodeItem(Presentation[UML.ForkNode], Named): self, constraint(above=(h1.pos, h2.pos), delta=30) ) - @property - def matrix(self) -> Matrix: - return self._matrix - - @property - def matrix_i2c(self) -> Matrix: - return self._matrix_i2c - def handles(self): return self._handles diff --git a/gaphor/UML/interactions/executionspecification.py b/gaphor/UML/interactions/executionspecification.py index 596806923..c3f050538 100644 --- a/gaphor/UML/interactions/executionspecification.py +++ b/gaphor/UML/interactions/executionspecification.py @@ -26,7 +26,6 @@ from gaphas import Handle from gaphas.connector import LinePort, Position from gaphas.constraint import constraint from gaphas.geometry import Rectangle, distance_rectangle_point -from gaphas.matrix import Matrix from gaphas.solver import WEAK from gaphor import UML @@ -43,8 +42,6 @@ class ExecutionSpecificationItem(Presentation[UML.ExecutionSpecification]): def __init__(self, diagram, id=None): super().__init__(diagram, id=id) - self._matrix = Matrix() - self._matrix_i2c = Matrix() self._connections = diagram.connections self.bar_width = 12 @@ -80,14 +77,6 @@ class ExecutionSpecificationItem(Presentation[UML.ExecutionSpecification]): style={"background-color": (1.0, 1.0, 1.0, 1.0)}, draw=draw_border ) - @property - def matrix(self) -> Matrix: - return self._matrix - - @property - def matrix_i2c(self) -> Matrix: - return self._matrix_i2c - def handles(self): return self._handles diff --git a/gaphor/core/modeling/diagram.py b/gaphor/core/modeling/diagram.py index 69d0ce36a..c823caf85 100644 --- a/gaphor/core/modeling/diagram.py +++ b/gaphor/core/modeling/diagram.py @@ -343,7 +343,6 @@ class Diagram(PackageableElement): def unlink(self): """Unlink all canvas items then unlink this diagram.""" - log.debug("unlinking %s", self) for item in self.ownedPresentation: self.connections.remove_connections_to_item(item) self._watcher.unsubscribe_all() diff --git a/gaphor/core/modeling/presentation.py b/gaphor/core/modeling/presentation.py index 9e5fa4dc5..ef8df6d00 100644 --- a/gaphor/core/modeling/presentation.py +++ b/gaphor/core/modeling/presentation.py @@ -3,16 +3,15 @@ from __future__ import annotations import logging -from typing import TYPE_CHECKING, Callable, Generic, List, TypeVar +from typing import TYPE_CHECKING, Generic, TypeVar + +from gaphas.item import Matrices from gaphor.core.modeling import Element from gaphor.core.modeling.event import DiagramItemDeleted from gaphor.core.modeling.properties import association, relation_many, relation_one if TYPE_CHECKING: - from gaphas.connector import Handle # noqa - from gaphas.matrix import Matrix # noqa - from gaphor.core.modeling.diagram import Diagram S = TypeVar("S", bound=Element) @@ -23,7 +22,7 @@ log = logging.getLogger(__name__) Transient = False -class Presentation(Element, Generic[S]): +class Presentation(Matrices, Element, Generic[S]): """This presentation is used to link the behaviors of `gaphor.core.modeling` and `gaphas.Item`. @@ -36,9 +35,9 @@ class Presentation(Element, Generic[S]): def __init__(self, diagram: Diagram, id=None): if id is Transient: - super().__init__(id) + super().__init__(id=id) else: - super().__init__(id, diagram.model) + super().__init__(id=id, model=diagram.model) self.diagram = diagram def update(event): @@ -58,11 +57,6 @@ class Presentation(Element, Generic[S]): parent: relation_one[Presentation] children: relation_many[Presentation] - handles: Callable[[Presentation], List[Handle]] - - matrix: Matrix - matrix_i2c: Matrix - def request_update(self, matrix=True): if self.diagram: self.diagram.request_update(self, matrix=matrix)