X-Git-Url: https://git.ao2.it/flexagon-toolkit.git/blobdiff_plain/0e3851edfb7df9410950e4446b73ef06966e5b0d..refs/heads/master:/src/diagram/svgwrite_diagram.py diff --git a/src/diagram/svgwrite_diagram.py b/src/diagram/svgwrite_diagram.py index c4b76af..bbc88eb 100755 --- a/src/diagram/svgwrite_diagram.py +++ b/src/diagram/svgwrite_diagram.py @@ -21,7 +21,10 @@ import warnings from math import degrees import svgwrite from svgwrite.data.types import SVGAttribute -from .diagram import Diagram +try: + from .diagram import Diagram +except ValueError: + from diagram import Diagram class InkscapeDrawing(svgwrite.Drawing): @@ -186,3 +189,18 @@ class SvgwriteDiagram(Diagram): if bb_stroke_color or bb_fill_color: warnings.warn("Drawing the bounding box has not been implemented yet.") + + # XXX: this is just a very quick and dirty estimate to advance the text + return self.font_size * len(text) / 2 + + +def test(): + diagram = SvgwriteDiagram(400, 400) + + Diagram.test(diagram) + + diagram.save_svg('svgwrite_diagram_test.svg') + + +if __name__ == "__main__": + test()