Browse Source

Make abstract syntax types usable as dict keys

Joeri Exelmans 2 years ago
parent
commit
f3f5c391e8
2 changed files with 10 additions and 21 deletions
  1. 10 11
      drawio2py/abstract_syntax.py
  2. 0 10
      whishlist.txt

+ 10 - 11
drawio2py/abstract_syntax.py

@@ -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

+ 0 - 10
whishlist.txt

@@ -1,10 +0,0 @@
-A list of features that are wanted in this tool:
-
-* More flags:
-    -o/--file: only generate specific file(s)
-    -i/--ignore: don't generate specific file(s)
-    -p/--print: print everything to the console instead of to files
-
-* Allow global variables/code? => Model specific; so no flag
-
-* Add "update" script, which generates a new drawio file, based on an old file and a new library