Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/toolbar.py
diff options
context:
space:
mode:
authorGonzalo Odiard <godiard@gmail.com>2013-01-02 13:29:10 (GMT)
committer Gonzalo Odiard <godiard@gmail.com>2013-01-02 13:29:10 (GMT)
commit7eeb53f79a1fd247825df4072fb48e8a612323e3 (patch)
tree989cc0860d14169949bbdf86b15b244842ed5281 /toolbar.py
parente9e4b6b1bf1e57f8dd561c64d94fefc2e5f5afcd (diff)
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 <gonzalo@laptop.org>
Diffstat (limited to 'toolbar.py')
-rw-r--r--toolbar.py10
1 files changed, 7 insertions, 3 deletions
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')