Activities/PortingToGtk3/Write

From OLPC
< Activities‎ | PortingToGtk3
Revision as of 12:30, 13 July 2012 by Godiard (talk | contribs) (Created page with 'Write uses libabiword python bindings. The Gtk2 version is available here http://www.abisource.com/wiki/PyAbiWord Ongoing work is needed to add introspection support to the libr…')
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Write uses libabiword python bindings. The Gtk2 version is available here http://www.abisource.com/wiki/PyAbiWord

Ongoing work is needed to add introspection support to the library to be able to use it with Gtk3

The following is a list of methods and signals used in our code.

It is the minimal support we need, but not all the support provided by the old Gtk2 binding.


  • setup
       # create our main abiword canvas
       abiword_canvas = Canvas()
       abiword_canvas.set_property("shadow-type", gtk.SHADOW_NONE)
       abiword_canvas.set_word_selections(True)
       abiword_canvas.set_show_margin(True)
       keybindings_file = os.path.join(get_bundle_path(), 'keybindings.xml')
       abiword_canvas.invoke_cmd(
               'com.abisource.abiword.loadbindings.fromURI',
               keybindings_file, 0, 0)
       abiword_canvas.select_all()
       abiword_canvas.get_selection('text/plain')
       abiword_canvas.set_font_name('Sans')
       abiword_canvas.moveto_bod()
  • preview
       abiword_canvas.render_page_to_image(...)
  • collaboration
       cmd_prefix = 'com.abisource.abiword.abicollab.olpc.'
       abiword_canvas.invoke_cmd(cmd_prefix + 'joinTube', address, 0, 0)
       abiword_canvas.invoke_cmd(cmd_prefix + 'buddyJoined',
                   initiator_dbus_name, 0, 0)
       abiword_canvas.invoke_cmd(cmd_prefix + 'offerTube', address, 0, 0)
       abiword_canvas.invoke_cmd(cmd_prefix + '.buddyJoined', bus_name, 0, 0)
       abiword_canvas.invoke_cmd(cmd_prefix + '.buddyLeft',bus_name, 0, 0)
  • files
       abiword_canvas.load_file(...)
       abiword_canvas.save(...)
       abiword_canvas.get_content(...)
  • document
       abiword_canvas.insert_image(...)
       abiword_canvas.copy()
       abiword_canvas.undo()
       abiword_canvas.paste()
       abiword_canvas.redo()
       abiword_canvas.set_current_page(...)
       abiword_canvas.get_current_page_num()
       abiword_canvas.connect("can-undo", ...)
       abiword_canvas.connect("can-redo", ...)
       abiword_canvas.connect('text-selected', ...)
       abiword_canvas.connect('image-selected', ...)
       abiword_canvas.connect('selection-cleared', ...)
       abiword_canvas.connect("page-count", ...)
       abiword_canvas.connect("current-page", ...)
       self._abiword_canvas.connect("zoom", self._zoom_cb)
  • search
       abiword_canvas.find_next(...)
       abiword_canvas.set_find_string(...)
       abiword_canvas.find_prev()
  • tables
       table = abiword.TableCreator()
       table.set_labels(_('Table'), _('Cancel'))
       table_id = self._table.connect('selected', self._table_cb)
       table.set_image(image)
       table.set_relief(gtk.RELIEF_NONE)
       abiword_canvas.insert_table(rows, cols)
       abiword_canvas.invoke_cmd('insertRowsAfter', , 0, 0)
       abiword_canvas.invoke_cmd('deleteRows', , 0, 0)
       abiword_canvas.invoke_cmd('insertColsAfter', , 0, 0)
       abiword_canvas.invoke_cmd('deleteColumns', , 0, 0)
  • zoom
       abiword_canvas.set_zoom_percentage(...)
       abiword_canvas.get_zoom_percentage()
       abiword_canvas.zoom_width()
  • styles
       abiword_canvas.connect('font-family', ...)
       abiword_canvas.toggle_bold()
       abiword_canvas.connect('bold', ...)
       abiword_canvas.toggle_italic()
       abiword_canvas.connect('italic', ...)
       abiword_canvas.toggle_underline()
       abiword_canvas.connect('underline', ...)
       abiword_canvas.connect('color', ...)
       abiword_canvas.set_font_name(...)
       abiword_canvas.set_text_color(...)
       abiword_canvas.set_style(...)
       abiword_canvas.align_left()
       abiword_canvas.align_center()
       abiword_canvas.align_right()
       abiword_canvas.align_justify()
       abiword_canvas.get_font_names()
       abiword_canvas.connect('font-family', ...)
       abiword_canvas.set_font_name(...)
       abiword_canvas.connect('font-size', ...)
       abiword_canvas.set_font_size(...)