diff options
author | Aneesh Dogra <lionaneesh@gmail.com> | 2012-12-20 18:16:25 (GMT) |
---|---|---|
committer | Aneesh Dogra <lionaneesh@gmail.com> | 2012-12-20 18:16:25 (GMT) |
commit | 3b957dd6d75e0bf8f6c2f073d61c03acab2cd1d8 (patch) | |
tree | 5911c2117ab3b60e971ad985ae3b40b33425c9e1 | |
parent | 6314183a9a6d1acb15cb30f9bdb0357638163c0f (diff) |
-rw-r--r-- | SliderPuzzleWidget.py | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/SliderPuzzleWidget.py b/SliderPuzzleWidget.py index a88a144..59a8660 100644 --- a/SliderPuzzleWidget.py +++ b/SliderPuzzleWidget.py @@ -21,7 +21,7 @@ from gi.repository import Gtk, GObject, Pango, GdkPixbuf, Gdk import md5 import logging - +import tempfile from mamamedia_modules import utils #from utils import load_image, calculate_matrix, debug, SliderCreator, trace @@ -580,9 +580,11 @@ class SliderPuzzleWidget (Gtk.Table): # and it looks like save_to_callback's data is being truncated on NULL. # Check http://ubuntuforums.org/showthread.php?t=1877793 # XXX: Hack - self.image.savev("tmp.png", "png", [], []) - pb_s = GdkPixbuf.Pixbuf.new_from_file("tmp.png").to_string() - os.remove("tmp.png") + tmp_file = tempfile.NamedTemporaryFile() + tmp_file_name = tmp_file.name + self.image.savev(tmp_file_name, "png", [], []) + pb_s = GdkPixbuf.Pixbuf.new_from_file(tmp_file_name).to_string() + tmp_file.close() return pb_s def _freeze (self, journal=True): |