Difference between revisions of "Features/GTK3/Porting/Log"

From Sugar Labs
< Features‎ | GTK3‎ | Porting
Jump to navigation Jump to search
Line 19: Line 19:
  
 
  self._textview.scroll_to_mark(log.get_insert(), 0, use_align=False, xalign=0.5, yalign=0.5)
 
  self._textview.scroll_to_mark(log.get_insert(), 0, use_align=False, xalign=0.5, yalign=0.5)
 +
 +
== Gtk.TreeSortable.set_sort_func ==
 +
 +
* http://python-gtk-3-tutorial.readthedocs.org/en/latest/treeview.html#Gtk.TreeSortable.set_sort_func
 +
 +
This function sometimes receives ''user_data'' so we need to add an optional argument to the definition.
 +
 +
def _sort_logfile(self, treemodel, itera, iterb):
 +
 +
replaced by:
 +
 +
def _sort_logfile(self, treemodel, itera, iterb, user_data=None):
  
 
= Missing things =
 
= Missing things =

Revision as of 09:29, 18 July 2012

This page is being performed while I'm porting Log Activity to Gtk3.

There is a ticket with some useful information that I'm using on the porting and to keep tracking this port. Besides, this wiki page will be useful to write some code snippets about what are the difficulties that I'm having on the port and maybe can be useful for someone else.

I will take this guide as reference on the Gtk3 porting.

Code Snippets

Gtk.TextView

Gtk.TextView.scroll_to_mark needs all the arguments. In gtk2 version three of them were optional (use_align, xalign, yalign)

self._textview.scroll_to_mark(log.get_insert(), 0)

replaced with:

self._textview.scroll_to_mark(log.get_insert(), 0, use_align=False, xalign=0.5, yalign=0.5)

Gtk.TreeSortable.set_sort_func

This function sometimes receives user_data so we need to add an optional argument to the definition.

def _sort_logfile(self, treemodel, itera, iterb):

replaced by:

def _sort_logfile(self, treemodel, itera, iterb, user_data=None):

Missing things

  • Copy button doesn't work
  • Look for a FIXME in the code (logviewer.py)