Changes

no edit summary
Line 7: Line 7:  
= Port to Cairo =
 
= Port to Cairo =
   −
'''README''': before to port this activity to GTK3, we should port it to Cairo as the first step and then move to GTK3.
+
'''README''': before to port this activity to GTK3, we should port it to Cairo as the first step and then move to GTK3. Here is the [PATCH http://bugs.sugarlabs.org/attachment/ticket/3772/0001-Port-to-Cairo.2.patch]
    
== Code Snippets ==
 
== Code Snippets ==
Line 104: Line 104:     
  cr.set_source_pixbuf(self.backgroundpixbuf, 0, 0)
 
  cr.set_source_pixbuf(self.backgroundpixbuf, 0, 0)
 +
cr.rectangle(x, 0, self.backgroundpixbuf.get_width(),
 +
              self.backgroundpixbuf.get_height())
 +
cr.paint()
 +
 +
==== Gtk3 version ====
 +
 +
Gdk.cairo_set_source_pixbuf(cr, self.backgroundpixbuf, 0, 0)
 
  cr.rectangle(x, 0, self.backgroundpixbuf.get_width(),
 
  cr.rectangle(x, 0, self.backgroundpixbuf.get_width(),
 
               self.backgroundpixbuf.get_height())
 
               self.backgroundpixbuf.get_height())
Line 182: Line 189:  
  Gdk.EventType.KEY_RELEASE
 
  Gdk.EventType.KEY_RELEASE
   −
----
+
== Gdk.Keymap.translate_keyboard_state ==
    
* http://developer.gnome.org/gdk/stable/gdk-Keyboard-Handling.html#gdk-keymap-translate-keyboard-state
 
* http://developer.gnome.org/gdk/stable/gdk-Keyboard-Handling.html#gdk-keymap-translate-keyboard-state
 
* http://www.pygtk.org/docs/pygtk/class-gdkkeymap.html#method-gdkkeymap--translate-keyboard-state
 
* http://www.pygtk.org/docs/pygtk/class-gdkkeymap.html#method-gdkkeymap--translate-keyboard-state
   −
----
+
Old way:
   −
  -   def expose_cb(self, area, event):
+
  t = self.keymap.translate_keyboard_state(key['key-scan'], self.active_state, self.active_group)
-        self.draw()
+
 
  +    def draw_cb(self, area, cr):
+
New way:
+        self.draw(cr)
+
 
 +
success, keyval, effective_group, level, consumed_modifiers = self.keymap.translate_keyboard_state(key['key-scan'], self.active_state, self.active_group)
 +
 
 +
 
 +
== 'expose-event' & 'draw' event ==
 +
 
 +
The new ''draw'' event that refers to the old ''expose-event'' into a Gtk.DrawingArea now receive the widget and the context instead the widget and the event:
 +
 
 +
''expose-event''
 +
 
 +
def expose_cb(self, area, event):
 +
    self.draw()
 +
 
 +
''draw'' event
 +
 
 +
  def draw_cb(self, area, cr):
 +
    self.draw(cr)
    
= Notes =
 
= Notes =
Line 205: Line 228:  
* [<span style="color: green;">SOLVED</span>] <del>This method, ''set_source_pixbuf'', is not available.</del>
 
* [<span style="color: green;">SOLVED</span>] <del>This method, ''set_source_pixbuf'', is not available.</del>
   −
cr = self.get_window().cairo_create()
+
* [<span style="color: green;">SOLVED</span>] <del>We should find the correct way to scale Left and Right hands that are drawn over the keyboard, because I just put values that I thought they were correct. We should calculate them according to the screen</del>
# README: http://developer.gnome.org/gdk/stable/gdk-Cairo-Interaction.html#gdk-cairo-set-source-pixbuf
  −
# Although this methos is not available in Python
  −
cr.set_source_pixbuf(self.backgroundpixbuf, 0, 0)
  −
 
  −
Gdk.cairo_set_source_pixbuf(cr, self.backgroundpixbuf, 0, 0)
  −
 
  −
* We should find the correct way to scale Left and Right hands that are drawn over the keyboard, because I just put values that I thought they were correct. We should calculate them according to the screen
     −
* PangoCairo fonts are not being drawn because of this: https://bugzilla.gnome.org/show_bug.cgi?id=680680
+
* [<span style="color: green;">SOLVED</span>] <del>PangoCairo fonts are not being drawn because of this: https://bugzilla.gnome.org/show_bug.cgi?id=680680</del>
   −
* Font Scale is wrong: https://bugzilla.gnome.org/show_bug.cgi?id=680663
+
* [<span style="color: green;">SOLVED</span>] <del>Font Scale is wrong: https://bugzilla.gnome.org/show_bug.cgi?id=680663</del>
    
= Useful links =
 
= Useful links =
266

edits