Features/GTK3/Porting/Implode: Difference between revisions

Humitos (talk | contribs)
New signals
Humitos (talk | contribs)
No edit summary
Line 35: Line 35:
     self.height = rect.height
     self.height = rect.height


= Focus =
== Focus ==


Replace:
Implode defines a new widget called ''GridWidget'' and it should be focusable because we want to move a cursor with the key arrows on it. So, this widget was using:


  self.set_flags(Gtk.CAN_FOCUS)
  self.set_flags(Gtk.CAN_FOCUS)


by
but that method (''set_flags'') is no longer available and we have to replace it by:


  self.set_can_focus(True)
  self.set_can_focus(True)


----
Another thing related with the focus is to know who has the actual focus. In gtk2 it was done by
 
.focus_child
 
and in Gtk3 it should be replaced by:
 
.get_focus_child()
 
 
= Handling .svg with rsvg =
 
'''rsvg''' is a library to manage ''.svg'' files. The only thing that I found that should be updated is the import and the loading of a rsvg from data.
 
Replace the usual import:


  import rsgv
  import rsgv
by the Gtk3 one:


  from gi.repository import Rsvg
  from gi.repository import Rsvg
This way to load a rsvg from data should be replaced:


  rsvg.Handle(data=data)
  rsvg.Handle(data=data)
by this new way


  Rsvg.Handle.new_from_data(data)
  Rsvg.Handle.new_from_data(data)


----
.focus_child
.get_focus_child()
'size-allocation' signal to save the size of the widget


= gtk signals =
= Useful Links =


* "draw" / "expose" / "size-"
* http://developer.gnome.org/rsvg/stable/