From 8d7cf5faaf5ff39d5dac7153566840b02f2dda6a Mon Sep 17 00:00:00 2001 From: Antonio Ospite Date: Tue, 26 Jun 2018 15:45:24 +0200 Subject: [PATCH] svgwrite_diagram: implement the clear() method --- src/diagram/svgwrite_diagram.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/diagram/svgwrite_diagram.py b/src/diagram/svgwrite_diagram.py index bf94541..b9e5a56 100755 --- a/src/diagram/svgwrite_diagram.py +++ b/src/diagram/svgwrite_diagram.py @@ -82,6 +82,15 @@ class SvgwriteDiagram(Diagram): self.svg = InkscapeDrawing(None, profile='full', size=(str(width) + "px", str(height) + "px")) self.active_group = self.svg + def clear(self): + # Reset the SVG object + self.svg.elements = [] + self.svg.add(self.svg.defs) + + rect = self.svg.rect((0, 0), ('100%', '100%')) + self._fill(rect, self.background) + self.svg.add(rect) + def save_svg(self, filename): self.svg.saveas(filename) -- 2.1.4