Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEsteban Arias <earias@plan.ceibal.edu.uy>2010-09-20 18:16:24 (GMT)
committer Esteban Arias <earias@plan.ceibal.edu.uy>2010-09-20 18:16:24 (GMT)
commit07341d2801bb138c53b6465a5492a80621d7073d (patch)
tree146c3acacf7b098401024acc9cb45e97542ce5d0
first commit
-rw-r--r--PrestametuVoz.activity/MANIFEST26
-rwxr-xr-xPrestametuVoz.activity/NEWS1
-rwxr-xr-xPrestametuVoz.activity/activity/activity.info9
-rwxr-xr-xPrestametuVoz.activity/activity/prestame-tu-icon.svg21
-rwxr-xr-xPrestametuVoz.activity/color.py71
-rwxr-xr-xPrestametuVoz.activity/color.pycbin0 -> 2380 bytes
-rw-r--r--PrestametuVoz.activity/config_nuevo.py180
-rw-r--r--PrestametuVoz.activity/config_nuevo.pycbin0 -> 5210 bytes
-rw-r--r--PrestametuVoz.activity/demos/fede2.zipbin0 -> 666488 bytes
-rw-r--r--PrestametuVoz.activity/funciones.py72
-rw-r--r--PrestametuVoz.activity/funciones.pycbin0 -> 1480 bytes
-rw-r--r--PrestametuVoz.activity/grid.py279
-rw-r--r--PrestametuVoz.activity/grid.pycbin0 -> 7964 bytes
-rw-r--r--PrestametuVoz.activity/icons/game-load.svg166
-rw-r--r--PrestametuVoz.activity/icons/game-new.svg129
-rw-r--r--PrestametuVoz.activity/icons/game-save.svg164
-rwxr-xr-xPrestametuVoz.activity/icons/media-audio.svg10
-rwxr-xr-xPrestametuVoz.activity/icons/media-photo.svg12
-rwxr-xr-xPrestametuVoz.activity/icons/media-record-red.pngbin0 -> 467 bytes
-rwxr-xr-xPrestametuVoz.activity/icons/media-record.pngbin0 -> 426 bytes
-rwxr-xr-xPrestametuVoz.activity/icons/media-video.svg11
-rwxr-xr-xPrestametuVoz.activity/icons/sin_foto.pngbin0 -> 4753 bytes
-rwxr-xr-xPrestametuVoz.activity/instance.py48
-rwxr-xr-xPrestametuVoz.activity/instance.pycbin0 -> 1987 bytes
-rwxr-xr-xPrestametuVoz.activity/manejar_datos.py98
-rwxr-xr-xPrestametuVoz.activity/manejar_datos.pycbin0 -> 2908 bytes
-rwxr-xr-xPrestametuVoz.activity/planillas/planillas.txt1
-rwxr-xr-xPrestametuVoz.activity/prestame_tu_voz.py88
-rwxr-xr-xPrestametuVoz.activity/prestame_tu_voz.pycbin0 -> 2252 bytes
-rw-r--r--PrestametuVoz.activity/settings.py11
-rw-r--r--PrestametuVoz.activity/settings.pycbin0 -> 529 bytes
-rwxr-xr-xPrestametuVoz.activity/setup.py4
-rw-r--r--PrestametuVoz.activity/sonido.py42
-rw-r--r--PrestametuVoz.activity/sonido.pycbin0 -> 1444 bytes
-rwxr-xr-xPrestametuVoz.activity/tarjeta.py54
-rwxr-xr-xPrestametuVoz.activity/tarjeta.pycbin0 -> 1938 bytes
-rwxr-xr-xPrestametuVoz.activity/toolbar.py74
-rwxr-xr-xPrestametuVoz.activity/toolbar.pycbin0 -> 2767 bytes
38 files changed, 1571 insertions, 0 deletions
diff --git a/PrestametuVoz.activity/MANIFEST b/PrestametuVoz.activity/MANIFEST
new file mode 100644
index 0000000..3a9e5b8
--- /dev/null
+++ b/PrestametuVoz.activity/MANIFEST
@@ -0,0 +1,26 @@
+toolbar.py
+prestame_tu_voz.py
+funciones.py
+NEWS
+sonido.py
+setup.py
+settings.py
+manejar_datos.py
+color.py
+tarjeta.py
+config_nuevo.py
+grid.py
+instance.py
+activity/activity.info
+activity/prestame-tu-icon.svg
+icons/media-audio.svg
+icons/media-record-red.png
+icons/media-photo.svg
+icons/game-save.svg
+icons/media-video.svg
+icons/game-new.svg
+icons/game-load.svg
+icons/media-record.png
+icons/sin_foto.png
+demos/fede2.zip
+planillas/planillas.txt
diff --git a/PrestametuVoz.activity/NEWS b/PrestametuVoz.activity/NEWS
new file mode 100755
index 0000000..047ccd0
--- /dev/null
+++ b/PrestametuVoz.activity/NEWS
@@ -0,0 +1 @@
+No news. \ No newline at end of file
diff --git a/PrestametuVoz.activity/activity/activity.info b/PrestametuVoz.activity/activity/activity.info
new file mode 100755
index 0000000..cf7588d
--- /dev/null
+++ b/PrestametuVoz.activity/activity/activity.info
@@ -0,0 +1,9 @@
+[Activity]
+name = Prestame tu Voz
+bundle_id = org.laptop.PrestameTuVoz
+service_name = org.laptop.PrestameTuVoz
+class = prestame_tu_voz.PrestameTuVozActivity
+icon = prestame-tu-icon
+activity_version = 6
+mime_types =
+show_launcher = yes
diff --git a/PrestametuVoz.activity/activity/prestame-tu-icon.svg b/PrestametuVoz.activity/activity/prestame-tu-icon.svg
new file mode 100755
index 0000000..83df075
--- /dev/null
+++ b/PrestametuVoz.activity/activity/prestame-tu-icon.svg
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 13.0.1, SVG Export Plug-In . SVG Version: 6.00 Build 14948) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd" [
+ <!ENTITY ns_svg "http://www.w3.org/2000/svg">
+ <!ENTITY ns_xlink "http://www.w3.org/1999/xlink">
+ <!ENTITY stroke_color "#000000">
+ <!ENTITY fill_color "#FFFFFF">
+]><!--"-->
+<svg version="1.1" id="Pippy_activity" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px"
+ y="0px" width="47.585px" height="49.326px" viewBox="0 0 47.585 49.326" enable-background="new 0 0 47.585 49.326"
+ xml:space="preserve">
+
+<path fill="&fill_color;" stroke="&stroke_color;" stroke-width="3.5" d="M26.042,34.293c0,1.108-0.904,2.011-2.021,2.011H5.828
+ c-1.117,0-2.021-0.902-2.021-2.011V18.222c0-1.11,0.905-2.009,2.021-2.009h18.192c1.117,0,2.021,0.9,2.021,2.009V34.293z"/>
+<ellipse fill="&fill_color;" stroke="&stroke_color;" stroke-width="3.5" cx="17.369" cy="24.489" rx="1.38" ry="1.839"/>
+<line fill="none" stroke="&stroke_color;" stroke-width="3.5" x1="17.14" y1="35.165" x2="17.14" y2="28.526"/>
+<line fill="none" stroke="&stroke_color;" stroke-width="2" x1="16.853" y1="30.955" x2="9.611" y2="24.001"/>
+<line fill="none" stroke="&stroke_color;" stroke-width="2" x1="24.972" y1="33.751" x2="18.19" y2="29.293"/>
+<path fill="none" stroke="&stroke_color;" stroke-width="3.5" d="M36.462,5.355c11.151,10.963,11.303,28.858,0.341,40.009"/>
+<path fill="none" stroke="&stroke_color;" stroke-width="3.5" d="M30.811,11.104c7.975,7.839,8.084,20.636,0.244,28.611"/>
+</svg>
diff --git a/PrestametuVoz.activity/color.py b/PrestametuVoz.activity/color.py
new file mode 100755
index 0000000..f544405
--- /dev/null
+++ b/PrestametuVoz.activity/color.py
@@ -0,0 +1,71 @@
+#Copyright (c) 2008, Media Modifications Ltd.
+
+#Permission is hereby granted, free of charge, to any person obtaining a copy
+#of this software and associated documentation files (the "Software"), to deal
+#in the Software without restriction, including without limitation the rights
+#to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+#copies of the Software, and to permit persons to whom the Software is
+#furnished to do so, subject to the following conditions:
+
+#The above copyright notice and this permission notice shall be included in
+#all copies or substantial portions of the Software.
+
+#THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+#IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+#FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+#AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+#LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+#OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+#THE SOFTWARE.
+
+import gtk
+
+class Color:
+
+ def __init__(self):
+ pass
+
+
+ def init_rgba(self, r, g, b, a):
+ self._ro = r
+ self._go = g
+ self._bo = b
+ self._ao = a;
+ self._r = self._ro / 255.0
+ self._g = self._go / 255.0
+ self._b = self._bo / 255.0
+ self._a = self._ao / 255.0
+
+ self._opaque = False
+ if (self._a == 1):
+ self.opaque = True
+
+ rgb_tup = ( self._ro, self._go, self._bo )
+ self.hex = self.rgb_to_hex( rgb_tup )
+ self.gColor = gtk.gdk.color_parse( self.hex )
+
+
+ def init_gdk(self, col):
+ self.init_hex( col.get_html() )
+
+
+ def init_hex(self, hex):
+ cTup = self.hex_to_rgb( hex )
+ self.init_rgba( cTup[0], cTup[1], cTup[2], 255 )
+
+
+ def get_int(self):
+ return int(self._a * 255) + (int(self._b * 255) << 8) + (int(self._g * 255) << 16) + (int(self._r * 255) << 24)
+
+
+ def rgb_to_hex(self, rgb_tup):
+ hexcolor = '#%02x%02x%02x' % rgb_tup
+ return hexcolor
+
+
+ def hex_to_rgb(self, h):
+ c = eval('0x' + h[1:])
+ r = (c >> 16) & 0xFF
+ g = (c >> 8) & 0xFF
+ b = c & 0xFF
+ return (int(r), int(g), int(b)) \ No newline at end of file
diff --git a/PrestametuVoz.activity/color.pyc b/PrestametuVoz.activity/color.pyc
new file mode 100755
index 0000000..a49aa17
--- /dev/null
+++ b/PrestametuVoz.activity/color.pyc
Binary files differ
diff --git a/PrestametuVoz.activity/config_nuevo.py b/PrestametuVoz.activity/config_nuevo.py
new file mode 100644
index 0000000..2db7413
--- /dev/null
+++ b/PrestametuVoz.activity/config_nuevo.py
@@ -0,0 +1,180 @@
+#!/usr/bin/python
+# -*- coding: iso-8859-15 -*-
+''' Config de Prestame tu voz '''
+
+#Copyright (C) 2009 Federico Moreira - <federico@piensalibre.info>
+# Alejandro Esperón - <ratman26@gmail.com>
+#Copyright (C) 2010 Plan Ceibal <comunidad@plan.ceibal.edu.uy>
+# Esteban Arias - <earias@plan.ceibal.edu.uy>
+#
+# 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 3 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, see <http://www.gnu.org/licenses/>
+
+
+import gtk
+import os
+
+import settings
+from manejar_datos import cargar_datos, cargar_planillas
+
+
+class VentanaConfig(gtk.Table):
+
+ def __init__(self):
+
+ self.lista_tarjetas = []
+
+ self.pos_actual = 0
+
+ self.posicion = gtk.Label('1/' + str(settings.TABLA_ANCHO * settings.TABLA_ALTO))
+ etiqueta_titulo = gtk.Label('Titulo : ')
+ self.titulo = gtk.Entry(30)
+ self.imagen = gtk.Image()
+ self.boton_imagen = gtk.FileChooserButton('Agregar imagen')
+ etiqueta_sonido = gtk.Label('Sonido : ')
+ self.boton_sonido = gtk.FileChooserButton('Agregar sonido')
+ boton_ingresar = gtk.Button('Ingresar Sig')
+
+ gtk.Table.__init__(self, 5, 1)
+
+ self.attach(self.posicion,0,1,0,1)
+
+ etiqueta_titulo.show()
+ self.titulo.show()
+ self.titulo.set_width_chars(10)
+
+ caja_titulo = gtk.HBox()
+ caja_titulo.pack_start(etiqueta_titulo)
+ caja_titulo.pack_start(self.titulo)
+
+ self.attach(caja_titulo,0,1,1,2)
+ self.imagen.show()
+ self.imagen.set_size_request(500, 500)
+ self.imagen.set_from_file(os.path.join(os.getcwd(),'icons','sin_foto.png'))
+
+ self.boton_imagen.show()
+
+ caja_imagen = gtk.VBox()
+ caja_imagen.pack_start(self.imagen)
+ caja_imagen.pack_start(self.boton_imagen)
+ self.attach(caja_imagen,0,1,2,3)
+
+ etiqueta_sonido.show()
+ self.boton_sonido.show()
+ caja_sonido = gtk.HBox()
+ caja_sonido.pack_start(etiqueta_sonido)
+ caja_sonido.pack_start(self.boton_sonido)
+ self.attach(caja_sonido,0,1,3,4)
+
+ boton_ingresar.show()
+ boton_ingresar.connect("clicked", self.ingresar_siguiente, "siguiente")
+ self.attach(boton_ingresar,0,1,4,5)
+
+ self.cargar_demo()
+
+ def cargar_tarjeta(self,lista_tarjetas):
+ print len(lista_tarjetas)
+ self.lista_tarjetas = lista_tarjetas
+ self.titulo.set_text(self.lista_tarjetas[self.pos_actual].titulo)
+ self.imagen.clear()
+ self.imagen.set_from_file(os.path.join(os.getcwd(), \
+ self.lista_tarjetas[self.pos_actual].imagen))
+ self.actualizar_ventana()
+
+
+ def ingresar_siguiente(self, widget, info):
+ self.pos_actual += 1
+ if self.pos_actual > (len(self.lista_tarjetas) - 1):
+ self.pos_actual = 0
+ self.titulo.set_text(self.lista_tarjetas[self.pos_actual].titulo)
+ self.posicion.set_label(str(self.pos_actual + 1) + '/'+ str(settings.TABLA_ANCHO * settings.TABLA_ALTO))
+ self.actualizar_ventana()
+
+ def actualizar_ventana(self):
+ self.imagen.clear()
+ self.imagen.set_from_file(self.lista_tarjetas[self.pos_actual].imagen)
+ self.boton_imagen.set_filename(self.lista_tarjetas[self.pos_actual].imagen)
+ self.boton_sonido.set_filename(self.lista_tarjetas[self.pos_actual].audio)
+
+ def guardar(self, archivo):
+ ''' Guarda un archivo '''
+ if archivo == '':
+ print "fideo"
+ selector = gtk.FileChooserDialog(title=None,
+ action=gtk.FILE_CHOOSER_ACTION_SAVE,
+ buttons=(gtk.STOCK_CANCEL,
+ gtk.RESPONSE_CANCEL,
+ gtk.STOCK_OPEN,
+ gtk.RESPONSE_OK))
+ selector.set_current_folder(os.getcwd())
+ respuesta = selector.run()
+ if respuesta == gtk.RESPONSE_OK:
+ self.crear_tarjetas(selector.get_filename())
+ selector.destroy()
+ else:
+ self.crear_tarjetas(archivo)
+
+
+ def crear_tarjetas(self, nombre_archivo):
+ ''' Creo las tarjetas '''
+ #guardar_datos(nombre_archivo, self.lista_de_tarjetas)
+ print nombre_archivo
+
+ def abrir(self, widget, info):
+ ''' Permite abrir un archivo '''
+ largo_home = len(os.environ["HOME"]) + 1
+ selector = gtk.FileChooserDialog(title=None,
+ action=gtk.FILE_CHOOSER_ACTION_OPEN,
+ buttons=(gtk.STOCK_CANCEL,
+ gtk.RESPONSE_CANCEL,
+ gtk.STOCK_OPEN,
+ gtk.RESPONSE_OK))
+ selector.set_current_folder(os.getcwd())
+ selector.set_default_response(gtk.RESPONSE_OK)
+ respuesta = selector.run()
+ if respuesta == gtk.RESPONSE_OK:
+ self.datos = cargar_datos(selector.get_filename())
+ self.archivo = selector.get_filename()
+ selector.destroy()
+ self.ventana.cargar_tarjeta(self.datos)
+
+ def guardar(self, widget, info):
+ '''Permite guardar '''
+ self.ventana.guardar(self.archivo)
+
+ def cargar_demo(self):
+ self.lista_tarjetas = cargar_datos('fede2')
+ self.actualizar_ventana()
+
+
+#config = gtk.Window(gtk.WINDOW_TOPLEVEL)
+#config.set_title('Prestame tu voz')
+#ventana = VentanaConfig()
+##control = ControlConfig(ventana)
+#
+#caja_principal = gtk.VBox()
+##caja_principal.pack_start(control)
+#caja_principal.pack_start(ventana)
+#caja_principal.show()
+#
+#config.add(caja_principal)
+#ventana.show_all()
+##control.show_all()
+#
+#config.set_default_size(300,300)
+#config.show()
+#config.connect("delete_event", gtk.main_quit)
+#gtk.main()
+
+
+
diff --git a/PrestametuVoz.activity/config_nuevo.pyc b/PrestametuVoz.activity/config_nuevo.pyc
new file mode 100644
index 0000000..d11d987
--- /dev/null
+++ b/PrestametuVoz.activity/config_nuevo.pyc
Binary files differ
diff --git a/PrestametuVoz.activity/demos/fede2.zip b/PrestametuVoz.activity/demos/fede2.zip
new file mode 100644
index 0000000..7597714
--- /dev/null
+++ b/PrestametuVoz.activity/demos/fede2.zip
Binary files differ
diff --git a/PrestametuVoz.activity/funciones.py b/PrestametuVoz.activity/funciones.py
new file mode 100644
index 0000000..8460938
--- /dev/null
+++ b/PrestametuVoz.activity/funciones.py
@@ -0,0 +1,72 @@
+#!/usr/bin/python
+# -*- coding: UTF-8 -*-
+'''Prestame Tu Voz'''
+
+#Copyright (C) 2009 Federico Moreira - <federico@piensalibre.info>
+# Alejandro Esperón - <ratman26@gmail.com>
+#
+# 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 3 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, see <http://www.gnu.org/licenses/>
+
+import gtk
+import os
+#import Image
+import settings
+
+def pintar_filas(button_list, num_fila):
+ ''' Pinta las filas de color rojo '''
+ color_rojo = gtk.gdk.color_parse('#ff0000')
+ color_blanco = gtk.gdk.color_parse('#ffffff')
+
+ for count in range(settings.TABLA_ALTO * settings.TABLA_ANCHO):
+ if (count >= num_fila and count<(num_fila+settings.TABLA_ANCHO)):
+ button_list[count].modify_bg(gtk.STATE_NORMAL, color_rojo)
+ else:
+ button_list[count].modify_bg(gtk.STATE_NORMAL, color_blanco)
+
+ num_fila += settings.TABLA_ANCHO
+ if num_fila >= (settings.TABLA_ANCHO * settings.TABLA_ALTO):
+ num_fila = 0
+
+
+
+ button_list[num_fila].grab_focus()
+ return num_fila
+
+def pintar_columnas(button_list, num_fila, num_columna):
+ ''' Pinta las columnas de violeta '''
+ colorblanco = gtk.gdk.color_parse('#ffffff')
+ colorrojo = gtk.gdk.color_parse('#ff0000')
+
+ button_list[num_columna].modify_bg(gtk.STATE_NORMAL, colorblanco)
+ num_columna = num_columna + 1
+
+ #print num_fila
+ if num_columna > (num_fila + (settings.TABLA_ANCHO-1)):
+ num_columna = num_fila
+
+ for i in range(num_fila, num_fila + (settings.TABLA_ANCHO)):
+ if i == num_columna:
+ button_list[i].modify_bg(gtk.STATE_NORMAL, colorrojo)
+ button_list[i].grab_focus()
+ else:
+ button_list[i].modify_bg(gtk.STATE_NORMAL, colorblanco)
+
+ return num_columna
+
+#def redim_imagen(img, alto, ancho):
+ ''' Redimensiona las imágenes '''
+# imagen = Image.open(os.path.join(os.getcwd(), 'imagenes', img))
+# imagen.thumbnail((alto, ancho), Image.ANTIALIAS)
+# imagen.save(os.path.join(os.getcwd(), img + '0.png'))
+
diff --git a/PrestametuVoz.activity/funciones.pyc b/PrestametuVoz.activity/funciones.pyc
new file mode 100644
index 0000000..33e079c
--- /dev/null
+++ b/PrestametuVoz.activity/funciones.pyc
Binary files differ
diff --git a/PrestametuVoz.activity/grid.py b/PrestametuVoz.activity/grid.py
new file mode 100644
index 0000000..46c1c70
--- /dev/null
+++ b/PrestametuVoz.activity/grid.py
@@ -0,0 +1,279 @@
+#!/usr/bin/python
+# -*- coding: iso-8859-15 -*-
+''' Ventana Principal de Prestame tu voz '''
+
+#Copyright (C) 2009 Federico Moreira - <federico@piensalibre.info>
+# Alejandro Esperón - <ratman26@gmail.com>
+# Esteban Arias - <earias@plan.ceibal.edu.uy>
+#
+# 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 3 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, see <http://www.gnu.org/licenses/>
+
+import gtk
+import os, gobject
+import subprocess
+
+import threading
+
+import settings
+
+from manejar_datos import cargar_datos, cargar_planillas
+from sonido import reproducir
+from funciones import pintar_filas, pintar_columnas
+
+class VentanaPrincipal(gtk.Table):
+ ''' Clase principal que dibuja la ventana, maneja controles
+ y carga los archivos de imagenes '''
+
+ TITLE_FONT_DESC = "sans bold 10"
+ def __init__(self):
+
+ # Creamos los botones y sus labels correspondientes
+ self.lista_botones = [gtk.Button() for dummy in xrange(1, (settings.TABLA_ANCHO * settings.TABLA_ALTO) + 1)]
+ self.lista_titulos = [gtk.Label() for dummy in xrange(1, (settings.TABLA_ANCHO * settings.TABLA_ALTO) + 1)]
+
+
+ # Cargo las planillas disponibles
+ #self.planillas = cargar_planillas(os.path.join('planillas',
+ # 'planillas.txt'))
+
+ self.num_fila = 0
+ self.num_columna = 0
+
+ #Tiempo de barrido
+ self.tiempo_repeticion = 2000
+
+ self.seleccione_fila = -1
+ self.handle_barrido_horizontal = 0
+ self.handle_barrido_vertical = 0
+
+ self.handle_check_process = 0
+
+ self.process_id = None
+
+ self.hilo = None
+
+ # Leo las tarjetas creadas
+ #self.lista_tarjetas = cargar_datos(self.planillas[0].replace("\n", ""))
+
+ #carga demo por defecto
+ self.lista_tarjetas = cargar_datos('fede2')
+
+ contador = 0
+
+ import pango
+
+ # Creo la tabla con un tamaño específico
+ gtk.Table.__init__(self, settings.TABLA_ANCHO, settings.TABLA_ALTO)
+
+ self.flag = True
+
+ # Por cada item cargo la fila correspondiente
+ for item in range(settings.TABLA_ALTO):
+ for pos in range(settings.TABLA_ANCHO):
+
+ print self.lista_tarjetas[contador].audio
+ # Agrego la label y la muestro
+ #self.lista_titulos[contador].set_label(self.lista_tarjetas[contador].titulo)
+ self.lista_titulos[contador].set_text(self.lista_tarjetas[contador].titulo)
+ self.lista_titulos[contador].modify_font(pango.FontDescription(self.TITLE_FONT_DESC))
+
+ self.lista_titulos[contador].show()
+
+ #Tamaño
+ self.lista_botones[contador].set_size_request(settings.BUTTON_SIZE, settings.BUTTON_SIZE)
+
+ # Agrego el botón y lo muestro
+ self.lista_botones[contador].show()
+
+ # Creo una caja para almacenar los titulos y la muestro
+ caja = gtk.VBox()
+ caja.show()
+ caja.pack_start(self.lista_titulos[contador])
+
+
+ # Cargo las imágenes en los botones
+ imagen = gtk.Image()
+ imagen.set_from_file(self.lista_tarjetas[contador].imagen)
+
+ self.lista_botones[contador].set_image(imagen)
+ # Conecto el evento de click, y asigno el método a reproducir audio
+ self.lista_botones[contador].connect("clicked",
+ self.pulso_boton,
+ self.lista_tarjetas[contador].audio,
+ self.lista_tarjetas[contador])
+
+ caja.pack_start(self.lista_botones[contador])
+
+ self.attach(caja, pos, pos + 1, item, item + 1, gtk.EXPAND, gtk.EXPAND)
+
+ contador += 1
+
+ # Comienzo con el barrido horizontal
+ self.barrido_horizontal()
+
+
+ def barrido_horizontal(self):
+ '''Barrido horizontal de la ventana '''
+ self.num_columna = self.num_fila
+ self.num_fila = pintar_filas(self.lista_botones, self.num_fila)
+ self.handle_barrido_horizontal = gobject.timeout_add(self.tiempo_repeticion,
+ self.barrido_horizontal)
+ def pulso_boton(self, dummy_widget, info,btn):
+ chat = get_chat_box()
+ ''' Método general que es usado al presionar algun boton '''
+ if self.seleccione_fila == -1 :
+ gobject.source_remove(self.handle_barrido_horizontal)
+ self.seleccione_fila = self.num_fila - settings.TABLA_ANCHO
+ self.barrido_vertical()
+ else:
+ if self.flag:
+ if self.lista_tarjetas[self.num_columna].titulo != 'REPRODUCIR':
+ gobject.source_remove(self.handle_barrido_vertical)
+ self.hilo = threading.Thread(target=self.ejecutar_sonido, args=(self.lista_tarjetas[self.num_columna].audio,))
+
+ chat.add_card(self.lista_tarjetas[self.num_columna])
+ self.hilo.start()
+ self.flag = False
+ self.check_process_id()
+ else:
+ self.hilo = threading.Thread(target=self.ejecutar_chatbox)
+
+ def ejecutar_chatbox(self):
+ chat = get_chat_box()
+ chat.play_sound()
+
+ def ejecutar_sonido(self, info):
+ print 'fila:' + str(self.seleccione_fila) + ' columna:' + str(self.num_columna)
+ reproducir(info)
+ #self.process_id = subprocess.Popen(['/usr/bin/aplay', info])
+ #self.process_id.wait()
+
+ def check_process_id(self):
+ "Verifica si el sonido termino"
+ if not self.hilo.isAlive() :
+ self.barrido_horizontal()
+ self.seleccione_fila = -1
+ self.flag = True
+ gobject.source_remove(self.handle_check_process)
+ else:
+ self.handle_check_process = gobject.timeout_add(1000,
+ self.check_process_id)
+
+ def barrido_vertical(self):
+ '''Barrido vertical de la ventana'''
+ self.num_columna = pintar_columnas(self.lista_botones,
+ self.seleccione_fila,
+ self.num_columna)
+ self.handle_barrido_vertical = gobject.timeout_add(self.tiempo_repeticion,
+ self.barrido_vertical)
+ #self.flag=False
+
+ def modifico_tiempo_barrido(self, tiempo):
+ ''' Altero el tiempo de barrido '''
+ self.tiempo_repeticion = tiempo
+
+
+class ControlBarrido(gtk.Table):
+ ''' Clase que controla la estabilidad del barrido '''
+
+ def __init__(self, grilla):
+ gtk.Table.__init__(self, 1, 3)
+
+ self.grilla = grilla
+ self.valor = 2
+
+ self.tiempo = gtk.Label('Espera (segundos) : '.join(str(self.valor)))
+ self.tiempo.show()
+ boton_mas = gtk.Button('+')
+ boton_mas.show()
+ boton_menos = gtk.Button('-')
+ boton_menos.show()
+
+ boton_mas.connect("clicked", self.pulso_boton_mas, 1)
+ boton_menos.connect("clicked", self.pulso_boton_menos, 1)
+
+ self.attach(self.tiempo, 0, 1, 0, 1)
+ self.attach(boton_mas, 1, 2, 0, 1)
+
+ self.attach(boton_menos, 2, 3, 0, 1)
+
+ def pulso_boton_mas(self, dummy_widget, dummy_info):
+ '''Incrementa tiempo barrido'''
+ self.valor += 1
+ self.tiempo.set_label('Espera : ' + str(self.valor) + ' seg')
+ self.grilla.modifico_tiempo_barrido(self.valor * 1000)
+
+
+ def pulso_boton_menos(self, dummy_widget, dummy_info):
+ '''Decrementa tiempo de barrido'''
+ if self.valor > 1:
+ self.valor -= 1
+
+ self.tiempo.set_label('Espera : ' + str(self.valor) + ' seg')
+ self.grilla.modifico_tiempo_barrido(self.valor * 1000)
+
+_chatbox = None
+
+class ChatBox(gtk.HBox):
+ def __init__(self):
+ super(ChatBox, self).__init__()
+ self.set_size_request(settings.BUTTON_SIZE, settings.BUTTON_SIZE)
+
+ def add_card(self, tarjeta):
+ tarjeta.refresh_image()
+ tarjeta.show()
+ self.pack_start(tarjeta)
+
+ def clear_box(self):
+ for child in this.get_children():
+ child.remove()
+
+ def play_sound(self):
+ for child in this.get_children():
+ child.remove()
+
+def get_chat_box():
+ global _chatbox
+ if _chatbox == None:
+ _chatbox = ChatBox()
+ return _chatbox
+
+
+#if __name__ == '__main__':
+# principal = gtk.Window(gtk.WINDOW_TOPLEVEL)
+# principal.set_title('Prestame tu voz')
+# tablebox = VentanaPrincipal()
+# control = ControlBarrido(tablebox)
+# chatbox = get_chat_box()
+# sw = gtk.ScrolledWindow()
+#
+# sw.set_policy(gtk.POLICY_ALWAYS, gtk.POLICY_NEVER)
+# sw.add(chatbox)
+# sw.show()
+#
+# caja_principal = gtk.VBox()
+# caja_principal.pack_start(control)
+# caja_principal.pack_start(tablebox)
+# caja_principal.pack_start(sw)
+#
+# principal.add(caja_principal)
+# tablebox.show_all()
+# control.show_all()
+# chatbox.show_all()
+# caja_principal.show_all()
+#
+#
+# principal.show()
+# principal.connect("delete_event", gtk.main_quit)
+# gtk.main()
diff --git a/PrestametuVoz.activity/grid.pyc b/PrestametuVoz.activity/grid.pyc
new file mode 100644
index 0000000..6186069
--- /dev/null
+++ b/PrestametuVoz.activity/grid.pyc
Binary files differ
diff --git a/PrestametuVoz.activity/icons/game-load.svg b/PrestametuVoz.activity/icons/game-load.svg
new file mode 100644
index 0000000..4222b7a
--- /dev/null
+++ b/PrestametuVoz.activity/icons/game-load.svg
@@ -0,0 +1,166 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://web.resource.org/cc/"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ enable-background="new 0 0 55 55"
+ height="55px"
+ version="1.1"
+ viewBox="0 0 55 55"
+ width="55px"
+ x="0px"
+ xml:space="preserve"
+ y="0px"
+ id="svg5142"
+ sodipodi:version="0.32"
+ inkscape:version="0.45.1"
+ sodipodi:docname="game-load.svg"
+ sodipodi:docbase="/home/msgodoi/olpc/workspace/Memorize.activity/images"
+ inkscape:output_extension="org.inkscape.output.svg.inkscape"><metadata
+ id="metadata5176"><rdf:RDF><cc:Work
+ rdf:about=""><dc:format>image/svg+xml</dc:format><dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" /></cc:Work></rdf:RDF></metadata><defs
+ id="defs5174">
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ </defs><sodipodi:namedview
+ inkscape:window-height="871"
+ inkscape:window-width="1432"
+ inkscape:pageshadow="2"
+ inkscape:pageopacity="0.96862745"
+ guidetolerance="10.0"
+ gridtolerance="10.0"
+ objecttolerance="10.0"
+ borderopacity="1.0"
+ bordercolor="#666666"
+ pagecolor="#4b4b4b"
+ id="base"
+ inkscape:zoom="12.145455"
+ inkscape:cx="27.5"
+ inkscape:cy="30.793413"
+ inkscape:window-x="4"
+ inkscape:window-y="25"
+ inkscape:current-layer="g4140" /><g
+ id="g5125"
+ transform="translate(-2,2)"><g
+ id="g5147">
+ <g
+ id="g5149">
+ <path
+ style="fill:#ffffff;stroke:#8c8c8c;stroke-width:3.5;stroke-linecap:round;stroke-linejoin:round"
+ id="path5151"
+ d="M 6.736,49.002 L 31.256,49.002 C 33.481,49.002 34.695,47.555 34.695,45.561 L 34.695,18.281 C 34.695,16.551 32.963,14.84 31.256,14.84 L 26.867,14.84" />
+ </g>
+ </g><g
+ id="g5153">
+ <g
+ id="g5155">
+ <path
+ style="fill:#ffffff;stroke:#8c8c8c;stroke-width:3.5;stroke-linecap:round;stroke-linejoin:round"
+ id="path5157"
+ d="M 26.867,38.592 C 26.867,40.428 25.522,41.793 23.426,42.639 L 6.736,49.002 L 6.736,14.84 L 23.426,6.241 C 25.654,5.847 26.867,7.081 26.867,9.075 L 26.867,38.592 z " />
+ </g>
+ </g><path
+ style="fill:none;stroke:#8c8c8c;stroke-width:2.25;stroke-linecap:round;stroke-linejoin:round"
+ id="path5159"
+ d="M 9.424,42.607 C 9.424,42.607 8.073,42.064 6.722,42.064 C 5.371,42.064 4.019,42.607 4.019,42.607" /><path
+ style="fill:none;stroke:#8c8c8c;stroke-width:2.25;stroke-linecap:round;stroke-linejoin:round"
+ id="path5161"
+ d="M 9.424,32.006 C 9.424,32.006 8.185,31.463 6.609,31.463 C 5.032,31.463 4.019,32.006 4.019,32.006" /><path
+ style="fill:none;stroke:#8c8c8c;stroke-width:2.25;stroke-linecap:round;stroke-linejoin:round"
+ id="path5163"
+ d="M 9.424,21.678 C 9.424,21.678 8.299,21.134 6.497,21.134 C 4.695,21.134 4.019,21.678 4.019,21.678" /><line
+ style="fill:none;stroke:#8c8c8c;stroke-width:2.25;stroke-linecap:round;stroke-linejoin:round"
+ id="line5165"
+ y2="11.505"
+ y1="46.533001"
+ x2="13.209"
+ x1="13.209" /></g><g
+ id="g4140"
+ transform="matrix(0.8372116,0,0,0.8372116,8.751416,-7.2720533e-2)"><rect
+ style="fill:#ffffff;stroke:#ffffff;stroke-width:1.79166174;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ id="rect2221"
+ height="5.0509453"
+ width="5.0529833"
+ y="2.5762157"
+ x="32.743912" /><rect
+ style="fill:#404040;stroke:#ffffff;stroke-width:1.79166175;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;fill-opacity:1"
+ id="rect2223"
+ height="5.0509453"
+ width="5.0529833"
+ y="2.5764074"
+ x="40.25333" /><rect
+ style="fill:#ffffff;stroke:#ffffff;stroke-width:1.79166175;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;fill-opacity:1"
+ id="rect2225"
+ height="5.0509453"
+ width="5.0529833"
+ y="2.5764074"
+ x="47.70649" /><rect
+ style="fill:#ffffff;fill-opacity:1;stroke:#ffffff;stroke-width:1.79166174;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ id="rect2227"
+ height="5.0509453"
+ width="5.0529833"
+ y="10.110711"
+ x="32.743912" /><rect
+ style="fill:#404040;fill-opacity:1;stroke:#ffffff;stroke-width:1.79166174;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ id="rect2229"
+ height="5.0509453"
+ width="5.0529833"
+ y="17.624184"
+ x="40.25333" /><rect
+ style="fill:#404040;stroke:#ffffff;stroke-width:1.79166175;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;fill-opacity:1"
+ id="rect2231"
+ height="5.0509453"
+ width="5.0529833"
+ y="10.110903"
+ x="47.70649" /><rect
+ style="fill:#404040;fill-opacity:1;stroke:#ffffff;stroke-width:1.79166174;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ id="rect2233"
+ height="5.0509453"
+ width="5.0529833"
+ y="17.623993"
+ x="32.743912" /><rect
+ style="fill:#ffffff;stroke:#ffffff;stroke-width:1.79166174;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ id="rect2235"
+ height="5.0509453"
+ width="5.0529833"
+ y="10.110903"
+ x="40.25333" /><rect
+ style="fill:#404040;stroke:#ffffff;stroke-width:1.79166175;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;fill-opacity:1"
+ id="rect2237"
+ height="5.0509453"
+ width="5.0529833"
+ y="17.624184"
+ x="47.70649" /></g><line
+ style="fill:none;stroke:#ffffff;stroke-width:3.5;stroke-linecap:round;stroke-linejoin:round;stroke-opacity:1"
+ id="line5169"
+ y2="36.425068"
+ y1="22.462688"
+ x2="44.528595"
+ x1="44.72258" /><polyline
+ style="fill:none;stroke:#ffffff;stroke-width:5.1055975;stroke-linecap:round;stroke-linejoin:round;stroke-opacity:1"
+ id="polyline5171"
+ points=" 51.562,15.306 41.17,16.188 42.053,5.794 "
+ transform="matrix(-0.5053552,0.4648229,-0.493202,-0.4762768,73.4836,10.383118)" /><line
+ style="fill:none;stroke:#ffffff;stroke-width:3.5;stroke-linecap:round;stroke-linejoin:round;stroke-opacity:1"
+ id="line4138"
+ y2="36.52364"
+ y1="36.329655"
+ x2="44.443764"
+ x1="36.409523" /></svg> \ No newline at end of file
diff --git a/PrestametuVoz.activity/icons/game-new.svg b/PrestametuVoz.activity/icons/game-new.svg
new file mode 100644
index 0000000..b71ccc1
--- /dev/null
+++ b/PrestametuVoz.activity/icons/game-new.svg
@@ -0,0 +1,129 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Generator: Adobe Illustrator 12.0.1, SVG Export Plug-In . SVG Version: 6.00 Build 51448) -->
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://web.resource.org/cc/"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ version="1.1"
+ id="Icon"
+ width="43.584"
+ height="43.292"
+ viewBox="0 0 43.584 43.292"
+ overflow="visible"
+ enable-background="new 0 0 43.584 43.292"
+ xml:space="preserve"
+ sodipodi:version="0.32"
+ inkscape:version="0.45.1"
+ sodipodi:docname="game-new.svg"
+ sodipodi:docbase="/home/msgodoi/olpc/workspace/Memorize.activity/images"
+ inkscape:output_extension="org.inkscape.output.svg.inkscape"><metadata
+ id="metadata2242"><rdf:RDF><cc:Work
+ rdf:about=""><dc:format>image/svg+xml</dc:format><dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" /></cc:Work></rdf:RDF></metadata><defs
+ id="defs2240" /><sodipodi:namedview
+ inkscape:window-height="879"
+ inkscape:window-width="1440"
+ inkscape:pageshadow="2"
+ inkscape:pageopacity="1"
+ guidetolerance="10.0"
+ gridtolerance="10.0"
+ objecttolerance="10.0"
+ borderopacity="1.0"
+ bordercolor="#666666"
+ pagecolor="#4b4b4b"
+ id="base"
+ inkscape:zoom="15.637993"
+ inkscape:cx="21.792"
+ inkscape:cy="26.761746"
+ inkscape:window-x="0"
+ inkscape:window-y="21"
+ inkscape:current-layer="Icon"
+ showguides="true"
+ inkscape:guide-bbox="true" />
+<rect
+ x="1.5007635"
+ y="1.5007635"
+ width="8.5757914"
+ height="8.5757914"
+ id="rect2221"
+ style="fill:#ffffff;stroke:#ffffff;stroke-width:3.00152707;stroke-opacity:1" />
+<rect
+ x="14.650882"
+ y="1.5007635"
+ width="8.5757914"
+ height="8.5757914"
+ id="rect2223"
+ style="fill:#404040;stroke:#ffffff;stroke-width:3.00152707;stroke-opacity:1;fill-opacity:1" />
+
+
+<rect
+ x="14.522763"
+ y="27.082636"
+ width="8.5757914"
+ height="8.5757914"
+ id="rect2229"
+ style="fill:#404040;fill-opacity:1;stroke:#ffffff;stroke-width:3.00152707;stroke-opacity:1" />
+<rect
+ x="27.300175"
+ y="14.320445"
+ width="8.5757914"
+ height="8.5757914"
+ id="rect2231"
+ style="fill:#404040;fill-opacity:1;stroke:#ffffff;stroke-width:3.00152707;stroke-opacity:1" />
+<rect
+ x="1.5007635"
+ y="27.049763"
+ width="8.5757914"
+ height="8.5757914"
+ id="rect2233"
+ style="fill:#404040;stroke:#ffffff;stroke-width:3.00152707;stroke-opacity:1;fill-opacity:1" />
+<rect
+ x="14.522988"
+ y="14.320445"
+ width="8.5757914"
+ height="8.5757914"
+ id="rect2235"
+ style="fill:#ffffff;stroke:#ffffff;stroke-width:3.00152707;stroke-opacity:1" />
+<rect
+ x="27.300175"
+ y="27.049763"
+ width="8.5757914"
+ height="8.5757914"
+ id="rect2237"
+ style="fill:#404040;fill-opacity:1;stroke:#ffffff;stroke-width:3.00152707;stroke-opacity:1" />
+<g
+ id="g8128"
+ transform="matrix(1.1533304,0,0,1.1849266,74.491613,11.842114)"
+ style="stroke:#ffffff;stroke-opacity:1"><path
+ sodipodi:nodetypes="cccccc"
+ id="path6167"
+ d="M -27.423669,19.213102 L -34.384959,18.667751 L -41.332006,19.051133 L -34.303975,19.649604 L -27.488656,19.213102 L -34.44067,18.736178"
+ style="fill:#ffffff;fill-rule:evenodd;stroke:#ffffff;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:round;marker-start:none;stroke-opacity:1" /><path
+ sodipodi:nodetypes="cccccc"
+ id="path6165"
+ d="M -34.432262,26.112846 L -33.886911,19.151556 L -34.270293,12.204509 L -34.868764,19.23254 L -34.432262,26.047859 L -33.955338,19.095845"
+ style="fill:#ffffff;fill-rule:evenodd;stroke:#ffffff;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:round;marker-start:none;stroke-opacity:1" /><path
+ sodipodi:nodetypes="cccccc"
+ id="path6169"
+ d="M -29.517762,24.133282 L -34.054516,18.825285 L -39.237912,14.184073 L -34.691527,19.576825 L -29.563716,24.087329 L -34.142295,18.834277"
+ style="fill:#ffffff;fill-rule:evenodd;stroke:#ffffff;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:round;marker-start:none;stroke-opacity:1" /><path
+ sodipodi:nodetypes="cccccc"
+ id="path6171"
+ d="M -29.403233,14.298603 L -34.71123,18.835357 L -39.352442,24.018753 L -33.959691,19.472367 L -29.449186,14.344555 L -34.702238,18.923135"
+ style="fill:#ffffff;fill-rule:evenodd;stroke:#ffffff;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:round;marker-start:none;stroke-opacity:1" /></g><rect
+ x="1.5007635"
+ y="14.320629"
+ width="8.5757914"
+ height="8.5757914"
+ id="rect2337"
+ style="fill:#ffffff;stroke:#ffffff;stroke-width:3.00152707;stroke-opacity:1" /><rect
+ x="27.299765"
+ y="1.5004449"
+ width="8.5757914"
+ height="8.5757914"
+ id="rect2339"
+ style="fill:#ffffff;stroke:#ffffff;stroke-width:3.00152707;stroke-opacity:1" /></svg> \ No newline at end of file
diff --git a/PrestametuVoz.activity/icons/game-save.svg b/PrestametuVoz.activity/icons/game-save.svg
new file mode 100644
index 0000000..67742a7
--- /dev/null
+++ b/PrestametuVoz.activity/icons/game-save.svg
@@ -0,0 +1,164 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://web.resource.org/cc/"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ enable-background="new 0 0 55 55"
+ height="55px"
+ version="1.1"
+ viewBox="0 0 55 55"
+ width="55px"
+ x="0px"
+ xml:space="preserve"
+ y="0px"
+ id="svg5142"
+ sodipodi:version="0.32"
+ inkscape:version="0.45.1"
+ sodipodi:docname="game-save.svg"
+ sodipodi:docbase="/home/msgodoi/olpc/workspace/Memorize.activity/images"
+ inkscape:output_extension="org.inkscape.output.svg.inkscape"><metadata
+ id="metadata5176"><rdf:RDF><cc:Work
+ rdf:about=""><dc:format>image/svg+xml</dc:format><dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" /></cc:Work></rdf:RDF></metadata><defs
+ id="defs5174">
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ </defs><sodipodi:namedview
+ inkscape:window-height="871"
+ inkscape:window-width="1432"
+ inkscape:pageshadow="2"
+ inkscape:pageopacity="1"
+ guidetolerance="10.0"
+ gridtolerance="10.0"
+ objecttolerance="10.0"
+ borderopacity="1.0"
+ bordercolor="#666666"
+ pagecolor="#4b4b4b"
+ id="base"
+ inkscape:zoom="12.145455"
+ inkscape:cx="27.5"
+ inkscape:cy="30.793413"
+ inkscape:window-x="4"
+ inkscape:window-y="25"
+ inkscape:current-layer="svg5142" /><g
+ id="g5125"
+ transform="translate(-2,2)"><g
+ id="g5147">
+ <g
+ id="g5149">
+ <path
+ style="fill:#ffffff;stroke:#8c8c8c;stroke-width:3.5;stroke-linecap:round;stroke-linejoin:round"
+ id="path5151"
+ d="M 6.736,49.002 L 31.256,49.002 C 33.481,49.002 34.695,47.555 34.695,45.561 L 34.695,18.281 C 34.695,16.551 32.963,14.84 31.256,14.84 L 26.867,14.84" />
+ </g>
+ </g><g
+ id="g5153">
+ <g
+ id="g5155">
+ <path
+ style="fill:#ffffff;stroke:#8c8c8c;stroke-width:3.5;stroke-linecap:round;stroke-linejoin:round"
+ id="path5157"
+ d="M 26.867,38.592 C 26.867,40.428 25.522,41.793 23.426,42.639 L 6.736,49.002 L 6.736,14.84 L 23.426,6.241 C 25.654,5.847 26.867,7.081 26.867,9.075 L 26.867,38.592 z " />
+ </g>
+ </g><path
+ style="fill:none;stroke:#8c8c8c;stroke-width:2.25;stroke-linecap:round;stroke-linejoin:round"
+ id="path5159"
+ d="M 9.424,42.607 C 9.424,42.607 8.073,42.064 6.722,42.064 C 5.371,42.064 4.019,42.607 4.019,42.607" /><path
+ style="fill:none;stroke:#8c8c8c;stroke-width:2.25;stroke-linecap:round;stroke-linejoin:round"
+ id="path5161"
+ d="M 9.424,32.006 C 9.424,32.006 8.185,31.463 6.609,31.463 C 5.032,31.463 4.019,32.006 4.019,32.006" /><path
+ style="fill:none;stroke:#8c8c8c;stroke-width:2.25;stroke-linecap:round;stroke-linejoin:round"
+ id="path5163"
+ d="M 9.424,21.678 C 9.424,21.678 8.299,21.134 6.497,21.134 C 4.695,21.134 4.019,21.678 4.019,21.678" /><line
+ style="fill:none;stroke:#8c8c8c;stroke-width:2.25;stroke-linecap:round;stroke-linejoin:round"
+ id="line5165"
+ y2="11.505"
+ y1="46.533001"
+ x2="13.209"
+ x1="13.209" /></g><line
+ style="fill:none;stroke:#ffffff;stroke-width:3.5;stroke-linecap:round;stroke-linejoin:round;stroke-opacity:1"
+ id="line5169"
+ y2="36.425068"
+ y1="22.462688"
+ x2="45.845959"
+ x1="46.039944" /><polyline
+ style="fill:none;stroke:#ffffff;stroke-width:5.1055975;stroke-linecap:round;stroke-linejoin:round;stroke-opacity:1"
+ id="polyline5171"
+ points=" 51.562,15.306 41.17,16.188 42.053,5.794 "
+ transform="matrix(0.4648229,0.5053552,-0.4762768,0.493202,24.919883,7.4889306)" /><line
+ style="fill:none;stroke:#ffffff;stroke-width:3.5;stroke-linecap:round;stroke-linejoin:round;stroke-opacity:1"
+ id="line4138"
+ y2="36.52364"
+ y1="36.329655"
+ x2="45.78508"
+ x1="37.750839" /><rect
+ style="fill:#ffffff;stroke:#ffffff;stroke-width:1.5;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ id="rect2221"
+ height="4.2287102"
+ width="4.2304163"
+ y="2.0430667"
+ x="36.411789" /><rect
+ style="fill:#404040;fill-opacity:1;stroke:#ffffff;stroke-width:1.5;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ id="rect2223"
+ height="4.2287102"
+ width="4.2304163"
+ y="2.0432274"
+ x="42.698757" /><rect
+ style="fill:#ffffff;fill-opacity:1;stroke:#ffffff;stroke-width:1.5;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ id="rect2225"
+ height="4.2287102"
+ width="4.2304163"
+ y="2.0432274"
+ x="48.938633" /><rect
+ style="fill:#ffffff;fill-opacity:1;stroke:#ffffff;stroke-width:1.5;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ id="rect2227"
+ height="4.2287102"
+ width="4.2304163"
+ y="8.3510332"
+ x="36.411789" /><rect
+ style="fill:#404040;fill-opacity:1;stroke:#ffffff;stroke-width:1.5;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ id="rect2229"
+ height="4.2287102"
+ width="4.2304163"
+ y="14.641401"
+ x="42.698757" /><rect
+ style="fill:#404040;fill-opacity:1;stroke:#ffffff;stroke-width:1.5;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ id="rect2231"
+ height="4.2287102"
+ width="4.2304163"
+ y="8.3511934"
+ x="48.938633" /><rect
+ style="fill:#404040;fill-opacity:1;stroke:#ffffff;stroke-width:1.5;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ id="rect2233"
+ height="4.2287102"
+ width="4.2304163"
+ y="14.641241"
+ x="36.411789" /><rect
+ style="fill:#ffffff;stroke:#ffffff;stroke-width:1.5;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ id="rect2235"
+ height="4.2287102"
+ width="4.2304163"
+ y="8.3511934"
+ x="42.698757" /><rect
+ style="fill:#404040;fill-opacity:1;stroke:#ffffff;stroke-width:1.5;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ id="rect2237"
+ height="4.2287102"
+ width="4.2304163"
+ y="14.641401"
+ x="48.938633" /></svg> \ No newline at end of file
diff --git a/PrestametuVoz.activity/icons/media-audio.svg b/PrestametuVoz.activity/icons/media-audio.svg
new file mode 100755
index 0000000..a78405f
--- /dev/null
+++ b/PrestametuVoz.activity/icons/media-audio.svg
@@ -0,0 +1,10 @@
+<?xml version="1.0" ?><!DOCTYPE svg PUBLIC '-//W3C//DTD SVG 1.1//EN' 'http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd' [
+ <!ENTITY stroke_color "#010101">
+ <!ENTITY fill_color "#FFFFFF">
+]><svg enable-background="new 0 0 55 55" height="55px" version="1.1" viewBox="0 0 55 55" width="55px" x="0px" xml:space="preserve" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" y="0px"><g display="block" id="record-audio">
+ <g display="inline">
+ <polygon fill="&fill_color;" points=" 8.872,38.893 13.296,43.314 38.942,21.406 30.782,13.246 " stroke="&stroke_color;" stroke-linecap="round" stroke-linejoin="round" stroke-width="3.5"/>
+ <circle cx="37.371" cy="14.759" fill="&fill_color;" r="8.757" stroke="&stroke_color;" stroke-linejoin="round" stroke-width="3.5"/>
+ <path d="M10.829,40.85 c-3.607,3.607-1.485,13.146,13.332,4.596C35.687,38.912,43.122,44.297,44.464,51" fill="none" stroke="&stroke_color;" stroke-linecap="round" stroke-linejoin="round" stroke-width="3.5"/>
+ </g>
+</g></svg> \ No newline at end of file
diff --git a/PrestametuVoz.activity/icons/media-photo.svg b/PrestametuVoz.activity/icons/media-photo.svg
new file mode 100755
index 0000000..a3a81e7
--- /dev/null
+++ b/PrestametuVoz.activity/icons/media-photo.svg
@@ -0,0 +1,12 @@
+<?xml version="1.0" ?><!DOCTYPE svg PUBLIC '-//W3C//DTD SVG 1.1//EN' 'http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd' [
+ <!ENTITY stroke_color "#010101">
+ <!ENTITY fill_color "#FFFFFF">
+]><svg enable-background="new 0 0 55 55" height="55px" version="1.1" viewBox="0 0 55 55" width="55px" x="0px" xml:space="preserve" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" y="0px"><g display="block" id="record-photo">
+ <g display="inline">
+ <polygon fill="&fill_color;" points="17.468,16.339 17.468,12.438 8.75,12.438 8.75,16.339 5,16.339 5,42.588 50,42.588 50,16.339 " stroke="&stroke_color;" stroke-linejoin="round" stroke-width="3.5"/>
+ <path d="M20.364,30.209 c0,3.94,3.197,7.137,7.138,7.137c3.937,0,7.135-3.197,7.135-7.137c0-3.937-3.198-7.141-7.135-7.141 C23.562,23.068,20.364,26.273,20.364,30.209z" fill="&fill_color;" stroke="&stroke_color;" stroke-linejoin="round" stroke-width="3.5"/>
+ <rect fill="&stroke_color;" height="4.502" width="6.748" x="39.147" y="20.522"/>
+ <rect fill="&stroke_color;" height="3.438" width="3.438" x="15.688" y="14.625"/>
+ <rect fill="&stroke_color;" height="3.438" width="3.438" x="7.062" y="14.625"/>
+ </g>
+</g></svg> \ No newline at end of file
diff --git a/PrestametuVoz.activity/icons/media-record-red.png b/PrestametuVoz.activity/icons/media-record-red.png
new file mode 100755
index 0000000..289b54a
--- /dev/null
+++ b/PrestametuVoz.activity/icons/media-record-red.png
Binary files differ
diff --git a/PrestametuVoz.activity/icons/media-record.png b/PrestametuVoz.activity/icons/media-record.png
new file mode 100755
index 0000000..41be533
--- /dev/null
+++ b/PrestametuVoz.activity/icons/media-record.png
Binary files differ
diff --git a/PrestametuVoz.activity/icons/media-video.svg b/PrestametuVoz.activity/icons/media-video.svg
new file mode 100755
index 0000000..7f87d04
--- /dev/null
+++ b/PrestametuVoz.activity/icons/media-video.svg
@@ -0,0 +1,11 @@
+<?xml version="1.0" ?><!DOCTYPE svg PUBLIC '-//W3C//DTD SVG 1.1//EN' 'http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd' [
+ <!ENTITY stroke_color "#010101">
+ <!ENTITY fill_color "#FFFFFF">
+]><svg enable-background="new 0 0 55 55" height="55px" version="1.1" viewBox="0 0 55 55" width="55px" x="0px" xml:space="preserve" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" y="0px"><g display="block" id="record-video">
+ <g display="inline">
+ <polygon fill="&fill_color;" points="49.373,40.475 26.9,27.5 49.373,14.525 " stroke="&stroke_color;" stroke-linejoin="round" stroke-width="3.5"/>
+
+ <rect fill="&fill_color;" height="22.379" stroke="&stroke_color;" stroke-linejoin="round" stroke-width="3.5" width="29.021" x="7.838" y="15.959"/>
+ <polyline fill="&fill_color;" points="9.586,28.249 4.627,28.249 4.627,20.817 9.586,20.817 " stroke="&stroke_color;" stroke-linejoin="round" stroke-width="3.5"/>
+ </g>
+</g></svg> \ No newline at end of file
diff --git a/PrestametuVoz.activity/icons/sin_foto.png b/PrestametuVoz.activity/icons/sin_foto.png
new file mode 100755
index 0000000..63f76b3
--- /dev/null
+++ b/PrestametuVoz.activity/icons/sin_foto.png
Binary files differ
diff --git a/PrestametuVoz.activity/instance.py b/PrestametuVoz.activity/instance.py
new file mode 100755
index 0000000..a4b1303
--- /dev/null
+++ b/PrestametuVoz.activity/instance.py
@@ -0,0 +1,48 @@
+import os
+
+from sugar import profile
+from sugar import util
+from sugar.activity import activity
+import shutil
+
+from color import Color
+
+class Instance:
+ key = profile.get_pubkey()
+ if hasattr(util, '_sha_data'):
+ # sugar-0.82 and previous
+ keyHash = util._sha_data(key)
+ else:
+ keyHash = util.sha_data(key)
+
+ keyHashPrintable = util.printable_hash(keyHash)
+ nickName = profile.get_nick_name()
+
+ colorFill = Color()
+ colorFill.init_hex( profile.get_color().get_fill_color() )
+ colorStroke = Color()
+ colorStroke.init_hex( profile.get_color().get_stroke_color() )
+
+ instanceId = None
+ instancePath = None
+ dataPath = None
+
+ def __init__(self, ca):
+ self.__class__.instanceId = ca._activity_id
+
+ self.__class__.instancePath = os.path.join(ca.get_activity_root(), "instance")
+ recreateTmp()
+
+ self.__class__.dataPath = os.path.join(ca.get_activity_root(), "data")
+ recreateData()
+
+
+def recreateTmp():
+ if (not os.path.exists(Instance.instancePath)):
+ os.makedirs(Instance.instancePath)
+
+
+def recreateData():
+ if (not os.path.exists(Instance.dataPath)):
+ os.makedirs(Instance.dataPath)
+
diff --git a/PrestametuVoz.activity/instance.pyc b/PrestametuVoz.activity/instance.pyc
new file mode 100755
index 0000000..56b6285
--- /dev/null
+++ b/PrestametuVoz.activity/instance.pyc
Binary files differ
diff --git a/PrestametuVoz.activity/manejar_datos.py b/PrestametuVoz.activity/manejar_datos.py
new file mode 100755
index 0000000..e29a9b3
--- /dev/null
+++ b/PrestametuVoz.activity/manejar_datos.py
@@ -0,0 +1,98 @@
+#!/usr/bin/python
+# -*- coding: iso-8859-1 -*-
+''' Lee y carga los archivos '''
+
+#Copyright (C) 2009 Federico Moreira - <federico@piensalibre.info>
+# Alejandro Esperón - <ratman26@gmail.com>
+# Esteban Arias - <earias@plan.ceibal.edu.uy>
+#
+# 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 3 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, see <http://www.gnu.org/licenses/>
+
+import os
+from os import environ, makedirs, chmod
+from os.path import join, basename, isdir, split, normpath
+import zipfile
+import tempfile
+import simplejson as json
+
+from sugar.activity import activity
+from tarjeta import Tarjeta
+
+
+def guardar_datos(archivo, lista_completa):
+ ''' Leo los datos que me pasan y los guardo en la base '''
+ lista =[]
+ for item in lista_completa:
+ i = {}
+ i['titulo'] = item.titulo
+ i['imagen'] = item.imagen
+ i['audio'] = item.audio
+ lista.append(i)
+ try:
+ a = open(os.path.join('data', archivo), 'w' )
+ json.dump(lista, a)
+ except IOError, error:
+ print error
+ finally:
+ a.close()
+
+def cargar_datos(archivo):
+ ''' Leo los datos de la base y los devuelvo en una lista '''
+ try:
+ #carga demo luego modificar para multiples planillas...
+ game_file = os.path.join(os.path.dirname(__file__), 'demos', archivo+'.zip')
+
+ tmp_root = os.path.join(environ['SUGAR_ACTIVITY_ROOT'], 'instance')
+ temp_folder = tempfile.mkdtemp(dir=tmp_root)
+ chmod(temp_folder, 0777)
+
+ ''' extracts files in the zip file '''
+ game_name = basename(game_file)[:-4]
+ zipFile = zipfile.ZipFile(game_file, "r")
+ for each in zipFile.namelist():
+ if not each.endswith('/'):
+ root, name = split(each)
+ directory = normpath(os.path.join(temp_folder, root))
+ if not isdir(directory):
+ makedirs(directory)
+ file(os.path.join(directory, name), 'wb').write(zipFile.read(each))
+
+ print 'RUTA: ' + os.path.join(temp_folder, 'data', archivo)
+ a = open(os.path.join(temp_folder, 'data', archivo))
+
+ l = json.load(a)
+ lista = []
+ for item in l:
+ card = Tarjeta()
+ card.titulo = item['titulo']
+ card.imagen = os.path.join(temp_folder, item['imagen'])
+ card.audio = os.path.join(temp_folder, item['audio'])
+ lista.append(card)
+ a.close()
+ except IOError, error:
+ print error
+ #finally:
+ # a.close()
+ return lista
+
+def cargar_planillas(archivo):
+ ''' Carga las plantillas '''
+ try:
+ archivo = open(archivo)
+ lista = archivo.readlines()
+ except IOError, error:
+ print error
+ finally:
+ archivo.close()
+ return lista
diff --git a/PrestametuVoz.activity/manejar_datos.pyc b/PrestametuVoz.activity/manejar_datos.pyc
new file mode 100755
index 0000000..195ac0a
--- /dev/null
+++ b/PrestametuVoz.activity/manejar_datos.pyc
Binary files differ
diff --git a/PrestametuVoz.activity/planillas/planillas.txt b/PrestametuVoz.activity/planillas/planillas.txt
new file mode 100755
index 0000000..e9f9e1a
--- /dev/null
+++ b/PrestametuVoz.activity/planillas/planillas.txt
@@ -0,0 +1 @@
+fede2
diff --git a/PrestametuVoz.activity/prestame_tu_voz.py b/PrestametuVoz.activity/prestame_tu_voz.py
new file mode 100755
index 0000000..572d714
--- /dev/null
+++ b/PrestametuVoz.activity/prestame_tu_voz.py
@@ -0,0 +1,88 @@
+#!/usr/bin/python
+# -*- coding: utf-8 -*-
+#Copyright (C) 2010 Federico Moreira - <federico@piensalibre.info>
+# Alejandro Esperón - <ratman26@gmail.com>
+# Esteban Arias - <earias@plan.ceibal.edu.uy>
+#
+# 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 3 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, see <http://www.gnu.org/licenses/>
+
+
+import gtk
+from gettext import gettext as _
+from sugar.activity.activity import Activity, ActivityToolbox
+
+from toolbar import ConfigToolbar
+import grid
+import config_nuevo
+
+_TOOLBAR_CONFIG = 1
+
+class PrestameTuVozActivity(Activity):
+
+ def __init__(self, handle):
+ Activity.__init__(self, handle)
+
+ self.config_load = False
+
+ toolbox = ActivityToolbox(self)
+
+ toolbar_config = ConfigToolbar(toolbox, self)
+ toolbox.add_toolbar(_('Configuration'), toolbar_config)
+ toolbar_config.show()
+
+ self.set_toolbox(toolbox)
+ toolbox.show()
+
+ self.lista_tarjetas =[]
+ self.pos_actual = 0
+ self.recording = False
+ self.rec_process = None
+
+ self.mainbox = gtk.VBox()
+ #self.mainbox.pack_start(self.image)
+
+ self.tablebox = grid.VentanaPrincipal()
+ self.control = grid.ControlBarrido(self.tablebox)
+ self.chatbox = grid.get_chat_box()
+ self.tablebox.show_all()
+ self.control.show_all()
+ self.chatbox.show_all()
+ self.mainbox.pack_start(self.control)
+ self.mainbox.pack_start(self.tablebox)
+ self.mainbox.pack_start(self.chatbox)
+
+ self.set_canvas(self.mainbox)
+ self.mainbox.show_all()
+
+ self.toolbox.connect('current-toolbar-changed', self.change_mode)
+
+ def change_mode(self, notebook, index):
+ if index == _TOOLBAR_CONFIG:
+ if not self.config_load:
+ self.config_load = True
+ self.mainbox.remove(self.control)
+ self.mainbox.remove(self.tablebox)
+ self.mainbox.remove(self.chatbox)
+
+ self.ventana_config = config_nuevo.VentanaConfig()
+ self.mainbox.pack_start(self.ventana_config)
+ self.ventana_config.show_all()
+
+ else:
+ self.mainbox.remove(self.ventana_config)
+
+ self.mainbox.pack_start(self.control)
+ self.mainbox.pack_start(self.tablebox)
+ self.mainbox.pack_start(self.chatbox)
+
diff --git a/PrestametuVoz.activity/prestame_tu_voz.pyc b/PrestametuVoz.activity/prestame_tu_voz.pyc
new file mode 100755
index 0000000..c9c22d5
--- /dev/null
+++ b/PrestametuVoz.activity/prestame_tu_voz.pyc
Binary files differ
diff --git a/PrestametuVoz.activity/settings.py b/PrestametuVoz.activity/settings.py
new file mode 100644
index 0000000..0847fcd
--- /dev/null
+++ b/PrestametuVoz.activity/settings.py
@@ -0,0 +1,11 @@
+from sugar.graphics import style
+
+def _get_button_size():
+ if style._compute_zoom_factor() == 0.72:
+ return 100
+ return 150
+
+TABLA_ALTO = 3
+TABLA_ANCHO = 4
+
+BUTTON_SIZE = _get_button_size()
diff --git a/PrestametuVoz.activity/settings.pyc b/PrestametuVoz.activity/settings.pyc
new file mode 100644
index 0000000..3792844
--- /dev/null
+++ b/PrestametuVoz.activity/settings.pyc
Binary files differ
diff --git a/PrestametuVoz.activity/setup.py b/PrestametuVoz.activity/setup.py
new file mode 100755
index 0000000..6ed89aa
--- /dev/null
+++ b/PrestametuVoz.activity/setup.py
@@ -0,0 +1,4 @@
+#!/usr/bin/env python
+from sugar.activity import bundlebuilder
+bundlebuilder.start()
+
diff --git a/PrestametuVoz.activity/sonido.py b/PrestametuVoz.activity/sonido.py
new file mode 100644
index 0000000..8d933c1
--- /dev/null
+++ b/PrestametuVoz.activity/sonido.py
@@ -0,0 +1,42 @@
+#!/usr/bin/python
+# -*- coding: UTF-8 -*-
+''' Función para reproducir sonido '''
+
+import pygst
+#pygst.require("0.10")
+import sys, gst, gobject
+
+gobject.threads_init()
+
+def reproducir(sonido):
+ ''' Reproduce el sonido mediante pygst '''
+
+ pipestr = "filesrc location= %s ! oggdemux ! vorbisdec ! audioconvert ! alsasink" % sonido
+
+ try:
+ pipeline = gst.parse_launch(pipestr)
+ except gobject.GError, e:
+ print "No se pudo crear tubería,", str(e)
+ return -1
+
+ def eventos(bus, msg):
+ t = msg.type
+ if t == gst.MESSAGE_EOS:
+ loop.quit()
+ elif t == gst.MESSAGE_ERROR:
+ e, d = msg.parse_error()
+ print "ERROR:", e
+ loop.quit()
+ return True
+
+ pipeline.get_bus().add_watch(eventos)
+ pipeline.set_state(gst.STATE_PLAYING)
+ loop = gobject.MainLoop()
+ try:
+ loop.run()
+ except KeyboardInterrupt:
+ pass
+ pipeline.set_state(gst.STATE_NULL)
+ return 0
+
+
diff --git a/PrestametuVoz.activity/sonido.pyc b/PrestametuVoz.activity/sonido.pyc
new file mode 100644
index 0000000..081abeb
--- /dev/null
+++ b/PrestametuVoz.activity/sonido.pyc
Binary files differ
diff --git a/PrestametuVoz.activity/tarjeta.py b/PrestametuVoz.activity/tarjeta.py
new file mode 100755
index 0000000..929d91c
--- /dev/null
+++ b/PrestametuVoz.activity/tarjeta.py
@@ -0,0 +1,54 @@
+#!/usr/bin/python
+# -*- coding: utf-8 -*-
+''' Clase de la Tarjeta'''
+
+#Copyright (C) 2009 Federico Moreira - <federico@piensalibre.info>
+# Alejandro Esperón - <ratman26@gmail.com>
+#
+# 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 3 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, see <http://www.gnu.org/licenses/>
+
+import gtk
+import os
+
+class Tarjeta(gtk.Button):
+ '''
+ Clase Tarjeta:
+ --------------
+
+ titulo --> Nombre de la tarjeta, aparece arriba de la imagen
+ imagen --> Imagen que se le agrega al botón al cargar el archivo
+ audio --> Audio que se reproduce al hacer click en la imagen
+ hijo --> En caso de que la accion sea la de cargar una nueva
+ plantilla aqui iria el nombre de la plantilla o la
+ posicion de la que se encuentra si tarian cargadas
+ en listas desde inicio.
+ '' = Uso normal, reproduccion de sonido
+ n = numero de plantilla (o nombre)
+ padre --> Desde donde viene, ya que seria necesario para retornar
+ a la plantilla anterior, dependeria si hijo tuviera algo
+
+ '''
+
+ def __init__(self, titulo='', imagen='', audio='', hijo='', padre=''):
+ super(Tarjeta, self).__init__()
+ self.titulo = titulo
+ self.audio = audio
+ self.imagen = imagen
+ self.hijo = hijo
+ self.padre = padre
+
+ def refresh_image(self):
+ imagen = gtk.Image()
+ imagen.set_from_file(os.path.join(os.getcwd(), self.imagen))
+ self.set_image(imagen)
diff --git a/PrestametuVoz.activity/tarjeta.pyc b/PrestametuVoz.activity/tarjeta.pyc
new file mode 100755
index 0000000..0d942eb
--- /dev/null
+++ b/PrestametuVoz.activity/tarjeta.pyc
Binary files differ
diff --git a/PrestametuVoz.activity/toolbar.py b/PrestametuVoz.activity/toolbar.py
new file mode 100755
index 0000000..9fa0e37
--- /dev/null
+++ b/PrestametuVoz.activity/toolbar.py
@@ -0,0 +1,74 @@
+# Copyright (C) 2010, Plan Ceibal <comunidad@plan.ceibal.edu.uy>
+# -*- coding: utf-8 -*-
+from gettext import gettext as _
+import logging
+import os
+import time
+import gtk
+
+from instance import Instance
+from sugar.graphics.icon import Icon
+from sugar.graphics.toolbutton import ToolButton
+from sugar.graphics.toggletoolbutton import ToggleToolButton
+from sugar.graphics.combobox import ComboBox
+from sugar.graphics.toolcombobox import ToolComboBox
+from sugar.graphics.objectchooser import ObjectChooser
+from sugar.graphics import iconentry
+from sugar.activity.activity import ActivityToolbar
+from sugar.activity.activity import EditToolbar
+from sugar.graphics.menuitem import MenuItem
+from sugar.datastore import datastore
+
+import sugar.profile
+
+
+#ick
+TOOLBAR_ACTIVITY = 0
+TOOLBAR_CONFIG = 1
+
+class ConfigToolbar(gtk.Toolbar):
+ __gtype_name__ = 'PrestametuvozToolbar'
+
+ def __init__(self, toolbox, parent):
+ gtk.Toolbar.__init__(self)
+
+ self._toolbox = toolbox
+ self._parent = parent
+
+ self._btn_game_load = ToolButton('game-load')
+ self._btn_game_load.get_icon_widget().set_property( 'fill-color', Instance.colorFill.hex )
+ self._btn_game_load.set_tooltip(_('Load'))
+ self._btn_game_load_id = self._btn_game_load.connect('clicked', self._game_load)
+ self.insert(self._btn_game_load, -1)
+ self._btn_game_load.show()
+
+ self._btn_game_new = ToolButton('game-new')
+ self._btn_game_new.get_icon_widget().set_property( 'fill-color', Instance.colorFill.hex )
+ self._btn_game_new.set_tooltip(_('Create'))
+ self._btn_game_new_id = self._btn_game_new.connect('clicked', self._game_new)
+ self.insert(self._btn_game_new, -1)
+ self._btn_game_new.show()
+
+# self._btn_game_save = ToolButton('save-load')
+# self._btn_game_save.get_icon_widget().set_property( 'fill-color', Instance.colorFill.hex )
+# self._btn_game_save.set_tooltip(_('Save'))
+# self._btn_game_save_id = self._btn_game_save.connect('clicked', self._game_save)
+# self.insert(self._btn_game_save, -1)
+# self._btn_game_save.show()
+
+ separator_photo = gtk.SeparatorToolItem()
+ separator_photo.set_draw(True)
+ separator_photo.show()
+ self.insert(separator_photo, -1)
+
+ def _game_load(self, *args):
+ pass
+
+ def _game_new(self, *args):
+ pass
+
+# def _game_save(self, *args):
+# pass
+
+
+
diff --git a/PrestametuVoz.activity/toolbar.pyc b/PrestametuVoz.activity/toolbar.pyc
new file mode 100755
index 0000000..8f6970a
--- /dev/null
+++ b/PrestametuVoz.activity/toolbar.pyc
Binary files differ