diff options
author | Agustin Zubiaga <aguz@sugarlabs.org> | 2013-11-18 21:51:45 (GMT) |
---|---|---|
committer | Gonzalo Odiard <godiard@gmail.com> | 2013-11-19 16:26:03 (GMT) |
commit | 41934c35435261db8adbfe494caa3e4aaaa4e9be (patch) | |
tree | 3d04c23778c782d11efbcc2150267bb33d22bb67 | |
parent | 0b2f5fbaff31bf9f5dab11cf156625a534c98231 (diff) |
Let the user to paste text SL#4559
Signed-off-by: Agustin Zubiaga <aguz@sugarlabs.org>
Reviewed-by: Gonzalo Odiard <gonzalo@laptop.org>
-rw-r--r-- | Area.py | 12 |
1 files changed, 11 insertions, 1 deletions
@@ -1110,7 +1110,16 @@ class Area(Gtk.DrawingArea): clipBoard = Gtk.Clipboard.get(Gdk.SELECTION_CLIPBOARD) - if clipBoard.wait_is_image_available(): + if clipBoard.wait_is_text_available(): + logging.debug('Area.paste(self): Wait is text available') + selection = clipBoard.wait_for_text() + props = self.tool + props['name'] = 'text' + self.set_tool(props) + self.tool_start(0, 0, False) + self.activity.textview.get_buffer().set_text(selection) + + elif clipBoard.wait_is_image_available(): logging.error('Area.paste(self): Wait is image available') pixbuf_sel = clipBoard.wait_for_image() self.load_pixbuf(pixbuf_sel) @@ -1122,6 +1131,7 @@ class Area(Gtk.DrawingArea): if selection is not None: for uri in selection.get_uris(): self.load_image(urlparse(uri).path, self) + else: tempPath = os.path.join("/tmp", "tempFile") tempPath = os.path.abspath(tempPath) |