Difference between revisions of "Features/GTK3/Porting/Log"
Jump to navigation
Jump to search
(Created page with "This page is being performed while I'm porting Log Activity to Gtk3. There is a [http://bugs.sugarlabs.org/ticket/3761 ticket] with some useful information that I'm using on ...") |
|||
Line 4: | Line 4: | ||
I will take [[User:Humitos/PortingGetBooks|this guide]] as reference on the Gtk3 porting. | I will take [[User:Humitos/PortingGetBooks|this guide]] as reference on the Gtk3 porting. | ||
+ | |||
+ | = Code Snippets = | ||
+ | |||
+ | == Gtk.TextView == | ||
+ | |||
+ | * gtk2: http://www.pygtk.org/docs/pygtk/class-gtktextview.html#method-gtktextview--scroll-to-mark | ||
+ | * Gtk3: http://developer.gnome.org/gtk3/3.5/GtkTextView.html#gtk-text-view-scroll-to-mark | ||
+ | |||
+ | 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) |
Revision as of 08:07, 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
* gtk2: http://www.pygtk.org/docs/pygtk/class-gtktextview.html#method-gtktextview--scroll-to-mark * Gtk3: http://developer.gnome.org/gtk3/3.5/GtkTextView.html#gtk-text-view-scroll-to-mark
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)