diff options
author | Victor Cubas <vhcubas91@gmail.com> | 2013-01-24 20:37:15 (GMT) |
---|---|---|
committer | Victor Cubas <vhcubas91@gmail.com> | 2013-01-24 20:37:15 (GMT) |
commit | 3bfc9821b1548dd9162f07fd2a1ee2593077e20f (patch) | |
tree | 4e4d1f978ffc006551d2e7c9bd6365b8a94dfd01 | |
parent | 316f146cbab8ef411893c2495e9da2c9fe21e234 (diff) |
Modificaciones del icono y activity
-rw-r--r-- | activity.py | 117 | ||||
-rw-r--r-- | activity/icono.svg | 341 |
2 files changed, 419 insertions, 39 deletions
diff --git a/activity.py b/activity.py index a21938d..ff46269 100644 --- a/activity.py +++ b/activity.py @@ -1,3 +1,6 @@ +#!/usr/bin/python +# -*- encoding: utf-8 -*- + # Copyright 2013 Patricia Espinola y Victor Cubas # # This program is free software; you can redistribute it and/or modify @@ -18,6 +21,8 @@ import gtk import logging +import voice +import programa from gettext import gettext as _ @@ -29,6 +34,11 @@ from sugar.activity.widgets import TitleEntry from sugar.activity.widgets import StopButton from sugar.activity.widgets import ShareButton +label_opciones = ["Claro - Oscuro", "Joven - Anciano", "Gordo - Flaco", "Alto - Bajo", "Pequeño - Grande", "Feliz - Triste"] +listImagenes = ['gordo.jpg', 'flaco.jpg','alto.jpg', 'bajo.jpg'] +correct_option = [label_opciones[2], "Alto - Bajo"] + + class PiensaEscribeActivity(activity.Activity): """PiensaEscribe class as specified in activity.info""" @@ -73,54 +83,83 @@ class PiensaEscribeActivity(activity.Activity): # label with the text, make the string translatable def createGUI(self): - - correct_option = [3, 2] - #fila_option = 0 - #cantidad_imagenes = 2 - image_number = 0 + self.indice_opciones = 0 + self.indice_imagen = 0 + self.indice_resp_correcta = 0 vbox = gtk.VBox() hbox = gtk.HBox() - imagen1 = gtk.Image() - imagen1.set_from_file('gordo.jpg') - imagen2 = gtk.Image() - imagen2.set_from_file('flaco.jpg') - - button1 = gtk.Button() - button1.set_label('Claro - Oscuro') - button2 = gtk.Button() - button2.set_label('Joven - Anciano') - button3 = gtk.Button() - button3.set_label('Gordo - Flaco') - - button1.connect('enter', self.__sobre_boton_cb) - button2.connect('enter', self.__sobre_boton_cb) - button3.connect('enter', self.__sobre_boton_cb) - button1.connect('clicked', self.__correcto_cb, correct_option[0], 1) - button2.connect('clicked', self.__correcto_cb, correct_option[0], 2) - button3.connect('clicked', self.__correcto_cb, correct_option[0], 3) - - hbox.add(imagen1) - hbox.add(imagen2) + #window.set_default_size(100,100) vbox.add(hbox) - vbox.add(button1) - vbox.add(button2) - vbox.add(button3) - + + imagen1 = gtk.Image() + imagen2 = gtk.Image() + button1 = gtk.Button() + button2 = gtk.Button() + button3 = gtk.Button() + + imagen1.set_from_file(listImagenes[self.indice_imagen]) + self.indice_imagen += 1 + imagen2.set_from_file(listImagenes[self.indice_imagen]) + self.indice_imagen += 1 + + button1.set_label(label_opciones[self.indice_opciones]) + self.indice_opciones += 1 + button2.set_label(label_opciones[self.indice_opciones]) + self.indice_opciones += 1 + button3.set_label(label_opciones[self.indice_opciones]) + self.indice_opciones += 1 + + button1.connect('enter', self.__sobre_boton_cb) + button2.connect('enter', self.__sobre_boton_cb) + button3.connect('enter', self.__sobre_boton_cb) + button1.connect('clicked', self.__correcto_cb, correct_option[self.indice_resp_correcta], imagen1, + imagen2, button1, button2, button3) + button2.connect('clicked', self.__correcto_cb, correct_option[self.indice_resp_correcta], imagen1, + imagen2, button1, button2, button3) + button3.connect('clicked', self.__correcto_cb, correct_option[self.indice_resp_correcta], imagen1, + imagen2, button1, button2, button3) + + + hbox.add(imagen1) + hbox.add(imagen2) + vbox.add(button1) + vbox.add(button2) + vbox.add(button3) + self.set_canvas(vbox) vbox.show_all() + def resetear(self, imagen1, imagen2, button1, button2, button3): + imagen1.set_from_file(listImagenes[self.indice_imagen]) + self.indice_imagen += 1 + imagen2.set_from_file(listImagenes[self.indice_imagen]) + self.indice_imagen += 1 + + button1.set_label(label_opciones[self.indice_opciones]) + self.indice_opciones += 1 + button2.set_label(label_opciones[self.indice_opciones]) + self.indice_opciones += 1 + button3.set_label(label_opciones[self.indice_opciones]) + self.indice_opciones += 1 + print self.indice_resp_correcta + self.indice_resp_correcta += 1 + print self.indice_resp_correcta + + def __correcto_cb(self, button, clave, imagen1, imagen2, button1, button2, button3): + if button.get_label() == clave: + #print clave + voice.say('Opcion correcta') + #self.indice_resp_correcta += 1 + self.resetear(imagen1, imagen2, button1, button2, button3) + print self.indice_resp_correcta + else: + print clave + voice.say('Opcion incorrecta') - def __correcto_cb(self, button, correct_option, clave): - if correct_option == clave: - voice.say('opcion - correcta') - else: - voice.say('opcion - incorrecta') - + def __sobre_boton_cb(self, button): voice.say(button.get_label()) + -if __name__ == "__main__": - my_app = PiensaEscribeActivity() - gtk.main() diff --git a/activity/icono.svg b/activity/icono.svg new file mode 100644 index 0000000..5ffc03c --- /dev/null +++ b/activity/icono.svg @@ -0,0 +1,341 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<!-- Created with Inkscape (http://www.inkscape.org/) --> + +<svg + xmlns:dc="http://purl.org/dc/elements/1.1/" + xmlns:cc="http://creativecommons.org/ns#" + 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" + version="1.1" + width="643.92487" + height="492.30716" + id="svg2"> + <defs + id="defs4"> + <marker + markerUnits="strokeWidth" + markerWidth="1" + markerHeight="1" + orient="auto" + viewBox="0 0 1 1" + id="DefaultArrow2" + style="overflow:visible"> + <g + transform="scale(0.00925926,0.00925926)" + id="g2990"> + <path + d="M -9,54 -9,-54 117,0 z" + id="path2992" /> + </g> + </marker> + <marker + markerUnits="strokeWidth" + markerWidth="1" + markerHeight="1" + orient="auto" + viewBox="0 0 1 1" + id="DefaultArrow3" + style="overflow:visible"> + <g + transform="scale(0.00925926,0.00925926)" + id="g2995"> + <path + d="M -27,54 -9,0 -27,-54 135,0 z" + id="path2997" /> + </g> + </marker> + <marker + markerUnits="strokeWidth" + markerWidth="1" + markerHeight="1" + orient="auto" + viewBox="0 0 1 1" + id="DefaultArrow4" + style="overflow:visible"> + <g + transform="scale(0.00925926,0.00925926)" + id="g3000"> + <path + d="m -9,0 0,-45 c 0,-6.708 11.808,-11.58 18,-9 l 108,45 c 3.916,1.631 9,4.758 9,9 0,4.242 -5.084,7.369 -9,9 L 9,54 C 2.808,56.58 -9,51.708 -9,45 z" + id="path3002" /> + </g> + </marker> + <marker + markerUnits="strokeWidth" + markerWidth="1" + markerHeight="1" + orient="auto" + viewBox="0 0 1 1" + id="DefaultArrow5" + style="overflow:visible"> + <g + transform="scale(0.00925926,0.00925926)" + id="g3005"> + <path + d="M -54,0 C -54,29.807 -29.807,54 0,54 29.807,54 54,29.807 54,0 54,-29.807 29.807,-54 0,-54 -29.807,-54 -54,-29.807 -54,0 z" + id="path3007" /> + </g> + </marker> + <marker + markerUnits="strokeWidth" + markerWidth="1" + markerHeight="1" + orient="auto" + viewBox="0 0 1 1" + id="DefaultArrow6" + style="overflow:visible"> + <g + transform="scale(0.00925926,0.00925926)" + id="g3010"> + <path + d="M -63,0 0,63 63,0 0,-63 z" + id="path3012" /> + </g> + </marker> + <marker + markerUnits="strokeWidth" + markerWidth="1" + markerHeight="1" + orient="auto" + viewBox="0 0 1 1" + id="DefaultArrow7" + style="overflow:visible"> + <g + transform="scale(0.00925926,0.00925926)" + id="g3015"> + <path + d="m 18,-54 90,0 L 63,0 108,54 18,54 -36,0 z" + id="path3017" /> + </g> + </marker> + <marker + markerUnits="strokeWidth" + markerWidth="1" + markerHeight="1" + orient="auto" + viewBox="0 0 1 1" + id="DefaultArrow8" + style="overflow:visible"> + <g + transform="scale(0.00925926,0.00925926)" + id="g3020"> + <path + d="m -36,0 54,-54 36,0 -36,36 9,0 36,-36 36,0 -36,36 9,0 36,-36 36,0 -54,54 54,54 -36,0 -36,-36 -9,0 36,36 -36,0 -36,-36 -9,0 36,36 -36,0 z" + id="path3022" /> + </g> + </marker> + <marker + markerUnits="strokeWidth" + markerWidth="1" + markerHeight="1" + orient="auto" + viewBox="0 0 1 1" + id="DefaultArrow9" + style="overflow:visible"> + <g + transform="scale(0.00925926,0.00925926)" + id="g3025"> + <path + d="M 0,45 -45,0 0,-45 45,0 z M 0,63 -63,0 0,-63 63,0 z" + id="path3027" /> + </g> + </marker> + <filter + color-interpolation-filters="sRGB" + id="StainedFilter"> + <feBlend + in2="BackgroundImage" + mode="multiply" + in="SourceGraphic" + result="blend" + id="feBlend3030" /> + <feComposite + in2="SourceAlpha" + operator="in" + in="blend" + result="comp" + id="feComposite3032" /> + </filter> + <filter + color-interpolation-filters="sRGB" + id="BleachFilter"> + <feBlend + in2="BackgroundImage" + mode="screen" + in="SourceGraphic" + result="blend" + id="feBlend3035" /> + <feComposite + in2="SourceAlpha" + operator="in" + in="blend" + result="comp" + id="feComposite3037" /> + </filter> + <filter + color-interpolation-filters="sRGB" + id="InvertTransparencyBitmapFilter"> + <feComponentTransfer + id="feComponentTransfer3040"> + <feFuncR + id="feFuncR3042" + offset="-0.055" + exponent=".416666666" + amplitude="1.055" + type="gamma" /> + <feFuncG + id="feFuncG3044" + offset="-0.055" + exponent=".416666666" + amplitude="1.055" + type="gamma" /> + <feFuncB + id="feFuncB3046" + offset="-0.055" + exponent=".416666666" + amplitude="1.055" + type="gamma" /> + </feComponentTransfer> + <feComponentTransfer + id="feComponentTransfer3048"> + <feFuncR + id="feFuncR3050" + intercept="1" + slope="-1" + type="linear" /> + <feFuncG + id="feFuncG3052" + intercept="1" + slope="-1" + type="linear" /> + <feFuncB + id="feFuncB3054" + intercept="1" + slope="-1" + type="linear" /> + <feFuncA + id="feFuncA3056" + intercept="0" + slope="1" + type="linear" /> + </feComponentTransfer> + <feComponentTransfer + id="feComponentTransfer3058"> + <feFuncR + id="feFuncR3060" + offset="0" + exponent="2.4" + amplitude="1" + type="gamma" /> + <feFuncG + id="feFuncG3062" + offset="0" + exponent="2.4" + amplitude="1" + type="gamma" /> + <feFuncB + id="feFuncB3064" + offset="0" + exponent="2.4" + amplitude="1" + type="gamma" /> + </feComponentTransfer> + </filter> + </defs> + <metadata + id="metadata7"> + <rdf:RDF> + <cc:Work + rdf:about=""> + <dc:format>image/svg+xml</dc:format> + <dc:type + rdf:resource="http://purl.org/dc/dcmitype/StillImage" /> + <dc:title></dc:title> + </cc:Work> + </rdf:RDF> + </metadata> + <g + transform="translate(-40.894697,-194.78004)" + id="layer1"> + <g + transform="matrix(0.93344388,0,0,0.91874991,45.734369,182.59496)" + id="layer1-9"> + <g + transform="matrix(1.6538628,0,0,-1.6106165,-20.027708,584.74584)" + id="Layer_1" + style="font-size:16px;fill:none;stroke:#000000;stroke-width:0.82703036;font-family:Times New Roman"> + <title + id="title3204">Lapiz Y Papel</title> + <path + d="m 141.509,328.159 c 73.908,40.665 166.896,13.687 207.562,-60.221 C 389.737,194.03 362.758,101.042 288.85,60.377 214.943,19.71 121.955,46.689 81.289,120.597 40.622,194.505 67.601,287.492 141.509,328.159 z" + id="path3069" + style="fill:#7f81ff;stroke:none;stroke-width:0.89200002;marker-start:none;marker-end:none" /> + <g + id="Group" + style="stroke:none"> + <path + d="m 383.308,45.817 c 22.245,79.582 30.994,160.468 23.476,242.926 L 181.964,310.47 C 231.878,235.494 180.467,147.674 158.488,67.544 l 224.82,-21.727 z" + id="path3072" + style="fill:#d4eef3;stroke-width:0.125;marker-start:none;marker-end:none" /> + <path + d="m 378.991,55.35 c 20.779,74.335 28.951,149.888 21.928,226.908 L 190.923,302.552 C 237.546,232.519 189.525,150.491 168.995,75.644 L 378.991,55.35 z" + id="path3074" + style="fill:#ffffff;stroke-width:0.116;marker-start:none;marker-end:none" /> + </g> + <g + id="Group_1" + style="stroke-width:0.82703036"> + <path + d="m 265.512,150.867 -33.957,51.889 -28.166,-44.528 62.123,-7.361 z" + id="path3077" + style="fill:#000000;stroke:none;stroke-width:0.52200001;marker-start:none;marker-end:none" /> + <path + d="m 249.231,176.322 -0.24,-0.306 -6.97,-1.787 2.142,-7.08 -7.077,-0.258 2.847,-6.43 -7.615,-0.646 3.504,-5.892 -69.604,5.16 c -24.496,41.361 -11.144,66.979 47.105,74.622 l 35.908,-57.383 z" + id="path3079" + style="fill:#e69138;stroke:none;stroke-width:0.13500001;marker-start:none;marker-end:none" /> + <path + d="M 100.273,303.929 70.059,323.09 c -3.287,2.086 -7.647,1.107 -9.727,-2.184 l -39.16,-61.907 c -2.081,-3.291 -1.102,-7.655 2.188,-9.741 l 30.212,-19.162 c 3.288,-2.086 7.647,-1.106 9.73,2.184 l 39.157,61.908 c 2.083,3.291 1.103,7.655 -2.186,9.741 z" + id="path3081" + style="fill:#c80505;stroke:none;stroke-width:0.13500001;marker-start:none;marker-end:none" /> + <path + d="m 244.904,178.987 -0.238,-0.307 -6.971,-1.786 2.144,-7.079 -7.077,-0.259 2.845,-6.429 -7.614,-0.647 3.503,-5.893 -69.604,5.161 c -24.495,41.361 -11.144,66.978 47.105,74.622 l 35.907,-57.383 z" + id="path3083" + style="fill:#febe7c;stroke:none;stroke-width:0.13500001;marker-start:none;marker-end:none" /> + <path + d="m 100.88,251.016 0.02,0.028 0.477,-0.303 13.103,20.718 -0.145,0.092 0.017,0.028 0.147,-0.093 11.118,17.577 88.484,-56.117 -29.216,-6.168 14.871,-21.696 -28.492,1.189 15.499,-24.135 -28.861,2.737 0.117,-0.075 -0.017,-0.029 -0.176,0.112 -0.086,0.009 10.321,-26.786 -89.595,56.417 9.357,14.793 -0.282,0.18 0.018,0.028 0.282,-0.179 13.517,21.37 -0.478,0.303 z" + id="path3085" + style="fill:#ff8200;stroke:none;stroke-width:1.09599996;marker-start:none;marker-end:none" /> + <path + d="m 100.335,251.739 0.018,0.027 0.433,-0.278 11.885,18.822 -0.133,0.085 0.016,0.026 0.134,-0.086 10.082,15.969 80.462,-51.169 -26.539,-5.563 13.535,-19.753 -25.89,1.122 14.109,-21.971 -26.707,1.427 9.739,-23.255 -81.47,51.442 8.486,13.438 -0.257,0.165 0.016,0.024 0.257,-0.163 12.259,19.413 -0.435,0.278 z" + id="path3087" + style="fill:#ffea00;stroke:none;stroke-width:0.99699998;marker-start:none;marker-end:none" /> + <path + d="m 98.015,300.144 -27.224,17.267 c -2.963,1.879 -6.891,0.998 -8.767,-1.967 L 26.739,259.661 c -1.876,-2.967 -0.993,-6.898 1.971,-8.778 l 27.223,-17.266 c 2.963,-1.879 6.891,-0.998 8.767,1.969 l 35.285,55.781 c 1.875,2.967 0.993,6.899 -1.97,8.777 z" + id="path3089" + style="fill:#e21111;stroke:none;stroke-width:0.122;marker-start:none;marker-end:none" /> + <path + d="m 120.895,285.732 74.626,-48.216 -20.717,-5.41 -63.107,38.62 9.198,15.006 z m -40.844,-65.322 7.189,10.966 61.991,-40.637 7.81,-18.584 -76.99,48.255 z m 20.147,32.052 10.819,16.249 62.423,-38.989 12.094,-17.115 -22.268,1.014 -63.068,38.841 z m -1.677,-2.084 63.092,-39.382 11.507,-18.838 -22.049,1.369 -61.374,39.104 8.824,17.747 z" + id="path3091" + style="fill:#fffe7f;stroke:#ffffff;stroke-width:0.09097333;stroke-miterlimit:79.84031677;marker-start:none;marker-end:none" /> + <g + id="Group_2" + style="fill:#12100f;stroke:none"> + <path + d="m 125.682,288.575 c -9.901,9.19 -19.48,15.444 -28.664,18.177 L 49.973,232.379 c 7.861,-7.625 16.882,-14.178 28.665,-18.179 l 47.044,74.375 z" + id="path3094" + style="marker-start:none;marker-end:none" /> + </g> + <g + id="Group_3" + style="fill:#3a3732;stroke:none"> + <path + d="m 120.926,286.649 c -8.128,7.797 -16.08,13.009 -23.816,15.116 L 54.463,234.316 c 6.441,-6.481 13.908,-11.975 23.816,-15.115 l 42.647,67.448 z" + id="path3097" + style="marker-start:none;marker-end:none" /> + </g> + </g> + </g> + </g> + </g> +</svg> |