Re: How to paste the content of a document with pyabiword

From: Gonzalo Odiard <gonzalo_at_laptop.org>
Date: Mon Nov 15 2010 - 13:35:14 CET

Just pinging if you forget me :)
Gonzalo

> On Sun, Nov 7, 2010 at 11:05 PM, Martin Sevior <msevior@gmail.com> wrote:
>>
>> 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 15 13:35:25 2010

This archive was generated by hypermail 2.1.8 : Mon Nov 15 2010 - 13:35:25 CET