Hi,

tomeu can you verify that patch?

Use case: Copying an image using the palette under rainbow.

We loose the data which exist in the filename, should we try to store this 
somehow?

Best,
   Simon
diff --git a/palettes.py b/palettes.py
index d62fb5e..254201f 100644
--- a/palettes.py
+++ b/palettes.py
@@ -15,8 +15,8 @@
 # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 
 import os
-import tempfile
 import urlparse
+import time
 from gettext import gettext as _
 
 import gtk
@@ -27,6 +27,7 @@ from sugar.graphics.palette import Palette, Invoker
 from sugar.graphics.menuitem import MenuItem
 from sugar.graphics.icon import Icon
 from sugar import profile
+from sugar.activity import activity
 
 class ContentInvoker(Invoker):
     _com_interfaces_ = interfaces.nsIDOMEventListener
@@ -157,8 +158,10 @@ class ImagePalette(Palette):
         extension = None
         if '.' in file_name:
             extension = file_name.split('.')[1]
-        fd, self._temp_file = tempfile.mkstemp(suffix='.' + extension)
-        os.close(fd)
+        
+        temp_path = os.path.join(activity.get_activity_root(), 'instance')
+        self._temp_file = os.path.join(temp_path, '%i%s' % 
+                                       (time.time(), extension))        
 
         cls = components.classes['@mozilla.org/network/io-service;1']
         io_service = cls.getService(interfaces.nsIIOService)
_______________________________________________
Sugar mailing list
Sugar@lists.laptop.org
http://lists.laptop.org/listinfo/sugar

Reply via email to