Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/SliderPuzzleWidget.py
diff options
context:
space:
mode:
Diffstat (limited to 'SliderPuzzleWidget.py')
-rw-r--r--SliderPuzzleWidget.py10
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):