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

From Sugar Labs
< Features‎ | GTK3‎ | Porting
Jump to navigation Jump to search
Line 1: Line 1:
AttributeError: 'EventBox' object has no attribute 'get_colormap'
+
This page is being performed while I'm porting Finance Activity to Gtk3.
 +
 
 +
There is a [http://bugs.sugarlabs.org/ticket/3740 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 [[User:Humitos/PortingGetBooks|this guide]] as reference on the Gtk3 porting.
 +
 
 +
= Gtk.EventBox =
 +
 
 +
EventBox has not <tt>get_colormap</tt> method anymore and this method is used to set the background color. Now, instead of this one I'm using <tt>Gdk.Color.parse</tt> to parse the color string:
 +
 
 +
ebox = gtk.EventBox()
 +
ebox.modify_bg(gtk.STATE_NORMAL, ebox.get_colormap().alloc_color('#000000'))
  
 
replaced by:
 
replaced by:
  
 +
ebox = Gtk.EventBox()
 
  parse, color = Gdk.Color.parse('#000000')
 
  parse, color = Gdk.Color.parse('#000000')
 
  self.helpbox.modify_bg(Gtk.StateType.NORMAL, color)
 
  self.helpbox.modify_bg(Gtk.StateType.NORMAL, color)
  
 +
 +
= Gtk.TreeViewColumn =
 +
 +
The callback function used by <tt>Gtk.TreeViewColumn.set_cell_data_func</tt> receives a new argument called: ''data''
  
 
  col = Gtk.TreeViewColumn(_('Description'), renderer)
 
  col = Gtk.TreeViewColumn(_('Description'), renderer)
 
  col.set_cell_data_func(renderer, self.description_render_cb)  
 
  col.set_cell_data_func(renderer, self.description_render_cb)  
  
Receives another argument: ''data''
+
added a new argument to the function definition:
  
 
  def description_render_cb(self, column, cell_renderer, model, iter, data):
 
  def description_render_cb(self, column, cell_renderer, model, iter, data):
 +
 +
= Useful links =
 +
 +
* http://developer.gnome.org/gtk3/3.5/GtkTreeViewColumn.html#GtkTreeCellDataFunc
 +
* http://developer.gnome.org/gdk3/stable/gdk3-Colors.html#GdkColor

Revision as of 13:23, 2 July 2012

This page is being performed while I'm porting Finance 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.

Gtk.EventBox

EventBox has not get_colormap method anymore and this method is used to set the background color. Now, instead of this one I'm using Gdk.Color.parse to parse the color string:

ebox = gtk.EventBox()
ebox.modify_bg(gtk.STATE_NORMAL, ebox.get_colormap().alloc_color('#000000'))

replaced by:

ebox = Gtk.EventBox()
parse, color = Gdk.Color.parse('#000000')
self.helpbox.modify_bg(Gtk.StateType.NORMAL, color)


Gtk.TreeViewColumn

The callback function used by Gtk.TreeViewColumn.set_cell_data_func receives a new argument called: data

col = Gtk.TreeViewColumn(_('Description'), renderer)
col.set_cell_data_func(renderer, self.description_render_cb) 

added a new argument to the function definition:

def description_render_cb(self, column, cell_renderer, model, iter, data):

Useful links

* http://developer.gnome.org/gtk3/3.5/GtkTreeViewColumn.html#GtkTreeCellDataFunc
* http://developer.gnome.org/gdk3/stable/gdk3-Colors.html#GdkColor