Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaolo Monsalvo <pmonsalvo@gmail.com>2013-01-21 21:05:26 (GMT)
committer Paolo Monsalvo <pmonsalvo@gmail.com>2013-01-21 21:05:26 (GMT)
commitd629f7b69a1f3a79985cfc1921cd8348240e8b02 (patch)
treef97c9509571e90fed5c9153b2407c3fddd1f6121
parent4ba839d7de703f5cc0f0966ad7118dc991c01de4 (diff)
Estructura pre terminada
-rw-r--r--activity.py143
-rw-r--r--config.ini2
-rw-r--r--prueba.py9
-rwxr-xr-xsetup.py21
4 files changed, 172 insertions, 3 deletions
diff --git a/activity.py b/activity.py
new file mode 100644
index 0000000..b55e6e9
--- /dev/null
+++ b/activity.py
@@ -0,0 +1,143 @@
+# Copyright 2013 Paolo Monsalvo
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+
+
+
+import gtk
+import logging
+import gobject
+import random
+from ConfigParser import SafeConfigParser
+from subprocess import Popen
+
+
+from gettext import gettext as _
+
+from sugar.activity import activity
+from sugar.graphics.toolbarbox import ToolbarBox
+from sugar.activity.widgets import ActivityButton
+from sugar.activity.widgets import ActivityToolbox
+from sugar.activity.widgets import TitleEntry
+from sugar.activity.widgets import StopButton
+from sugar.activity.widgets import ShareButton
+
+class JugandoAprendesActivity(activity.Activity):
+ """HelloWorldActivity class as specified in activity.info"""
+
+ def __init__(self, handle):
+ """Set up the HelloWorld activity."""
+ activity.Activity.__init__(self, handle)
+
+ # toolbar with the new toolbar redesign
+ toolbar_box = ToolbarBox()
+
+ activity_button = ActivityButton(self)
+ toolbar_box.toolbar.insert(activity_button, 0)
+ activity_button.show()
+
+ 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)
+ toolbar_box.toolbar.insert(separator, -1)
+ separator.show()
+
+ stop_button = StopButton(self)
+ toolbar_box.toolbar.insert(stop_button, -1)
+ stop_button.show()
+
+ self.set_toolbar_box(toolbar_box)
+ toolbar_box.show()
+
+ self.load_data()
+ self.cargar_ui()
+
+ # label with the text, make the string translatable
+ def cargar_ui(self):
+ vbox = gtk.VBox()
+ self.set_canvas(vbox)
+ hbox = gtk.HBox()
+ label = gtk.Label()
+ self.connect('key-press-event', self.__key_press_cb)
+
+
+ vbox.add(hbox)
+
+ image=gtk.Image()
+ image.set_from_file('imagenes/Derecha.png')
+ image.show()
+ hbox.pack_start(image)
+
+ image=gtk.Image()
+ image.set_from_file('imagenes/Izquierda.png')
+ image.show()
+ hbox.pack_start(image)
+
+ image=gtk.Image()
+ image.set_from_file('imagenes/Arriba.png')
+ image.show()
+ hbox.pack_start(image)
+
+ image=gtk.Image()
+ image.set_from_file('imagenes/Abajo.png')
+ image.show()
+ hbox.pack_start(image)
+
+ vbox.show_all()
+
+ def load_data(self):
+ parser=SafeConfigParser()
+ parser.read('config.ini')
+ words= parser.get('inicio','patron')
+ self.say (words)
+
+ def patrones(self):
+ #parser=SafeConfigParser()
+ #parser.read('config.ini')
+ #words= parser.get('patron1','patron')
+ self.words=['arriba','abajo','izquierda','derecha']
+ random.shuffle(words)
+ self.say (words)
+
+
+
+ def __key_press_cb(self, window, event, label):
+ key_name = gtk.gdk.keyval_name(event.keyval)
+ if (key_name=='Up'):
+ self.say ('Arriba')
+ elif (key_name=='Down'):
+ self.say ('Abajo')
+ elif (key_name=='Left'):
+ self.say ('Izquierda')
+ elif (key_name=='Right'):
+ self.say ('Derecha')
+ elif (key_name=='space'):
+ self.patrones()
+ else:
+ self.say('Tecla incorrecta')
+
+ def say(self, text):
+ Popen(['espeak', '-v', 'es', text])
+
+
+if __name__ == "__main__":
+ my_app = MyApp()
+ gtk.main()
+
+
diff --git a/config.ini b/config.ini
index d4243ed..0500ffc 100644
--- a/config.ini
+++ b/config.ini
@@ -2,4 +2,4 @@
patron = ['Bienvenido', 'a','Jugando', 'Aprendes']
[patron1]
-patron = ['pulse','la','tecla','espacio','para''escuchar','el','patrĂ³n','sonoro']
+patron = ['arriba','abajo','izquierda','derecha']
diff --git a/prueba.py b/prueba.py
index 8a1b3e9..2a56461 100644
--- a/prueba.py
+++ b/prueba.py
@@ -22,9 +22,14 @@ class MyApp():
parser=SafeConfigParser()
parser.read('config.ini')
words= parser.get('patron1','patron')
- self.say (words)
- self.words=['arriba','abajo','izquierda','derecha']
+ #words=['arriba','abajo','izquierda','derecha']
random.shuffle(words)
+ n=0;m=10
+ for i in words:
+ self.say(i[n:m])
+ n+=1
+ m+=1
+
diff --git a/setup.py b/setup.py
new file mode 100755
index 0000000..c24196e
--- /dev/null
+++ b/setup.py
@@ -0,0 +1,21 @@
+#!/usr/bin/env python
+
+# Copyright (C) 2009, Simon Schampijer
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+
+from sugar.activity import bundlebuilder
+
+bundlebuilder.start()