|
|
@@ -4,15 +4,15 @@ from decimal import Decimal
|
|
|
import re
|
|
|
|
|
|
# Sub-class of all (non-abstract) Drawio AS classes
|
|
|
-@dataclass
|
|
|
+@dataclass(eq=False)
|
|
|
class Element:
|
|
|
pass
|
|
|
|
|
|
-@dataclass
|
|
|
+@dataclass(eq=False)
|
|
|
class Style(Element):
|
|
|
data: dict[str,str]
|
|
|
|
|
|
-@dataclass
|
|
|
+@dataclass(eq=False)
|
|
|
class Cell(Element):
|
|
|
""" Instances of Cell are: the root cell and its layers """
|
|
|
id: str
|
|
|
@@ -23,38 +23,37 @@ class Cell(Element):
|
|
|
style: Optional[Style]
|
|
|
attributes: dict[str,str] # Any extra XML attributes
|
|
|
|
|
|
-@dataclass
|
|
|
+@dataclass(eq=False)
|
|
|
class Point(Element):
|
|
|
x: Decimal
|
|
|
y: Decimal
|
|
|
|
|
|
-@dataclass
|
|
|
+@dataclass(eq=False)
|
|
|
class VertexGeometry(Point):
|
|
|
width: Decimal
|
|
|
height: Decimal
|
|
|
|
|
|
-@dataclass
|
|
|
+@dataclass(eq=False)
|
|
|
class Vertex(Cell):
|
|
|
geometry: VertexGeometry
|
|
|
|
|
|
-@dataclass
|
|
|
+@dataclass(eq=False)
|
|
|
class EdgeGeometry(Element):
|
|
|
points: List[Point] = field(default_factory=list)
|
|
|
source_point: Optional[Point] = None
|
|
|
target_point: Optional[Point] = None
|
|
|
|
|
|
-@dataclass
|
|
|
+@dataclass(eq=False)
|
|
|
class Edge(Cell):
|
|
|
geometry: EdgeGeometry
|
|
|
source: Vertex
|
|
|
target: Vertex
|
|
|
|
|
|
-@dataclass
|
|
|
+@dataclass(eq=False)
|
|
|
class Page(Element):
|
|
|
id: str # (Globally unique) ID of the page
|
|
|
name: str # Page name, as shown in GUI
|
|
|
attributes: dict[str,str] # Attributes of the <mxGraphModel> of the page
|
|
|
-
|
|
|
root: Cell
|
|
|
|
|
|
def get_sanitized_name(self):
|
|
|
@@ -62,7 +61,7 @@ class Page(Element):
|
|
|
return self.name[len("Page-"):]
|
|
|
return re.sub(r"[^a-zA-Z0-9_]", "", self.name)
|
|
|
|
|
|
-@dataclass
|
|
|
+@dataclass(eq=False)
|
|
|
class DrawIOFile(Element):
|
|
|
filename: str
|
|
|
compressed: bool
|