From 85d207608d9ea2e3888539195792c5e7c07b4102 Mon Sep 17 00:00:00 2001 From: flavio Date: Wed, 11 Apr 2012 19:13:59 +0000 Subject: Camino a la Plata --- diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..81f8dd0 --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +*.pyc +*.pyo +*.??~ diff --git a/CaminoAlaPlata.py b/CaminoAlaPlata.py new file mode 100644 index 0000000..fa681eb --- /dev/null +++ b/CaminoAlaPlata.py @@ -0,0 +1,178 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- + +# CaminoAlaPlata.py por: +# Flavio Danesse +# CeibalJAM! - Uruguay + +# 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 time +import sys +import gobject +import os +from Widgets import * +import Globals as G + +class CaminoAlaPlata(gtk.Window): + def __init__(self): + gtk.Window.__init__(self, gtk.WINDOW_TOPLEVEL) + self.set_title("Camino a la Plata") + self.set_icon_from_file(os.path.join(G.ICONOS, "caminoalaplata-ico.png")) + self.modify_bg(gtk.STATE_NORMAL, G.FONDO) + self.set_size_request(G.WIDTH,G.HEIGHT) + self.set_border_width(5) + self.set_position(gtk.WIN_POS_CENTER) + self.set_resizable(True) + + self.toolbar = None + self.tablaperiodica = None + + self.set_layout() + self.show_all() + + self.connect("delete_event", self.delete_event) + + def set_layout(self): + vbox = gtk.VBox() + self.toolbar = Toolbar1() + self.tablaperiodica = TablaPeriodica() + vbox.pack_start(self.toolbar, False, False, 0) + vbox.pack_start(self.tablaperiodica, True, True, 0) + + self.add(vbox) + + def delete_event(self, widget, event, data=None): + self.salir() + return False + + def salir(self, widget= None, event= None): + sys.exit(0) + +class Toolbar1(gtk.Toolbar): + def __init__(self): + gtk.Toolbar.__init__(self) + self.modify_bg(gtk.STATE_NORMAL, G.NEGRO) + + ''' + separator = gtk.SeparatorToolItem() + separator.props.draw = False + separator.set_size_request(5, -1) + separator.set_expand(False) + self.insert(separator, -1)''' + + boton = gtk.ToolButton() + imagen = gtk.Image() + pixbuf = gtk.gdk.pixbuf_new_from_file_at_size(os.path.join(G.ICONOS, + "atomo.png"), 32, 32) + imagen.set_from_pixbuf(pixbuf) + boton.set_icon_widget(imagen) + imagen.show() + self.insert(boton, -1) + boton.show() + #tooltips = gtk.Tooltips() + #tooltips.set_tip(boton, _("Detener Grabación."), tip_private=None) + #boton.connect("clicked", self.ok_callback) + + ''' + separator = gtk.SeparatorToolItem() + separator.props.draw = False + separator.set_size_request(5, -1) + separator.set_expand(False) + self.insert(separator, -1)''' + + boton = gtk.ToolButton() + imagen = gtk.Image() + pixbuf = gtk.gdk.pixbuf_new_from_file_at_size(os.path.join(G.ICONOS, + "caminoalaplata-ico.png"), 32, 32) + imagen.set_from_pixbuf(pixbuf) + boton.set_icon_widget(imagen) + imagen.show() + self.insert(boton, -1) + boton.show() + #tooltips = gtk.Tooltips() + #tooltips.set_tip(boton, _("Detener Grabación."), tip_private=None) + #boton.connect("clicked", self.ok_callback) + + separator = gtk.SeparatorToolItem() + separator.props.draw = False + separator.set_size_request(0, -1) + separator.set_expand(True) + self.insert(separator, -1) + + imagen = gtk.Image() + pixbuf = gtk.gdk.pixbuf_new_from_file(os.path.join(G.ICONOS, + 'ceibaljam.png')) + imagen.set_from_pixbuf(pixbuf) + imagen.show() + item = gtk.ToolItem() + item.add(imagen) + self.insert(item, -1) + + separator = gtk.SeparatorToolItem() + separator.props.draw = False + separator.set_size_request(5, -1) + separator.set_expand(False) + self.insert(separator, -1) + + imagen = gtk.Image() + pixbuf = gtk.gdk.pixbuf_new_from_file(os.path.join(G.ICONOS, + 'uruguay.png')) + imagen.set_from_pixbuf(pixbuf) + imagen.show() + item = gtk.ToolItem() + item.add(imagen) + self.insert(item, -1) + + separator = gtk.SeparatorToolItem() + separator.props.draw = False + separator.set_size_request(5, -1) + separator.set_expand(False) + self.insert(separator, -1) + + imagen = gtk.Image() + pixbuf = gtk.gdk.pixbuf_new_from_file(os.path.join(G.ICONOS, + 'licencia.png')) + imagen.set_from_pixbuf(pixbuf) + imagen.show() + item = gtk.ToolItem() + item.add(imagen) + self.insert(item, -1) + + separator = gtk.SeparatorToolItem() + separator.props.draw = False + separator.set_size_request(0, -1) + separator.set_expand(True) + self.insert(separator, -1) + + boton = gtk.ToolButton() + imagen = gtk.Image() + pixbuf = gtk.gdk.pixbuf_new_from_file_at_size(os.path.join(G.ICONOS, + "salir.png"), 32, 32) + imagen.set_from_pixbuf(pixbuf) + boton.set_icon_widget(imagen) + imagen.show() + self.insert(boton, -1) + boton.show() + #tooltips = gtk.Tooltips() + #tooltips.set_tip(boton, _("Detener Grabación."), tip_private=None) + #boton.connect("clicked", self.ok_callback) + + self.show_all() + +if __name__=="__main__": + CaminoAlaPlata() + gtk.main() diff --git a/Docs/Tabla_elementos.svg b/Docs/Tabla_elementos.svg new file mode 100644 index 0000000..0b8af61 --- /dev/null +++ b/Docs/Tabla_elementos.svg @@ -0,0 +1,528 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + 13 + 14 + 15 + 16 + 17 + 18 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + H + 1 + Li + Na + K + Rb + Cs + Fr + 3 + 11 + 19 + 37 + 55 + 87 + 2 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 12 + 13 + 14 + 15 + 16 + 17 + 18 + 20 + 21 + 22 + 23 + 24 + 25 + 26 + 27 + 28 + 29 + 30 + 31 + 32 + 33 + 34 + 35 + 36 + 38 + 39 + 40 + 41 + 42 + 43 + 44 + 45 + 46 + 47 + 48 + 49 + 50 + 51 + 52 + 53 + 54 + 56 + 72 + 73 + 74 + 75 + 76 + 77 + 78 + 79 + 80 + 81 + 82 + 83 + 84 + 85 + 86 + 88 + 104 + 105 + 106 + 107 + 108 + 109 + 110 + 111 + 112 + 113 + 114 + 115 + 116 + 117 + 118 + Be + Mg + Ca + Sr + Ba + Ra + Sc + Y + Ti + Zr + Hf + Rf + V + Nb + Ta + Db + Cr + Mo + W + Sg + Mn + Tc + Re + Bh + Fe + Ru + Os + Hs + Co + Rh + Ir + Mt + Ni + Pd + Pt + Ds + Cu + Ag + Au + Rg + Zn + Cd + Hg + Cn + B + Al + Ga + In + Tl + Uut + C + N + O + F + He + Ne + Ar + Kr + Xe + Rn + Uuo + Si + Ge + Sn + Pb + Uuq + P + As + Sb + Bi + Uup + S + Se + Te + Po + Uuh + Cl + Br + I + At + Uus + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Lantánidos + Actínidos + 57 + 58 + 59 + 60 + 61 + 62 + 63 + 64 + 65 + 66 + 67 + 68 + 69 + 70 + 71 + 89 + 90 + 91 + 92 + 93 + 94 + 95 + 96 + 97 + 98 + 99 + 100 + 101 + 102 + 103 + La + Ce + Pr + Nd + Pm + Ac + Th + Pa + U + Np + Sm + Pu + Eu + Am + Gd + Cm + Tb + Bk + Dy + Cf + Ho + Es + Er + Fm + Tm + Md + Yb + No + Lu + Lr + Grupo + Periodo + + + + diff --git a/Docs/Tarjetas....doc b/Docs/Tarjetas....doc new file mode 100644 index 0000000..dac435e --- /dev/null +++ b/Docs/Tarjetas....doc Binary files differ diff --git a/Globals.py b/Globals.py new file mode 100644 index 0000000..fac6fe5 --- /dev/null +++ b/Globals.py @@ -0,0 +1,370 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- + +# Globals.py por: +# Flavio Danesse +# CeibalJAM! - Uruguay + +# 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 os + +GRIS = gtk.gdk.Color(60156, 60156, 60156, 1) +ROJO = gtk.gdk.Color(65000,0,0,1) +NARANJA = gtk.gdk.Color(65000,49705,0,1) +VERDEOSCURO = gtk.gdk.Color(43588, 50980, 14019, 1) +VERDECLARO = gtk.gdk.Color(0, 60000, 0, 1) +VERDELIMON = gtk.gdk.Color(50725, 65000, 21666, 1) +ROSADOCLARO = gtk.gdk.Color(65000,43333,43333,1) +ROSADOOSCURO = gtk.gdk.Color(65000,20000,43333,1) +CELESTE = gtk.gdk.Color(0, 44352, 65000,1) +CELESTECLARO = gtk.gdk.Color(50725, 65000, 62450,1) +AMARILLO = gtk.gdk.Color(65000,65000,0,1) + +BLANCO = gtk.gdk.Color(65000, 65000, 65000,1) +NEGRO = gtk.gdk.Color(0, 0, 0, 1) +FONDO = gtk.gdk.Color(29823, 42568, 43333, 1) + +WIDTH= 640 +HEIGHT= 480 +BUTTONS= 45 + +DIRECTORIO_BASE = os.path.dirname(__file__) +ICONOS = os.path.join(DIRECTORIO_BASE, "Iconos/") + +COLORS = [(VERDELIMON,[1,6,7,8,15,16,34]), (NARANJA,[3,11,19,37,55,87]), +(VERDEOSCURO,[5,14,32,33,51,52,84]), (VERDECLARO,[2,10,18,36,54,86,118]), +(ROSADOCLARO,[57,58,59,60,61,62,63,64,65,66,67,68,69,70,71]), +(AMARILLO,[21,22,23,24,25,26,27,28,29,30,39,40,41,42,43,44,45,46,47,48, +72,73,74,75,76,77,78,79,80,104,105,106,107,108,109,110,111,112]), +(ROJO,[9,17,35,53,85,117]),(GRIS,[13,31,49,50,81,82,83,113,114,115,116]), +(ROSADOOSCURO,[89,90,91,92,93,94,95,96,97,98,99,100,101,102,103]), +(CELESTECLARO,[4,12,20,38,56,88])] + +INDICEELEMENTOS = [ +[1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2], +[3,4,0,0,0,0,0,0,0,0,0,0,5,6,7,8,9,10], +[11,12,0,0,0,0,0,0,0,0,0,0,13,14,15,16,17,18], +[19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36], +[37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54], +[55,56,57,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86], +[87,88,89,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118], +[0,0,0,0,58,59,60,61,62,63,64,65,66,67,68,69,70,71], +[0,0,0,0,90,91,92,93,94,95,96,97,98,99,100,101,102,103] +] + +ELEMENTOS = [ +{"nombre":"hidrogeno","simbolo":"H","Z":1,"masa": 1.00}, +{"nombre":"helio","simbolo":"He","Z":2,"masa":4.00}, +{"nombre":"litio","simbolo":"Li","Z":3,"masa":6.94}, +{"nombre":"berilio","simbolo":"Be","Z":4,"masa":9.01}, +{"nombre":"boro","simbolo":"B","Z":5,"masa":10.81}, +{"nombre":"carbono","simbolo":"C","Z":6,"masa":12.01}, +{"nombre":"nitrogeno","simbolo":"N","Z":7,"masa":14.01}, +{"nombre":"oxigeno","simbolo":"O","Z":8,"masa":16.00}, +{"nombre":"fluor","simbolo":"F","Z":9,"masa":19.00}, +{"nombre":"neon","simbolo":"Ne","Z":10,"masa":20.18}, +{"nombre":"sodio","simbolo":"Na","Z":11,"masa":23.00}, +{"nombre":"magnesio","simbolo":"Mg","Z":12,"masa":24.31}, +{"nombre":"aluminio","simbolo":"Al","Z":13,"masa":26.98}, +{"nombre":"silicio","simbolo":"Si","Z":14,"masa":28.09}, +{"nombre":"fosforo","simbolo":"P","Z":15,"masa":30.97}, +{"nombre":"azufre","simbolo":"S","Z":16,"masa":32.06}, +{"nombre":"cloro","simbolo":"Cl","Z":17,"masa":35.45}, +{"nombre":"argon","simbolo":"Ar","Z":18,"masa":39.95}, +{"nombre":"potasio","simbolo":"K","Z":19,"masa":39.10}, +{"nombre":"calcio","simbolo":"Ca","Z":20,"masa":40.08}, +{"nombre":"escandio","simbolo":"Sc","Z":21,"masa":44.96}, +{"nombre":"titanio","simbolo":"Ti","Z":22,"masa":47.88}, +{"nombre":"vanadio","simbolo":"V","Z":23,"masa":50.94}, +{"nombre":"cromo","simbolo":"Cr","Z":24,"masa":52.00}, +{"nombre":"manganeso","simbolo":"Mn","Z":25,"masa":54.94}, +{"nombre":"hierro","simbolo":"Fe","Z":26,"masa":55.85}, +{"nombre":"cobalto","simbolo":"Co","Z":27,"masa":58.93}, +{"nombre":"niquel","simbolo":"Ni","Z":28,"masa":58.71}, +{"nombre":"cobre","simbolo":"Cu","Z":29,"masa":63.54}, +{"nombre":"zinc","simbolo":"Zn","Z":30,"masa":65.37}, +{"nombre":"galio","simbolo":"Ga","Z":31,"masa":69.72}, +{"nombre":"germanio","simbolo":"Ge","Z":32,"masa":72.59}, +{"nombre":"arsenico","simbolo":"As","Z":33,"masa":74.92}, +{"nombre":"selenio","simbolo":"Se","Z":34,"masa":78.96}, +{"nombre":"bromo","simbolo":"Br","Z":35,"masa":79.91}, +{"nombre":"kripton","simbolo":"Kr","Z":36,"masa":83.80}, +{"nombre":"rubidio","simbolo":"Rb","Z":37,"masa":85.47}, +{"nombre":"estroncio","simbolo":"Sr","Z":38,"masa":87.62}, +{"nombre":"itrio","simbolo":"Y","Z":39,"masa":88.91}, +{"nombre":"zirconio","simbolo":"Zr","Z":40,"masa":91.22}, +{"nombre":"niobio","simbolo":"Nb","Z":41,"masa":92.91}, +{"nombre":"molibdeno","simbolo":"Mo","Z":42,"masa":95.94}, +{"nombre":"tecnecio","simbolo":"Tc","Z":43,"masa":"(99)"}, +{"nombre":"rutenio","simbolo":"Ru","Z":44,"masa":101.07}, +{"nombre":"rodio","simbolo":"Rh","Z":45,"masa":102.91}, +{"nombre":"paladio","simbolo":"Pd","Z":46,"masa":106.4}, +{"nombre":"plata","simbolo":"Ag","Z":47,"masa":107.87}, +{"nombre":"cadmio","simbolo":"Cd","Z":48,"masa":112.40}, +{"nombre":"indio","simbolo":"In","Z":49,"masa":114.82}, +{"nombre":"estaño","simbolo":"Sn","Z":50,"masa":118.69}, +{"nombre":"antimonio","simbolo":"Sb","Z":51,"masa":121.75}, +{"nombre":"telurio","simbolo":"Te","Z":52,"masa":127.60}, +{"nombre":"Yodo","simbolo":"I","Z":53,"masa":126.90}, +{"nombre":"xenon","simbolo":"Xe","Z":54,"masa":131.30}, +{"nombre":"cesio","simbolo":"Cs","Z":55,"masa":132.91}, +{"nombre":"bario","simbolo":"Ba","Z":56,"masa":137.33}, +{"nombre":"lantano","simbolo":"La","Z":57,"masa":138.91}, +{"nombre":"cerio","simbolo":"Ce","Z":58,"masa":140.12}, +{"nombre":"praseodimio","simbolo":"Pr","Z":59,"masa":140.91}, +{"nombre":"neodimio","simbolo":"Nd","Z":60,"masa":144.24}, +{"nombre":"prometio","simbolo":"Pm","Z":61,"masa":147.0}, +{"nombre":"samario","simbolo":"Sm","Z":62,"masa":150.35}, +{"nombre":"europio","simbolo":"Eu","Z":63,"masa":151.96}, +{"nombre":"gadolinio","simbolo":"Gd","Z":64,"masa":157.25}, +{"nombre":"terbio","simbolo":"Tb","Z":65,"masa":158.92}, +{"nombre":"disprosio","simbolo":"Dy","Z":66,"masa":162.50}, +{"nombre":"holmio","simbolo":"Ho","Z":67,"masa":164.93}, +{"nombre":"erbio","simbolo":"Er","Z":68,"masa":167.26}, +{"nombre":"tulio","simbolo":"Tm","Z":69,"masa":168.93}, +{"nombre":"yterbio","simbolo":"Yb","Z":70,"masa":173.04}, +{"nombre":"lutecio","simbolo":"Lu","Z":71,"masa":174.97}, +{"nombre":"hafnio","simbolo":"Hf","Z":72,"masa":178.49}, +{"nombre":"tantalo","simbolo":"Ta","Z":73,"masa":180.94}, +{"nombre":"wolframio","simbolo":"W","Z":74,"masa":183.85}, +{"nombre":"renio","simbolo":"Re","Z":75,"masa":186.20}, +{"nombre":"osmio","simbolo":"Os","Z":76,"masa":190.2}, +{"nombre":"iridio","simbolo":"Ir","Z":77,"masa":192.2}, +{"nombre":"platino","simbolo":"Pt","Z":78,"masa":195.09}, +{"nombre":"oro","simbolo":"Au","Z":79,"masa":196.97}, +{"nombre":"mercurio","simbolo":"Hg","Z":80,"masa":200.59}, +{"nombre":"talio","simbolo":"Tl","Z":81,"masa":204.38}, +{"nombre":"plomo","simbolo":"Pb","Z":81,"masa":207.19}, +{"nombre":"bismuto","simbolo":"Bi","Z":82,"masa":208.98}, +{"nombre":"polonio","simbolo":"Po","Z":84,"masa":210.0}, +{"nombre":"astato","simbolo":"At","Z":85,"masa":210.0}, +{"nombre":"radon","simbolo":"Rn","Z":86,"masa":222.0}, +{"nombre":"francio","simbolo":"Fr","Z":87,"masa":223.0}, +{"nombre":"radio","simbolo":"Ra","Z":88,"masa":226.03}, +{"nombre":"actinio","simbolo":"Ac","Z":89,"masa":227.03}, +{"nombre":"torio","simbolo":"Th","Z":90,"masa":232.03}, +{"nombre":"protactinio","simbolo":"Pa","Z":91,"masa":231.04}, +{"nombre":"uranio","simbolo":"U","Z":92,"masa":238.03}, +{"nombre":"neptunio","simbolo":"Np","Z":93,"masa":237.05}, +{"nombre":"plutonio","simbolo":"Pu","Z":94,"masa":242.0}, +{"nombre":"americio","simbolo":"Am","Z":95,"masa":243.0}, +{"nombre":"curio","simbolo":"Cm","Z":96,"masa":247.0}, +{"nombre":"berkelio","simbolo":"Bk","Z":97,"masa":247.0}, +{"nombre":"californio","simbolo":"Cf","Z":98,"masa":251.0}, +{"nombre":"einstenio","simbolo":"Es","Z":99,"masa":254.0}, +{"nombre":"fermio","simbolo":"Fm","Z":100,"masa":258.0}, +{"nombre":"mendelevio","simbolo":"Md","Z":101,"masa":256.0}, +{"nombre":"nobelio","simbolo":"No","Z":102,"masa":259.0}, +{"nombre":"laurencio","simbolo":"Lr","Z":103,"masa":257.0}, +{"nombre":"rutherforio","simbolo":"Rf","Z":104,"masa":261.0}, +{"nombre":"dubnio","simbolo":"Db","Z":105,"masa":262.0}, +{"nombre":"seaborgio","simbolo":"Sg","Z":106,"masa":263.0}, +{"nombre":"bohrio","simbolo":"Bh","Z":107,"masa":262.0}, +{"nombre":"hassio","simbolo":"Hs","Z":108,"masa":265.0}, +{"nombre":"meitnerio","simbolo":"Mt","Z":109,"masa":266.0}, +{"nombre":"darmstadtio","simbolo":"Ds","Z":110,"masa":269.0}, +{"nombre":"roentgenio","simbolo":"Rg","Z":111,"masa":272.0}, +{"nombre":"ununbio","simbolo":"Uub","Z":112,"masa":277.0}, +{"nombre":"ununtrio","simbolo":"Uut","Z":113,"masa":284.0}, +{"nombre":"flevorio","simbolo":"Fl","Z":114,"masa":289.0}, +{"nombre":"ununpentio","simbolo":"Uup","Z":115,"masa":288.0}, +{"nombre":"livermorio","simbolo":"Lv","Z":116,"masa":293.0}, +{"nombre":"ununseptio","simbolo":"Uus","Z":117,"masa":291.0}, +{"nombre":"ununoctio","simbolo":"Uuo","Z":118,"masa":294.0}] + +''' +{"elemento":4, Automáticamente avanzan 3 espacios. +"pregunta":None, +"opciones":[], +"respuesta": None}''' + +PREGUNTAS = [None, +{"elemento":1, +"pregunta":"¿Cómo se llama el cambio del estado sólido a gaseoso?", +"opciones":["Disposición", "Ebullición", "Fusión", "Sublimación", "Reacción", "Licuación", "Deposición", "Tamización"], +"respuesta": 3}, + +{"elemento":2, +"pregunta":"Marcar la característica del modelo atómico de Bohr que es correcta:", +"opciones":["Los neutrones ocuparían el núcleo.", "Cada protón tiene la capacidad de moverse.", +"No considera la existencia de espacio vacío.", "Se le conoce como modelo de budín de pasas.", +"Los neutrones se moverían en órbitas circulares.", "La energía de cada electrón depende de su distancia al núcleo."], +"respuesta": 5}, + +{"elemento":3, +"pregunta":"¿Qué es una ecuación química?", +"opciones":["Una forma de representar una reacción.", "Una ecuación matemática adaptada a la química.", +"Una reacción química.", "La escritura de una fórmula química.", +"La forma de nombrar un cambio físico.", "Ninguna de las respuestas anteriores corresponde a su definición."], +"respuesta": 0}, + +None, + +{"elemento":5, +"pregunta":"¿Qué es un período en la tabla periódica?", +"opciones":["El tiempo que va desde que se descubre un elemento hasta que se elige su nombre.", +"Una forma de expresar cantidad de electrones de valencia.", +"Una secuencia de cuadros en vertical.","Una secuencia de cuadros en horizontal.", +"Un conjunto de elementos cuyos símbolos no son oficiales.", +"Ninguna de las respuestas anteriores corresponde a su definición."], +"respuesta": 3}, + +{"elemento":6, +"pregunta":"¿Qué es una solución desde el punto de vista químico?", +"opciones":["Una forma de determinar los electrones por nivel de energía en un átomo.", +"Una mezcla heterogénea de 2 o más sustancias.", +"La correcta igualación de una ecuación química.","Una operación de fraccionamiento.", +"Un método de separación de fases.", +"Ninguna de las respuestas anteriores corresponde a su definición."], +"respuesta": 5}, + +{"elemento":7, +"pregunta":"¿Cuál es la concentración aproximada de una solución que tiene 24,0g de soluto y un volumen de 74cm3?", +"opciones":["98g/L","98L/g","No se puede determinar con estos datos.","0,307g/L","307g/L","3,25L/g"], +"respuesta": 4}, + +{"elemento":8, +"pregunta":"¿Qué método de separación de fases utilizarías para separa un sistema formado por agua y aceite?", +"opciones":["Filtración.","Centrifugación.","Cromatografía.","Tamización.","Decantación.","Imantación.","Destilación."], +"respuesta": 4}, + +{"elemento":9, +"pregunta":"¿Qué es una fórmula química?", +"opciones":["Una forma de representar un átomo.","Una forma de representar una sustancia.", +"Una reacción química.","Una forma de representar una reacción", +"Una expresión que se emplea para realizar cálculos.", "Un sinónimo de sustancia."], +"respuesta": 1}, + +{"elemento":10, +"pregunta":"¿Qué es un nucleón?", +"opciones":["Una partícula subatómica que tiene carga positiva.", +"Una partícula subatómica que tiene núcleo.", +"Una partícula subatómica que tiene carga negativa","Una partícula subatómica que no tiene núcleo.", +"Una partícula subatómica que no tiene carga.", "Una partícula subatómica que está en el núcleo."], +"respuesta": 5}, + +None, +None, +None, +None, +None, +None, +None, +None, +None, +None, +None, +None, +None, +None, +None, +None, +None, +None, +None, +None, +None, +None, +None, +None, +None, +None, +None, +None, +None, +None, +None, +None, +None, +None, +None, +None, +None, +None, +None, +None, +None, +None, +None, +None, +None, +None, +None, +None, +None, +None, +None, +None, +None, +None, +None, +None, +None, +None, +None, +None, +None, +None, +None, +None, +None, +None, +None, +None, +None, +None, +None, +None, +None, +None, +None, +None, +None, +None, +None, +None, +None, +None, +None, +None, +None, +None, +None, +None, +None, +None, +None, +None, +None, +None, +None, +None, +None, +None, +None, +None, +None, +None, +None, +None, +None, +None, +None, +None, +None, +] + diff --git a/Iconos/atomo.png b/Iconos/atomo.png new file mode 100644 index 0000000..f3bde8e --- /dev/null +++ b/Iconos/atomo.png Binary files differ diff --git a/Iconos/caminoalaplata-ico.png b/Iconos/caminoalaplata-ico.png new file mode 100644 index 0000000..d99079c --- /dev/null +++ b/Iconos/caminoalaplata-ico.png Binary files differ diff --git a/Iconos/caminoalaplata.png b/Iconos/caminoalaplata.png new file mode 100644 index 0000000..fd1c55a --- /dev/null +++ b/Iconos/caminoalaplata.png Binary files differ diff --git a/Iconos/ceibaljam.png b/Iconos/ceibaljam.png new file mode 100644 index 0000000..d5917ed --- /dev/null +++ b/Iconos/ceibaljam.png Binary files differ diff --git a/Iconos/licencia.png b/Iconos/licencia.png new file mode 100644 index 0000000..2c4a38a --- /dev/null +++ b/Iconos/licencia.png Binary files differ diff --git a/Iconos/salir.png b/Iconos/salir.png new file mode 100644 index 0000000..2330d0b --- /dev/null +++ b/Iconos/salir.png Binary files differ diff --git a/Iconos/uruguay.png b/Iconos/uruguay.png new file mode 100644 index 0000000..ff71b2f --- /dev/null +++ b/Iconos/uruguay.png Binary files differ diff --git a/Widgets.py b/Widgets.py new file mode 100644 index 0000000..2eca4b0 --- /dev/null +++ b/Widgets.py @@ -0,0 +1,167 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- + +# Widgets.py por: +# Flavio Danesse +# CeibalJAM! - Uruguay + +# 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 time +import sys +import gobject +import os +import Globals as G + +class ButtonElemento(gtk.EventBox): + __gsignals__ = {"clicked":(gobject.SIGNAL_RUN_FIRST, gobject.TYPE_NONE, (gobject.TYPE_PYOBJECT, ))} + def __init__(self, diccionario): + gtk.EventBox.__init__(self) + self.set_visible_window(True) + #self.modify_bg(gtk.STATE_NORMAL, G.BLANCO) + self.set_border_width(1) + + # http://developer.gnome.org/pygtk/stable/gdk-constants.html#gdk-event-mask-constants + self.add_events(gtk.gdk.BUTTON_PRESS_MASK | gtk.gdk.BUTTON_RELEASE_MASK | gtk.gdk.POINTER_MOTION_MASK | + gtk.gdk.ENTER_NOTIFY_MASK | gtk.gdk.LEAVE_NOTIFY_MASK) + + self.connect("button_press_event", self.button_press) + self.connect("button_release_event", self.button_release) + self.connect("enter-notify-event", self.enter_notify_event) + self.connect("leave-notify-event", self.leave_notify_event) + + self.tamanio = (0,0) + self.normalcolor = G.AMARILLO + self.selectlocor = G.BLANCO + self.clickedcolor = G.NARANJA + self.modify_bg(gtk.STATE_NORMAL, self.normalcolor) + + self.elementoquimico = diccionario + self.add(gtk.Label(self.elementoquimico["simbolo"])) + texto = "" + for key in self.elementoquimico.keys(): + texto += "%s = %s%s" % (key, self.elementoquimico[key], "\n") + self.set_tooltip(texto) + self.show_all() + + # --------------------------- EVENTOS -------------------------- + def button_release(self, widget, event): + self.modify_bg(gtk.STATE_NORMAL, self.selectlocor) + def leave_notify_event(self, widget, event): + self.modify_bg(gtk.STATE_NORMAL, self.normalcolor) + def enter_notify_event(self, widget, event): + self.modify_bg(gtk.STATE_NORMAL, self.selectlocor) + def button_press(self, widget, event): + if event.button == 1: + self.modify_bg(gtk.STATE_NORMAL, self.clickedcolor) + self.emit("clicked", event) + # --------------------------- EVENTOS -------------------------- + + # --------------------------- SETEOS --------------------------- + def set_tooltip(self, texto): + tooltips = gtk.Tooltips() + tooltips.set_tip(self, texto, tip_private=None) + + def set_tamanio(self, w, h): + if self.tamanio != (w,h): + self.tamanio = (w,h) + self.set_size_request(w,h) + # --------------------------- SETEOS --------------------------- + +''' +class ElementoenJuego(ButtonElemento): + def __init__(self, diccionario): + ButtonElemento.__init__(self, diccionario) + + self.pregunta = None + self.opciones = [] + self.respuesta = None + + preguntas = G.PREGUNTAS[self.elementoquimico["Z"]] + if preguntas: + self.pregunta = preguntas["pregunta"] + for opcion in preguntas["opciones"]: + self.opciones.append( opcion ) + self.respuesta = preguntas["opciones"][preguntas["respuesta"]] + + #if self.pregunta: + # print self.pregunta + # for opcion in self.opciones: + # print opcion + # print "Respuesta:", self.respuesta''' + +class TablaPeriodica(gtk.EventBox): + def __init__(self): + gtk.EventBox.__init__(self) + self.set_visible_window(True) + self.modify_bg(gtk.STATE_NORMAL, G.FONDO) + + self.fixed = None + self.filasdeelementos = None + self.tamanios = (0,0) + + self.set_layout() + self.show_all() + + self.connect("expose_event", self.repaint) + + def set_layout(self): + self.fixed = gtk.Fixed() + estructura = G.INDICEELEMENTOS + elementos = G.ELEMENTOS + self.filasdeelementos = [] + for linea in estructura: + fila = [] + for index in linea: + if index: + boton = ButtonElemento(elementos[index-1])#ElementoenJuego(elementos[index-1]) + self.set_colores(boton) + self.fixed.put(boton,0,0) + boton.show_all() + fila.append(boton) + else: + fila.append(None) + self.filasdeelementos.append(fila) + self.add(self.fixed) + + def set_colores(self, boton): + for elemen in G.COLORS: + color, indices = elemen + if boton.elementoquimico["Z"] in indices: + boton.normalcolor = color + boton.modify_bg(gtk.STATE_NORMAL, boton.normalcolor) + ''' + def get_elementos(self): + elementos = [] + for fila in self.filasdeelementos: + for elemento in fila: + elementos.append(elemento) + return elementos''' + + def repaint(self, widget= None, event= None): + x,y,w,h= self.get_allocation() + if self.tamanios == (w/18,h/10): return True + self.tamanios = (w/18,h/10) + x, y = (0,0) + for line in self.filasdeelementos: + for boton in line: + if boton != None: + boton.set_tamanio(self.tamanios[0], self.tamanios[1]) + self.fixed.move(boton,x,y) + x += self.tamanios[0] + x = 0 + y += self.tamanios[1] + return True -- cgit v0.9.1