diff options
Diffstat (limited to 'gencards.py')
-rwxr-xr-x | gencards.py | 24 |
1 files changed, 18 insertions, 6 deletions
diff --git a/gencards.py b/gencards.py index 45fe22c..ab501a0 100755 --- a/gencards.py +++ b/gencards.py @@ -228,10 +228,13 @@ class SVG: svg_string += self._svg_style() return svg_string - def _background(self): - return self._svg_rect(119.5, 69.5, 11, 9, 2.75, 2.75) + def _background(self, width=None, height=None): + if width == 125 and height == 75: + return self._svg_rect(119.5, 69.5, 11, 9, 2.75, 2.75) + else: + return self._svg_rect(width - 5.5, height - 5.5, 11, 9, 2.75, 2.75) - def _header(self): + def _header(self, width=125, height=75): svg_string = "<?xml version=\"1.0\" encoding=\"UTF-8\"" svg_string += " standalone=\"no\"?>\n" svg_string += "<!-- Created with Emacs -->\n" @@ -239,12 +242,12 @@ class SVG: svg_string += " xmlns:svg=\"http://www.w3.org/2000/svg\"\n" svg_string += " xmlns=\"http://www.w3.org/2000/svg\"\n" svg_string += " version=\"1.0\"\n" - svg_string += "%s%f%s" % (" width=\"", 125 * self._scale, "\"\n") - svg_string += "%s%f%s" % (" height=\"", 75 * self._scale, "\">\n") + svg_string += "%s%f%s" % (" width=\"", width * self._scale, "\"\n") + svg_string += "%s%f%s" % (" height=\"", height * self._scale, "\">\n") svg_string += "%s%f%s%f%s" % ("<g\n transform=\"matrix(", self._scale, ", 0, 0, ", self._scale, ", 0, 0)\">\n") - svg_string += self._background() + svg_string += self._background(width, height) return svg_string def _footer(self): @@ -862,6 +865,15 @@ def generate_selected_card(scale): svg_string += svg._footer() return svg_string +def generate_label(width, height): + svg = SVG() + svg._set_scale(1.0) + svg._set_stroke_width(6.0) + svg._set_colors(["none", "none"]) + svg_string = svg._header(width, height) + svg_string += svg._footer() + return svg_string + # Command line utilities used for testing purposed only |