Hi Gonzalo,
I hope to be able to answer this questions within 2 days. Still busy
at the moment.
Best Regards,
Martin
On Sat, Nov 6, 2010 at 7:19 AM, Gonzalo Odiard <gonzalo@laptop.org> wrote:
>
> I am trying to solve a ticket from the Write activity:
> http://dev.laptop.org/ticket/1925
>
> I tried different ideas but without success:
>
> 1) Create a temp_canvas and use the clipboard:
>
> temp_canvas = abiword.Canvas()
> if mime_type in ['text/plain', 'text/csv'] or \
> 'text/plain' in mime_parents:
> temp_canvas.load_file('file://' + file_path,
> 'text/plain')
> else:
> temp_canvas.load_file('file://' + file_path, '')
> text =
> temp_canvas.get_content(extension_or_mimetype='.txt')
> logging.error('test = %s' % text)
> temp_canvas.select_all()
> temp_canvas.copy()
> self._abiword_canvas.paste()
>
> The text is displayed in the log, but no text is pasted in the main canvas.
>
> 2) get content and insert it
>
> If I do
> data =
> temp_canvas.get_content(extension_or_mimetype='.abw')
> self._abiword_canvas.insert_data(data)
>
> Insert the text of the abiword file (the xml file
>
> I can copy only the text, without formating doing:
>
> text =
> temp_canvas.get_content(extension_or_mimetype='.txt')
> self._abiword_canvas.insert_data(text)
>
> There are any way to copy all the content form a file in the opened
> file with format?
> Thanks!
>
> Gonzalo
>
Received on Mon Nov 8 03:05:56 2010
This archive was generated by hypermail 2.1.8 : Mon Nov 08 2010 - 03:05:56 CET