Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/CalculArte.activity/activity.py
diff options
context:
space:
mode:
Diffstat (limited to 'CalculArte.activity/activity.py')
-rw-r--r--CalculArte.activity/activity.py57
1 files changed, 19 insertions, 38 deletions
diff --git a/CalculArte.activity/activity.py b/CalculArte.activity/activity.py
index 85436e2..87fd14d 100644
--- a/CalculArte.activity/activity.py
+++ b/CalculArte.activity/activity.py
@@ -14,7 +14,7 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-"""HelloWorld Activity: A case study for developing an activity."""
+"""CalculArteActivity: Calculadora que realiza operaciones basicas disenhada para personas con problemas de motricidad fisica."""
import gtk
import gobject
@@ -40,10 +40,10 @@ DELAY = 1000
class CalculArteActivity(activity.Activity):
- """HelloWorldActivity class as specified in activity.info"""
+ """CalculArteActivity class as specified in activity.info"""
def __init__(self, handle):
- """Set up the HelloWorld activity."""
+ """Set up the CalculArte activity."""
activity.Activity.__init__(self, handle)
# we do not have collaboration features
@@ -77,33 +77,24 @@ class CalculArteActivity(activity.Activity):
self.set_toolbar_box(toolbar_box)
toolbar_box.show()
-
- # label with the text, make the string translatable
-
+
vbox = gtk.VBox()
hbox = gtk.HBox(True)
self.label_historial = gtk.Label()
self.label_historial.set_line_wrap(True)
self.entry_visor = gtk.Entry()
- table = gtk.Table(5,5, True)
+ self.table = gtk.Table(5,5, True)
boton = gtk.Button('boton falso')
- #window.connect('destroy', self.destroy)
-
self.label_historial.set_text('Ultimo resultado:')
- #label_historial.justify()
-
-
- #window.add(hbox)
self.set_canvas(hbox)
hbox.add(vbox)
hbox.add(self.label_historial)
vbox.add(self.entry_visor)
- vbox.add(table)
+ vbox.add(self.table)
vbox.add(boton)
OPTIONS.reverse()
for j in range(4):
-
for i in range(OPT_LENGHT):
button = gtk.Button()
option = OPTIONS.pop()
@@ -113,26 +104,24 @@ class CalculArteActivity(activity.Activity):
#canvas = self.get_canvas()
#canvas.connect('key-press-event', self.__barrido_columnas_cb)
if option == 'Aceptar':
- table.attach(button, i, i+3, j, j+1)
+ self.table.attach(button, i, i+3, j, j+1)
break
else:
- table.attach(button, i, i+1, j, j+1)
-
+ self.table.attach(button, i, i+1, j, j+1)
hbox.show_all()
boton.hide()
-
- #window.grab_focus()
-
- #table.set_focus()
+
OPTIONS.reverse()
self._filas_index = 0
self._columnas_index = 0
self._flag_fila_columna = 0
- gobject.timeout_add(DELAY, self.__timeout_cb, table)
+ gobject.timeout_add(DELAY, self.__timeout_cb, self.table)
def __button_cb(self, button, entry, boton, label):
+ """ Callback que maneja el evento activate """
+
if (button.get_label() == 'Aceptar'):
try:
@@ -160,10 +149,8 @@ class CalculArteActivity(activity.Activity):
def __timeout_cb(self, table):
- #self._button_index = (self._button_index + 1) % OPT_LENGHT
- #buttons = hbox.get_children()
- #button = buttons[self._button_index]
- #button.grab_focus()
+ """ Callback que realiza el barrido automatico"""
+
if self._flag_fila_columna == 0:
self._filas_index = (self._filas_index) % OPT_FILAS
buttons = table.get_children()
@@ -190,29 +177,25 @@ class CalculArteActivity(activity.Activity):
button.grab_focus()
self._columnas_index += 1
-
- #buttons = table.get(row = self._filas_index)
-
-
+
return True
def __barrido_columnas_cb(self, table, arg):
+ """ Callback para cambiar valor del flag que verifica si corresponde a una fila o columna"""
self._flag_fila_columna = 1
def read_file(self, tmp_file):
- """ datastore high-level interaction to read
- logging.debug("The tmp_file is at %s, for reading", tmp_file)"""
# resume metadata
try:
self.label_historial.set_label(self.metadata['entry'])
- self._filas_index = int(self.metadata['fila'])
+ self._filas_index = int(self.metadata['fila'])
self._columnas_index = int(self.metadata['columna'])
self._flag_fila_columna = int(self.metadata['flag'])
- buttons = table.get_children()
+ buttons = self.table.get_children()
buttons.reverse()
- buttons_focus = buttons[self._filas_index*OPT_LENGHT:self._filas_index*OPT_LENGHT+OPT_LENGHT]
+ buttons_focus = buttons[(self._filas_index-1)*OPT_LENGHT:(self._filas_index-1)*OPT_LENGHT+OPT_LENGHT]
for button in buttons:
button.modify_bg(gtk.STATE_NORMAL, gtk.gdk.Color('dark gray'))
for button in buttons_focus:
@@ -227,8 +210,6 @@ class CalculArteActivity(activity.Activity):
data.close()
def write_file(self, tmp_file):
- """ datastore high-level interaction to write
- logging.debug("The tmp_file is at %s, for writing", tmp_file)"""
# save metadata
self.metadata['entry'] = self.label_historial.get_label()