diff options
author | Miguel Ruiz Diaz Genez <mgnezzeneo@gmail.com> | 2013-01-23 16:44:59 (GMT) |
---|---|---|
committer | Miguel Ruiz Diaz Genez <mgnezzeneo@gmail.com> | 2013-01-23 16:44:59 (GMT) |
commit | 766f62ee648c0a6c9582cf2b3ab8d0e9de31add1 (patch) | |
tree | 03265a9ef61cd354fc20fd0a7af4059009558928 | |
parent | 50cd2038b4cdf62331175a78e112c366e6b6603e (diff) |
Expresar.py
-rw-r--r-- | SugarActivity/Expresar.py | 58 |
1 files changed, 53 insertions, 5 deletions
diff --git a/SugarActivity/Expresar.py b/SugarActivity/Expresar.py index 98bf6be..290ee0d 100644 --- a/SugarActivity/Expresar.py +++ b/SugarActivity/Expresar.py @@ -2,6 +2,8 @@ # Actividad que permite a los usuarios con problemas motrices expresarse a traves de un teclado conceptual import gtk +import pygtk +import gobject import logging from gettext import gettext as _ @@ -14,6 +16,8 @@ from sugar.activity.widgets import TitleEntry from sugar.activity.widgets import StopButton from sugar.activity.widgets import ShareButton +DELAY = 1000 + class Expresar(activity.Activity): """Expresar class as specified in activity.info""" @@ -32,7 +36,7 @@ class Expresar(activity.Activity): title_entry = TitleEntry(self) toolbar_box.toolbar.insert(title_entry, -1) title_entry.show() - + separator = gtk.SeparatorToolItem() separator.props.draw = False separator.set_expand(True) @@ -46,7 +50,51 @@ class Expresar(activity.Activity): self.set_toolbar_box(toolbar_box) toolbar_box.show() - # label with the text, make the string translatable - #label = gtk.Label(_("Hello World!")) - #self.set_canvas(label) - #label.show() + + table = gtk.Table(4, 4) + self.set_canvas(table) + self.create_interior(table) + table.show() + + self._button_index = 0 + gobject.timeout_add(DELAY, self.__timeout_cb, table) + + def create_interior(self, table): + self.set_canvas(table) + uno = gtk.Button( "UNO") + dos = gtk.Button( "DOS") + tres = gtk.Button( "TRES") + cuatro = gtk.Button( "CUATRO") + #self.table.attach(child, left_attach, right_attach, top_attach, bottom_attach) + table.attach( uno, 0, 1, 0, 1) + uno.show() + table.attach( dos, 0, 1, 1, 2) + dos.show() + table.attach( tres, 0, 1, 2, 3) + tres.show() + table.attach( cuatro, 0, 1, 3, 4) + cuatro.show() + + a = gtk.Button("A") + table.attach(a, 1, 2, 1, 2) + a.show() + b = gtk.Button("B") + table.attach(b, 2, 3, 1, 2) + b.show() + c = gtk.Button("C") + table.attach(c, 3, 4, 1, 2) + c.show() + # show the table + table.show() + + def __timeout_cb(self, table): + + buttonsV = table.get_children() + print buttonsV[1].get_label() + self._button_index = (self._button_index + 1) % len(buttonsV) + + button = buttonsV[self._button_index] + button.grab_focus() + + return True + |