Skip to content

Commit a0feb53

Browse files
committed
PR comments, bump version to 1.1
1 parent b441f02 commit a0feb53

File tree

5 files changed

+16
-147
lines changed

5 files changed

+16
-147
lines changed

graphviz2drawio/models/Errors.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,15 @@ def __init__(self, message: str) -> None:
1010
super().__init__(message)
1111

1212

13+
class CouldNotParsePathError(GdValueError):
14+
"""Could not parse path from SVG element."""
15+
16+
def __init__(self, g: Element) -> None:
17+
super().__init__(
18+
f"Could not parse path from SVG element: {g.tag} ({g.attrib})",
19+
)
20+
21+
1322
class MissingTitleError(GdValueError):
1423
"""Title missing from SVG element."""
1524

graphviz2drawio/mx/RectFactory.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,22 @@
11
from svg import path as svg_path
22

33
from ..models.CoordsTranslate import CoordsTranslate
4+
from ..models.Errors import CouldNotParsePathError
45
from ..models.Rect import Rect
56

67

78
def rect_from_svg_path(coords: CoordsTranslate, path_d: str) -> Rect:
89
parsed_path: svg_path.Path = svg_path.parse_path(path_d)
10+
if len(parsed_path) == 0 or not isinstance(parsed_path[0], svg_path.Move):
11+
raise CouldNotParsePathError
912
start: svg_path.Move = parsed_path.pop(0)
1013
min_x = start.start.real
1114
min_y = start.start.imag
1215
max_x = start.start.real
1316
max_y = start.start.imag
17+
18+
# Note that this loop may not be accurate since it does not calculate
19+
# the Bezier curve based on the control points
1420
for e in parsed_path:
1521
min_x = min(min_x, e.start.real, e.end.real)
1622
min_y = min(min_y, e.start.imag, e.end.imag)

graphviz2drawio/version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
__version__ = "1.0.0"
1+
__version__ = "1.1.0"
22

33
if __name__ == "__main__":
44
print(__version__)

specs/directed/subgraph.xml

Lines changed: 0 additions & 121 deletions
This file was deleted.

test/directed/subgraph.gv.txt

Lines changed: 0 additions & 25 deletions
This file was deleted.

0 commit comments

Comments
 (0)