diff options
author | Walter Bender <walter.bender@gmail.com> | 2011-12-09 14:49:16 (GMT) |
---|---|---|
committer | Walter Bender <walter.bender@gmail.com> | 2011-12-09 14:49:16 (GMT) |
commit | f5cddc64f74a27e4387a080f31208bbaa54f9c94 (patch) | |
tree | 2819ba0f72d7c1e9eb07de36c03b8b46346437b6 /TurtleArt/tacanvas.py | |
parent | 9bdad15b7778194a9506a00eabd1fd4e9440eff2 (diff) |
fixed some problems with svg conversion of bitmaps used for export and sharing
Diffstat (limited to 'TurtleArt/tacanvas.py')
-rw-r--r-- | TurtleArt/tacanvas.py | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/TurtleArt/tacanvas.py b/TurtleArt/tacanvas.py index 43e5ad2..bf22248 100644 --- a/TurtleArt/tacanvas.py +++ b/TurtleArt/tacanvas.py @@ -22,6 +22,7 @@ import gtk from math import sin, cos, atan, pi, sqrt +import os import pango import cairo import pangocairo @@ -552,23 +553,24 @@ class TurtleGraphics: if self.tw.saving_svg: if self.tw.running_sugar: # In Sugar, we embed the images inside the SVG - tmp_file = os.path.join(get_path(tw.activity, 'instance'), + tmp_file = os.path.join(get_path(self.tw.activity, 'instance'), 'tmpfile.png') pixbuf.save(tmp_file, 'png', {'quality': '100'}) self.tw.svg_string += self.svg.image( - x - self.width / 2, y, w, h, path, + x, y, w, h, path, image_to_base64(tmp_file, get_path(self.tw.activity, 'instance'))) + os.remove(tmp_file) else: # In GNOME, we embed a path - self.tw.svg_string += self.svg.image(x - self.width / 2, - y, w, h, path) + self.tw.svg_string += self.svg.image( + x - self.width / 2, y, w, h, path) if self.tw.sharing() and share: if self.tw.running_sugar: tmp_path = get_path(self.tw.activity, 'instance') else: tmp_path = '/tmp' - tmp_file = os.path.join(get_path(tw.activity, 'instance'), + tmp_file = os.path.join(get_path(self.tw.activity, 'instance'), 'tmpfile.png') pixbuf.save(tmp_file, 'png', {'quality': '100'}) data = image_to_base64(tmp_file, tmp_path) @@ -583,6 +585,7 @@ class TurtleGraphics: round_int(height), data]])) self.tw.send_event(event) + os.remove(tmp_file) def draw_text(self, label, x, y, size, w, share=True): ''' Draw text ''' |