From f5cddc64f74a27e4387a080f31208bbaa54f9c94 Mon Sep 17 00:00:00 2001 From: Walter Bender Date: Fri, 09 Dec 2011 14:49:16 +0000 Subject: fixed some problems with svg conversion of bitmaps used for export and sharing --- (limited to 'TurtleArt/tacanvas.py') 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 ''' -- cgit v0.9.1