From 7eeb53f79a1fd247825df4072fb48e8a612323e3 Mon Sep 17 00:00:00 2001 From: Gonzalo Odiard Date: Wed, 02 Jan 2013 13:29:10 +0000 Subject: Fix paste of images - (part of #4130) The Pixbuf api changed with the new bindings and the save method is not available anymore. Signed-off-by: Gonzalo Odiard --- (limited to 'toolbar.py') diff --git a/toolbar.py b/toolbar.py index 782d303..7f69bf7 100644 --- a/toolbar.py +++ b/toolbar.py @@ -142,11 +142,15 @@ class EditToolbar(Gtk.Toolbar): temp_path = os.path.join(activity.get_activity_root(), 'instance') if not os.path.exists(temp_path): os.makedirs(temp_path) - fd, file_path = tempfile.mkstemp(dir=temp_path, suffix='.jpg') + fd, file_path = tempfile.mkstemp(dir=temp_path, suffix='.png') os.close(fd) logging.error('tempfile is %s' % file_path) - pixbuf_sel.save(file_path, 'jpeg') - self._abiword_canvas.insert_image(file_path, False) + success, data = pixbuf_sel.save_to_bufferv('png', [], []) + if success: + px_file = open(file_path, 'w') + px_file.write(data) + px_file.close() + self._abiword_canvas.insert_image(file_path, False) elif clipboard.wait_is_uris_available(): selection = clipboard.wait_for_contents('text/uri-list') -- cgit v0.9.1