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 Fri Nov  5 21:19:15 2010
This archive was generated by hypermail 2.1.8 : Fri Nov 05 2010 - 21:19:15 CET