Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbcorrales <bcorrales@bcorrales-laptop.(none)>2010-10-02 06:31:17 (GMT)
committer bcorrales <bcorrales@bcorrales-laptop.(none)>2010-10-02 06:31:17 (GMT)
commit17701f0339836556d3a4755b0483c5ca798b4d4c (patch)
tree0ac4f904c28e45aa2295682cc40f9e20d32f7204
parent64d21265674705e04148a355c8bdc65fb79c9f47 (diff)
Agregando la actividad y adaptando el menu
-rwxr-xr-xconozco-nicaragua.activity/COPYING674
-rwxr-xr-xconozco-nicaragua.activity/MANIFEST424
-rwxr-xr-xconozco-nicaragua.activity/MANIFEST.in6
-rw-r--r--conozco-nicaragua.activity/NEWS60
-rwxr-xr-xconozco-nicaragua.activity/POTFILES.in1
-rwxr-xr-xconozco-nicaragua.activity/TODO3
-rwxr-xr-xconozco-nicaragua.activity/activity.py9
-rw-r--r--conozco-nicaragua.activity/activity.pycbin0 -> 668 bytes
-rwxr-xr-xconozco-nicaragua.activity/activity/activity-conozcouy.svg10
-rwxr-xr-xconozco-nicaragua.activity/activity/activity-olpcgames.svg65
-rwxr-xr-xconozco-nicaragua.activity/activity/activity.info8
-rwxr-xr-xconozco-nicaragua.activity/activity/activity.info.bak8
-rwxr-xr-xconozco-nicaragua.activity/activity/activity.svg74
-rwxr-xr-xconozco-nicaragua.activity/activity/activity.svg.bak70
-rwxr-xr-xconozco-nicaragua.activity/activity/activity.svg~70
-rwxr-xr-xconozco-nicaragua.activity/conozcouy.py1752
-rw-r--r--conozco-nicaragua.activity/conozcouy.pycbin0 -> 50706 bytes
-rw-r--r--conozco-nicaragua.activity/dist/ConozcoUruguay-3.xobin0 -> 579165 bytes
-rw-r--r--conozco-nicaragua.activity/dist/ConozcoUruguay-4.xobin0 -> 579165 bytes
-rw-r--r--conozco-nicaragua.activity/dist/ConozcoUruguay-5.xobin0 -> 865468 bytes
-rw-r--r--conozco-nicaragua.activity/dist/ConozcoUruguay-6.xobin0 -> 865320 bytes
-rw-r--r--conozco-nicaragua.activity/dist/ConozcoUruguay-7.xobin0 -> 647969 bytes
-rw-r--r--conozco-nicaragua.activity/dist/ConozcoUruguay-8.xobin0 -> 723033 bytes
-rw-r--r--conozco-nicaragua.activity/dist/ConozcoUruguay-9.xobin0 -> 2178202 bytes
-rwxr-xr-xconozco-nicaragua.activity/dist/conozco-uruguay-1.xobin0 -> 368233 bytes
-rwxr-xr-xconozco-nicaragua.activity/dist/conozco-uruguay-2.xobin0 -> 581304 bytes
-rwxr-xr-xconozco-nicaragua.activity/olpcgames/COPYING24
-rwxr-xr-xconozco-nicaragua.activity/olpcgames/__init__.py102
-rw-r--r--conozco-nicaragua.activity/olpcgames/__init__.pycbin0 -> 3744 bytes
-rwxr-xr-xconozco-nicaragua.activity/olpcgames/_cairoimage.py135
-rwxr-xr-xconozco-nicaragua.activity/olpcgames/_gtkmain.py70
-rwxr-xr-xconozco-nicaragua.activity/olpcgames/_version.py2
-rw-r--r--conozco-nicaragua.activity/olpcgames/_version.pycbin0 -> 264 bytes
-rwxr-xr-xconozco-nicaragua.activity/olpcgames/activity.py241
-rw-r--r--conozco-nicaragua.activity/olpcgames/activity.pycbin0 -> 10505 bytes
-rwxr-xr-xconozco-nicaragua.activity/olpcgames/buildmanifest.py33
-rwxr-xr-xconozco-nicaragua.activity/olpcgames/camera.py221
-rwxr-xr-xconozco-nicaragua.activity/olpcgames/canvas.py171
-rw-r--r--conozco-nicaragua.activity/olpcgames/canvas.pycbin0 -> 6653 bytes
-rwxr-xr-xconozco-nicaragua.activity/olpcgames/data/__init__.py36
-rwxr-xr-xconozco-nicaragua.activity/olpcgames/data/sleeping_svg.py61
-rwxr-xr-xconozco-nicaragua.activity/olpcgames/dbusproxy.py93
-rwxr-xr-xconozco-nicaragua.activity/olpcgames/eventwrap.py388
-rw-r--r--conozco-nicaragua.activity/olpcgames/eventwrap.pycbin0 -> 16434 bytes
-rwxr-xr-xconozco-nicaragua.activity/olpcgames/gtkEvent.py289
-rw-r--r--conozco-nicaragua.activity/olpcgames/gtkEvent.pycbin0 -> 11288 bytes
-rwxr-xr-xconozco-nicaragua.activity/olpcgames/mesh.py583
-rw-r--r--conozco-nicaragua.activity/olpcgames/mesh.pycbin0 -> 24425 bytes
-rwxr-xr-xconozco-nicaragua.activity/olpcgames/pangofont.py346
-rwxr-xr-xconozco-nicaragua.activity/olpcgames/pausescreen.py116
-rwxr-xr-xconozco-nicaragua.activity/olpcgames/svgsprite.py84
-rwxr-xr-xconozco-nicaragua.activity/olpcgames/textsprite.py40
-rwxr-xr-xconozco-nicaragua.activity/olpcgames/util.py79
-rw-r--r--conozco-nicaragua.activity/olpcgames/util.pycbin0 -> 3546 bytes
-rwxr-xr-xconozco-nicaragua.activity/olpcgames/video.py178
-rwxr-xr-xconozco-nicaragua.activity/po/POTFILES.in4
-rwxr-xr-xconozco-nicaragua.activity/recursos/0uruguay/datos/ciudades.txt91
-rwxr-xr-xconozco-nicaragua.activity/recursos/0uruguay/datos/cuchillas.txt9
-rwxr-xr-xconozco-nicaragua.activity/recursos/0uruguay/datos/departamentos.txt25
-rwxr-xr-xconozco-nicaragua.activity/recursos/0uruguay/datos/exploraciones.txt43
-rwxr-xr-xconozco-nicaragua.activity/recursos/0uruguay/datos/niveles.txt254
-rwxr-xr-xconozco-nicaragua.activity/recursos/0uruguay/datos/rios.txt32
-rwxr-xr-xconozco-nicaragua.activity/recursos/0uruguay/datos/rutas.txt16
-rw-r--r--conozco-nicaragua.activity/recursos/0uruguay/imagenes/LICENSE9
-rwxr-xr-xconozco-nicaragua.activity/recursos/0uruguay/imagenes/cuchillas.pngbin0 -> 85228 bytes
-rwxr-xr-xconozco-nicaragua.activity/recursos/0uruguay/imagenes/cuchillasDetectar.pngbin0 -> 7772 bytes
-rwxr-xr-xconozco-nicaragua.activity/recursos/0uruguay/imagenes/deptos.pngbin0 -> 59915 bytes
-rwxr-xr-xconozco-nicaragua.activity/recursos/0uruguay/imagenes/deptosLineas.pngbin0 -> 41887 bytes
-rwxr-xr-xconozco-nicaragua.activity/recursos/0uruguay/imagenes/fondo.pngbin0 -> 40650 bytes
-rwxr-xr-xconozco-nicaragua.activity/recursos/0uruguay/imagenes/rios.pngbin0 -> 96875 bytes
-rwxr-xr-xconozco-nicaragua.activity/recursos/0uruguay/imagenes/riosDetectar.pngbin0 -> 39127 bytes
-rwxr-xr-xconozco-nicaragua.activity/recursos/0uruguay/imagenes/rutas.pngbin0 -> 50611 bytes
-rwxr-xr-xconozco-nicaragua.activity/recursos/0uruguay/imagenes/rutasDetectar.pngbin0 -> 16388 bytes
-rw-r--r--conozco-nicaragua.activity/recursos/0uruguay/nombre.txt1
-rwxr-xr-xconozco-nicaragua.activity/recursos/comun/datos/creditos.txt12
-rw-r--r--conozco-nicaragua.activity/recursos/comun/datos/presentacion.txt4
-rw-r--r--conozco-nicaragua.activity/recursos/comun/fuentes/AllCaps.ttfbin0 -> 51996 bytes
-rw-r--r--conozco-nicaragua.activity/recursos/comun/fuentes/Share-Regular.ttfbin0 -> 112376 bytes
-rw-r--r--conozco-nicaragua.activity/recursos/comun/imagenes/LICENSE10
-rw-r--r--conozco-nicaragua.activity/recursos/comun/imagenes/alerta.pngbin0 -> 49020 bytes
-rw-r--r--conozco-nicaragua.activity/recursos/comun/imagenes/alertarojo.pngbin0 -> 8573 bytes
-rwxr-xr-xconozco-nicaragua.activity/recursos/comun/imagenes/bicho.pngbin0 -> 13297 bytes
-rw-r--r--conozco-nicaragua.activity/recursos/comun/imagenes/bichofrente.pngbin0 -> 13353 bytes
-rw-r--r--conozco-nicaragua.activity/recursos/comun/imagenes/bichopestanas.pngbin0 -> 12498 bytes
-rw-r--r--conozco-nicaragua.activity/recursos/comun/imagenes/bichotriste.pngbin0 -> 15602 bytes
-rwxr-xr-xconozco-nicaragua.activity/recursos/comun/imagenes/capital.pngbin0 -> 667 bytes
-rwxr-xr-xconozco-nicaragua.activity/recursos/comun/imagenes/cerro.pngbin0 -> 680 bytes
-rwxr-xr-xconozco-nicaragua.activity/recursos/comun/imagenes/ciudad.pngbin0 -> 273 bytes
-rwxr-xr-xconozco-nicaragua.activity/recursos/comun/imagenes/fuego1.pngbin0 -> 2322 bytes
-rwxr-xr-xconozco-nicaragua.activity/recursos/comun/imagenes/fuego2.pngbin0 -> 2084 bytes
-rwxr-xr-xconozco-nicaragua.activity/recursos/comun/imagenes/globito.pngbin0 -> 1583 bytes
-rwxr-xr-xconozco-nicaragua.activity/recursos/comun/imagenes/localidad.pngbin0 -> 388 bytes
-rwxr-xr-xconozco-nicaragua.activity/recursos/comun/imagenes/nave1.pngbin0 -> 538 bytes
-rwxr-xr-xconozco-nicaragua.activity/recursos/comun/imagenes/nave2.pngbin0 -> 737 bytes
-rwxr-xr-xconozco-nicaragua.activity/recursos/comun/imagenes/nave3.pngbin0 -> 940 bytes
-rwxr-xr-xconozco-nicaragua.activity/recursos/comun/imagenes/nave4.pngbin0 -> 1291 bytes
-rwxr-xr-xconozco-nicaragua.activity/recursos/comun/imagenes/nave5.pngbin0 -> 1599 bytes
-rwxr-xr-xconozco-nicaragua.activity/recursos/comun/imagenes/nave6.pngbin0 -> 1651 bytes
-rwxr-xr-xconozco-nicaragua.activity/recursos/comun/imagenes/nave7.pngbin0 -> 1687 bytes
-rw-r--r--conozco-nicaragua.activity/recursos/comun/imagenes/navellegando.pngbin0 -> 4701 bytes
-rw-r--r--conozco-nicaragua.activity/recursos/comun/imagenes/paracaidas.pngbin0 -> 1210 bytes
-rw-r--r--conozco-nicaragua.activity/recursos/comun/imagenes/pedazo1.pngbin0 -> 406 bytes
-rw-r--r--conozco-nicaragua.activity/recursos/comun/imagenes/pedazo2.pngbin0 -> 388 bytes
-rw-r--r--conozco-nicaragua.activity/recursos/comun/imagenes/terron.pngbin0 -> 11964 bytes
-rw-r--r--conozco-nicaragua.activity/recursos/comun/imagenes/tierra.pngbin0 -> 5790 bytes
-rw-r--r--conozco-nicaragua.activity/recursos/comun/sonidos/NoiseCollector_boom2.oggbin0 -> 52406 bytes
-rw-r--r--conozco-nicaragua.activity/recursos/comun/sonidos/chirp_alerta.oggbin0 -> 7533 bytes
-rwxr-xr-xconozco-nicaragua.activity/recursos/comun/sonidos/junggle_btn045.wavbin0 -> 22028 bytes
-rwxr-xr-xconozco-nicaragua.activity/run.py41
-rwxr-xr-xconozco-nicaragua.activity/setup.py4
110 files changed, 7081 insertions, 0 deletions
diff --git a/conozco-nicaragua.activity/COPYING b/conozco-nicaragua.activity/COPYING
new file mode 100755
index 0000000..94a9ed0
--- /dev/null
+++ b/conozco-nicaragua.activity/COPYING
@@ -0,0 +1,674 @@
+ GNU GENERAL PUBLIC LICENSE
+ Version 3, 29 June 2007
+
+ Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+ Preamble
+
+ The GNU General Public License is a free, copyleft license for
+software and other kinds of works.
+
+ The licenses for most software and other practical works are designed
+to take away your freedom to share and change the works. By contrast,
+the GNU General Public License is intended to guarantee your freedom to
+share and change all versions of a program--to make sure it remains free
+software for all its users. We, the Free Software Foundation, use the
+GNU General Public License for most of our software; it applies also to
+any other work released this way by its authors. You can apply it to
+your programs, too.
+
+ When we speak of free software, we are referring to freedom, not
+price. Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+them if you wish), that you receive source code or can get it if you
+want it, that you can change the software or use pieces of it in new
+free programs, and that you know you can do these things.
+
+ To protect your rights, we need to prevent others from denying you
+these rights or asking you to surrender the rights. Therefore, you have
+certain responsibilities if you distribute copies of the software, or if
+you modify it: responsibilities to respect the freedom of others.
+
+ For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must pass on to the recipients the same
+freedoms that you received. You must make sure that they, too, receive
+or can get the source code. And you must show them these terms so they
+know their rights.
+
+ Developers that use the GNU GPL protect your rights with two steps:
+(1) assert copyright on the software, and (2) offer you this License
+giving you legal permission to copy, distribute and/or modify it.
+
+ For the developers' and authors' protection, the GPL clearly explains
+that there is no warranty for this free software. For both users' and
+authors' sake, the GPL requires that modified versions be marked as
+changed, so that their problems will not be attributed erroneously to
+authors of previous versions.
+
+ Some devices are designed to deny users access to install or run
+modified versions of the software inside them, although the manufacturer
+can do so. This is fundamentally incompatible with the aim of
+protecting users' freedom to change the software. The systematic
+pattern of such abuse occurs in the area of products for individuals to
+use, which is precisely where it is most unacceptable. Therefore, we
+have designed this version of the GPL to prohibit the practice for those
+products. If such problems arise substantially in other domains, we
+stand ready to extend this provision to those domains in future versions
+of the GPL, as needed to protect the freedom of users.
+
+ Finally, every program is threatened constantly by software patents.
+States should not allow patents to restrict development and use of
+software on general-purpose computers, but in those that do, we wish to
+avoid the special danger that patents applied to a free program could
+make it effectively proprietary. To prevent this, the GPL assures that
+patents cannot be used to render the program non-free.
+
+ The precise terms and conditions for copying, distribution and
+modification follow.
+
+ TERMS AND CONDITIONS
+
+ 0. Definitions.
+
+ "This License" refers to version 3 of the GNU General Public License.
+
+ "Copyright" also means copyright-like laws that apply to other kinds of
+works, such as semiconductor masks.
+
+ "The Program" refers to any copyrightable work licensed under this
+License. Each licensee is addressed as "you". "Licensees" and
+"recipients" may be individuals or organizations.
+
+ To "modify" a work means to copy from or adapt all or part of the work
+in a fashion requiring copyright permission, other than the making of an
+exact copy. The resulting work is called a "modified version" of the
+earlier work or a work "based on" the earlier work.
+
+ A "covered work" means either the unmodified Program or a work based
+on the Program.
+
+ To "propagate" a work means to do anything with it that, without
+permission, would make you directly or secondarily liable for
+infringement under applicable copyright law, except executing it on a
+computer or modifying a private copy. Propagation includes copying,
+distribution (with or without modification), making available to the
+public, and in some countries other activities as well.
+
+ To "convey" a work means any kind of propagation that enables other
+parties to make or receive copies. Mere interaction with a user through
+a computer network, with no transfer of a copy, is not conveying.
+
+ An interactive user interface displays "Appropriate Legal Notices"
+to the extent that it includes a convenient and prominently visible
+feature that (1) displays an appropriate copyright notice, and (2)
+tells the user that there is no warranty for the work (except to the
+extent that warranties are provided), that licensees may convey the
+work under this License, and how to view a copy of this License. If
+the interface presents a list of user commands or options, such as a
+menu, a prominent item in the list meets this criterion.
+
+ 1. Source Code.
+
+ The "source code" for a work means the preferred form of the work
+for making modifications to it. "Object code" means any non-source
+form of a work.
+
+ A "Standard Interface" means an interface that either is an official
+standard defined by a recognized standards body, or, in the case of
+interfaces specified for a particular programming language, one that
+is widely used among developers working in that language.
+
+ The "System Libraries" of an executable work include anything, other
+than the work as a whole, that (a) is included in the normal form of
+packaging a Major Component, but which is not part of that Major
+Component, and (b) serves only to enable use of the work with that
+Major Component, or to implement a Standard Interface for which an
+implementation is available to the public in source code form. A
+"Major Component", in this context, means a major essential component
+(kernel, window system, and so on) of the specific operating system
+(if any) on which the executable work runs, or a compiler used to
+produce the work, or an object code interpreter used to run it.
+
+ The "Corresponding Source" for a work in object code form means all
+the source code needed to generate, install, and (for an executable
+work) run the object code and to modify the work, including scripts to
+control those activities. However, it does not include the work's
+System Libraries, or general-purpose tools or generally available free
+programs which are used unmodified in performing those activities but
+which are not part of the work. For example, Corresponding Source
+includes interface definition files associated with source files for
+the work, and the source code for shared libraries and dynamically
+linked subprograms that the work is specifically designed to require,
+such as by intimate data communication or control flow between those
+subprograms and other parts of the work.
+
+ The Corresponding Source need not include anything that users
+can regenerate automatically from other parts of the Corresponding
+Source.
+
+ The Corresponding Source for a work in source code form is that
+same work.
+
+ 2. Basic Permissions.
+
+ All rights granted under this License are granted for the term of
+copyright on the Program, and are irrevocable provided the stated
+conditions are met. This License explicitly affirms your unlimited
+permission to run the unmodified Program. The output from running a
+covered work is covered by this License only if the output, given its
+content, constitutes a covered work. This License acknowledges your
+rights of fair use or other equivalent, as provided by copyright law.
+
+ You may make, run and propagate covered works that you do not
+convey, without conditions so long as your license otherwise remains
+in force. You may convey covered works to others for the sole purpose
+of having them make modifications exclusively for you, or provide you
+with facilities for running those works, provided that you comply with
+the terms of this License in conveying all material for which you do
+not control copyright. Those thus making or running the covered works
+for you must do so exclusively on your behalf, under your direction
+and control, on terms that prohibit them from making any copies of
+your copyrighted material outside their relationship with you.
+
+ Conveying under any other circumstances is permitted solely under
+the conditions stated below. Sublicensing is not allowed; section 10
+makes it unnecessary.
+
+ 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
+
+ No covered work shall be deemed part of an effective technological
+measure under any applicable law fulfilling obligations under article
+11 of the WIPO copyright treaty adopted on 20 December 1996, or
+similar laws prohibiting or restricting circumvention of such
+measures.
+
+ When you convey a covered work, you waive any legal power to forbid
+circumvention of technological measures to the extent such circumvention
+is effected by exercising rights under this License with respect to
+the covered work, and you disclaim any intention to limit operation or
+modification of the work as a means of enforcing, against the work's
+users, your or third parties' legal rights to forbid circumvention of
+technological measures.
+
+ 4. Conveying Verbatim Copies.
+
+ You may convey verbatim copies of the Program's source code as you
+receive it, in any medium, provided that you conspicuously and
+appropriately publish on each copy an appropriate copyright notice;
+keep intact all notices stating that this License and any
+non-permissive terms added in accord with section 7 apply to the code;
+keep intact all notices of the absence of any warranty; and give all
+recipients a copy of this License along with the Program.
+
+ You may charge any price or no price for each copy that you convey,
+and you may offer support or warranty protection for a fee.
+
+ 5. Conveying Modified Source Versions.
+
+ You may convey a work based on the Program, or the modifications to
+produce it from the Program, in the form of source code under the
+terms of section 4, provided that you also meet all of these conditions:
+
+ a) The work must carry prominent notices stating that you modified
+ it, and giving a relevant date.
+
+ b) The work must carry prominent notices stating that it is
+ released under this License and any conditions added under section
+ 7. This requirement modifies the requirement in section 4 to
+ "keep intact all notices".
+
+ c) You must license the entire work, as a whole, under this
+ License to anyone who comes into possession of a copy. This
+ License will therefore apply, along with any applicable section 7
+ additional terms, to the whole of the work, and all its parts,
+ regardless of how they are packaged. This License gives no
+ permission to license the work in any other way, but it does not
+ invalidate such permission if you have separately received it.
+
+ d) If the work has interactive user interfaces, each must display
+ Appropriate Legal Notices; however, if the Program has interactive
+ interfaces that do not display Appropriate Legal Notices, your
+ work need not make them do so.
+
+ A compilation of a covered work with other separate and independent
+works, which are not by their nature extensions of the covered work,
+and which are not combined with it such as to form a larger program,
+in or on a volume of a storage or distribution medium, is called an
+"aggregate" if the compilation and its resulting copyright are not
+used to limit the access or legal rights of the compilation's users
+beyond what the individual works permit. Inclusion of a covered work
+in an aggregate does not cause this License to apply to the other
+parts of the aggregate.
+
+ 6. Conveying Non-Source Forms.
+
+ You may convey a covered work in object code form under the terms
+of sections 4 and 5, provided that you also convey the
+machine-readable Corresponding Source under the terms of this License,
+in one of these ways:
+
+ a) Convey the object code in, or embodied in, a physical product
+ (including a physical distribution medium), accompanied by the
+ Corresponding Source fixed on a durable physical medium
+ customarily used for software interchange.
+
+ b) Convey the object code in, or embodied in, a physical product
+ (including a physical distribution medium), accompanied by a
+ written offer, valid for at least three years and valid for as
+ long as you offer spare parts or customer support for that product
+ model, to give anyone who possesses the object code either (1) a
+ copy of the Corresponding Source for all the software in the
+ product that is covered by this License, on a durable physical
+ medium customarily used for software interchange, for a price no
+ more than your reasonable cost of physically performing this
+ conveying of source, or (2) access to copy the
+ Corresponding Source from a network server at no charge.
+
+ c) Convey individual copies of the object code with a copy of the
+ written offer to provide the Corresponding Source. This
+ alternative is allowed only occasionally and noncommercially, and
+ only if you received the object code with such an offer, in accord
+ with subsection 6b.
+
+ d) Convey the object code by offering access from a designated
+ place (gratis or for a charge), and offer equivalent access to the
+ Corresponding Source in the same way through the same place at no
+ further charge. You need not require recipients to copy the
+ Corresponding Source along with the object code. If the place to
+ copy the object code is a network server, the Corresponding Source
+ may be on a different server (operated by you or a third party)
+ that supports equivalent copying facilities, provided you maintain
+ clear directions next to the object code saying where to find the
+ Corresponding Source. Regardless of what server hosts the
+ Corresponding Source, you remain obligated to ensure that it is
+ available for as long as needed to satisfy these requirements.
+
+ e) Convey the object code using peer-to-peer transmission, provided
+ you inform other peers where the object code and Corresponding
+ Source of the work are being offered to the general public at no
+ charge under subsection 6d.
+
+ A separable portion of the object code, whose source code is excluded
+from the Corresponding Source as a System Library, need not be
+included in conveying the object code work.
+
+ A "User Product" is either (1) a "consumer product", which means any
+tangible personal property which is normally used for personal, family,
+or household purposes, or (2) anything designed or sold for incorporation
+into a dwelling. In determining whether a product is a consumer product,
+doubtful cases shall be resolved in favor of coverage. For a particular
+product received by a particular user, "normally used" refers to a
+typical or common use of that class of product, regardless of the status
+of the particular user or of the way in which the particular user
+actually uses, or expects or is expected to use, the product. A product
+is a consumer product regardless of whether the product has substantial
+commercial, industrial or non-consumer uses, unless such uses represent
+the only significant mode of use of the product.
+
+ "Installation Information" for a User Product means any methods,
+procedures, authorization keys, or other information required to install
+and execute modified versions of a covered work in that User Product from
+a modified version of its Corresponding Source. The information must
+suffice to ensure that the continued functioning of the modified object
+code is in no case prevented or interfered with solely because
+modification has been made.
+
+ If you convey an object code work under this section in, or with, or
+specifically for use in, a User Product, and the conveying occurs as
+part of a transaction in which the right of possession and use of the
+User Product is transferred to the recipient in perpetuity or for a
+fixed term (regardless of how the transaction is characterized), the
+Corresponding Source conveyed under this section must be accompanied
+by the Installation Information. But this requirement does not apply
+if neither you nor any third party retains the ability to install
+modified object code on the User Product (for example, the work has
+been installed in ROM).
+
+ The requirement to provide Installation Information does not include a
+requirement to continue to provide support service, warranty, or updates
+for a work that has been modified or installed by the recipient, or for
+the User Product in which it has been modified or installed. Access to a
+network may be denied when the modification itself materially and
+adversely affects the operation of the network or violates the rules and
+protocols for communication across the network.
+
+ Corresponding Source conveyed, and Installation Information provided,
+in accord with this section must be in a format that is publicly
+documented (and with an implementation available to the public in
+source code form), and must require no special password or key for
+unpacking, reading or copying.
+
+ 7. Additional Terms.
+
+ "Additional permissions" are terms that supplement the terms of this
+License by making exceptions from one or more of its conditions.
+Additional permissions that are applicable to the entire Program shall
+be treated as though they were included in this License, to the extent
+that they are valid under applicable law. If additional permissions
+apply only to part of the Program, that part may be used separately
+under those permissions, but the entire Program remains governed by
+this License without regard to the additional permissions.
+
+ When you convey a copy of a covered work, you may at your option
+remove any additional permissions from that copy, or from any part of
+it. (Additional permissions may be written to require their own
+removal in certain cases when you modify the work.) You may place
+additional permissions on material, added by you to a covered work,
+for which you have or can give appropriate copyright permission.
+
+ Notwithstanding any other provision of this License, for material you
+add to a covered work, you may (if authorized by the copyright holders of
+that material) supplement the terms of this License with terms:
+
+ a) Disclaiming warranty or limiting liability differently from the
+ terms of sections 15 and 16 of this License; or
+
+ b) Requiring preservation of specified reasonable legal notices or
+ author attributions in that material or in the Appropriate Legal
+ Notices displayed by works containing it; or
+
+ c) Prohibiting misrepresentation of the origin of that material, or
+ requiring that modified versions of such material be marked in
+ reasonable ways as different from the original version; or
+
+ d) Limiting the use for publicity purposes of names of licensors or
+ authors of the material; or
+
+ e) Declining to grant rights under trademark law for use of some
+ trade names, trademarks, or service marks; or
+
+ f) Requiring indemnification of licensors and authors of that
+ material by anyone who conveys the material (or modified versions of
+ it) with contractual assumptions of liability to the recipient, for
+ any liability that these contractual assumptions directly impose on
+ those licensors and authors.
+
+ All other non-permissive additional terms are considered "further
+restrictions" within the meaning of section 10. If the Program as you
+received it, or any part of it, contains a notice stating that it is
+governed by this License along with a term that is a further
+restriction, you may remove that term. If a license document contains
+a further restriction but permits relicensing or conveying under this
+License, you may add to a covered work material governed by the terms
+of that license document, provided that the further restriction does
+not survive such relicensing or conveying.
+
+ If you add terms to a covered work in accord with this section, you
+must place, in the relevant source files, a statement of the
+additional terms that apply to those files, or a notice indicating
+where to find the applicable terms.
+
+ Additional terms, permissive or non-permissive, may be stated in the
+form of a separately written license, or stated as exceptions;
+the above requirements apply either way.
+
+ 8. Termination.
+
+ You may not propagate or modify a covered work except as expressly
+provided under this License. Any attempt otherwise to propagate or
+modify it is void, and will automatically terminate your rights under
+this License (including any patent licenses granted under the third
+paragraph of section 11).
+
+ However, if you cease all violation of this License, then your
+license from a particular copyright holder is reinstated (a)
+provisionally, unless and until the copyright holder explicitly and
+finally terminates your license, and (b) permanently, if the copyright
+holder fails to notify you of the violation by some reasonable means
+prior to 60 days after the cessation.
+
+ Moreover, your license from a particular copyright holder is
+reinstated permanently if the copyright holder notifies you of the
+violation by some reasonable means, this is the first time you have
+received notice of violation of this License (for any work) from that
+copyright holder, and you cure the violation prior to 30 days after
+your receipt of the notice.
+
+ Termination of your rights under this section does not terminate the
+licenses of parties who have received copies or rights from you under
+this License. If your rights have been terminated and not permanently
+reinstated, you do not qualify to receive new licenses for the same
+material under section 10.
+
+ 9. Acceptance Not Required for Having Copies.
+
+ You are not required to accept this License in order to receive or
+run a copy of the Program. Ancillary propagation of a covered work
+occurring solely as a consequence of using peer-to-peer transmission
+to receive a copy likewise does not require acceptance. However,
+nothing other than this License grants you permission to propagate or
+modify any covered work. These actions infringe copyright if you do
+not accept this License. Therefore, by modifying or propagating a
+covered work, you indicate your acceptance of this License to do so.
+
+ 10. Automatic Licensing of Downstream Recipients.
+
+ Each time you convey a covered work, the recipient automatically
+receives a license from the original licensors, to run, modify and
+propagate that work, subject to this License. You are not responsible
+for enforcing compliance by third parties with this License.
+
+ An "entity transaction" is a transaction transferring control of an
+organization, or substantially all assets of one, or subdividing an
+organization, or merging organizations. If propagation of a covered
+work results from an entity transaction, each party to that
+transaction who receives a copy of the work also receives whatever
+licenses to the work the party's predecessor in interest had or could
+give under the previous paragraph, plus a right to possession of the
+Corresponding Source of the work from the predecessor in interest, if
+the predecessor has it or can get it with reasonable efforts.
+
+ You may not impose any further restrictions on the exercise of the
+rights granted or affirmed under this License. For example, you may
+not impose a license fee, royalty, or other charge for exercise of
+rights granted under this License, and you may not initiate litigation
+(including a cross-claim or counterclaim in a lawsuit) alleging that
+any patent claim is infringed by making, using, selling, offering for
+sale, or importing the Program or any portion of it.
+
+ 11. Patents.
+
+ A "contributor" is a copyright holder who authorizes use under this
+License of the Program or a work on which the Program is based. The
+work thus licensed is called the contributor's "contributor version".
+
+ A contributor's "essential patent claims" are all patent claims
+owned or controlled by the contributor, whether already acquired or
+hereafter acquired, that would be infringed by some manner, permitted
+by this License, of making, using, or selling its contributor version,
+but do not include claims that would be infringed only as a
+consequence of further modification of the contributor version. For
+purposes of this definition, "control" includes the right to grant
+patent sublicenses in a manner consistent with the requirements of
+this License.
+
+ Each contributor grants you a non-exclusive, worldwide, royalty-free
+patent license under the contributor's essential patent claims, to
+make, use, sell, offer for sale, import and otherwise run, modify and
+propagate the contents of its contributor version.
+
+ In the following three paragraphs, a "patent license" is any express
+agreement or commitment, however denominated, not to enforce a patent
+(such as an express permission to practice a patent or covenant not to
+sue for patent infringement). To "grant" such a patent license to a
+party means to make such an agreement or commitment not to enforce a
+patent against the party.
+
+ If you convey a covered work, knowingly relying on a patent license,
+and the Corresponding Source of the work is not available for anyone
+to copy, free of charge and under the terms of this License, through a
+publicly available network server or other readily accessible means,
+then you must either (1) cause the Corresponding Source to be so
+available, or (2) arrange to deprive yourself of the benefit of the
+patent license for this particular work, or (3) arrange, in a manner
+consistent with the requirements of this License, to extend the patent
+license to downstream recipients. "Knowingly relying" means you have
+actual knowledge that, but for the patent license, your conveying the
+covered work in a country, or your recipient's use of the covered work
+in a country, would infringe one or more identifiable patents in that
+country that you have reason to believe are valid.
+
+ If, pursuant to or in connection with a single transaction or
+arrangement, you convey, or propagate by procuring conveyance of, a
+covered work, and grant a patent license to some of the parties
+receiving the covered work authorizing them to use, propagate, modify
+or convey a specific copy of the covered work, then the patent license
+you grant is automatically extended to all recipients of the covered
+work and works based on it.
+
+ A patent license is "discriminatory" if it does not include within
+the scope of its coverage, prohibits the exercise of, or is
+conditioned on the non-exercise of one or more of the rights that are
+specifically granted under this License. You may not convey a covered
+work if you are a party to an arrangement with a third party that is
+in the business of distributing software, under which you make payment
+to the third party based on the extent of your activity of conveying
+the work, and under which the third party grants, to any of the
+parties who would receive the covered work from you, a discriminatory
+patent license (a) in connection with copies of the covered work
+conveyed by you (or copies made from those copies), or (b) primarily
+for and in connection with specific products or compilations that
+contain the covered work, unless you entered into that arrangement,
+or that patent license was granted, prior to 28 March 2007.
+
+ Nothing in this License shall be construed as excluding or limiting
+any implied license or other defenses to infringement that may
+otherwise be available to you under applicable patent law.
+
+ 12. No Surrender of Others' Freedom.
+
+ If conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License. If you cannot convey a
+covered work so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you may
+not convey it at all. For example, if you agree to terms that obligate you
+to collect a royalty for further conveying from those to whom you convey
+the Program, the only way you could satisfy both those terms and this
+License would be to refrain entirely from conveying the Program.
+
+ 13. Use with the GNU Affero General Public License.
+
+ Notwithstanding any other provision of this License, you have
+permission to link or combine any covered work with a work licensed
+under version 3 of the GNU Affero General Public License into a single
+combined work, and to convey the resulting work. The terms of this
+License will continue to apply to the part which is the covered work,
+but the special requirements of the GNU Affero General Public License,
+section 13, concerning interaction through a network will apply to the
+combination as such.
+
+ 14. Revised Versions of this License.
+
+ The Free Software Foundation may publish revised and/or new versions of
+the GNU General Public License from time to time. Such new versions will
+be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+ Each version is given a distinguishing version number. If the
+Program specifies that a certain numbered version of the GNU General
+Public License "or any later version" applies to it, you have the
+option of following the terms and conditions either of that numbered
+version or of any later version published by the Free Software
+Foundation. If the Program does not specify a version number of the
+GNU General Public License, you may choose any version ever published
+by the Free Software Foundation.
+
+ If the Program specifies that a proxy can decide which future
+versions of the GNU General Public License can be used, that proxy's
+public statement of acceptance of a version permanently authorizes you
+to choose that version for the Program.
+
+ Later license versions may give you additional or different
+permissions. However, no additional obligations are imposed on any
+author or copyright holder as a result of your choosing to follow a
+later version.
+
+ 15. Disclaimer of Warranty.
+
+ THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
+APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
+HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
+OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
+THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
+IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
+ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
+
+ 16. Limitation of Liability.
+
+ IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
+THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
+GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
+USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
+DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
+PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
+EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
+SUCH DAMAGES.
+
+ 17. Interpretation of Sections 15 and 16.
+
+ If the disclaimer of warranty and limitation of liability provided
+above cannot be given local legal effect according to their terms,
+reviewing courts shall apply local law that most closely approximates
+an absolute waiver of all civil liability in connection with the
+Program, unless a warranty or assumption of liability accompanies a
+copy of the Program in return for a fee.
+
+ END OF TERMS AND CONDITIONS
+
+ How to Apply These Terms to Your New Programs
+
+ If you develop a new program, and you want it to be of the greatest
+possible use to the public, the best way to achieve this is to make it
+free software which everyone can redistribute and change under these terms.
+
+ To do so, attach the following notices to the program. It is safest
+to attach them to the start of each source file to most effectively
+state the exclusion of warranty; and each file should have at least
+the "copyright" line and a pointer to where the full notice is found.
+
+ <one line to give the program's name and a brief idea of what it does.>
+ Copyright (C) <year> <name of author>
+
+ 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/>.
+
+Also add information on how to contact you by electronic and paper mail.
+
+ If the program does terminal interaction, make it output a short
+notice like this when it starts in an interactive mode:
+
+ <program> Copyright (C) <year> <name of author>
+ This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
+ This is free software, and you are welcome to redistribute it
+ under certain conditions; type `show c' for details.
+
+The hypothetical commands `show w' and `show c' should show the appropriate
+parts of the General Public License. Of course, your program's commands
+might be different; for a GUI interface, you would use an "about box".
+
+ You should also get your employer (if you work as a programmer) or school,
+if any, to sign a "copyright disclaimer" for the program, if necessary.
+For more information on this, and how to apply and follow the GNU GPL, see
+<http://www.gnu.org/licenses/>.
+
+ The GNU General Public License does not permit incorporating your program
+into proprietary programs. If your program is a subroutine library, you
+may consider it more useful to permit linking proprietary applications with
+the library. If this is what you want to do, use the GNU Lesser General
+Public License instead of this License. But first, please read
+<http://www.gnu.org/philosophy/why-not-lgpl.html>.
diff --git a/conozco-nicaragua.activity/MANIFEST b/conozco-nicaragua.activity/MANIFEST
new file mode 100755
index 0000000..a8d696a
--- /dev/null
+++ b/conozco-nicaragua.activity/MANIFEST
@@ -0,0 +1,424 @@
+conozcouy.py
+run.py
+activity.py
+setup.py
+NEWS
+TODO
+COPYING
+activity/activity.svg
+activity/activity.info
+olpcgames/COPYING
+olpcgames/_cairoimage.py
+olpcgames/svgsprite.py
+olpcgames/util.py
+olpcgames/__init__.py
+olpcgames/pangofont.py
+olpcgames/_gtkmain.py
+olpcgames/canvas.py
+olpcgames/gtkEvent.py
+olpcgames/_version.py
+olpcgames/video.py
+olpcgames/eventwrap.py
+olpcgames/camera.py
+olpcgames/mesh.py
+olpcgames/pausescreen.py
+olpcgames/activity.py
+olpcgames/textsprite.py
+olpcgames/buildmanifest.py
+olpcgames/dbusproxy.py
+olpcgames/data/__init__.py
+olpcgames/data/sleeping_svg.py
+recursos/comun/datos/creditos.txt
+recursos/comun/datos/presentacion.txt
+recursos/comun/imagenes/globito.png
+recursos/comun/imagenes/nave6.png
+recursos/comun/imagenes/nave7.png
+recursos/comun/imagenes/ciudad.png
+recursos/comun/imagenes/localidad.png
+recursos/comun/imagenes/nave1.png
+recursos/comun/imagenes/capital.png
+recursos/comun/imagenes/nave5.png
+recursos/comun/imagenes/bicho.png
+recursos/comun/imagenes/bichopestanas.png
+recursos/comun/imagenes/bichofrente.png
+recursos/comun/imagenes/nave4.png
+recursos/comun/imagenes/fuego1.png
+recursos/comun/imagenes/fuego2.png
+recursos/comun/imagenes/nave2.png
+recursos/comun/imagenes/nave3.png
+recursos/comun/imagenes/cerro.png
+recursos/comun/imagenes/tierra.png
+recursos/comun/imagenes/navellegando.png
+recursos/comun/imagenes/pedazo1.png
+recursos/comun/imagenes/pedazo2.png
+recursos/comun/imagenes/paracaidas.png
+recursos/comun/imagenes/alerta.png
+recursos/comun/imagenes/alertarojo.png
+recursos/comun/imagenes/bichotriste.png
+recursos/comun/imagenes/terron.png
+recursos/comun/imagenes/LICENSE
+recursos/comun/sonidos/junggle_btn045.wav
+recursos/comun/sonidos/NoiseCollector_boom2.ogg
+recursos/comun/sonidos/chirp_alerta.ogg
+recursos/comun/fuentes/AllCaps.ttf
+recursos/comun/fuentes/Share-Regular.ttf
+recursos/0uruguay/nombre.txt
+recursos/0uruguay/datos/departamentos.txt
+recursos/0uruguay/datos/exploraciones.txt
+recursos/0uruguay/datos/niveles.txt
+recursos/0uruguay/datos/rios.txt
+recursos/0uruguay/datos/rutas.txt
+recursos/0uruguay/datos/cuchillas.txt
+recursos/0uruguay/datos/ciudades.txt
+recursos/0uruguay/imagenes/fondo.png
+recursos/0uruguay/imagenes/rios.png
+recursos/0uruguay/imagenes/deptos.png
+recursos/0uruguay/imagenes/riosDetectar.png
+recursos/0uruguay/imagenes/rutas.png
+recursos/0uruguay/imagenes/rutasDetectar.png
+recursos/0uruguay/imagenes/deptosLineas.png
+recursos/0uruguay/imagenes/cuchillas.png
+recursos/0uruguay/imagenes/cuchillasDetectar.png
+recursos/0uruguay/imagenes/LICENSE
+recursos/4artigas/nombre.txt
+recursos/4artigas/datos/departamentos.txt
+recursos/4artigas/datos/exploraciones.txt
+recursos/4artigas/datos/niveles.txt
+recursos/4artigas/datos/rios.txt
+recursos/4artigas/datos/rutas.txt
+recursos/4artigas/datos/cuchillas.txt
+recursos/4artigas/datos/ciudades.txt
+recursos/4artigas/imagenes/fondo.png
+recursos/4artigas/imagenes/rios.png
+recursos/4artigas/imagenes/rutas.png
+recursos/4artigas/imagenes/deptos.png
+recursos/4artigas/imagenes/riosDetectar.png
+recursos/4artigas/imagenes/rutasDetectar.png
+recursos/4artigas/imagenes/deptosLineas.png
+recursos/4artigas/imagenes/cuchillas.png
+recursos/4artigas/imagenes/cuchillasDetectar.png
+recursos/4artigas/imagenes/LICENSE
+recursos/4canelones/nombre.txt
+recursos/4canelones/datos/departamentos.txt
+recursos/4canelones/datos/exploraciones.txt
+recursos/4canelones/datos/niveles.txt
+recursos/4canelones/datos/rios.txt
+recursos/4canelones/datos/rutas.txt
+recursos/4canelones/datos/cuchillas.txt
+recursos/4canelones/datos/ciudades.txt
+recursos/4canelones/imagenes/fondo.png
+recursos/4canelones/imagenes/rios.png
+recursos/4canelones/imagenes/rutas.png
+recursos/4canelones/imagenes/deptos.png
+recursos/4canelones/imagenes/riosDetectar.png
+recursos/4canelones/imagenes/rutasDetectar.png
+recursos/4canelones/imagenes/deptosLineas.png
+recursos/4canelones/imagenes/cuchillas.png
+recursos/4canelones/imagenes/cuchillasDetectar.png
+recursos/4canelones/imagenes/LICENSE
+recursos/4cerro_largo/nombre.txt
+recursos/4cerro_largo/datos/departamentos.txt
+recursos/4cerro_largo/datos/exploraciones.txt
+recursos/4cerro_largo/datos/niveles.txt
+recursos/4cerro_largo/datos/rios.txt
+recursos/4cerro_largo/datos/rutas.txt
+recursos/4cerro_largo/datos/cuchillas.txt
+recursos/4cerro_largo/datos/ciudades.txt
+recursos/4cerro_largo/imagenes/fondo.png
+recursos/4cerro_largo/imagenes/rios.png
+recursos/4cerro_largo/imagenes/rutas.png
+recursos/4cerro_largo/imagenes/deptos.png
+recursos/4cerro_largo/imagenes/riosDetectar.png
+recursos/4cerro_largo/imagenes/rutasDetectar.png
+recursos/4cerro_largo/imagenes/deptosLineas.png
+recursos/4cerro_largo/imagenes/cuchillas.png
+recursos/4cerro_largo/imagenes/cuchillasDetectar.png
+recursos/4cerro_largo/imagenes/LICENSE
+recursos/4colonia/nombre.txt
+recursos/4colonia/datos/departamentos.txt
+recursos/4colonia/datos/exploraciones.txt
+recursos/4colonia/datos/niveles.txt
+recursos/4colonia/datos/rios.txt
+recursos/4colonia/datos/rutas.txt
+recursos/4colonia/datos/cuchillas.txt
+recursos/4colonia/datos/ciudades.txt
+recursos/4colonia/imagenes/fondo.png
+recursos/4colonia/imagenes/rios.png
+recursos/4colonia/imagenes/rutas.png
+recursos/4colonia/imagenes/deptos.png
+recursos/4colonia/imagenes/riosDetectar.png
+recursos/4colonia/imagenes/rutasDetectar.png
+recursos/4colonia/imagenes/deptosLineas.png
+recursos/4colonia/imagenes/cuchillas.png
+recursos/4colonia/imagenes/cuchillasDetectar.png
+recursos/4colonia/imagenes/LICENSE
+recursos/4durazno/nombre.txt
+recursos/4durazno/datos/departamentos.txt
+recursos/4durazno/datos/exploraciones.txt
+recursos/4durazno/datos/niveles.txt
+recursos/4durazno/datos/rios.txt
+recursos/4durazno/datos/rutas.txt
+recursos/4durazno/datos/cuchillas.txt
+recursos/4durazno/datos/ciudades.txt
+recursos/4durazno/imagenes/fondo.png
+recursos/4durazno/imagenes/rios.png
+recursos/4durazno/imagenes/rutas.png
+recursos/4durazno/imagenes/deptos.png
+recursos/4durazno/imagenes/riosDetectar.png
+recursos/4durazno/imagenes/rutasDetectar.png
+recursos/4durazno/imagenes/deptosLineas.png
+recursos/4durazno/imagenes/cuchillas.png
+recursos/4durazno/imagenes/cuchillasDetectar.png
+recursos/4durazno/imagenes/LICENSE
+recursos/4flores/nombre.txt
+recursos/4flores/datos/departamentos.txt
+recursos/4flores/datos/exploraciones.txt
+recursos/4flores/datos/niveles.txt
+recursos/4flores/datos/rios.txt
+recursos/4flores/datos/rutas.txt
+recursos/4flores/datos/cuchillas.txt
+recursos/4flores/datos/ciudades.txt
+recursos/4flores/imagenes/fondo.png
+recursos/4flores/imagenes/rios.png
+recursos/4flores/imagenes/rutas.png
+recursos/4flores/imagenes/deptos.png
+recursos/4flores/imagenes/riosDetectar.png
+recursos/4flores/imagenes/rutasDetectar.png
+recursos/4flores/imagenes/deptosLineas.png
+recursos/4flores/imagenes/cuchillas.png
+recursos/4flores/imagenes/cuchillasDetectar.png
+recursos/4flores/imagenes/LICENSE
+recursos/4florida/nombre.txt
+recursos/4florida/datos/departamentos.txt
+recursos/4florida/datos/exploraciones.txt
+recursos/4florida/datos/niveles.txt
+recursos/4florida/datos/rios.txt
+recursos/4florida/datos/rutas.txt
+recursos/4florida/datos/cuchillas.txt
+recursos/4florida/datos/ciudades.txt
+recursos/4florida/imagenes/fondo.png
+recursos/4florida/imagenes/rios.png
+recursos/4florida/imagenes/rutas.png
+recursos/4florida/imagenes/deptos.png
+recursos/4florida/imagenes/riosDetectar.png
+recursos/4florida/imagenes/rutasDetectar.png
+recursos/4florida/imagenes/deptosLineas.png
+recursos/4florida/imagenes/cuchillas.png
+recursos/4florida/imagenes/cuchillasDetectar.png
+recursos/4florida/imagenes/LICENSE
+recursos/4lavalleja/nombre.txt
+recursos/4lavalleja/datos/departamentos.txt
+recursos/4lavalleja/datos/exploraciones.txt
+recursos/4lavalleja/datos/niveles.txt
+recursos/4lavalleja/datos/rios.txt
+recursos/4lavalleja/datos/rutas.txt
+recursos/4lavalleja/datos/cuchillas.txt
+recursos/4lavalleja/datos/ciudades.txt
+recursos/4lavalleja/imagenes/fondo.png
+recursos/4lavalleja/imagenes/rios.png
+recursos/4lavalleja/imagenes/rutas.png
+recursos/4lavalleja/imagenes/deptos.png
+recursos/4lavalleja/imagenes/riosDetectar.png
+recursos/4lavalleja/imagenes/rutasDetectar.png
+recursos/4lavalleja/imagenes/deptosLineas.png
+recursos/4lavalleja/imagenes/cuchillas.png
+recursos/4lavalleja/imagenes/cuchillasDetectar.png
+recursos/4lavalleja/imagenes/LICENSE
+recursos/4maldonado/nombre.txt
+recursos/4maldonado/datos/departamentos.txt
+recursos/4maldonado/datos/exploraciones.txt
+recursos/4maldonado/datos/niveles.txt
+recursos/4maldonado/datos/rios.txt
+recursos/4maldonado/datos/rutas.txt
+recursos/4maldonado/datos/cuchillas.txt
+recursos/4maldonado/datos/ciudades.txt
+recursos/4maldonado/imagenes/fondo.png
+recursos/4maldonado/imagenes/rios.png
+recursos/4maldonado/imagenes/rutas.png
+recursos/4maldonado/imagenes/deptos.png
+recursos/4maldonado/imagenes/riosDetectar.png
+recursos/4maldonado/imagenes/rutasDetectar.png
+recursos/4maldonado/imagenes/deptosLineas.png
+recursos/4maldonado/imagenes/cuchillas.png
+recursos/4maldonado/imagenes/cuchillasDetectar.png
+recursos/4maldonado/imagenes/LICENSE
+recursos/4montevideo/nombre.txt
+recursos/4montevideo/datos/departamentos.txt
+recursos/4montevideo/datos/exploraciones.txt
+recursos/4montevideo/datos/niveles.txt
+recursos/4montevideo/datos/rios.txt
+recursos/4montevideo/datos/rutas.txt
+recursos/4montevideo/datos/cuchillas.txt
+recursos/4montevideo/datos/ciudades.txt
+recursos/4montevideo/imagenes/fondo.png
+recursos/4montevideo/imagenes/rios.png
+recursos/4montevideo/imagenes/rutas.png
+recursos/4montevideo/imagenes/deptos.png
+recursos/4montevideo/imagenes/riosDetectar.png
+recursos/4montevideo/imagenes/rutasDetectar.png
+recursos/4montevideo/imagenes/deptosLineas.png
+recursos/4montevideo/imagenes/cuchillas.png
+recursos/4montevideo/imagenes/cuchillasDetectar.png
+recursos/4montevideo/imagenes/LICENSE
+recursos/4paysandu/nombre.txt
+recursos/4paysandu/datos/departamentos.txt
+recursos/4paysandu/datos/exploraciones.txt
+recursos/4paysandu/datos/niveles.txt
+recursos/4paysandu/datos/rios.txt
+recursos/4paysandu/datos/rutas.txt
+recursos/4paysandu/datos/cuchillas.txt
+recursos/4paysandu/datos/ciudades.txt
+recursos/4paysandu/imagenes/fondo.png
+recursos/4paysandu/imagenes/rios.png
+recursos/4paysandu/imagenes/rutas.png
+recursos/4paysandu/imagenes/deptos.png
+recursos/4paysandu/imagenes/riosDetectar.png
+recursos/4paysandu/imagenes/rutasDetectar.png
+recursos/4paysandu/imagenes/deptosLineas.png
+recursos/4paysandu/imagenes/cuchillas.png
+recursos/4paysandu/imagenes/cuchillasDetectar.png
+recursos/4paysandu/imagenes/LICENSE
+recursos/4rio_negro/nombre.txt
+recursos/4rio_negro/datos/departamentos.txt
+recursos/4rio_negro/datos/exploraciones.txt
+recursos/4rio_negro/datos/niveles.txt
+recursos/4rio_negro/datos/rios.txt
+recursos/4rio_negro/datos/rutas.txt
+recursos/4rio_negro/datos/cuchillas.txt
+recursos/4rio_negro/datos/ciudades.txt
+recursos/4rio_negro/imagenes/fondo.png
+recursos/4rio_negro/imagenes/rios.png
+recursos/4rio_negro/imagenes/rutas.png
+recursos/4rio_negro/imagenes/deptos.png
+recursos/4rio_negro/imagenes/riosDetectar.png
+recursos/4rio_negro/imagenes/rutasDetectar.png
+recursos/4rio_negro/imagenes/deptosLineas.png
+recursos/4rio_negro/imagenes/cuchillas.png
+recursos/4rio_negro/imagenes/cuchillasDetectar.png
+recursos/4rio_negro/imagenes/LICENSE
+recursos/4rivera/nombre.txt
+recursos/4rivera/datos/departamentos.txt
+recursos/4rivera/datos/exploraciones.txt
+recursos/4rivera/datos/niveles.txt
+recursos/4rivera/datos/rios.txt
+recursos/4rivera/datos/rutas.txt
+recursos/4rivera/datos/cuchillas.txt
+recursos/4rivera/datos/ciudades.txt
+recursos/4rivera/imagenes/fondo.png
+recursos/4rivera/imagenes/rios.png
+recursos/4rivera/imagenes/rutas.png
+recursos/4rivera/imagenes/deptos.png
+recursos/4rivera/imagenes/riosDetectar.png
+recursos/4rivera/imagenes/rutasDetectar.png
+recursos/4rivera/imagenes/deptosLineas.png
+recursos/4rivera/imagenes/cuchillas.png
+recursos/4rivera/imagenes/cuchillasDetectar.png
+recursos/4rivera/imagenes/LICENSE
+recursos/4rocha/nombre.txt
+recursos/4rocha/datos/departamentos.txt
+recursos/4rocha/datos/exploraciones.txt
+recursos/4rocha/datos/niveles.txt
+recursos/4rocha/datos/rios.txt
+recursos/4rocha/datos/rutas.txt
+recursos/4rocha/datos/cuchillas.txt
+recursos/4rocha/datos/ciudades.txt
+recursos/4rocha/imagenes/fondo.png
+recursos/4rocha/imagenes/rios.png
+recursos/4rocha/imagenes/rutas.png
+recursos/4rocha/imagenes/deptos.png
+recursos/4rocha/imagenes/riosDetectar.png
+recursos/4rocha/imagenes/rutasDetectar.png
+recursos/4rocha/imagenes/deptosLineas.png
+recursos/4rocha/imagenes/cuchillas.png
+recursos/4rocha/imagenes/cuchillasDetectar.png
+recursos/4rocha/imagenes/LICENSE
+recursos/4salto/nombre.txt
+recursos/4salto/datos/departamentos.txt
+recursos/4salto/datos/exploraciones.txt
+recursos/4salto/datos/niveles.txt
+recursos/4salto/datos/rios.txt
+recursos/4salto/datos/rutas.txt
+recursos/4salto/datos/cuchillas.txt
+recursos/4salto/datos/ciudades.txt
+recursos/4salto/imagenes/fondo.png
+recursos/4salto/imagenes/rios.png
+recursos/4salto/imagenes/rutas.png
+recursos/4salto/imagenes/deptos.png
+recursos/4salto/imagenes/riosDetectar.png
+recursos/4salto/imagenes/rutasDetectar.png
+recursos/4salto/imagenes/deptosLineas.png
+recursos/4salto/imagenes/cuchillas.png
+recursos/4salto/imagenes/cuchillasDetectar.png
+recursos/4salto/imagenes/LICENSE
+recursos/4san_jose/nombre.txt
+recursos/4san_jose/datos/departamentos.txt
+recursos/4san_jose/datos/exploraciones.txt
+recursos/4san_jose/datos/niveles.txt
+recursos/4san_jose/datos/rios.txt
+recursos/4san_jose/datos/rutas.txt
+recursos/4san_jose/datos/cuchillas.txt
+recursos/4san_jose/datos/ciudades.txt
+recursos/4san_jose/imagenes/fondo.png
+recursos/4san_jose/imagenes/rios.png
+recursos/4san_jose/imagenes/rutas.png
+recursos/4san_jose/imagenes/deptos.png
+recursos/4san_jose/imagenes/riosDetectar.png
+recursos/4san_jose/imagenes/rutasDetectar.png
+recursos/4san_jose/imagenes/deptosLineas.png
+recursos/4san_jose/imagenes/cuchillas.png
+recursos/4san_jose/imagenes/cuchillasDetectar.png
+recursos/4san_jose/imagenes/LICENSE
+recursos/4soriano/nombre.txt
+recursos/4soriano/datos/departamentos.txt
+recursos/4soriano/datos/exploraciones.txt
+recursos/4soriano/datos/niveles.txt
+recursos/4soriano/datos/rios.txt
+recursos/4soriano/datos/rutas.txt
+recursos/4soriano/datos/cuchillas.txt
+recursos/4soriano/datos/ciudades.txt
+recursos/4soriano/imagenes/fondo.png
+recursos/4soriano/imagenes/rios.png
+recursos/4soriano/imagenes/rutas.png
+recursos/4soriano/imagenes/deptos.png
+recursos/4soriano/imagenes/riosDetectar.png
+recursos/4soriano/imagenes/rutasDetectar.png
+recursos/4soriano/imagenes/deptosLineas.png
+recursos/4soriano/imagenes/cuchillas.png
+recursos/4soriano/imagenes/cuchillasDetectar.png
+recursos/4soriano/imagenes/LICENSE
+recursos/4tacuarembo/nombre.txt
+recursos/4tacuarembo/datos/departamentos.txt
+recursos/4tacuarembo/datos/exploraciones.txt
+recursos/4tacuarembo/datos/niveles.txt
+recursos/4tacuarembo/datos/rios.txt
+recursos/4tacuarembo/datos/rutas.txt
+recursos/4tacuarembo/datos/cuchillas.txt
+recursos/4tacuarembo/datos/ciudades.txt
+recursos/4tacuarembo/imagenes/fondo.png
+recursos/4tacuarembo/imagenes/rios.png
+recursos/4tacuarembo/imagenes/rutas.png
+recursos/4tacuarembo/imagenes/deptos.png
+recursos/4tacuarembo/imagenes/riosDetectar.png
+recursos/4tacuarembo/imagenes/rutasDetectar.png
+recursos/4tacuarembo/imagenes/deptosLineas.png
+recursos/4tacuarembo/imagenes/cuchillas.png
+recursos/4tacuarembo/imagenes/cuchillasDetectar.png
+recursos/4tacuarembo/imagenes/LICENSE
+recursos/4treinta_y_tres/nombre.txt
+recursos/4treinta_y_tres/datos/departamentos.txt
+recursos/4treinta_y_tres/datos/exploraciones.txt
+recursos/4treinta_y_tres/datos/niveles.txt
+recursos/4treinta_y_tres/datos/rios.txt
+recursos/4treinta_y_tres/datos/rutas.txt
+recursos/4treinta_y_tres/datos/cuchillas.txt
+recursos/4treinta_y_tres/datos/ciudades.txt
+recursos/4treinta_y_tres/imagenes/fondo.png
+recursos/4treinta_y_tres/imagenes/rios.png
+recursos/4treinta_y_tres/imagenes/rutas.png
+recursos/4treinta_y_tres/imagenes/deptos.png
+recursos/4treinta_y_tres/imagenes/riosDetectar.png
+recursos/4treinta_y_tres/imagenes/rutasDetectar.png
+recursos/4treinta_y_tres/imagenes/deptosLineas.png
+recursos/4treinta_y_tres/imagenes/cuchillas.png
+recursos/4treinta_y_tres/imagenes/cuchillasDetectar.png
+recursos/4treinta_y_tres/imagenes/LICENSE
diff --git a/conozco-nicaragua.activity/MANIFEST.in b/conozco-nicaragua.activity/MANIFEST.in
new file mode 100755
index 0000000..4a0d51d
--- /dev/null
+++ b/conozco-nicaragua.activity/MANIFEST.in
@@ -0,0 +1,6 @@
+include *.py *.txt *.png *.jpg NEWS README
+recursive-include activity *.svg *.info
+include olpcgames/COPYING
+recursive-include olpcgames *.py
+recursive-include datos *
+recursive-include imagenes *
diff --git a/conozco-nicaragua.activity/NEWS b/conozco-nicaragua.activity/NEWS
new file mode 100644
index 0000000..81890e8
--- /dev/null
+++ b/conozco-nicaragua.activity/NEWS
@@ -0,0 +1,60 @@
+* Versión 9 (19/4/10)
+
+ - Se ingresaron los mapas de todos los departamentos (gracias a Alan
+ Aguiar)
+ - Se mejoró el menú de opciones
+ - Se cambiaron las fuentes
+ - Se incluyó un nivel con información de Montevideo (gracias a Miriam
+ Martínez y Magdalena Lallo)
+
+* Versión 8 (4/12/09)
+
+ - Se introduce la posibilidad de usar distintos mapas
+ - Se agrega el mapa de Canelones
+ - Se agrega un nivel con preguntas sobre Canelones (gracias a Nancy
+ Gómez y Ana Cichero)
+
+* Versión 7 (11/10/09)
+
+ - La resolución de la pantalla se adapta automáticamente para usar en
+ cualquier computadora.
+ - Secuencia inicial con la llegada del marcianito a la Tierra.
+ - Se optimizaron los gráficos y sonidos para reducir el tamaño.
+ - Se optimizó el código para que no consuma tantos recursos (gracias a
+ Pablo Moleri).
+ - Se agregó un nivel con lugares históricos (gracias a Ana Trujillo y
+ Ana Cichero).
+
+* Versión 6 (21/7/09)
+
+ - La resolución de la pantalla se adapta automáticamente para usar en
+ máquinas distintas a la XO, por ejemplo corriendo Sugar on a Stick.
+ - Esta versión está basada en la versión 2, así que no tiene ayuda ni
+ secuencia inicial.
+
+* Versión 5 (6/6/09)
+ - Se agregó secuencia inicial contando la llegada del marcianito a la
+ Tierra.
+
+* Versión 4 (8/5/08)
+
+ - Se corrigió un problema de permisos en la versión 3 que no permitía
+ su ejecución en la versión de Sugar 8.2
+
+* Versión 3 (7/5/08)
+
+ - Se agregó ayuda (gracias a los alumnos de Rosamel Ramírez por la
+ sugerencia)
+
+* Versión 2 (4/1/09)
+
+ - Se agregaron más ciudades y ríos
+ - Se agregaron cuchillas y cerros
+ - Se agregó sonido
+ - Cuando se selecciona una respuesta correcta, se muestra el nombre
+ - Se hizo compatible con Sugar 8.2 y otras correcciones menores
+
+* Versión 1 (29/7/08)
+
+ - Primera versión, tiene departamentos, capitales departamentales,
+ algunas ciudades y algunos cursos de agua.
diff --git a/conozco-nicaragua.activity/POTFILES.in b/conozco-nicaragua.activity/POTFILES.in
new file mode 100755
index 0000000..6c9e6b4
--- /dev/null
+++ b/conozco-nicaragua.activity/POTFILES.in
@@ -0,0 +1 @@
+include *.py
diff --git a/conozco-nicaragua.activity/TODO b/conozco-nicaragua.activity/TODO
new file mode 100755
index 0000000..a4e5cd6
--- /dev/null
+++ b/conozco-nicaragua.activity/TODO
@@ -0,0 +1,3 @@
+- agregar informacion en el modo exploro
+- agregar lugares historicos/turisticos
+- agregar mapa de america del sur
diff --git a/conozco-nicaragua.activity/activity.py b/conozco-nicaragua.activity/activity.py
new file mode 100755
index 0000000..31e8585
--- /dev/null
+++ b/conozco-nicaragua.activity/activity.py
@@ -0,0 +1,9 @@
+from olpcgames import activity
+from gettext import gettext as _
+
+class Activity(activity.PyGameActivity):
+ """Your Sugar activity"""
+
+ game_name = 'conozcouy'
+ game_title = _('Conozco Nicaragua')
+ game_size = (1200,900)
diff --git a/conozco-nicaragua.activity/activity.pyc b/conozco-nicaragua.activity/activity.pyc
new file mode 100644
index 0000000..2c258eb
--- /dev/null
+++ b/conozco-nicaragua.activity/activity.pyc
Binary files differ
diff --git a/conozco-nicaragua.activity/activity/activity-conozcouy.svg b/conozco-nicaragua.activity/activity/activity-conozcouy.svg
new file mode 100755
index 0000000..ad6160e
--- /dev/null
+++ b/conozco-nicaragua.activity/activity/activity-conozcouy.svg
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="UTF-8"?>
+ <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"
+ "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd" [
+ <!ENTITY stroke_color "#666666">
+ <!ENTITY fill_color "#FFFFFF">
+ ]>
+ <svg xmlns="http://www.w3.org/2000/svg" width="55" height="55">
+ <rect x="5" y="5" width="45" height="45"
+ style="fill:&fill_color;;stroke:&stroke_color;;stroke-width:3.5"/>
+ </svg>
diff --git a/conozco-nicaragua.activity/activity/activity-olpcgames.svg b/conozco-nicaragua.activity/activity/activity-olpcgames.svg
new file mode 100755
index 0000000..40e804b
--- /dev/null
+++ b/conozco-nicaragua.activity/activity/activity-olpcgames.svg
@@ -0,0 +1,65 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!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 "#AAAAAA">
+]>
+<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"
+ width="45"
+ height="45"
+ id="svg2215"
+ sodipodi:version="0.32"
+ inkscape:version="0.45.1"
+ sodipodi:docname="activity-tictactoe.svg"
+ sodipodi:docbase="/home/mcfletch/olpc/code/productive/Productive.activity/activity"
+ inkscape:output_extension="org.inkscape.output.svg.inkscape">
+ <metadata
+ id="metadata2232">
+ <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="defs2230" />
+ <sodipodi:namedview
+ inkscape:cy="22.5"
+ inkscape:cx="22.5"
+ inkscape:zoom="20.333333"
+ inkscape:window-height="1127"
+ inkscape:window-width="1600"
+ inkscape:pageshadow="2"
+ inkscape:pageopacity="0.0"
+ guidetolerance="10.0"
+ gridtolerance="10.0"
+ objecttolerance="10.0"
+ borderopacity="1.0"
+ bordercolor="#666666"
+ pagecolor="#ffffff"
+ id="base"
+ inkscape:window-x="0"
+ inkscape:window-y="0"
+ inkscape:current-layer="svg2215" />
+ <path
+ style="fill:&fill_color;;fill-opacity:0.75;fill-rule:evenodd;stroke:&stroke_color;;stroke-width:1.5;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;stroke-miterlimit:4;stroke-dasharray:none"
+ d="M 15.534377,13.195073 C 15.791157,11.763199 17.933873,10.957056 19.095051,10.602777 C 20.105324,9.9896474 22.787279,11.783276 22.898009,11.878244 C 23.416714,11.4045 23.425424,11.364819 23.770372,10.827625 C 23.601381,10.487593 22.939011,9.4960211 22.623866,9.0601604 C 22.623866,9.0601604 22.742529,8.9416821 22.812515,8.8485545 C 23.845529,9.0345464 24.306088,9.4281391 24.871474,9.6093119 C 25.668983,8.6239218 25.446369,9.2835875 25.828152,8.4790083 C 25.13443,8.0435993 21.714652,2.4366571 13.009162,7.2066853 C 9.0621306,9.978134 8.895617,8.7992283 6.932744,9.097028 C 5.2661869,9.464109 3.3873402,9.399673 2.1395212,10.873663 C 1.0843595,12.628037 1.1078166,14.962252 1.6747872,16.900122 C 2.4157932,18.645311 4.1348484,20.102541 6.0059863,20.181304 C 8.0128058,20.306614 8.5055554,18.063138 9.9449657,17.103325 C 11.084352,16.320185 12.66414,14.87405 13.854988,16.927543 C 15.319531,18.689841 17.42612,19.671958 18.836759,21.491545 C 20.428246,22.860338 21.802711,24.499357 23.595734,25.605883 C 25.959172,27.177087 27.743932,29.469159 29.192905,31.938198 C 30.3509,33.066387 30.214635,34.990613 31.186387,36.125386 C 32.955624,37.317013 35.489203,37.310037 36.995239,35.662719 C 38.298566,34.629828 39.238431,33.219156 40.335881,31.969909 C 41.40463,30.61446 41.737725,28.191719 40.036666,27.203889 C 37.921417,25.933868 35.386076,25.826524 33.06998,25.148133 C 31.392091,24.657752 29.525099,24.370514 28.305913,22.933725 C 26.477551,21.069741 24.407817,19.456446 22.158802,18.204958 C 20.689355,17.069909 19.172075,16.000044 17.716766,14.850016 C 16.9591,14.352917 16.087813,13.95948 15.534377,13.195073 z "
+ id="path2242"
+ sodipodi:nodetypes="ccccccccccccccccccccccscccc" />
+ <path
+ style="fill:none;fill-opacity:0.75;fill-rule:evenodd;stroke:&stroke_color;;stroke-width:1.5;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ d="M 7.9653982,19.368521 C 8.992869,17.523226 9.0484129,16.552739 9.0744982,15.127094 C 9.152233,13.679143 9.0097453,12.591507 8.3457541,11.372405 C 7.8839907,10.583866 6.0804649,9.1928072 5.6129699,9.3821562"
+ id="path2263"
+ sodipodi:nodetypes="cccc" />
+</svg>
diff --git a/conozco-nicaragua.activity/activity/activity.info b/conozco-nicaragua.activity/activity/activity.info
new file mode 100755
index 0000000..17cd6f6
--- /dev/null
+++ b/conozco-nicaragua.activity/activity/activity.info
@@ -0,0 +1,8 @@
+[Activity]
+name = Conozco Nicaragua
+activity_version = 9
+host_version = 1
+bundle_id = uy.edu.fing.geirea.conozcouruguay
+icon = activity
+exec = sugar-activity activity.Activity
+license = GPL+
diff --git a/conozco-nicaragua.activity/activity/activity.info.bak b/conozco-nicaragua.activity/activity/activity.info.bak
new file mode 100755
index 0000000..179b0d6
--- /dev/null
+++ b/conozco-nicaragua.activity/activity/activity.info.bak
@@ -0,0 +1,8 @@
+[Activity]
+name = Conozco Uruguay
+activity_version = 1
+host_version = 1
+bundle_id = uy.edu.fing.geirea.conozcouy
+icon = activity-conozcouy
+class = conozcouy.ConozcoUy
+show_launcher = yes
diff --git a/conozco-nicaragua.activity/activity/activity.svg b/conozco-nicaragua.activity/activity/activity.svg
new file mode 100755
index 0000000..76155bd
--- /dev/null
+++ b/conozco-nicaragua.activity/activity/activity.svg
@@ -0,0 +1,74 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd" [
+ <!ENTITY stroke_color "#666666">
+ <!ENTITY fill_color "#FFFFFF">
+]>
+<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"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ width="45"
+ height="45"
+ id="svg2215"
+ sodipodi:version="0.32"
+ inkscape:version="0.46"
+ sodipodi:docname="activity.svg"
+ sodipodi:docbase="/home/mcfletch/olpc/code/productive/Productive.activity/activity"
+ inkscape:output_extension="org.inkscape.output.svg.inkscape">
+ <metadata
+ id="metadata2232">
+ <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="defs2230">
+ <inkscape:perspective
+ sodipodi:type="inkscape:persp3d"
+ inkscape:vp_x="0 : 22.5 : 1"
+ inkscape:vp_y="0 : 1000 : 0"
+ inkscape:vp_z="45 : 22.5 : 1"
+ inkscape:persp3d-origin="22.5 : 15 : 1"
+ id="perspective2456" />
+ <inkscape:perspective
+ id="perspective2556"
+ inkscape:persp3d-origin="372.04724 : 350.78739 : 1"
+ inkscape:vp_z="744.09448 : 526.18109 : 1"
+ inkscape:vp_y="0 : 1000 : 0"
+ inkscape:vp_x="0 : 526.18109 : 1"
+ sodipodi:type="inkscape:persp3d" />
+ </defs>
+ <sodipodi:namedview
+ inkscape:cy="21.619216"
+ inkscape:cx="25.66548"
+ inkscape:zoom="10.026793"
+ inkscape:window-height="735"
+ inkscape:window-width="960"
+ inkscape:pageshadow="2"
+ inkscape:pageopacity="0.0"
+ guidetolerance="10.0"
+ gridtolerance="10.0"
+ objecttolerance="10.0"
+ borderopacity="1.0"
+ bordercolor="#666666"
+ pagecolor="#ffffff"
+ id="base"
+ inkscape:window-x="0"
+ inkscape:window-y="0"
+ inkscape:current-layer="svg2215"
+ showgrid="false" />
+ <path
+ fill="&fill_color;" stroke="&stroke_color;" stroke-width="3.5"
+ d="M 38.871849,18.879841 C 37.433172,16.949303 35.187645,16.542091 33.257107,12.996363 C 30.776733,11.784837 29.768575,11.284612 25.690528,7.8889324 C 24.513775,8.7117145 25.535048,8.542751 23.610378,9.1477525 C 21.950607,7.5385545 21.812769,6.8350868 19.984568,5.1213369 C 18.388491,3.8367486 17.525876,2.2371912 15.701948,1.5219166 C 14.248236,2.3984422 12.685462,2.6157956 10.523124,2.4149317 C 9.2554984,3.6796077 10.867299,3.8146373 9.3202814,5.5878252 C 9.7611121,7.8408631 9.0864396,9.2774821 9.1547457,11.315085 C 8.9981567,13.060274 8.6228233,12.423115 7.9009089,14.197336 C 7.7136077,17.115164 7.4084944,15.66955 6.8532495,17.502255 C 7.4939716,19.711098 6.7799066,22.653206 8.1702201,26.601622 C 7.4406419,28.36392 6.5552474,27.550846 5.871498,28.572571 C 5.6677949,31.038425 5.2470698,33.076375 5.9430322,35.479427 C 7.8078063,37.349829 7.5979107,37.148582 9.0468837,39.617621 C 10.903008,40.147413 11.564605,39.777785 14.43128,39.516299 C 17.397311,40.807659 19.531958,41.997477 21.337193,43.242409 C 23.238917,42.708182 23.680118,42.394571 25.375964,41.943186 C 27.641507,42.083729 28.672731,43.550566 30.46232,43.75953 C 33.732641,41.691646 35.449335,39.896143 37.458223,38.412592 C 39.403903,36.97572 39.298912,36.138981 41.171443,33.006735 C 39.343081,31.142751 40.165597,30.726249 39.412574,28.277968 C 40.436446,26.245323 40.514891,25.873588 42.251031,24.125163 C 40.296572,22.830202 39.425285,20.940775 38.871849,18.879841 z"
+ id="path2242"
+ sodipodi:nodetypes="cccccccccccccccccccscccc" />
+</svg>
diff --git a/conozco-nicaragua.activity/activity/activity.svg.bak b/conozco-nicaragua.activity/activity/activity.svg.bak
new file mode 100755
index 0000000..f2dfa7a
--- /dev/null
+++ b/conozco-nicaragua.activity/activity/activity.svg.bak
@@ -0,0 +1,70 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<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"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ width="45"
+ height="45"
+ id="svg2215"
+ sodipodi:version="0.32"
+ inkscape:version="0.46"
+ sodipodi:docname="activity.svg"
+ sodipodi:docbase="/home/mcfletch/olpc/code/productive/Productive.activity/activity"
+ inkscape:output_extension="org.inkscape.output.svg.inkscape">
+ <metadata
+ id="metadata2232">
+ <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="defs2230">
+ <inkscape:perspective
+ sodipodi:type="inkscape:persp3d"
+ inkscape:vp_x="0 : 22.5 : 1"
+ inkscape:vp_y="0 : 1000 : 0"
+ inkscape:vp_z="45 : 22.5 : 1"
+ inkscape:persp3d-origin="22.5 : 15 : 1"
+ id="perspective2456" />
+ <inkscape:perspective
+ id="perspective2556"
+ inkscape:persp3d-origin="372.04724 : 350.78739 : 1"
+ inkscape:vp_z="744.09448 : 526.18109 : 1"
+ inkscape:vp_y="0 : 1000 : 0"
+ inkscape:vp_x="0 : 526.18109 : 1"
+ sodipodi:type="inkscape:persp3d" />
+ </defs>
+ <sodipodi:namedview
+ inkscape:cy="21.619216"
+ inkscape:cx="25.66548"
+ inkscape:zoom="10.026793"
+ inkscape:window-height="735"
+ inkscape:window-width="960"
+ inkscape:pageshadow="2"
+ inkscape:pageopacity="0.0"
+ guidetolerance="10.0"
+ gridtolerance="10.0"
+ objecttolerance="10.0"
+ borderopacity="1.0"
+ bordercolor="#666666"
+ pagecolor="#ffffff"
+ id="base"
+ inkscape:window-x="0"
+ inkscape:window-y="0"
+ inkscape:current-layer="svg2215"
+ showgrid="false" />
+ <path
+ style="fill:#aaaaaa;fill-opacity:0.75000000000000000;fill-rule:evenodd;stroke:#000000;stroke-width:3.5;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ d="M 38.871849,18.879841 C 37.433172,16.949303 35.187645,16.542091 33.257107,12.996363 C 30.776733,11.784837 29.768575,11.284612 25.690528,7.8889324 C 24.513775,8.7117145 25.535048,8.542751 23.610378,9.1477525 C 21.950607,7.5385545 21.812769,6.8350868 19.984568,5.1213369 C 18.388491,3.8367486 17.525876,2.2371912 15.701948,1.5219166 C 14.248236,2.3984422 12.685462,2.6157956 10.523124,2.4149317 C 9.2554984,3.6796077 10.867299,3.8146373 9.3202814,5.5878252 C 9.7611121,7.8408631 9.0864396,9.2774821 9.1547457,11.315085 C 8.9981567,13.060274 8.6228233,12.423115 7.9009089,14.197336 C 7.7136077,17.115164 7.4084944,15.66955 6.8532495,17.502255 C 7.4939716,19.711098 6.7799066,22.653206 8.1702201,26.601622 C 7.4406419,28.36392 6.5552474,27.550846 5.871498,28.572571 C 5.6677949,31.038425 5.2470698,33.076375 5.9430322,35.479427 C 7.8078063,37.349829 7.5979107,37.148582 9.0468837,39.617621 C 10.903008,40.147413 11.564605,39.777785 14.43128,39.516299 C 17.397311,40.807659 19.531958,41.997477 21.337193,43.242409 C 23.238917,42.708182 23.680118,42.394571 25.375964,41.943186 C 27.641507,42.083729 28.672731,43.550566 30.46232,43.75953 C 33.732641,41.691646 35.449335,39.896143 37.458223,38.412592 C 39.403903,36.97572 39.298912,36.138981 41.171443,33.006735 C 39.343081,31.142751 40.165597,30.726249 39.412574,28.277968 C 40.436446,26.245323 40.514891,25.873588 42.251031,24.125163 C 40.296572,22.830202 39.425285,20.940775 38.871849,18.879841 z"
+ id="path2242"
+ sodipodi:nodetypes="cccccccccccccccccccscccc" />
+</svg>
diff --git a/conozco-nicaragua.activity/activity/activity.svg~ b/conozco-nicaragua.activity/activity/activity.svg~
new file mode 100755
index 0000000..01ef881
--- /dev/null
+++ b/conozco-nicaragua.activity/activity/activity.svg~
@@ -0,0 +1,70 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<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"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ width="45"
+ height="45"
+ id="svg2215"
+ sodipodi:version="0.32"
+ inkscape:version="0.46"
+ sodipodi:docname="activity.svg"
+ sodipodi:docbase="/home/mcfletch/olpc/code/productive/Productive.activity/activity"
+ inkscape:output_extension="org.inkscape.output.svg.inkscape">
+ <metadata
+ id="metadata2232">
+ <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="defs2230">
+ <inkscape:perspective
+ sodipodi:type="inkscape:persp3d"
+ inkscape:vp_x="0 : 22.5 : 1"
+ inkscape:vp_y="0 : 1000 : 0"
+ inkscape:vp_z="45 : 22.5 : 1"
+ inkscape:persp3d-origin="22.5 : 15 : 1"
+ id="perspective2456" />
+ <inkscape:perspective
+ id="perspective2556"
+ inkscape:persp3d-origin="372.04724 : 350.78739 : 1"
+ inkscape:vp_z="744.09448 : 526.18109 : 1"
+ inkscape:vp_y="0 : 1000 : 0"
+ inkscape:vp_x="0 : 526.18109 : 1"
+ sodipodi:type="inkscape:persp3d" />
+ </defs>
+ <sodipodi:namedview
+ inkscape:cy="21.619216"
+ inkscape:cx="25.66548"
+ inkscape:zoom="10.026793"
+ inkscape:window-height="735"
+ inkscape:window-width="960"
+ inkscape:pageshadow="2"
+ inkscape:pageopacity="0.0"
+ guidetolerance="10.0"
+ gridtolerance="10.0"
+ objecttolerance="10.0"
+ borderopacity="1.0"
+ bordercolor="#666666"
+ pagecolor="#ffffff"
+ id="base"
+ inkscape:window-x="0"
+ inkscape:window-y="0"
+ inkscape:current-layer="svg2215"
+ showgrid="false" />
+ <path
+ style="fill:#aaaaaa;fill-opacity:0.75000000000000000;fill-rule:evenodd;stroke:#000000;stroke-width:3;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ d="M 38.871849,18.879841 C 37.433172,16.949303 35.187645,16.542091 33.257107,12.996363 C 30.776733,11.784837 29.768575,11.284612 25.690528,7.8889324 C 24.513775,8.7117145 25.535048,8.542751 23.610378,9.1477525 C 21.950607,7.5385545 21.812769,6.8350868 19.984568,5.1213369 C 18.388491,3.8367486 17.525876,2.2371912 15.701948,1.5219166 C 14.248236,2.3984422 12.685462,2.6157956 10.523124,2.4149317 C 9.2554984,3.6796077 10.867299,3.8146373 9.3202814,5.5878252 C 9.7611121,7.8408631 9.0864396,9.2774821 9.1547457,11.315085 C 8.9981567,13.060274 8.6228233,12.423115 7.9009089,14.197336 C 7.7136077,17.115164 7.4084944,15.66955 6.8532495,17.502255 C 7.4939716,19.711098 6.7799066,22.653206 8.1702201,26.601622 C 7.4406419,28.36392 6.5552474,27.550846 5.871498,28.572571 C 5.6677949,31.038425 5.2470698,33.076375 5.9430322,35.479427 C 7.8078063,37.349829 7.5979107,37.148582 9.0468837,39.617621 C 10.903008,40.147413 11.564605,39.777785 14.43128,39.516299 C 17.397311,40.807659 19.531958,41.997477 21.337193,43.242409 C 23.238917,42.708182 23.680118,42.394571 25.375964,41.943186 C 27.641507,42.083729 28.672731,43.550566 30.46232,43.75953 C 33.732641,41.691646 35.449335,39.896143 37.458223,38.412592 C 39.403903,36.97572 39.298912,36.138981 41.171443,33.006735 C 39.343081,31.142751 40.165597,30.726249 39.412574,28.277968 C 40.436446,26.245323 40.514891,25.873588 42.251031,24.125163 C 40.296572,22.830202 39.425285,20.940775 38.871849,18.879841 z"
+ id="path2242"
+ sodipodi:nodetypes="cccccccccccccccccccscccc" />
+</svg>
diff --git a/conozco-nicaragua.activity/conozcouy.py b/conozco-nicaragua.activity/conozcouy.py
new file mode 100755
index 0000000..25ac303
--- /dev/null
+++ b/conozco-nicaragua.activity/conozcouy.py
@@ -0,0 +1,1752 @@
+#! /usr/bin/env python
+# Conozco Uruguay
+# Copyright (C) 2008,2009,2010 Gabriel Eirea
+#
+# 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/>.
+#
+# Contact information:
+# Gabriel Eirea geirea@gmail.com
+# Ceibal Jam http://ceibaljam.org
+
+import sys
+import random
+import os
+import pygame
+import olpcgames
+import gtk
+
+# constantes
+RADIO = 10
+RADIO2 = RADIO**2
+XMAPAMAX = 786
+DXPANEL = 414
+XCENTROPANEL = 1002
+YGLOBITO = 310
+DXBICHO = 218
+DYBICHO = 268
+XBICHO = 1200-DXBICHO
+YBICHO = 900-DYBICHO
+XNAVE = 800
+YNAVE = 650
+DXNAVE = 100
+DYNAVE = 200
+CAMINORECURSOS = "recursos"
+CAMINOCOMUN = "comun"
+CAMINOFUENTES = "fuentes"
+CAMINODATOS = "datos"
+ARCHIVODEPTOS = "departamentos.txt"
+ARCHIVOLUGARES = "ciudades.txt"
+ARCHIVONIVELES = "niveles.txt"
+ARCHIVOEXPLORACIONES = "exploraciones.txt"
+ARCHIVORIOS = "rios.txt"
+ARCHIVORUTAS = "rutas.txt"
+ARCHIVOCUCHILLAS = "cuchillas.txt"
+ARCHIVOCREDITOS = "creditos.txt"
+ARCHIVOPRESENTACION = "presentacion.txt"
+ARCHIVONOMBRE = "nombre.txt"
+CAMINOIMAGENES = "imagenes"
+CAMINOSONIDOS = "sonidos"
+COLORNOMBREDEPTO = (200,60,60)
+COLORNOMBRECAPITAL = (10,10,10)
+COLORNOMBRERIO = (10,10,10)
+COLORNOMBRERUTA = (10,10,10)
+COLORNOMBREELEVACION = (10,10,10)
+COLORPREGUNTAS = (80,80,155)
+COLORPANEL = (156,158,172)
+TOTALAVANCE = 7
+EVENTORESPUESTA = pygame.USEREVENT+1
+TIEMPORESPUESTA = 2300
+EVENTODESPEGUE = EVENTORESPUESTA+1
+TIEMPODESPEGUE = 40
+EVENTOREFRESCO = EVENTODESPEGUE+1
+TIEMPOREFRESCO = 250
+ESTADONORMAL = 1
+ESTADOPESTANAS = 2
+ESTADOFRENTE = 3
+ESTADODESPEGUE = 4
+
+# variables globales para adaptar la pantalla a distintas resoluciones
+scale = 1
+shift_x = 0
+shift_y = 0
+xo_resolution = True
+
+clock = pygame.time.Clock()
+
+def wait_events():
+ """ Funcion para esperar por eventos de pygame sin consumir CPU """
+ global clock
+ clock.tick(20)
+ return pygame.event.get()
+
+class Punto():
+ """Clase para objetos geograficos que se pueden definir como un punto.
+
+ La posicion esta dada por un par de coordenadas (x,y) medida en pixels
+ dentro del mapa.
+ """
+
+ def __init__(self,nombre,tipo,simbolo,posicion,postexto):
+ global scale, shift_x, shift_y
+ self.nombre = nombre
+ self.tipo = int(tipo)
+ self.posicion = (int(int(posicion[0])*scale+shift_x),
+ int(int(posicion[1])*scale+shift_y))
+ self.postexto = (int(int(postexto[0])*scale)+self.posicion[0],
+ int(int(postexto[1])*scale)+self.posicion[1])
+ self.simbolo = simbolo
+
+ def estaAca(self,pos):
+ """Devuelve un booleano indicando si esta en la coordenada pos,
+ la precision viene dada por la constante global RADIO"""
+ if (pos[0]-self.posicion[0])**2 + \
+ (pos[1]-self.posicion[1])**2 < RADIO2:
+ return True
+ else:
+ return False
+
+ def dibujar(self,pantalla,flipAhora):
+ """Dibuja un punto en su posicion"""
+ pantalla.blit(self.simbolo, (self.posicion[0]-8, self.posicion[1]-8))
+ if flipAhora:
+ pygame.display.flip()
+
+ def mostrarNombre(self,pantalla,fuente,color,flipAhora):
+ """Escribe el nombre del punto en su posicion"""
+ text = fuente.render(self.nombre, 1, color)
+ textrect = text.get_rect()
+ textrect.center = (self.postexto[0], self.postexto[1])
+ pantalla.blit(text, textrect)
+ if flipAhora:
+ pygame.display.flip()
+
+
+class Zona():
+ """Clase para objetos geograficos que se pueden definir como una zona.
+
+ La posicion esta dada por una imagen bitmap pintada con un color
+ especifico, dado por la clave (valor 0 a 255 del componente rojo).
+ """
+
+ def __init__(self,mapa,nombre,claveColor,tipo,posicion,rotacion):
+ self.mapa = mapa # esto hace una copia en memoria o no????
+ self.nombre = nombre
+ self.claveColor = int(claveColor)
+ self.tipo = int(tipo)
+ self.posicion = (int(int(posicion[0])*scale+shift_x),
+ int(int(posicion[1])*scale+shift_y))
+ self.rotacion = int(rotacion)
+
+ def estaAca(self,pos):
+ """Devuelve True si la coordenada pos esta en la zona"""
+ if pos[0] < XMAPAMAX*scale+shift_x:
+ try:
+ colorAca = self.mapa.get_at((pos[0]-shift_x,
+ pos[1]-shift_y))
+ except: # probablemente click fuera de la imagen
+ return False
+ if colorAca[0] == self.claveColor:
+ return True
+ else:
+ return False
+ else:
+ return False
+
+ def mostrarNombre(self,pantalla,fuente,color,flipAhora):
+ """Escribe el nombre de la zona en su posicion"""
+ text = fuente.render(self.nombre, 1, color)
+ textrot = pygame.transform.rotate(text, self.rotacion)
+ textrect = textrot.get_rect()
+ textrect.center = (self.posicion[0], self.posicion[1])
+ pantalla.blit(textrot, textrect)
+ if flipAhora:
+ pygame.display.flip()
+
+
+class Nivel():
+ """Clase para definir los niveles del juego.
+
+ Cada nivel tiene un dibujo inicial, los elementos pueden estar
+ etiquetados con el nombre o no, y un conjunto de preguntas.
+ """
+
+ def __init__(self,nombre):
+ self.nombre = nombre
+ self.dibujoInicial = list()
+ self.nombreInicial = list()
+ self.preguntas = list()
+ self.indicePreguntaActual = 0
+ self.elementosActivos = list()
+
+ def prepararPreguntas(self):
+ """Este metodo sirve para preparar la lista de preguntas al azar."""
+ random.shuffle(self.preguntas)
+
+ def siguientePregunta(self,listaSufijos,listaPrefijos):
+ """Prepara el texto de la pregunta siguiente"""
+ self.preguntaActual = self.preguntas[self.indicePreguntaActual]
+ self.sufijoActual = random.randint(1,len(listaSufijos))-1
+ self.prefijoActual = random.randint(1,len(listaPrefijos))-1
+ lineas = listaPrefijos[self.prefijoActual].split("\\")
+ lineas.extend(self.preguntaActual[0].split("\\"))
+ lineas.extend(listaSufijos[self.sufijoActual].split("\\"))
+ self.indicePreguntaActual = self.indicePreguntaActual+1
+ if self.indicePreguntaActual == len(self.preguntas):
+ self.indicePreguntaActual = 0
+ return lineas
+
+ def devolverAyuda(self):
+ """Devuelve la linea de ayuda"""
+ self.preguntaActual = self.preguntas[self.indicePreguntaActual-1]
+ return self.preguntaActual[3].split("\\")
+
+ def mostrarPregunta(self,pantalla,fuente,sufijo,prefijo):
+ """Muestra la pregunta en el globito"""
+ self.preguntaActual = self.preguntas[self.indicePreguntaActual]
+ lineas = prefijo.split("\\")
+ lineas.extend(self.preguntaActual[0].split("\\"))
+ lineas.extend(sufijo.split("\\"))
+ yLinea = 100
+ for l in lineas:
+ text = fuente.render(l, 1, COLORPREGUNTAS)
+ textrect = text.get_rect()
+ textrect.center = (XCENTROPANEL,yLinea)
+ pantalla.blit(text, textrect)
+ yLinea = yLinea + fuente.get_height()
+ pygame.display.flip()
+
+
+class ConozcoUy():
+ """Clase principal del juego.
+
+ """
+
+ def mostrarTexto(self,texto,fuente,posicion,color):
+ """Muestra texto en una determinada posicion"""
+ text = fuente.render(texto, 1, color)
+ textrect = text.get_rect()
+ textrect.center = posicion
+ self.pantalla.blit(text, textrect)
+
+ def cargarDepartamentos(self):
+ """Carga las imagenes y los datos de los departamentos"""
+ self.deptos = self.cargarImagen("deptos.png")
+ self.deptosLineas = self.cargarImagen("deptosLineas.png")
+ self.listaDeptos = list()
+ # falta sanitizar manejo de archivo
+ f = open(os.path.join(self.camino_datos,ARCHIVODEPTOS),"r")
+ linea = f.readline()
+ while linea:
+ if linea[0] == "#":
+ linea = f.readline()
+ continue
+ [nombreDepto,claveColor,posx,posy,rotacion] = \
+ linea.strip().split("|")
+ nuevoDepto = Zona(self.deptos,
+ unicode(nombreDepto,'iso-8859-1'),
+ claveColor,1,(posx,posy),rotacion)
+ self.listaDeptos.append(nuevoDepto)
+ linea = f.readline()
+ f.close()
+
+ def cargarRios(self):
+ """Carga las imagenes y los datos de los rios"""
+ self.rios = self.cargarImagen("rios.png")
+ self.riosDetectar = self.cargarImagen("riosDetectar.png")
+ self.listaRios = list()
+ # falta sanitizar manejo de archivo
+ f = open(os.path.join(self.camino_datos,ARCHIVORIOS),"r")
+ linea = f.readline()
+ while linea:
+ if linea[0] == "#":
+ linea = f.readline()
+ continue
+ [nombreRio,claveColor,posx,posy,rotacion] = \
+ linea.strip().split("|")
+ nuevoRio = Zona(self.riosDetectar,
+ unicode(nombreRio,'iso-8859-1'),
+ claveColor,3,(posx,posy),rotacion)
+ self.listaRios.append(nuevoRio)
+ linea = f.readline()
+ f.close()
+
+ def cargarRutas(self):
+ """Carga las imagenes y los datos de las rutas"""
+ self.rutas = self.cargarImagen("rutas.png")
+ self.rutasDetectar = self.cargarImagen("rutasDetectar.png")
+ self.listaRutas = list()
+ # falta sanitizar manejo de archivo
+ f = open(os.path.join(self.camino_datos,ARCHIVORUTAS),"r")
+ linea = f.readline()
+ while linea:
+ if linea[0] == "#":
+ linea = f.readline()
+ continue
+ [nombreRuta,claveColor,posx,posy,rotacion] = \
+ linea.strip().split("|")
+ nuevaRuta = Zona(self.rutasDetectar,
+ unicode(nombreRuta,'iso-8859-1'),
+ claveColor,6,(posx,posy),rotacion)
+ self.listaRutas.append(nuevaRuta)
+ linea = f.readline()
+ f.close()
+
+ def cargarCuchillas(self):
+ """Carga las imagenes y los datos de las cuchillas"""
+ self.cuchillas = self.cargarImagen("cuchillas.png")
+ self.cuchillasDetectar = self.cargarImagen("cuchillasDetectar.png")
+ self.listaCuchillas = list()
+ # falta sanitizar manejo de archivo
+ f = open(os.path.join(self.camino_datos,ARCHIVOCUCHILLAS),"r")
+ linea = f.readline()
+ while linea:
+ if linea[0] == "#":
+ linea = f.readline()
+ continue
+ [nombreCuchilla,claveColor,posx,posy,rotacion] = \
+ linea.strip().split("|")
+ nuevaCuchilla = Zona(self.cuchillasDetectar,
+ unicode(nombreCuchilla,'iso-8859-1'),
+ claveColor,4,(posx,posy),rotacion)
+ self.listaCuchillas.append(nuevaCuchilla)
+ linea = f.readline()
+ f.close()
+
+ def cargarLugares(self):
+ """Carga los datos de las ciudades y otros puntos de interes"""
+ self.listaLugares = list()
+ # falta sanitizar manejo de archivo
+ f = open(os.path.join(self.camino_datos,ARCHIVOLUGARES),"r")
+ linea = f.readline()
+ while linea:
+ if linea[0] == "#":
+ linea = f.readline()
+ continue
+ [nombreLugar,posx,posy,tipo,incx,incy] = \
+ linea.strip().split("|")
+ if int(tipo) == 1:
+ simbolo = self.simboloCapital
+ elif int(tipo) == 2:
+ simbolo = self.simboloCiudad
+ elif int(tipo) == 5:
+ simbolo = self.simboloCerro
+ else:
+ simbolo = self.simboloCiudad
+ nuevoLugar = Punto(unicode(nombreLugar,'iso-8859-1'),
+ int(tipo),simbolo,
+ (posx,posy),(incx,incy))
+ self.listaLugares.append(nuevoLugar)
+ linea = f.readline()
+ f.close()
+
+ def cargarListaDirectorios(self):
+ """Carga la lista de directorios con los distintos mapas"""
+ self.listaDirectorios = list()
+ self.listaNombreDirectorios = list()
+ listaTemp = os.listdir(CAMINORECURSOS)
+ listaTemp.sort()
+ for d in listaTemp:
+ if d == "comun":
+ pass
+ else:
+ self.listaDirectorios.append(d)
+ f = open(os.path.join(CAMINORECURSOS,d,ARCHIVONOMBRE),"r")
+ linea = f.readline()
+ self.listaNombreDirectorios.append(\
+ unicode(linea.strip(),'iso-8859-1'))
+ f.close()
+
+ def cargarNiveles(self):
+ """Carga los niveles del archivo de configuracion"""
+ self.listaNiveles = list()
+ self.listaPrefijos = list()
+ self.listaSufijos = list()
+ self.listaCorrecto = list()
+ self.listaMal = list()
+ self.listaDespedidas = list()
+ # falta sanitizar manejo de archivo
+ f = open(os.path.join(self.camino_datos,ARCHIVONIVELES),"r")
+ linea = f.readline()
+ while linea:
+ if linea[0] == "#":
+ linea = f.readline()
+ continue
+ if linea[0] == "[":
+ # empieza nivel
+ nombreNivel = linea.strip("[]\n")
+ nuevoNivel = Nivel(nombreNivel)
+ self.listaNiveles.append(nuevoNivel)
+ linea = f.readline()
+ continue
+ if linea.find("=") == -1:
+ linea = f.readline()
+ continue
+ [var,valor] = linea.strip().split("=")
+ if var.startswith("Prefijo"):
+ self.listaPrefijos.append(
+ unicode(valor.strip(),'iso-8859-1'))
+ elif var.startswith("Sufijo"):
+ self.listaSufijos.append(
+ unicode(valor.strip(),'iso-8859-1'))
+ elif var.startswith("Correcto"):
+ self.listaCorrecto.append(
+ unicode(valor.strip(),'iso-8859-1'))
+ elif var.startswith("Mal"):
+ self.listaMal.append(
+ unicode(valor.strip(),'iso-8859-1'))
+ elif var.startswith("Despedida"):
+ self.listaDespedidas.append(
+ unicode(valor.strip(),'iso-8859-1'))
+ elif var.startswith("dibujoInicial"):
+ listaDibujos = valor.split(",")
+ for i in listaDibujos:
+ nuevoNivel.dibujoInicial.append(i.strip())
+ elif var.startswith("nombreInicial"):
+ listaNombres = valor.split(",")
+ for i in listaNombres:
+ nuevoNivel.nombreInicial.append(i.strip())
+ elif var.startswith("Pregunta"):
+ [texto,tipo,respuesta,ayuda] = valor.split("|")
+ nuevoNivel.preguntas.append(
+ (unicode(texto.strip(),'iso-8859-1'),
+ int(tipo),
+ unicode(respuesta.strip(),'iso-8859-1'),
+ unicode(ayuda.strip(),'iso-8859-1')))
+ linea = f.readline()
+ f.close()
+ self.indiceNivelActual = 0
+ self.numeroNiveles = len(self.listaNiveles)
+ self.numeroSufijos = len(self.listaSufijos)
+ self.numeroPrefijos = len(self.listaPrefijos)
+ self.numeroCorrecto = len(self.listaCorrecto)
+ self.numeroMal = len(self.listaMal)
+ self.numeroDespedidas = len(self.listaDespedidas)
+
+ def cargarExploraciones(self):
+ """Carga los niveles de exploracion del archivo de configuracion"""
+ self.listaExploraciones = list()
+ # falta sanitizar manejo de archivo
+ f = open(os.path.join(self.camino_datos,ARCHIVOEXPLORACIONES),"r")
+ linea = f.readline()
+ while linea:
+ if linea[0] == "#":
+ linea = f.readline()
+ continue
+ if linea[0] == "[":
+ # empieza nivel
+ nombreNivel = linea.strip("[]\n")
+ nuevoNivel = Nivel(nombreNivel)
+ self.listaExploraciones.append(nuevoNivel)
+ linea = f.readline()
+ continue
+ if linea.find("=") == -1:
+ linea = f.readline()
+ continue
+ [var,valor] = linea.strip().split("=")
+ if var.startswith("dibujoInicial"):
+ listaDibujos = valor.split(",")
+ for i in listaDibujos:
+ nuevoNivel.dibujoInicial.append(i.strip())
+ elif var.startswith("nombreInicial"):
+ listaNombres = valor.split(",")
+ for i in listaNombres:
+ nuevoNivel.nombreInicial.append(i.strip())
+ elif var.startswith("elementosActivos"):
+ listaNombres = valor.split(",")
+ for i in listaNombres:
+ nuevoNivel.elementosActivos.append(i.strip())
+ linea = f.readline()
+ f.close()
+ self.numeroExploraciones = len(self.listaExploraciones)
+
+ def pantallaAcercaDe(self):
+ """Pantalla con los datos del juego, creditos, etc"""
+ global scale, shift_x, shift_y, xo_resolution
+ self.pantallaTemp = pygame.Surface(
+ (self.anchoPantalla,self.altoPantalla))
+ self.pantallaTemp.blit(self.pantalla,(0,0))
+ self.pantalla.fill((0,0,0))
+ self.pantalla.blit(self.terron,
+ (int(20*scale+shift_x),
+ int(20*scale+shift_y)))
+ self.mostrarTexto("Acerca de Conozco Nicaragua",
+ self.fuente40,
+ (int(600*scale+shift_x),
+ int(100*scale+shift_y)),
+ (255,255,255))
+ # falta sanitizar acceso a archivo
+ f = open(os.path.join(CAMINORECURSOS,
+ CAMINOCOMUN,
+ CAMINODATOS,
+ ARCHIVOCREDITOS),"r")
+ yLinea = int(200*scale+shift_y)
+ for linea in f:
+ self.mostrarTexto(linea.strip(),
+ self.fuente32,
+ (int(600*scale+shift_x),yLinea),
+ (155,155,255))
+ yLinea = yLinea + int(40*scale)
+ f.close()
+ self.mostrarTexto("Presiona cualquier tecla para volver",
+ self.fuente32,
+ (int(600*scale+shift_x),
+ int(800*scale+shift_y)),
+ (255,155,155))
+ pygame.display.flip()
+ while 1:
+ for event in wait_events():
+ if event.type == pygame.KEYDOWN or \
+ event.type == pygame.MOUSEBUTTONDOWN:
+ self.click.play()
+ self.pantalla.blit(self.pantallaTemp,(0,0))
+ pygame.display.flip()
+ return
+ elif event.type == EVENTOREFRESCO:
+ pygame.display.flip()
+
+ def pantallaInicial(self):
+ """Pantalla con el menu principal del juego"""
+ global scale, shift_x, shift_y
+ self.pantalla.fill((0,0,0))
+ self.mostrarTexto("Conozco Nicaragua",
+ self.fuente48,
+ (int(600*scale+shift_x),
+ int(80*scale+shift_y)),
+ (255,255,255))
+ self.mostrarTexto("Has elegido el mapa de "+\
+ self.listaNombreDirectorios\
+ [self.indiceDirectorioActual],
+ self.fuente40,
+ (int(600*scale+shift_x), int(140*scale+shift_y)),
+ (200,100,100))
+ self.mostrarTexto("Juego",
+ self.fuente48,
+ (int(300*scale+shift_x), int(220*scale+shift_y)),
+ (200,100,100))
+ yLista = int(300*scale+shift_y)
+ for n in self.listaNiveles:
+ self.pantalla.fill((20,20,20),
+ (int(10*scale+shift_x),
+ yLista-int(24*scale),
+ int(590*scale),
+ int(48*scale)))
+ self.mostrarTexto(n.nombre,
+ self.fuente40,
+ (int(300*scale+shift_x), yLista),
+ (200,100,100))
+ yLista += int(50*scale)
+ self.mostrarTexto("Exploro",
+ self.fuente48,
+ (int(900*scale+shift_x), int(220*scale+shift_y)),
+ (100,100,200))
+ yLista = int(300*scale+shift_y)
+ for n in self.listaExploraciones:
+ self.pantalla.fill((20,20,20),
+ (int(610*scale+shift_x),
+ yLista-int(24*scale),
+ int(590*scale),
+ int(48*scale)))
+ self.mostrarTexto(n.nombre,
+ self.fuente40,
+ (int(900*scale+shift_x),yLista),
+ (100,100,200))
+ yLista += int(50*scale)
+ self.pantalla.fill((20,20,20),
+ (int(10*scale+shift_x),
+ int(801*scale+shift_y),
+ int(590*scale),int(48*scale)))
+ self.mostrarTexto("Sobre este juego",
+ self.fuente40,
+ (int(300*scale+shift_x),int(825*scale+shift_y)),
+ (100,200,100))
+ self.pantalla.fill((20,20,20),
+ (int(610*scale+shift_x),
+ int(801*scale+shift_y),
+ int(590*scale),int(48*scale)))
+ self.mostrarTexto("Volver",
+ self.fuente40,
+ (int(900*scale+shift_x),int(825*scale+shift_y)),
+ (100,200,100))
+ pygame.display.flip()
+ while 1:
+ for event in wait_events():
+ if event.type == pygame.KEYDOWN:
+ if event.key == 27: # escape: volver
+ self.click.play()
+ self.elegir_directorio = True
+ return
+ elif event.type == pygame.MOUSEBUTTONDOWN:
+ self.click.play()
+ pos = event.pos
+ if pos[1] > 275*scale + shift_y: # zona de opciones
+ if pos[0] < 600*scale + shift_x: # primera columna
+ if pos[1] < 275*scale + shift_y + \
+ len(self.listaNiveles)*50*scale: # nivel
+ self.indiceNivelActual = \
+ int((pos[1]-int(275*scale+shift_y))//\
+ int(50*scale))
+ self.jugar = True
+ return
+ elif pos[1] > 800*scale + shift_y and \
+ pos[1] < 850*scale + shift_y: # acerca de
+ self.pantallaAcercaDe()
+ else: # segunda columna
+ if pos[1] < 275*scale + shift_y+\
+ len(self.listaExploraciones)*50*scale:
+ # nivel de exploracion
+ self.indiceNivelActual = \
+ int((pos[1]-int(275*scale+shift_y))//\
+ int(50*scale))
+ self.jugar = False
+ return
+ elif pos[1] > 800*scale + shift_y and \
+ pos[1] < 850*scale+shift_y: # volver
+ self.elegir_directorio = True
+ return
+ elif event.type == EVENTOREFRESCO:
+ pygame.display.flip()
+
+ def pantallaDirectorios(self):
+ """Pantalla con el menu de directorios"""
+ global scale, shift_x, shift_y
+ self.pantalla.fill((0,0,0))
+ self.mostrarTexto("Conozco Nicaragua",
+ self.fuente48,
+ (int(600*scale+shift_x),int(80*scale+shift_y)),
+ (255,255,255))
+ self.mostrarTexto("Elige el mapa a utilizar",
+ self.fuente40,
+ (int(600*scale+shift_x),int(140*scale+shift_y)),
+ (200,100,100))
+ nDirectorios = len(self.listaNombreDirectorios)
+ paginaDirectorios = self.paginaDir
+ while 1:
+ yLista = int(200*scale+shift_y)
+ self.pantalla.fill((0,0,0),
+ (int(shift_x),yLista-int(24*scale),
+ int(1200*scale),int(600*scale)))
+ if paginaDirectorios == 0:
+ paginaAnteriorActiva = False
+ else:
+ paginaAnteriorActiva = True
+ paginaSiguienteActiva = False
+ if paginaAnteriorActiva:
+ self.pantalla.fill((20,20,20),
+ (int(10*scale+shift_x),yLista-int(24*scale),
+ int(590*scale),int(48*scale)))
+ self.mostrarTexto("<<< Pagina anterior",
+ self.fuente40,
+ (int(300*scale+shift_x),yLista),
+ (100,100,200))
+ yLista += int(50*scale)
+ indiceDir = paginaDirectorios * 20
+ terminar = False
+ while not terminar:
+ self.pantalla.fill((20,20,20),
+ (int(10*scale+shift_x),yLista-int(24*scale),
+ int(590*scale),int(48*scale)))
+ self.mostrarTexto(self.listaNombreDirectorios[indiceDir],
+ self.fuente40,
+ (int(300*scale+shift_x),yLista),
+ (200,100,100))
+ yLista += int(50*scale)
+ indiceDir = indiceDir + 1
+ if indiceDir == nDirectorios or \
+ indiceDir == paginaDirectorios * 20 + 10:
+ terminar = True
+ if indiceDir == paginaDirectorios * 20 + 10 and \
+ not indiceDir == nDirectorios:
+ nDirectoriosCol1 = 10
+ yLista = int(250*scale+shift_y)
+ terminar = False
+ while not terminar:
+ self.pantalla.fill((20,20,20),
+ (int(610*scale+shift_x),
+ yLista-int(24*scale),
+ int(590*scale),int(48*scale)))
+ self.mostrarTexto(self.listaNombreDirectorios[indiceDir],
+ self.fuente40,
+ (int(900*scale+shift_x),yLista),
+ (200,100,100))
+ yLista += int(50*scale)
+ indiceDir = indiceDir + 1
+ if indiceDir == nDirectorios or \
+ indiceDir == paginaDirectorios * 20 + 20:
+ terminar = True
+ if indiceDir == paginaDirectorios * 20 + 20:
+ if indiceDir < nDirectorios:
+ self.pantalla.fill((20,20,20),
+ (int(610*scale+shift_x),
+ yLista-int(24*scale),
+ int(590*scale),int(48*scale)))
+ self.mostrarTexto("Pagina siguiente >>>",
+ self.fuente40,
+ (int(900*scale+shift_x),yLista),
+ (100,100,200))
+ paginaSiguienteActiva = True
+ nDirectoriosCol2 = 10
+ else:
+ nDirectoriosCol2 = indiceDir - paginaDirectorios * 20 - 10
+ else:
+ nDirectoriosCol1 = indiceDir - paginaDirectorios * 20
+ nDirectoriosCol2 = 0
+ self.pantalla.fill((20,20,20),
+ (int(10*scale+shift_x),int(801*scale+shift_y),
+ int(590*scale),int(48*scale)))
+ self.mostrarTexto("Sobre este juego",
+ self.fuente40,
+ (int(300*scale+shift_x),int(825*scale+shift_y)),
+ (100,200,100))
+ self.pantalla.fill((20,20,20),
+ (int(610*scale+shift_x),int(801*scale+shift_y),
+ int(590*scale),int(48*scale)))
+ self.mostrarTexto("Salir",
+ self.fuente40,
+ (int(900*scale+shift_x),int(825*scale+shift_y)),
+ (100,200,100))
+ pygame.display.flip()
+ cambiarPagina = False
+ while not cambiarPagina:
+ for event in wait_events():
+ if event.type == pygame.KEYDOWN:
+ if event.key == 27: # escape: salir
+ self.click.play()
+ sys.exit()
+ elif event.type == pygame.MOUSEBUTTONDOWN:
+ self.click.play()
+ pos = event.pos
+ if pos[1] > 175*scale+shift_y: # zona de opciones
+ if pos[0] < 600*scale+shift_x: # primera columna
+ if pos[1] < 175*scale + shift_y + \
+ (nDirectoriosCol1+1)*50*scale: # mapa
+ self.indiceDirectorioActual = \
+ int((pos[1]-int(175*scale+shift_y))//\
+ int(50*scale)) - 1 + \
+ paginaDirectorios*20
+ if self.indiceDirectorioActual == \
+ paginaDirectorios*20-1 and \
+ paginaAnteriorActiva: # pag. ant.
+ paginaDirectorios = paginaDirectorios-1
+ paginaSiguienteActiva = True
+ cambiarPagina = True
+ elif self.indiceDirectorioActual>\
+ paginaDirectorios*20-1:
+ self.paginaDir = paginaDirectorios
+ return
+ elif pos[1] > 800*scale + shift_y and \
+ pos[1] < 850*scale + shift_y: # acerca
+ self.pantallaAcercaDe()
+ else:
+ if pos[1] < 225*scale + shift_y + \
+ nDirectoriosCol2*50*scale or \
+ (paginaSiguienteActiva and \
+ pos[1]<775*scale+shift_y): # mapa
+ self.indiceDirectorioActual = \
+ int((pos[1]-int(225*scale+shift_y))//\
+ int(50*scale)) + \
+ paginaDirectorios*20 + 10
+ if self.indiceDirectorioActual == \
+ paginaDirectorios*20+9:
+ pass # ignorar; espacio vacio
+ elif self.indiceDirectorioActual == \
+ paginaDirectorios*20+20 and \
+ paginaSiguienteActiva: # pag. sig.
+ paginaDirectorios = \
+ paginaDirectorios + 1
+ paginaAnteriorActiva = True
+ cambiarPagina = True
+ elif self.indiceDirectorioActual<\
+ paginaDirectorios*20+20:
+ self.paginaDir = paginaDirectorios
+ return
+ elif pos[1] > 800*scale+shift_y and \
+ pos[1] < 850*scale+shift_y: # salir
+ sys.exit()
+ elif event.type == EVENTOREFRESCO:
+ pygame.display.flip()
+
+ def cargarImagen(self,nombre):
+ """Carga una imagen y la escala de acuerdo a la resolucion"""
+ global scale, xo_resolution
+ if xo_resolution:
+ imagen = pygame.image.load( \
+ os.path.join(self.camino_imagenes,nombre))
+ else:
+ imagen0 = pygame.image.load( \
+ os.path.join(self.camino_imagenes,nombre))
+ imagen = pygame.transform.scale(imagen0,
+ (int(imagen0.get_width()*scale),
+ int(imagen0.get_height()*scale)))
+ del imagen0
+ return imagen
+
+ def __init__(self):
+ """Esta es la inicializacion del juego"""
+ global scale, shift_x, shift_y, xo_resolution
+ pygame.init()
+ # crear pantalla
+ self.anchoPantalla = gtk.gdk.screen_width()
+ self.altoPantalla = gtk.gdk.screen_height()
+ self.pantalla = pygame.display.set_mode((self.anchoPantalla,
+ self.altoPantalla))
+ if self.anchoPantalla==1200 and self.altoPantalla==900:
+ xo_resolution = True
+ scale = 1
+ shift_x = 0
+ shift_y = 0
+ else:
+ xo_resolution = False
+ if self.anchoPantalla/1200.0<self.altoPantalla/900.0:
+ scale = self.anchoPantalla/1200.0
+ shift_x = 0
+ shift_y = int((self.altoPantalla-scale*900)/2)
+ else:
+ scale = self.altoPantalla/900.0
+ shift_x = int((self.anchoPantalla-scale*1200)/2)
+ shift_y = 0
+ # cargar imagenes generales
+ self.camino_imagenes = os.path.join(CAMINORECURSOS,
+ CAMINOCOMUN,
+ CAMINOIMAGENES)
+ self.bicho = self.cargarImagen("bicho.png")
+ self.bichopestanas = self.cargarImagen("bichopestanas.png")
+ self.bichofrente = self.cargarImagen("bichofrente.png")
+ self.globito = self.cargarImagen("globito.png")
+ self.nave = list()
+ self.nave.append(self.cargarImagen("nave1.png"))
+ self.nave.append(self.cargarImagen("nave2.png"))
+ self.nave.append(self.cargarImagen("nave3.png"))
+ self.nave.append(self.cargarImagen("nave4.png"))
+ self.nave.append(self.cargarImagen("nave5.png"))
+ self.nave.append(self.cargarImagen("nave6.png"))
+ self.nave.append(self.cargarImagen("nave7.png"))
+ self.fuego = list()
+ self.fuego.append(self.cargarImagen("fuego1.png"))
+ self.fuego.append(self.cargarImagen("fuego2.png"))
+ self.tierra = self.cargarImagen("tierra.png")
+ self.navellegando = self.cargarImagen("navellegando.png")
+ self.bichotriste = self.cargarImagen("bichotriste.png")
+ self.alerta = self.cargarImagen("alerta.png")
+ self.alertarojo = self.cargarImagen("alertarojo.png")
+ self.pedazo1 = self.cargarImagen("pedazo1.png")
+ self.pedazo2 = self.cargarImagen("pedazo2.png")
+ self.paracaidas = self.cargarImagen("paracaidas.png")
+ self.terron = self.cargarImagen("terron.png")
+ self.simboloCapital = self.cargarImagen("capital.png")
+ self.simboloCiudad = self.cargarImagen("ciudad.png")
+ self.simboloCerro = self.cargarImagen("cerro.png")
+ # cargar sonidos
+ self.camino_sonidos = os.path.join(CAMINORECURSOS,
+ CAMINOCOMUN,
+ CAMINOSONIDOS)
+ self.despegue = pygame.mixer.Sound(os.path.join(\
+ self.camino_sonidos,"NoiseCollector_boom2.ogg"))
+ self.click = pygame.mixer.Sound(os.path.join(\
+ self.camino_sonidos,"junggle_btn045.wav"))
+ self.click.set_volume(0.2)
+ self.chirp = pygame.mixer.Sound(os.path.join(\
+ self.camino_sonidos,"chirp_alerta.ogg"))
+ # cargar directorios
+ self.cargarListaDirectorios()
+ # cargar fuentes
+ self.fuente48 = pygame.font.Font(os.path.join(CAMINORECURSOS,\
+ CAMINOCOMUN,\
+ CAMINOFUENTES,\
+ "AllCaps.ttf"),
+ int(48*scale))
+ self.fuente40 = pygame.font.Font(os.path.join(CAMINORECURSOS,\
+ CAMINOCOMUN,\
+ CAMINOFUENTES,\
+ "Share-Regular.ttf"),
+ int(34*scale))
+ self.fuente32 = pygame.font.Font(None, int(32*scale))
+ self.fuente24 = pygame.font.Font(None, int(24*scale))
+ # cursor
+ datos_cursor = (
+ "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX ",
+ "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX ",
+ "XXX.........................XXXX",
+ "XXX..........................XXX",
+ "XXX..........................XXX",
+ "XXX.........................XXXX",
+ "XXX.......XXXXXXXXXXXXXXXXXXXXX ",
+ "XXX........XXXXXXXXXXXXXXXXXXX ",
+ "XXX.........XXX ",
+ "XXX..........XXX ",
+ "XXX...........XXX ",
+ "XXX....X.......XXX ",
+ "XXX....XX.......XXX ",
+ "XXX....XXX.......XXX ",
+ "XXX....XXXX.......XXX ",
+ "XXX....XXXXX.......XXX ",
+ "XXX....XXXXXX.......XXX ",
+ "XXX....XXX XXX.......XXX ",
+ "XXX....XXX XXX.......XXX ",
+ "XXX....XXX XXX.......XXX ",
+ "XXX....XXX XXX.......XXX ",
+ "XXX....XXX XXX.......XXX ",
+ "XXX....XXX XXX.......XXX ",
+ "XXX....XXX XXX.......XXX ",
+ "XXX....XXX XXX.......XXX ",
+ "XXX....XXX XXX.......XXX",
+ "XXX....XXX XXX......XXX",
+ "XXX....XXX XXX.....XXX",
+ "XXX....XXX XXX...XXXX",
+ " XXX..XXX XXXXXXXX ",
+ " XXXXXX XXXXXX ",
+ " XXXX XXXX ")
+ self.cursor = pygame.cursors.compile(datos_cursor)
+ pygame.mouse.set_cursor((32,32), (1,1), *self.cursor)
+ datos_cursor_espera = (
+ " ",
+ " ",
+ " ",
+ " ",
+ " ",
+ " ",
+ " ",
+ " ",
+ " ",
+ " ",
+ " XXXXXX XXXXXX XXXXXX ",
+ " XXXXXXXX XXXXXXXX XXXXXXXX ",
+ "XXXX..XXXX XXXX..XXXX XXXX..XXXX",
+ "XXX....XXX XXX....XXX XXX....XXX",
+ "XXX....XXX XXX....XXX XXX....XXX",
+ "XXX....XXX XXX....XXX XXX....XXX",
+ "XXXX..XXXX XXXX..XXXX XXXX..XXXX",
+ " XXXXXXXX XXXXXXXX XXXXXXXX ",
+ " XXXXXX XXXXXX XXXXX ",
+ " ",
+ " ",
+ " ",
+ " ",
+ " ",
+ " ",
+ " ",
+ " ",
+ " ",
+ " ",
+ " ",
+ " ",
+ " ")
+ self.cursor_espera = pygame.cursors.compile(datos_cursor_espera)
+
+ def cargarDirectorio(self):
+ """Carga la informacion especifica de un directorio"""
+ self.camino_imagenes = os.path.join(CAMINORECURSOS,
+ self.directorio,
+ CAMINOIMAGENES)
+ self.camino_sonidos = os.path.join(CAMINORECURSOS,
+ self.directorio,
+ CAMINOSONIDOS)
+ self.camino_datos = os.path.join(CAMINORECURSOS,
+ self.directorio,
+ CAMINODATOS)
+ self.fondo = self.cargarImagen("fondo.png")
+ self.cargarDepartamentos()
+ self.cargarRios()
+ self.cargarRutas()
+ self.cargarCuchillas()
+ self.cargarLugares()
+ self.cargarNiveles()
+ self.cargarExploraciones()
+
+ def mostrarGlobito(self,lineas):
+ """Muestra texto en el globito"""
+ global scale, shift_x, shift_y
+ self.pantalla.blit(self.globito,
+ (int(XMAPAMAX*scale+shift_x),
+ int(YGLOBITO*scale+shift_y)))
+ yLinea = int(YGLOBITO*scale) + shift_y + \
+ self.fuente32.get_height()*3
+ for l in lineas:
+ text = self.fuente32.render(l, 1, COLORPREGUNTAS)
+ textrect = text.get_rect()
+ textrect.center = (int(XCENTROPANEL*scale+shift_x),yLinea)
+ self.pantalla.blit(text, textrect)
+ yLinea = yLinea + self.fuente32.get_height() + int(10*scale)
+ pygame.display.flip()
+
+ def borrarGlobito(self):
+ """ Borra el globito, lo deja en blanco"""
+ global scale, shift_x, shift_y
+ self.pantalla.blit(self.globito,
+ (int(XMAPAMAX*scale+shift_x),
+ int(YGLOBITO*scale+shift_y)))
+
+ def correcto(self):
+ """Muestra texto en el globito cuando la respuesta es correcta"""
+ global scale, shift_x, shift_y
+ self.pantalla.blit(self.nave[self.avanceNivel],
+ (int(XNAVE*scale+shift_x),
+ int(YNAVE*scale+shift_y)))
+ self.correctoActual = random.randint(1,self.numeroCorrecto)-1
+ self.mostrarGlobito([self.listaCorrecto[self.correctoActual]])
+ self.esCorrecto = True
+ pygame.time.set_timer(EVENTORESPUESTA,TIEMPORESPUESTA)
+
+ def mal(self):
+ """Muestra texto en el globito cuando la respuesta es incorrecta"""
+ self.malActual = random.randint(1,self.numeroMal)-1
+ self.mostrarGlobito([self.listaMal[self.malActual]])
+ self.esCorrecto = False
+ self.nRespuestasMal += 1
+ pygame.time.set_timer(EVENTORESPUESTA,TIEMPORESPUESTA)
+
+ def esCorrecta(self,nivel,pos):
+ """Devuelve True si las coordenadas cliqueadas corresponden a la
+ respuesta correcta
+ """
+ respCorrecta = nivel.preguntaActual[2]
+ # primero averiguar tipo
+ if nivel.preguntaActual[1] == 1: # DEPTO
+ # buscar depto correcto
+ encontrado = False
+ for d in self.listaDeptos:
+ if d.nombre == respCorrecta:
+ encontrado = True
+ break
+ if d.estaAca(pos):
+ d.mostrarNombre(self.pantalla,
+ self.fuente32,
+ COLORNOMBREDEPTO,
+ True)
+ return True
+ else:
+ return False
+ elif nivel.preguntaActual[1] == 2: # CAPITAL o CIUDAD
+ # buscar lugar correcto
+ encontrado = False
+ for l in self.listaLugares:
+ if l.nombre == respCorrecta:
+ encontrado = True
+ break
+ if l.estaAca(pos):
+ l.mostrarNombre(self.pantalla,
+ self.fuente24,
+ COLORNOMBRECAPITAL,
+ True)
+ return True
+ else:
+ return False
+ if nivel.preguntaActual[1] == 3: # RIO
+ # buscar rio correcto
+ encontrado = False
+ for d in self.listaRios:
+ if d.nombre == respCorrecta:
+ encontrado = True
+ break
+ if d.estaAca(pos):
+ d.mostrarNombre(self.pantalla,
+ self.fuente24,
+ COLORNOMBRERIO,
+ True)
+ return True
+ else:
+ return False
+ if nivel.preguntaActual[1] == 4: # CUCHILLA
+ # buscar cuchilla correcta
+ encontrado = False
+ for d in self.listaCuchillas:
+ if d.nombre == respCorrecta:
+ encontrado = True
+ break
+ if d.estaAca(pos):
+ d.mostrarNombre(self.pantalla,
+ self.fuente24,
+ COLORNOMBREELEVACION,
+ True)
+ return True
+ else:
+ return False
+ elif nivel.preguntaActual[1] == 5: # CERRO
+ # buscar lugar correcto
+ encontrado = False
+ for l in self.listaLugares:
+ if l.nombre == respCorrecta:
+ encontrado = True
+ break
+ if l.estaAca(pos):
+ l.mostrarNombre(self.pantalla,
+ self.fuente24,
+ COLORNOMBREELEVACION,
+ True)
+ return True
+ else:
+ return False
+ if nivel.preguntaActual[1] == 6: # RUTA
+ # buscar ruta correcta
+ encontrado = False
+ for d in self.listaRutas:
+ if d.nombre == respCorrecta:
+ encontrado = True
+ break
+ if d.estaAca(pos):
+ d.mostrarNombre(self.pantalla,
+ self.fuente24,
+ COLORNOMBRERUTA,
+ True)
+ return True
+ else:
+ return False
+
+ def explorarNombres(self):
+ """Juego principal en modo exploro."""
+ self.nivelActual = self.listaExploraciones[self.indiceNivelActual]
+ # presentar nivel
+ for i in self.nivelActual.dibujoInicial:
+ if i.startswith("lineasDepto"):
+ self.pantalla.blit(self.deptosLineas, (shift_x, shift_y))
+ elif i.startswith("rios"):
+ self.pantalla.blit(self.rios, (shift_x, shift_y))
+ elif i.startswith("rutas"):
+ self.pantalla.blit(self.rutas, (shift_x, shift_y))
+ elif i.startswith("cuchillas"):
+ self.pantalla.blit(self.cuchillas, (shift_x, shift_y))
+ elif i.startswith("capitales"):
+ for l in self.listaLugares:
+ if l.tipo == 1:
+ l.dibujar(self.pantalla,False)
+ elif i.startswith("ciudades"):
+ for l in self.listaLugares:
+ if l.tipo == 2:
+ l.dibujar(self.pantalla,False)
+ elif i.startswith("cerros"):
+ for l in self.listaLugares:
+ if l.tipo == 5:
+ l.dibujar(self.pantalla,False)
+ for i in self.nivelActual.nombreInicial:
+ if i.startswith("deptos"):
+ for d in self.listaDeptos:
+ d.mostrarNombre(self.pantalla,self.fuente32,
+ COLORNOMBREDEPTO,False)
+ elif i.startswith("rios"):
+ for d in self.listaRios:
+ d.mostrarNombre(self.pantalla,self.fuente32,
+ COLORNOMBRERIO,False)
+ elif i.startswith("rutas"):
+ for d in self.listaRutas:
+ d.mostrarNombre(self.pantalla,self.fuente32,
+ COLORNOMBRERUTA,False)
+ elif i.startswith("cuchillas"):
+ for d in self.listaCuchillas:
+ d.mostrarNombre(self.pantalla,self.fuente32,
+ COLORNOMBREELEVACION,False)
+ elif i.startswith("capitales"):
+ for l in self.listaLugares:
+ if l.tipo == 1:
+ l.mostrarNombre(self.pantalla,self.fuente24,
+ COLORNOMBRECAPITAL,False)
+ elif i.startswith("ciudades"):
+ for l in self.listaLugares:
+ if l.tipo == 2:
+ l.mostrarNombre(self.pantalla,self.fuente24,
+ COLORNOMBRECAPITAL,False)
+ elif i.startswith("cerros"):
+ for l in self.listaLugares:
+ if l.tipo == 5:
+ l.mostrarNombre(self.pantalla,self.fuente24,
+ COLORNOMBREELEVACION,False)
+ self.pantalla.fill((100,20,20),(int(975*scale+shift_x),
+ int(26*scale+shift_y),
+ int(200*scale),
+ int(48*scale)))
+ self.mostrarTexto("Terminar",
+ self.fuente40,
+ (int(1075*scale+shift_x),
+ int(50*scale+shift_y)),
+ (255,155,155))
+ pygame.display.flip()
+ # lazo principal de espera por acciones del usuario
+ while 1:
+ for event in wait_events():
+ if event.type == pygame.KEYDOWN:
+ if event.key == 27: # escape: salir
+ self.click.play()
+ return
+ elif event.type == pygame.MOUSEBUTTONDOWN:
+ self.click.play()
+ if event.pos[0] < XMAPAMAX*scale+shift_x: # zona de mapa
+ for i in self.nivelActual.elementosActivos:
+ if i.startswith("capitales"):
+ for l in self.listaLugares:
+ if l.tipo == 1 and l.estaAca(event.pos):
+ l.mostrarNombre(self.pantalla,
+ self.fuente24,
+ COLORNOMBRECAPITAL,
+ True)
+ break
+ elif i.startswith("ciudades"):
+ for l in self.listaLugares:
+ if l.tipo == 2 and l.estaAca(event.pos):
+ l.mostrarNombre(self.pantalla,
+ self.fuente24,
+ COLORNOMBRECAPITAL,
+ True)
+ break
+ elif i.startswith("rios"):
+ for d in self.listaRios:
+ if d.estaAca(event.pos):
+ d.mostrarNombre(self.pantalla,
+ self.fuente24,
+ COLORNOMBRERIO,
+ True)
+ break
+ elif i.startswith("rutas"):
+ for d in self.listaRutas:
+ if d.estaAca(event.pos):
+ d.mostrarNombre(self.pantalla,
+ self.fuente24,
+ COLORNOMBRERUTA,
+ True)
+ break
+ elif i.startswith("cuchillas"):
+ for d in self.listaCuchillas:
+ if d.estaAca(event.pos):
+ d.mostrarNombre(self.pantalla,
+ self.fuente24,
+ COLORNOMBREELEVACION,
+ True)
+ break
+ elif i.startswith("cerros"):
+ for l in self.listaLugares:
+ if l.tipo == 5 and l.estaAca(event.pos):
+ l.mostrarNombre(self.pantalla,
+ self.fuente24,
+ COLORNOMBREELEVACION,
+ True)
+ break
+ elif i.startswith("deptos"):
+ for d in self.listaDeptos:
+ if d.estaAca(event.pos):
+ d.mostrarNombre(self.pantalla,
+ self.fuente32,
+ COLORNOMBREDEPTO,
+ True)
+ break
+ elif event.pos[0] > 975*scale+shift_x and \
+ event.pos[0] < 1175*scale+shift_x and \
+ event.pos[1] > 25*scale+shift_y and \
+ event.pos[1] < 75*scale+shift_y: # terminar
+ return
+ elif event.type == EVENTOREFRESCO:
+ pygame.display.flip()
+
+
+ def jugarNivel(self):
+ """Juego principal de preguntas y respuestas"""
+ self.nivelActual = self.listaNiveles[self.indiceNivelActual]
+ self.avanceNivel = 0
+ self.nivelActual.prepararPreguntas()
+ # presentar nivel
+ for i in self.nivelActual.dibujoInicial:
+ if i.startswith("lineasDepto"):
+ self.pantalla.blit(self.deptosLineas, (shift_x, shift_y))
+ elif i.startswith("rios"):
+ self.pantalla.blit(self.rios, (shift_x, shift_y))
+ elif i.startswith("rutas"):
+ self.pantalla.blit(self.rutas, (shift_x, shift_y))
+ elif i.startswith("cuchillas"):
+ self.pantalla.blit(self.cuchillas, (shift_x, shift_y))
+ elif i.startswith("capitales"):
+ for l in self.listaLugares:
+ if l.tipo == 1:
+ l.dibujar(self.pantalla,False)
+ elif i.startswith("ciudades"):
+ for l in self.listaLugares:
+ if l.tipo == 2:
+ l.dibujar(self.pantalla,False)
+ elif i.startswith("cerros"):
+ for l in self.listaLugares:
+ if l.tipo == 5:
+ l.dibujar(self.pantalla,False)
+ for i in self.nivelActual.nombreInicial:
+ if i.startswith("deptos"):
+ for d in self.listaDeptos:
+ d.mostrarNombre(self.pantalla,self.fuente32,
+ COLORNOMBREDEPTO,False)
+ if i.startswith("rios"):
+ for d in self.listaRios:
+ d.mostrarNombre(self.pantalla,self.fuente32,
+ COLORNOMBRERIO,False)
+ if i.startswith("rutas"):
+ for d in self.listaRutas:
+ d.mostrarNombre(self.pantalla,self.fuente32,
+ COLORNOMBRERUTA,False)
+ if i.startswith("cuchillas"):
+ for d in self.listaCuchillas:
+ d.mostrarNombre(self.pantalla,self.fuente32,
+ COLORNOMBREELEVACION,False)
+ elif i.startswith("capitales"):
+ for l in self.listaLugares:
+ if l.tipo == 1:
+ l.mostrarNombre(self.pantalla,self.fuente24,
+ COLORNOMBRECAPITAL,False)
+ elif i.startswith("ciudades"):
+ for l in self.listaLugares:
+ if l.tipo == 2:
+ l.mostrarNombre(self.pantalla,self.fuente24,
+ COLORNOMBRECAPITAL,False)
+ elif i.startswith("cerros"):
+ for l in self.listaLugares:
+ if l.tipo == 5:
+ l.mostrarNombre(self.pantalla,self.fuente24,
+ COLORNOMBREELEVACION,False)
+ self.pantalla.fill((100,20,20),
+ (int(975*scale+shift_x),
+ int(26*scale+shift_y),
+ int(200*scale),
+ int(48*scale)))
+ self.mostrarTexto("Terminar",
+ self.fuente40,
+ (int(1075*scale+shift_x),
+ int(50*scale+shift_y)),
+ (255,155,155))
+ pygame.display.flip()
+ # presentar pregunta inicial
+ self.lineasPregunta = self.nivelActual.siguientePregunta(\
+ self.listaSufijos,self.listaPrefijos)
+ self.mostrarGlobito(self.lineasPregunta)
+ self.nRespuestasMal = 0
+ # leer eventos y ver si la respuesta es correcta
+ while 1:
+ for event in wait_events():
+ if event.type == pygame.KEYDOWN:
+ if event.key == 27: # escape: salir
+ self.click.play()
+ pygame.time.set_timer(EVENTORESPUESTA,0)
+ pygame.time.set_timer(EVENTODESPEGUE,0)
+ return
+ elif event.type == pygame.MOUSEBUTTONDOWN:
+ self.click.play()
+ if self.avanceNivel < TOTALAVANCE:
+ if event.pos[0] < XMAPAMAX*scale+shift_x: # zona mapa
+ self.borrarGlobito()
+ if self.esCorrecta(self.nivelActual,
+ event.pos):
+ self.correcto()
+ else:
+ self.mal()
+ elif event.pos[0] > 975*scale+shift_x and \
+ event.pos[0] < 1175*scale+shift_x and \
+ event.pos[1] > 25*scale+shift_y and \
+ event.pos[1] < 75*scale+shift_y: # terminar
+ return
+ elif event.type == EVENTORESPUESTA:
+ pygame.time.set_timer(EVENTORESPUESTA,0)
+ if self.esCorrecto:
+ self.avanceNivel = self.avanceNivel + 1
+ if self.avanceNivel == TOTALAVANCE: # inicia despegue
+ self.lineasPregunta = self.listaDespedidas[\
+ random.randint(1,self.numeroDespedidas)-1]\
+ .split("\\")
+ self.mostrarGlobito(self.lineasPregunta)
+ self.yNave = int(YNAVE*scale+shift_y)
+ self.fuego1 = True
+ pygame.time.set_timer(EVENTODESPEGUE,
+ TIEMPORESPUESTA*2)
+ else: # pregunta siguiente
+ self.lineasPregunta = \
+ self.nivelActual.siguientePregunta(\
+ self.listaSufijos,self.listaPrefijos)
+ self.mostrarGlobito(self.lineasPregunta)
+ self.nRespuestasMal = 0
+ else:
+ if self.nRespuestasMal >= 2: # ayuda
+ self.mostrarGlobito(
+ self.nivelActual.devolverAyuda())
+ self.nRespuestasMal = 0
+ pygame.time.set_timer(
+ EVENTORESPUESTA,TIEMPORESPUESTA)
+ else: # volver a preguntar
+ self.mostrarGlobito(self.lineasPregunta)
+ elif event.type == EVENTODESPEGUE:
+ if self.yNave == int(YNAVE*scale+shift_y): # inicio
+ self.pantalla.fill(COLORPANEL,
+ (int(XBICHO*scale+shift_x),
+ int(YBICHO*scale+shift_y),
+ int(DXBICHO*scale),
+ int(DYBICHO*scale)))
+ self.pantalla.fill(COLORPANEL,
+ (int(XMAPAMAX*scale+shift_x),0,
+ int(DXPANEL*scale),
+ int(900*scale)))
+ self.estadobicho = ESTADODESPEGUE
+ self.despegue.play()
+ self.pantalla.fill(COLORPANEL,
+ (int(XNAVE*scale+shift_x),
+ self.yNave,
+ int(DXNAVE*scale),
+ int((DYNAVE+30)*scale)))
+ self.yNave = self.yNave-8
+ if self.yNave<1: # fin del despegue
+ pygame.time.set_timer(EVENTODESPEGUE,0)
+ return
+ else: # animacion
+ pygame.time.set_timer(EVENTODESPEGUE,TIEMPODESPEGUE)
+ self.pantalla.blit(self.nave[6],
+ (int(XNAVE*scale+shift_x),
+ self.yNave))
+ if self.fuego1:
+ self.pantalla.blit(self.fuego[0],
+ (int((XNAVE+30)*scale+shift_x),
+ self.yNave+int(DYNAVE*scale)))
+ else:
+ self.pantalla.blit(self.fuego[1],
+ (int((XNAVE+30)*scale+shift_x),
+ self.yNave+int(DYNAVE*scale)))
+ self.fuego1 = not self.fuego1
+ pygame.display.flip()
+ elif event.type == EVENTOREFRESCO:
+ if self.estadobicho == ESTADONORMAL:
+ if random.randint(1,15) == 1:
+ self.estadobicho = ESTADOPESTANAS
+ self.pantalla.blit(self.bichopestanas,
+ (int(XBICHO*scale+shift_x),
+ int(YBICHO*scale+shift_y)))
+ elif random.randint(1,20) == 1:
+ self.estadobicho = ESTADOFRENTE
+ self.pantalla.blit(self.bichofrente,
+ (int(XBICHO*scale+shift_x),
+ int(YBICHO*scale+shift_y)))
+
+ elif self.estadobicho == ESTADOPESTANAS:
+ self.estadobicho = ESTADONORMAL
+ self.pantalla.blit(self.bicho,
+ (int(XBICHO*scale+shift_x),
+ int(YBICHO*scale+shift_y)))
+ elif self.estadobicho == ESTADOFRENTE:
+ if random.randint(1,10) == 1:
+ self.estadobicho = ESTADONORMAL
+ self.pantalla.blit(self.bicho,
+ (int(XBICHO*scale+shift_x),
+ int(YBICHO*scale+shift_y)))
+ elif self.estadobicho == ESTADODESPEGUE:
+ pass
+ pygame.display.flip()
+
+ def presentacion(self):
+ """Presenta una animacion inicial"""
+ # falta sanitizar manejo de archivo
+ self.listaPresentacion = list()
+ f = open(os.path.join(CAMINORECURSOS,
+ CAMINOCOMUN,
+ CAMINODATOS,ARCHIVOPRESENTACION),"r")
+ for linea in f:
+ self.listaPresentacion.append(unicode(linea,'iso-8859-1'))
+ f.close()
+ self.pantalla.fill((0,0,0))
+ # cuadro 1: nave llegando
+ self.pantalla.blit(self.tierra,(int(200*scale+shift_x),
+ int(150*scale+shift_y)))
+ self.mostrarTexto("Presiona cualquier tecla para saltear",
+ self.fuente32,
+ (int(600*scale+shift_x),int(800*scale+shift_y)),
+ (255,155,155))
+ pygame.display.flip()
+ pygame.time.set_timer(EVENTODESPEGUE,TIEMPODESPEGUE)
+ self.despegue.play()
+ self.paso = 0
+ terminar = False
+ while 1:
+ for event in wait_events():
+ if event.type == pygame.KEYDOWN or \
+ event.type == pygame.MOUSEBUTTONDOWN:
+ self.click.play()
+ pygame.time.set_timer(EVENTODESPEGUE,0)
+ return
+ elif event.type == EVENTODESPEGUE:
+ self.paso += 1
+ if self.paso == 150:
+ pygame.time.set_timer(EVENTODESPEGUE,0)
+ terminar = True
+ else:
+ pygame.time.set_timer(EVENTODESPEGUE,TIEMPODESPEGUE)
+ self.pantalla.fill((0,0,0),
+ (int((900-(self.paso-1)*3)*scale+\
+ shift_x),
+ int((150+(self.paso-1)*1)*scale+\
+ shift_y),
+ int(100*scale),int(63*scale)))
+ self.pantalla.blit(self.navellegando,
+ (int((900-self.paso*3)*scale+\
+ shift_x),
+ int((150+self.paso*1)*scale+\
+ shift_y)))
+ pygame.display.flip()
+ elif event.type == EVENTOREFRESCO:
+ pygame.display.flip()
+ if terminar:
+ break
+ # cuadro 2: marcianito hablando
+ self.pantalla.fill((0,0,0))
+ self.pantalla.blit(self.bicho,(int(600*scale+shift_x),
+ int(450*scale+shift_y)))
+ self.pantalla.blit(self.globito,
+ (int(350*scale+shift_x),int(180*scale+shift_y)))
+ yLinea = int((180+self.fuente32.get_height()*3)*scale+shift_y)
+ lineas = self.listaPresentacion[0].split("\\")
+ for l in lineas:
+ text = self.fuente32.render(l.strip(), 1, COLORPREGUNTAS)
+ textrect = text.get_rect()
+ textrect.center = (int(557*scale+shift_x),yLinea)
+ self.pantalla.blit(text, textrect)
+ yLinea = yLinea + self.fuente32.get_height()+int(10*scale)
+ self.mostrarTexto("Presiona cualquier tecla para saltear",
+ self.fuente32,
+ (int(600*scale+shift_x),int(800*scale+shift_y)),
+ (255,155,155))
+ pygame.display.flip()
+ terminar = False
+ pygame.time.set_timer(EVENTORESPUESTA,4000)
+ while 1:
+ for event in wait_events():
+ if event.type == pygame.KEYDOWN or \
+ event.type == pygame.MOUSEBUTTONDOWN:
+ self.click.play()
+ pygame.time.set_timer(EVENTORESPUESTA,0)
+ return
+ elif event.type == EVENTORESPUESTA:
+ pygame.time.set_timer(EVENTORESPUESTA,0)
+ terminar = True
+ elif event.type == EVENTOREFRESCO:
+ pygame.display.flip()
+ if terminar:
+ break
+ # cuadro 3: alerta
+ self.pantalla.fill((0,0,0))
+ self.pantalla.blit(self.alerta,(int(264*scale+shift_x),
+ int(215*scale+shift_y)))
+ self.pantalla.blit(self.alertarojo,(int(459*scale+shift_x),
+ int(297*scale+shift_y)))
+ self.mostrarTexto("Presiona cualquier tecla para saltear",
+ self.fuente32,
+ (int(600*scale+shift_x),int(800*scale+shift_y)),
+ (255,155,155))
+ pygame.display.flip()
+ self.chirp.play()
+ pygame.time.set_timer(EVENTORESPUESTA,500)
+ self.paso = 0
+ terminar = False
+ while 1:
+ for event in wait_events():
+ if event.type == pygame.KEYDOWN or \
+ event.type == pygame.MOUSEBUTTONDOWN:
+ self.click.play()
+ pygame.time.set_timer(EVENTORESPUESTA,0)
+ return
+ elif event.type == EVENTORESPUESTA:
+ self.paso += 1
+ if self.paso == 10:
+ pygame.time.set_timer(EVENTORESPUESTA,0)
+ terminar = True
+ else:
+ pygame.time.set_timer(EVENTORESPUESTA,500)
+ if self.paso % 2 == 0:
+ self.pantalla.blit(self.alerta,
+ (int(264*scale+shift_x),
+ int(215*scale+shift_y)))
+ self.pantalla.blit(self.alertarojo,
+ (int(459*scale+shift_x),
+ int(297*scale+shift_y)))
+ self.chirp.play()
+ else:
+ self.pantalla.blit(self.alerta,
+ (int(264*scale+shift_x),
+ int(215*scale+shift_y)))
+ pygame.display.flip()
+ elif event.type == EVENTOREFRESCO:
+ pygame.display.flip()
+ if terminar:
+ break
+ # cuadro 4: marcianito asustado
+ self.pantalla.fill((0,0,0))
+ self.pantalla.blit(self.bichotriste,(int(600*scale+shift_x),
+ int(450*scale+shift_y)))
+ self.pantalla.blit(self.globito,(int(350*scale+shift_x),
+ int(180*scale+shift_y)))
+ yLinea = int(180*scale+shift_y)+self.fuente32.get_height()*3
+ lineas = self.listaPresentacion[1].split("\\")
+ for l in lineas:
+ text = self.fuente32.render(l.strip(), 1, COLORPREGUNTAS)
+ textrect = text.get_rect()
+ textrect.center = (int(557*scale+shift_x),yLinea)
+ self.pantalla.blit(text, textrect)
+ yLinea = yLinea + self.fuente32.get_height()+int(10*scale)
+ self.mostrarTexto("Presiona cualquier tecla para saltear",
+ self.fuente32,
+ (int(600*scale+shift_x),int(800*scale+shift_y)),
+ (255,155,155))
+ pygame.display.flip()
+ terminar = False
+ pygame.time.set_timer(EVENTORESPUESTA,4000)
+ while 1:
+ for event in wait_events():
+ if event.type == pygame.KEYDOWN or \
+ event.type == pygame.MOUSEBUTTONDOWN:
+ self.click.play()
+ pygame.time.set_timer(EVENTORESPUESTA,0)
+ return
+ elif event.type == EVENTORESPUESTA:
+ pygame.time.set_timer(EVENTORESPUESTA,0)
+ terminar = True
+ elif event.type == EVENTOREFRESCO:
+ pygame.display.flip()
+ if terminar:
+ break
+ # cuadro 5: explota nave
+ self.pantalla.blit(self.tierra,(int(200*scale+shift_x),
+ int(150*scale+shift_y)))
+ self.mostrarTexto("Presiona cualquier tecla para saltear",
+ self.fuente32,
+ (int(600*scale+shift_x),int(800*scale+shift_y)),
+ (255,155,155))
+ pygame.display.flip()
+ pygame.time.set_timer(EVENTODESPEGUE,TIEMPODESPEGUE)
+ self.despegue.play()
+ self.paso = 0
+ terminar = False
+ while 1:
+ for event in wait_events():
+ if event.type == pygame.KEYDOWN or \
+ event.type == pygame.MOUSEBUTTONDOWN:
+ self.click.play()
+ pygame.time.set_timer(EVENTODESPEGUE,0)
+ return
+ elif event.type == EVENTODESPEGUE:
+ self.paso += 1
+ if self.paso == 130:
+ pygame.time.set_timer(EVENTODESPEGUE,0)
+ terminar = True
+ else:
+ pygame.time.set_timer(EVENTODESPEGUE,TIEMPODESPEGUE)
+ self.pantalla.fill((0,0,0),
+ (int((430-(self.paso-1)*.1)*scale+\
+ shift_x),
+ int((280+(self.paso-1)*.6)*scale+\
+ shift_y),
+ int(30*scale),int(35*scale)))
+ self.pantalla.blit(self.pedazo1,
+ (int((430-self.paso*.2)*scale+\
+ shift_x),
+ int((290+self.paso*1)*scale+\
+ shift_y)))
+ self.pantalla.blit(self.pedazo1,
+ (int((430+self.paso*.15)*scale+\
+ shift_x),
+ int((290+self.paso*.9)*scale+\
+ shift_y)))
+ self.pantalla.blit(self.pedazo2,
+ (int((430+self.paso*.25)*scale+\
+ shift_x),
+ int((290+self.paso*.75)*scale+\
+ shift_y)))
+ self.pantalla.blit(self.pedazo2,
+ (int((430-self.paso*.15)*scale+\
+ shift_x),
+ int((290+self.paso*.8)*scale+\
+ shift_y)))
+ self.pantalla.blit(self.paracaidas,
+ (int((430-self.paso*.1)*scale+\
+ shift_x),
+ int((280+self.paso*.6)*scale+\
+ shift_y)))
+ pygame.display.flip()
+ elif event.type == EVENTOREFRESCO:
+ pygame.display.flip()
+ if terminar:
+ break
+ # cuadro 6: marcianito hablando
+ self.pantalla.fill((0,0,0))
+ self.pantalla.blit(self.bicho,(int(600*scale+shift_x),
+ int(450*scale+shift_y)))
+ self.pantalla.blit(self.globito,(int(350*scale+shift_x),
+ int(180*scale+shift_y)))
+ yLinea = int(180*scale+shift_y)+self.fuente32.get_height()*3
+ lineas = self.listaPresentacion[2].split("\\")
+ for l in lineas:
+ text = self.fuente32.render(l.strip(), 1, COLORPREGUNTAS)
+ textrect = text.get_rect()
+ textrect.center = (int(557*scale+shift_x),yLinea)
+ self.pantalla.blit(text, textrect)
+ yLinea = yLinea + self.fuente32.get_height()+int(10*scale)
+ self.mostrarTexto("Presiona cualquier tecla para saltear",
+ self.fuente32,
+ (int(600*scale+shift_x),int(800*scale+shift_y)),
+ (255,155,155))
+ pygame.display.flip()
+ terminar = False
+ pygame.time.set_timer(EVENTORESPUESTA,6000)
+ while 1:
+ for event in wait_events():
+ if event.type == pygame.KEYDOWN or \
+ event.type == pygame.MOUSEBUTTONDOWN:
+ self.click.play()
+ pygame.time.set_timer(EVENTORESPUESTA,0)
+ return
+ elif event.type == EVENTORESPUESTA:
+ pygame.time.set_timer(EVENTORESPUESTA,0)
+ terminar = True
+ elif event.type == EVENTOREFRESCO:
+ pygame.display.flip()
+ if terminar:
+ break
+ return
+
+ def principal(self):
+ """Este es el loop principal del juego"""
+ global scale, shift_x, shift_y
+ pygame.time.set_timer(EVENTOREFRESCO,TIEMPOREFRESCO)
+ self.presentacion()
+ self.paginaDir = 0
+ while 1:
+ self.pantallaDirectorios() # seleccion de mapa
+ pygame.mouse.set_cursor((32,32), (1,1), *self.cursor_espera)
+ self.directorio = self.listaDirectorios\
+ [self.indiceDirectorioActual]
+ self.cargarDirectorio()
+ pygame.mouse.set_cursor((32,32), (1,1), *self.cursor)
+ while 1:
+ # pantalla inicial de juego
+ self.elegir_directorio = False
+ self.pantallaInicial()
+ if self.elegir_directorio: # volver a seleccionar mapa
+ break
+ # dibujar fondo y panel
+ self.pantalla.blit(self.fondo, (shift_x, shift_y))
+ self.pantalla.fill(COLORPANEL,
+ (int(XMAPAMAX*scale+shift_x),shift_y,
+ int(DXPANEL*scale),int(900*scale)))
+ if self.jugar:
+ self.pantalla.blit(self.bicho,
+ (int(XBICHO*scale+shift_x),
+ int(YBICHO*scale+shift_y)))
+ self.estadobicho = ESTADONORMAL
+ # mostrar pantalla
+ pygame.display.flip()
+ # ir al juego
+ if self.jugar: # juego
+ self.jugarNivel()
+ else: # exploro
+ self.explorarNombres()
+
+
+def main():
+ juego = ConozcoUy()
+ juego.principal()
+
+
+if __name__ == "__main__":
+ main()
diff --git a/conozco-nicaragua.activity/conozcouy.pyc b/conozco-nicaragua.activity/conozcouy.pyc
new file mode 100644
index 0000000..23d12c0
--- /dev/null
+++ b/conozco-nicaragua.activity/conozcouy.pyc
Binary files differ
diff --git a/conozco-nicaragua.activity/dist/ConozcoUruguay-3.xo b/conozco-nicaragua.activity/dist/ConozcoUruguay-3.xo
new file mode 100644
index 0000000..a378516
--- /dev/null
+++ b/conozco-nicaragua.activity/dist/ConozcoUruguay-3.xo
Binary files differ
diff --git a/conozco-nicaragua.activity/dist/ConozcoUruguay-4.xo b/conozco-nicaragua.activity/dist/ConozcoUruguay-4.xo
new file mode 100644
index 0000000..bda66cb
--- /dev/null
+++ b/conozco-nicaragua.activity/dist/ConozcoUruguay-4.xo
Binary files differ
diff --git a/conozco-nicaragua.activity/dist/ConozcoUruguay-5.xo b/conozco-nicaragua.activity/dist/ConozcoUruguay-5.xo
new file mode 100644
index 0000000..bd991c3
--- /dev/null
+++ b/conozco-nicaragua.activity/dist/ConozcoUruguay-5.xo
Binary files differ
diff --git a/conozco-nicaragua.activity/dist/ConozcoUruguay-6.xo b/conozco-nicaragua.activity/dist/ConozcoUruguay-6.xo
new file mode 100644
index 0000000..2973798
--- /dev/null
+++ b/conozco-nicaragua.activity/dist/ConozcoUruguay-6.xo
Binary files differ
diff --git a/conozco-nicaragua.activity/dist/ConozcoUruguay-7.xo b/conozco-nicaragua.activity/dist/ConozcoUruguay-7.xo
new file mode 100644
index 0000000..c476ae2
--- /dev/null
+++ b/conozco-nicaragua.activity/dist/ConozcoUruguay-7.xo
Binary files differ
diff --git a/conozco-nicaragua.activity/dist/ConozcoUruguay-8.xo b/conozco-nicaragua.activity/dist/ConozcoUruguay-8.xo
new file mode 100644
index 0000000..bf83452
--- /dev/null
+++ b/conozco-nicaragua.activity/dist/ConozcoUruguay-8.xo
Binary files differ
diff --git a/conozco-nicaragua.activity/dist/ConozcoUruguay-9.xo b/conozco-nicaragua.activity/dist/ConozcoUruguay-9.xo
new file mode 100644
index 0000000..90a54f3
--- /dev/null
+++ b/conozco-nicaragua.activity/dist/ConozcoUruguay-9.xo
Binary files differ
diff --git a/conozco-nicaragua.activity/dist/conozco-uruguay-1.xo b/conozco-nicaragua.activity/dist/conozco-uruguay-1.xo
new file mode 100755
index 0000000..d9055f7
--- /dev/null
+++ b/conozco-nicaragua.activity/dist/conozco-uruguay-1.xo
Binary files differ
diff --git a/conozco-nicaragua.activity/dist/conozco-uruguay-2.xo b/conozco-nicaragua.activity/dist/conozco-uruguay-2.xo
new file mode 100755
index 0000000..0743ea1
--- /dev/null
+++ b/conozco-nicaragua.activity/dist/conozco-uruguay-2.xo
Binary files differ
diff --git a/conozco-nicaragua.activity/olpcgames/COPYING b/conozco-nicaragua.activity/olpcgames/COPYING
new file mode 100755
index 0000000..b8adee0
--- /dev/null
+++ b/conozco-nicaragua.activity/olpcgames/COPYING
@@ -0,0 +1,24 @@
+* Copyright (c) 2007, One Laptop Per Child.
+* All rights reserved.
+*
+* Redistribution and use in source and binary forms, with or without
+* modification, are permitted provided that the following conditions are met:
+* * Redistributions of source code must retain the above copyright
+* notice, this list of conditions and the following disclaimer.
+* * Redistributions in binary form must reproduce the above copyright
+* notice, this list of conditions and the following disclaimer in the
+* documentation and/or other materials provided with the distribution.
+* * Neither the name of One Laptop Per Child nor the
+* names of its contributors may be used to endorse or promote products
+* derived from this software without specific prior written permission.
+*
+* THIS SOFTWARE IS PROVIDED BY ONE LAPTOP PER CHILD ``AS IS'' AND ANY
+* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+* DISCLAIMED. IN NO EVENT SHALL ONE LAPTOP PER CHILD BE LIABLE FOR ANY
+* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
diff --git a/conozco-nicaragua.activity/olpcgames/__init__.py b/conozco-nicaragua.activity/olpcgames/__init__.py
new file mode 100755
index 0000000..504388c
--- /dev/null
+++ b/conozco-nicaragua.activity/olpcgames/__init__.py
@@ -0,0 +1,102 @@
+"""Wrapper/adaptation system for writing/porting Pygame games to OLPC/Sugar
+
+The wrapper system attempts to substitute various pieces of the Pygame
+implementation in order to make code written without knowledge of the
+OLPC/Sugar environment run "naturally" under the GTK environment of
+Sugar. It also provides some convenience mechanisms for dealing with
+e.g. the Camera and Mesh Network system.
+
+Considerations for Developers:
+
+Pygame programs running under OLPCGames will generally not have
+"hardware" surfaces, and will not be able to have a reduced-resolution
+full-screen view to optimise rendering. The Pygame code will run in
+a secondary thread, with the main GTK UI running in the primary thread.
+A third "mainloop" thread will occasionally be created to handle the
+GStreamer interface to the camera.
+
+Attributes of Note:
+
+ ACTIVITY -- if not None, then the activity instance which represents
+ this activity at the Sugar shell level.
+ WIDGET -- PygameCanvas instance, a GTK widget with an embedded
+ socket object which is a proxy for the SDL window Pygame to which
+ pygame renders.
+
+ Constants: All event constants used by the package are defined at this
+ level. Note that eventually we will need to switch to using UserEvent
+ and making these values sub-types rather than top-level types.
+
+
+Pygame events at the Activity Level:
+
+ pygame.USEREVENT
+ code == olpcgames.FILE_READ_REQUEST
+ filename (unicode/string) -- filename from which to read
+ metadata (dictionary-like) -- mapping from key to string values
+
+ Note: due to a limitation in the Sugar API, the GTK event loop
+ will be *frozen* during this operation, as a result you cannot
+ make any DBUS or GTK calls, nor can you use GUI during the
+ call to provide input. That is, you have to process this event
+ synchronously.
+
+ code == olpcgames.FILE_WRITE_REQUEST
+ filename (unicode/string) -- file name to which to write
+ metadata (dictionary-like) -- mapping from key: value where all
+ values must (currently) be strings
+
+ Note: due to a limitation in the Sugar API, the GTK event loop
+ will be *frozen* during this operation, as a result you cannot
+ make any DBUS or GTK calls, nor can you use GUI during the
+ call to provide input. That is, you have to process this event
+ synchronously.
+
+see also the mesh and camera modules for more events.
+
+Deprecated:
+
+ This module includes the activity.PyGameActivity class currently,
+ this is a deprecated mechanism for accessing the activity class,
+ and uses the deprecated spelling (case) of the name. Use:
+
+ from olpcgames import activity
+
+ class MyActivity( activity.PygameActivity ):
+ ...
+
+ to define your PygameActivity subclass (note the case of the
+ spelling, which now matches Pygame's own spelling).
+"""
+from olpcgames._version import __version__
+ACTIVITY = None
+widget = WIDGET = None
+
+# XXX problem here, we're filling up the entirety of the Pygame
+# event-set with just this small bit of functionality, obviously
+# Pygame is not intending for this kind of usage!
+(
+ CAMERA_LOAD, CAMERA_LOAD_FAIL,
+
+ CONNECT,PARTICIPANT_ADD,
+ PARTICIPANT_REMOVE,
+ MESSAGE_UNI,MESSAGE_MULTI,
+) = range( 25, 32 )
+
+# These events use UserEvent.code, eventually *all* events should be
+# delivered as UserEvent with code set to the values defined here...
+
+(
+ #NET_CONNECT, NET_PARTICIPANT_ADD,NET_PARTICIPANT_REMOVE,
+ #NET_MESSAGE_UNICAST, NET_MESSAGE_MULTICAST,
+ #CAMERA_LOAD, CAMERA_LOAD_FAIL,
+ FILE_READ_REQUEST, FILE_WRITE_REQUEST,
+) = range(
+ 2**16, 2**16+2,
+)
+
+try:
+ from olpcgames.activity import PygameActivity as PyGameActivity
+except ImportError, err:
+ PyGameActivity = None
+
diff --git a/conozco-nicaragua.activity/olpcgames/__init__.pyc b/conozco-nicaragua.activity/olpcgames/__init__.pyc
new file mode 100644
index 0000000..0714142
--- /dev/null
+++ b/conozco-nicaragua.activity/olpcgames/__init__.pyc
Binary files differ
diff --git a/conozco-nicaragua.activity/olpcgames/_cairoimage.py b/conozco-nicaragua.activity/olpcgames/_cairoimage.py
new file mode 100755
index 0000000..3cfa22c
--- /dev/null
+++ b/conozco-nicaragua.activity/olpcgames/_cairoimage.py
@@ -0,0 +1,135 @@
+"""Utility functions for cairo-specific operations
+
+USE_BASE_ARRAY -- if False (default), uses numpy arrays,
+ currently this is the only version that works on 32-bit
+ machines.
+"""
+import pygame, struct, logging
+big_endian = struct.pack( '=i', 1 ) == struct.pack( '>i', 1 )
+
+log = logging.getLogger( 'olpcgames._cairoimage' )
+##log.setLevel( logging.DEBUG )
+
+USE_BASE_ARRAY = False
+
+def newContext( width, height ):
+ """Create a new render-to-image context
+
+ width, height -- pixel dimensions to be rendered
+
+ Produces an ARGB format Cairo ImageSurface for
+ rendering your data into using rsvg, Cairo or Pango.
+
+ returns (ImageSurface, CairoContext) for rendering
+ """
+ import cairo
+ csrf = cairo.ImageSurface(cairo.FORMAT_ARGB32, width, height)
+ context = cairo.Context (csrf)
+ #log.info( 'Format (expect: %s): %s', cairo.FORMAT_ARGB32, csrf.get_format())
+ return csrf, context
+
+def mangle_color(color):
+ """Mange a colour depending on endian-ness, and swap-necessity
+
+ Converts a 3 or 4 int (or float) value in the range 0-255 into a
+ 4-float value in the range 0.0-1.0
+ """
+ r,g,b = color[:3]
+ if len(color) > 3:
+ a = color[3]
+ else:
+ a = 255.0
+ return map(_fixColorBase, (r,g,b,a) )
+
+def _fixColorBase( v ):
+ """Return a properly clamped colour in floating-point space"""
+ return max((0,min((v,255.0))))/255.0
+
+def asImage( csrf ):
+ """Get the pixels in csrf as a Pygame image
+
+ Note that Pygame 1.7.1 on (Gentoo Linux) AMD64 is incorrectly
+ calculating the required size ARGB images, so this code will *not* work
+ on that platform with that version of the library. Pygame-ctypes
+ does work correctly there.
+
+ Note also that Pygame 1.7.1 is showing a strange colour rotation
+ bug on 32-bit platforms, such that ARGB mode cannot be used for
+ images there. Instead we have to do an expensive bit-shift operation
+ to produce an RGBA image from the ARGB native Cairo format.
+
+ Will raise a ValueError if passed a Null image (i.e. dimension of 0)
+
+ returns Pygame.Surface (image) with convert_alpha() called for it.
+ """
+ # Create and return a new Pygame Image derived from the Cairo Surface
+ format = 'ARGB'
+ if hasattr(csrf,'get_data'):
+ # more recent API, native-format, but have to (potentially) convert the format...
+ log.debug( 'Native-mode api (get_data)' )
+ data = csrf.get_data()
+ if not big_endian:
+ # we use array here because it's considerably lighter-weight
+ # to import than the numpy module
+ log.debug( 'Not big-endian, byte-swapping array' )
+ if USE_BASE_ARRAY:
+ import array
+ a = array.array( 'I' )
+ a.fromstring( data )
+ a.byteswap()
+ data = a.tostring()
+ else:
+ import numpy
+ n = numpy.fromstring( data, dtype='I' )
+ n = ((n & 0xff000000) >> 24 ) | ((n & 0x00ffffff) << 8 )
+ n = n.byteswap()
+ data = n.tostring()
+ format = 'RGBA'
+ else:
+ log.debug( 'Big-endian, array unchanged' )
+ data = str(data) # there's one copy
+ else:
+ # older api, not native, but we know what it is...
+ log.debug( 'Non-native mode api, explicitly RGBA' )
+ data = csrf.get_data_as_rgba()
+ data = str(data) # there's one copy
+ format = 'RGBA'
+ width, height = csrf.get_width(),csrf.get_height()
+
+ try:
+ log.info( 'Format = %s', format )
+ return pygame.image.fromstring(
+ data,
+ (width,height),
+ format
+ ) # there's the next
+ except ValueError, err:
+ err.args += (len(data), (width,height), width*height*4,format )
+ raise
+
+if __name__ == "__main__":
+ import unittest
+ logging.basicConfig()
+ class Tests( unittest.TestCase ):
+ def test_colours( self ):
+ """Test that colours are correctly translated
+
+ If we draw a given colour in cairo, we want the same
+ colour to show up in Pygame, let's test that...
+ """
+ for sourceColour in [
+ (255,0,0, 255),
+ (0,255,0, 255),
+ (0,0,255, 255),
+ (255,255,0, 255),
+ (0,255,255,255),
+ (255,0,255,255),
+ ]:
+ csrf,cctx = newContext( 1,1 )
+ background = mangle_color( sourceColour )
+ cctx.set_source_rgba(*background)
+ cctx.paint()
+ img = asImage( csrf )
+ colour = img.get_at( (0,0))
+ assert colour == sourceColour, (sourceColour,mangle_color(sourceColour),colour)
+ unittest.main()
diff --git a/conozco-nicaragua.activity/olpcgames/_gtkmain.py b/conozco-nicaragua.activity/olpcgames/_gtkmain.py
new file mode 100755
index 0000000..33a6a83
--- /dev/null
+++ b/conozco-nicaragua.activity/olpcgames/_gtkmain.py
@@ -0,0 +1,70 @@
+"""Support for GObject mainloop-requiring libraries when not inside GTK
+
+INITIALIZED -- whether we have a running gobject loop yet...
+LOOP_TRACKER -- if present, the manual gtk event loop used to
+ support gobject-based code running in a non-Gobject event loop
+
+Holder -- objects which can be held as attributes to keep the mainloop running
+"""
+import threading, logging
+log = logging.getLogger( 'olpcgames._gtkmain' )
+##log.setLevel( logging.DEBUG )
+
+INITIALIZED = False
+LOOP_TRACKER = None
+
+class _TrackLoop( object ):
+ """Tracks the number of open loops and stops when finished"""
+ count = 0
+ _mainloop = None
+ def increment( self ):
+ log.info( 'Increment from %s', self.count )
+ self.count += 1 # XXX race condition here?
+ if self.count == 1:
+ log.info( 'Creating GObject mainloop')
+ self.t_loop = threading.Thread(target=self.loop)
+ self.t_loop.setDaemon( True )
+ self.t_loop.start()
+ def decrement( self ):
+ log.info( 'Decrement from %s', self.count )
+ self.count -= 1
+ def loop( self ):
+ """Little thread loop that replicates the gtk mainloop"""
+ import gtk
+ while self.count >= 1:
+ log.debug( 'GTK loop restarting' )
+ while gtk.events_pending():
+ gtk.main_iteration()
+ log.debug( 'GTK loop exiting' )
+ try:
+ del self.t_loop
+ except AttributeError, err:
+ pass
+
+class Holder():
+ """Object which, while held, keeps the gtk mainloop running"""
+ def __init__( self ):
+ log.info( 'Beginning hold on GTK mainloop with Holder object' )
+ startGTK()
+ def __del__( self ):
+ log.info( 'Releasing hold on GTK mainloop with Holder object' )
+ stopGTK()
+
+def startGTK( ):
+ """GTK support is required here, process..."""
+ if not INITIALIZED:
+ init()
+ if LOOP_TRACKER:
+ LOOP_TRACKER.increment()
+def stopGTK( ):
+ """GTK support is no longer required, release"""
+ if LOOP_TRACKER:
+ LOOP_TRACKER.decrement()
+def init( ):
+ """Create a gobject mainloop in a sub-thread (you don't need to call this normally)"""
+ global INITIALIZED, LOOP_TRACKER
+ if not INITIALIZED:
+ if not LOOP_TRACKER:
+ LOOP_TRACKER = _TrackLoop()
+ INITIALIZED = True
+ return LOOP_TRACKER
diff --git a/conozco-nicaragua.activity/olpcgames/_version.py b/conozco-nicaragua.activity/olpcgames/_version.py
new file mode 100755
index 0000000..6a4e1db
--- /dev/null
+++ b/conozco-nicaragua.activity/olpcgames/_version.py
@@ -0,0 +1,2 @@
+"""Module defining the current version of the library"""
+__version__ = '1.6'
diff --git a/conozco-nicaragua.activity/olpcgames/_version.pyc b/conozco-nicaragua.activity/olpcgames/_version.pyc
new file mode 100644
index 0000000..0cb5915
--- /dev/null
+++ b/conozco-nicaragua.activity/olpcgames/_version.pyc
Binary files differ
diff --git a/conozco-nicaragua.activity/olpcgames/activity.py b/conozco-nicaragua.activity/olpcgames/activity.py
new file mode 100755
index 0000000..d4a2b5a
--- /dev/null
+++ b/conozco-nicaragua.activity/olpcgames/activity.py
@@ -0,0 +1,241 @@
+"""Embeds the Canvas widget into a Sugar-specific Activity environment
+
+The olpcgames.activity module encapsulates creation of a Pygame activity.
+Your Activity should inherit from this class. Simply setting some class
+attributes is all you need to do in a class inheriting from
+olpcgames.activity.PygameActivity in order to get Pygame to work.
+
+(The skeleton builder script creates this file automatically for you).
+
+Note:
+ You should not import pygame into your activity file, as the olpcgames
+ wrapper needs to be initialized before pygame is imported the first time.
+
+Example usage:
+
+ class PygameActivity(activity.Activity):
+ game_name = None
+ game_title = 'Pygame Game'
+ game_size = (units.grid_to_pixels(16),
+ units.grid_to_pixels(11))
+ pygame_mode = 'SDL'
+"""
+import logging
+logging.root.setLevel( logging.WARN )
+log = logging.getLogger( 'olpcgames.activity' )
+##log.setLevel( logging.DEBUG )
+
+import pygtk
+pygtk.require('2.0')
+import gtk
+import gtk.gdk
+import os
+
+from sugar.activity import activity
+from sugar.graphics import style
+from olpcgames.canvas import PygameCanvas
+from olpcgames import mesh, util
+
+__all__ = ['PygameActivity']
+
+class PygameActivity(activity.Activity):
+ """Pygame-specific activity type, provides boilerplate toolbar, creates canvas
+
+ Subclass Overrides:
+
+ game_name -- specifies a fully-qualified name for the game's main-loop
+ format like so:
+ 'package.module:main'
+ if no function name is provided, "main" is assumed.
+
+ game_handler -- DEPRECATED. alternate specification via direct
+ reference to a main-loop function.
+
+ game_size -- two-value tuple specifying the size of the display in pixels,
+ this is currently static, so once the window is created it cannot be
+ changed.
+
+ If None, use the bulk of the screen for the Pygame surface based on
+ the values reported by the gtk.gdk functions. Note that None is
+ *not* the default value.
+
+ game_title -- title to be displayed in the Sugar Shell UI
+
+ pygame_mode -- chooses the rendering engine used for handling the
+ Pygame drawing mode, 'SDL' chooses the standard Pygame renderer,
+ 'Cairo' chooses the experimental pygamecairo renderer.
+
+ Note: You likely do *not* want to use Cairo, it is no longer maintained.
+
+ PYGAME_CANVAS_CLASS -- normally PygameCanvas, but can be overridden
+ if you want to provide a different canvas class, e.g. to provide a different
+ internal layout. Note: only used where pygame_mode == 'SDL'
+
+ The Activity, once created, will be made available as olpcgames.ACTIVITY,
+ and that access mechanism should allow code to test for the presence of the
+ activity before accessing Sugar-specific functionality.
+
+ XXX Note that currently the toolbar and window layout are hard-coded into
+ this super-class, with no easy way of overriding without completely rewriting
+ the __init__ method. We should allow for customising both the UI layout and
+ the toolbar contents/layout/connection.
+
+ XXX Note that if you change the title of your activity in the toolbar you may
+ see the same focus issues as we have patched around in the build_toolbar
+ method. If so, please report them to Mike Fletcher.
+ """
+ game_name = None
+ game_title = 'Pygame Game'
+ game_handler = None
+ game_size = (16 * style.GRID_CELL_SIZE,
+ 11 * style.GRID_CELL_SIZE)
+ pygame_mode = 'SDL'
+
+ def __init__(self, handle):
+ """Initialise the Activity with the activity-description handle"""
+ super(PygameActivity, self).__init__(handle)
+ self.make_global()
+ if self.game_size is None:
+ width,height = gtk.gdk.screen_width(), gtk.gdk.screen_height()
+ log.info( 'Total screen size: %s %s', width,height)
+ # for now just fudge the toolbar size...
+ self.game_size = width, height - (1*style.GRID_CELL_SIZE)
+ self.set_title(self.game_title)
+# toolbar = self.build_toolbar()
+# log.debug( 'Toolbar size: %s', toolbar.get_size_request())
+ canvas = self.build_canvas()
+ self.connect( 'configure-event', canvas._translator.do_resize_event )
+
+ def make_global( self ):
+ """Hack to make olpcgames.ACTIVITY point to us
+ """
+ import weakref, olpcgames
+ assert not olpcgames.ACTIVITY, """Activity.make_global called twice, have you created two Activity instances in a single process?"""
+ olpcgames.ACTIVITY = weakref.proxy( self )
+
+ def build_toolbar( self ):
+ """Build our Activity toolbar for the Sugar system
+
+ This is a customisation point for those games which want to
+ provide custom toolbars when running under Sugar.
+ """
+ toolbar = activity.ActivityToolbar(self)
+ toolbar.show()
+ self.set_toolbox(toolbar)
+ def shared_cb(*args, **kwargs):
+ log.info( 'shared: %s, %s', args, kwargs )
+ try:
+ mesh.activity_shared(self)
+ except Exception, err:
+ log.error( """Failure signaling activity sharing to mesh module: %s""", util.get_traceback(err) )
+ else:
+ log.info( 'mesh activity shared message sent, trying to grab focus' )
+ try:
+ self._pgc.grab_focus()
+ except Exception, err:
+ log.warn( 'Focus failed: %s', err )
+ else:
+ log.info( 'asserting focus' )
+ assert self._pgc.is_focus(), """Did not successfully set pygame canvas focus"""
+ log.info( 'callback finished' )
+
+ def joined_cb(*args, **kwargs):
+ log.info( 'joined: %s, %s', args, kwargs )
+ mesh.activity_joined(self)
+ self._pgc.grab_focus()
+ self.connect("shared", shared_cb)
+ self.connect("joined", joined_cb)
+
+ if self.get_shared():
+ # if set at this point, it means we've already joined (i.e.,
+ # launched from Neighborhood)
+ joined_cb()
+
+ toolbar.title.unset_flags(gtk.CAN_FOCUS)
+ return toolbar
+
+ PYGAME_CANVAS_CLASS = PygameCanvas
+ def build_canvas( self ):
+ """Construct the Pygame or PygameCairo canvas for drawing"""
+ assert self.game_handler or self.game_name, 'You must specify a game_handler or game_name on your Activity (%r)'%(
+ self.game_handler or self.game_name
+ )
+ if self.pygame_mode != 'Cairo':
+ self._pgc = self.PYGAME_CANVAS_CLASS(*self.game_size)
+ self.set_canvas(self._pgc)
+ self._pgc.grab_focus()
+ self._pgc.connect_game(self.game_handler or self.game_name)
+ # XXX Bad coder, do not hide in a widely subclassed operation
+ # map signal does not appear to show up on socket instances
+ gtk.gdk.threads_init()
+ return self._pgc
+ else:
+ import hippo
+ self._drawarea = gtk.DrawingArea()
+ canvas = hippo.Canvas()
+ canvas.grab_focus()
+ self.set_canvas(canvas)
+ self.show_all()
+
+ import pygamecairo
+ pygamecairo.install()
+
+ pygamecairo.display.init(canvas)
+ app = self.game_handler or self.game_name
+ if ':' not in app:
+ app += ':main'
+ mod_name, fn_name = app.split(':')
+ mod = __import__(mod_name, globals(), locals(), [])
+ fn = getattr(mod, fn_name)
+ fn()
+ def read_file(self, file_path):
+ """Handle request to read the given file on the Pygame side
+
+ This is complicated rather noticeably by the silly semantics of the Journal
+ where it unlinks the file as soon as this method returns. We either have to
+ handle the file-opening in PyGTK (not acceptable), block this thread until
+ the Pygame thread handles the event (which it may never do) or we have
+ to make the silly thing use a non-standard file-opening interface.
+ """
+ log.info( 'read_file: %s %s', file_path, self.metadata )
+ import olpcgames, pygame
+ from olpcgames import eventwrap
+ event = eventwrap.Event(
+ type = pygame.USEREVENT,
+ code = olpcgames.FILE_READ_REQUEST,
+ filename = file_path,
+ metadata = self.metadata,
+ )
+ eventwrap.post( event )
+ event.block()
+ def write_file( self, file_path ):
+ """Handle request to write to the given file on the Pygame side
+
+ This is rather complicated by the need to have the file complete by the
+ time the function returns. Very poor API, after all, if I have to write a
+ multi-hundred-megabyte file it might take many minutes to complete
+ writing.
+ """
+ log.info( 'write_file: %s %s', file_path, self.metadata )
+ if os.path.exists( file_path ):
+ self.read_file( file_path )
+ import olpcgames, pygame
+ from olpcgames import eventwrap
+ event = eventwrap.Event(
+ type = pygame.USEREVENT,
+ code = olpcgames.FILE_WRITE_REQUEST,
+ filename = file_path,
+ metadata = self.metadata,
+ )
+ eventwrap.post( event )
+ event.block()
+ if not os.path.exists( file_path ):
+ log.warn( '''No file created in %r''', file_path )
+ raise NotImplementedError( """Pygame Activity code did not produce a file for %s"""%( file_path, ))
+ else:
+ log.info( '''Stored file in %r''', file_path )
+
+
+import olpcgames
+olpcgames.PyGameActivity = PygameActivity
+PyGameActivity = PygameActivity
diff --git a/conozco-nicaragua.activity/olpcgames/activity.pyc b/conozco-nicaragua.activity/olpcgames/activity.pyc
new file mode 100644
index 0000000..1030be8
--- /dev/null
+++ b/conozco-nicaragua.activity/olpcgames/activity.pyc
Binary files differ
diff --git a/conozco-nicaragua.activity/olpcgames/buildmanifest.py b/conozco-nicaragua.activity/olpcgames/buildmanifest.py
new file mode 100755
index 0000000..899433b
--- /dev/null
+++ b/conozco-nicaragua.activity/olpcgames/buildmanifest.py
@@ -0,0 +1,33 @@
+#! /usr/bin/env python
+"""Stupid little script to automate generation of MANIFEST and po/POTFILES.in
+
+Really this should have been handled by using distutils, but oh well,
+distutils is a hoary beast and I can't fault people for not wanting to
+spend days spelunking around inside it to find the solutions...
+"""
+from distutils.filelist import FileList
+import os
+
+def fileList( template ):
+ """Produce a formatted file-list for storing in a file"""
+ files = FileList()
+ for line in filter(None,template.splitlines()):
+ files.process_template_line( line )
+ content = '\n'.join( files.files )
+ return content
+
+
+def main( ):
+ """Do the quicky finding of files for our manifests"""
+ content = fileList( open('MANIFEST.in').read() )
+ open( 'MANIFEST','w').write( content )
+
+ content = fileList( open('POTFILES.in').read() )
+ try:
+ os.makedirs( 'po' )
+ except OSError, err:
+ pass
+ open( os.path.join('po','POTFILES.in'), 'w').write( content )
+
+if __name__ == "__main__":
+ main()
diff --git a/conozco-nicaragua.activity/olpcgames/camera.py b/conozco-nicaragua.activity/olpcgames/camera.py
new file mode 100755
index 0000000..249f295
--- /dev/null
+++ b/conozco-nicaragua.activity/olpcgames/camera.py
@@ -0,0 +1,221 @@
+"""Accesses OLPC Camera functionality via gstreamer
+
+Depends upon:
+ pygame
+ gstreamer (particularly gst-launch)
+
+Activity demonstrating usage:
+
+ http://dev.laptop.org/git?p=projects/games-misc;a=tree;f=cameratest.activity;hb=HEAD
+
+
+"""
+import threading, subprocess
+import logging
+import olpcgames
+import time
+import os
+import pygame
+from olpcgames.util import get_activity_root
+
+log = logging.getLogger( 'olpcgames.camera' )
+#log.setLevel( logging.DEBUG )
+
+CAMERA_LOAD, CAMERA_LOAD_FAIL = olpcgames.CAMERA_LOAD, olpcgames.CAMERA_LOAD
+
+class Camera(object):
+ """A class representing a still-picture camera
+
+ Produces a simple gstreamer bus that terminates in a filesink, that is,
+ it stores the results in a file. When a picture is "snapped" the gstreamer
+ stream is iterated until it finishes processing and then the file can be
+ read.
+
+ There are two APIs available, a synchronous API which can potentially
+ stall your activity's GUI (and is NOT recommended) and an
+ asynchronous API which returns immediately and delivers the captured
+ camera image via a Pygame event. To be clear, it is recommended
+ that you use the snap_async method, *not* the snap method.
+
+ Note:
+
+ The Camera class is simply a convenience wrapper around a fairly
+ straightforward gst-launch bus. If you have more involved
+ requirements for your camera manipulations you will probably
+ find it easier to write your own camera implementation than to
+ use this one. Basically we provide here the "normal" use case of
+ snapping a picture into a pygame image.
+
+ Note:
+
+ With the current camera implementation taking a single photograph
+ requires about 6 seconds! Obviously we'll need to figure out what's
+ taking gstreamer so long to process the pipe and fix that.
+
+ """
+ _aliases = {
+ 'camera': 'v4l2src',
+ 'test': 'videotestsrc',
+ 'testing': 'videotestsrc',
+ 'png': 'pngenc',
+ 'jpeg': 'jpegenc',
+ 'jpg': 'jpegenc',
+ }
+ def __init__(self, source='camera', format='png', filename=None, directory = None):
+ """Initialises the Camera's internal description
+
+ source -- the gstreamer source for the video to capture, useful values:
+ 'v4l2src','camera' -- the camera
+ 'videotestsrc','test' -- test pattern generator source
+ format -- the gstreamer encoder to use for the capture, useful values:
+ 'pngenc','png' -- PNG format graphic
+ 'jpegenc','jpg','jpeg' -- JPEG format graphic
+ filename -- the filename to use for the capture, if not specified defaults
+ to a random UUID + '.' + format
+ directory -- the directory in which to create the temporary file, defaults
+ to get_activity_root() + 'tmp'
+ """
+ log.info( 'Creating camera' )
+ if not filename:
+ import uuid
+ filename = '%s.%s'%( uuid.uuid4(), format )
+ self.source = self._aliases.get( source, source )
+ self.format = self._aliases.get( format, format )
+ self.filename = filename
+ self.directory = directory
+ SNAP_PIPELINE = 'gst-launch','%(source)s','!','ffmpegcolorspace','!','%(format)s','!','filesink','location="%(filename)s"'
+ def _create_subprocess( self ):
+ """Method to create the gstreamer subprocess from our settings"""
+ if not self.directory:
+ path = os.path.join( get_activity_root(), 'tmp' )
+ try:
+ os.makedirs( path )
+ log.info( 'Created temporary directory: %s', path )
+ except (OSError,IOError), err:
+ pass
+ else:
+ path = self.directory
+ filename = os.path.join( path, self.filename )
+ format = self.format
+ source = self.source
+ pipeline = [s%locals() for s in self.SNAP_PIPELINE ]
+ return filename, subprocess.Popen(
+ pipeline,stderr = subprocess.PIPE
+ )
+
+ def snap(self):
+ """Snap a picture via the camera by iterating gstreamer until finished
+
+ Note: this is an unsafe implementation, it will cause the whole
+ activity to hang until the capture finishes. Time to finish is often
+ measured in whole seconds (3-6s).
+
+ It is *strongly* recommended that you use snap_async instead of snap!
+ """
+ log.debug( 'Starting snap' )
+ filename, pipe = self._create_subprocess()
+ if not pipe.wait():
+ log.debug( 'Ending snap, loading: %s', filename )
+ return self._load_and_clean( filename )
+ else:
+ raise IOError( """Unable to complete snapshot: %s""", pipe.stderr.read() )
+ def _load_and_clean( self, filename ):
+ """Use pygame to load given filename, delete after loading/attempt"""
+ try:
+ log.info( 'Loading snapshot file: %s', filename )
+ return pygame.image.load(filename)
+ finally:
+ try:
+ os.remove( filename )
+ except (IOError,OSError), err:
+ pass
+ def snap_async( self, token=None ):
+ """Snap a picture asynchronously generating event on success/failure
+
+ token -- passed back as attribute of the event which signals that capture
+ is finished
+
+ We return events of type CAMERA_LOAD with an attribute "succeed"
+ depending on whether we succeed or not. Attributes of the events which
+ are returned:
+
+ success -- whether the loading process succeeded
+ token -- as passed to this method
+ image -- pygame image.load result if successful, None otherwise
+ filename -- the filename in our temporary directory we used to store
+ the file temporarily (this file will be deleted before the event
+ is sent, the name is for informational purposes only).
+ err -- Exception instance if failed, None otherwise
+
+ Basically identical to the snap method, save that it posts a message
+ to the event bus in pygame.event instead of blocking and returning...
+
+ Example:
+ if event == pygame.MOUSEBUTTONDOWN:
+ camera = Camera( source='test', filename = 'picture32' )
+ camera.snap_async( myIdentifier )
+ ...
+ elif event.type == olpcgames.CAMERA_LOAD:
+ if event.token == myIdentifier:
+ doSomething( event.image )
+ """
+ log.debug( 'beginning async snap')
+ t = threading.Thread(target=self._background_snap, args=[token])
+ t.start()
+ return token
+
+ def _background_snap(
+ self,
+ token = None,
+ ):
+ """Process gst messages until pipe is finished
+
+ pipe -- gstreamer pipe definition for parse_launch, normally it will
+ produce a file into which the camera should store an image
+
+ We consider pipe to be finished when we have had two "state changed"
+ gstreamer events where the pending state is VOID, the first for when
+ we begin playing, the second for when we finish.
+ """
+ log.debug( 'Background thread kicking off gstreamer capture begun' )
+ from pygame.event import Event, post
+ filename, pipe = self._create_subprocess()
+ if not pipe.wait():
+ success = True
+ log.debug( 'Ending capture, loading: %s', filename )
+ try:
+ image = self._load_and_clean( filename )
+ except Exception, err:
+ image = None
+ success = False
+ else:
+ err = None
+ else:
+ success = False
+ err = pipe.stderr.read()
+ image = None
+ evt = Event(
+ CAMERA_LOAD,
+ dict(
+ filename=filename,
+ success = success,
+ token = token,
+ image=image,
+ err=err
+ )
+ )
+ post( evt )
+
+def snap():
+ """Dump a snapshot from the camera to a pygame surface in background thread
+
+ See Camera.snap
+ """
+ return Camera().snap()
+
+def snap_async( token=None, **named ):
+ """Dump snapshot from camera return asynchronously as event in Pygame
+
+ See Camera.snap_async
+ """
+ return Camera(**named).snap_async( token )
diff --git a/conozco-nicaragua.activity/olpcgames/canvas.py b/conozco-nicaragua.activity/olpcgames/canvas.py
new file mode 100755
index 0000000..2583827
--- /dev/null
+++ b/conozco-nicaragua.activity/olpcgames/canvas.py
@@ -0,0 +1,171 @@
+"""Implements bridge connection between Sugar/GTK and Pygame"""
+import os
+import sys
+import logging
+log = logging.getLogger( 'olpcgames.canvas' )
+##log.setLevel( logging.DEBUG )
+import threading
+from pprint import pprint
+
+import pygtk
+pygtk.require('2.0')
+import gtk
+import gobject
+import pygame
+
+from olpcgames import gtkEvent, util
+
+__all__ = ['PygameCanvas']
+
+class PygameCanvas(gtk.Layout):
+ """Canvas providing bridge methods to run Pygame in GTK
+
+ The PygameCanvas creates a secondary thread in which the Pygame instance will
+ live, providing synthetic Pygame events to that thread via a Queue. The GUI
+ connection is done by having the Pygame canvas use a GTK Port object as it's
+ window pointer, it draws to that X-level window in order to produce output.
+ """
+ mod_name = None
+ def __init__(self, width, height):
+ """Initializes the Canvas Object
+
+ width,height -- passed to the inner EventBox in order to request a given size,
+ the Socket is the only child of this EventBox, and the Pygame commands
+ will be writing to the Window ID of the socket. The internal EventBox is
+ centered via an Alignment instance within the PygameCanvas instance.
+
+ XXX Should refactor so that the internal setup can be controlled by the
+ sub-class, e.g. to get size from the host window, or something similar.
+ """
+ # Build the main widget
+ log.info( 'Creating the pygame canvas' )
+ super(PygameCanvas,self).__init__()
+ self.set_flags(gtk.CAN_FOCUS)
+
+ # Build the sub-widgets
+ self._align = gtk.Alignment(0.5, 0.5)
+ self._inner_evb = gtk.EventBox()
+ self._socket = gtk.Socket()
+
+
+ # Add internal widgets
+ self._inner_evb.set_size_request(width, height)
+ self._inner_evb.add(self._socket)
+
+ self._socket.show()
+
+ self._align.add(self._inner_evb)
+ self._inner_evb.show()
+
+ self._align.show()
+
+ self.put(self._align, 0,0)
+
+ # Construct a gtkEvent.Translator
+ self._translator = gtkEvent.Translator(self, self._inner_evb)
+ # <Cue Thus Spract Zarathustra>
+ self.show()
+ def connect_game(self, app):
+ """Imports the given main-loop and starts processing in secondary thread
+
+ app -- fully-qualified Python path-name for the game's main-loop, with
+ name within module as :functionname, if no : character is present then
+ :main will be assumed.
+
+ Side effects:
+
+ Sets the SDL_WINDOWID variable to our socket's window ID
+ Calls Pygame init
+ Causes the gtkEvent.Translator to "hook" Pygame
+ Creates and starts secondary thread for Game/Pygame event processing.
+ """
+ log.info( 'Connecting the pygame canvas' )
+ # Setup the embedding
+ os.environ['SDL_WINDOWID'] = str(self._socket.get_id())
+ #print 'Socket ID=%s'%os.environ['SDL_WINDOWID']
+ pygame.init()
+
+ self._translator.hook_pygame()
+
+ # Load the modules
+ # NOTE: This is delayed because pygame.init() must come after the embedding is up
+ if ':' not in app:
+ app += ':main'
+ mod_name, fn_name = app.split(':')
+ self.mod_name = mod_name
+ mod = __import__(mod_name, globals(), locals(), [])
+ fn = getattr(mod, fn_name)
+
+ # Start Pygame
+ self.__thread = threading.Thread(target=self._start, args=[fn])
+ self.__thread.start()
+
+ def _start(self, fn):
+ """The method that actually runs in the background thread"""
+ log.info( 'Staring the mainloop' )
+ import olpcgames
+ olpcgames.widget = olpcgames.WIDGET = self
+ try:
+ import sugar.activity.activity,os
+ except ImportError, err:
+ log.info( """Running outside Sugar""" )
+ else:
+ try:
+ os.chdir(sugar.activity.activity.get_bundle_path())
+ except KeyError, err:
+ pass
+
+ try:
+ try:
+ try:
+ log.info( '''Running mainloop: %s''', fn )
+ fn()
+ except Exception, err:
+ log.error(
+ """Uncaught top-level exception: %s""",
+ util.get_traceback( err ),
+ )
+ raise
+ else:
+ log.info( "Mainloop exited" )
+ finally:
+ log.debug( "Clearing any pending events" )
+ from olpcgames import eventwrap
+ eventwrap.clear()
+ finally:
+ log.info( 'Main function finished, calling main_quit' )
+ gtk.main_quit()
+
+ source_object_id = None
+ def view_source(self):
+ """Implement the 'view source' key by saving
+ datastore, and then telling the Journal to view it."""
+ if self.source_object_id is None:
+ from sugar import profile
+ from sugar.datastore import datastore
+ from sugar.activity.activity import get_bundle_name, get_bundle_path
+ from gettext import gettext as _
+ import os.path
+ jobject = datastore.create()
+ metadata = {
+ 'title': _('%s Source') % get_bundle_name(),
+ 'title_set_by_user': '1',
+ 'suggested_filename': 'pippy_app.py',
+ 'icon-color': profile.get_color().to_string(),
+ 'mime_type': 'text/x-python',
+ }
+ for k,v in metadata.items():
+ jobject.metadata[k] = v # dict.update method is missing =(
+ jobject.file_path = os.path.join(get_bundle_path(), 'pippy_app.py')
+ datastore.write(jobject)
+ self.__source_object_id = jobject.object_id
+ jobject.destroy()
+ self.journal_show_object(self.__source_object_id)
+ def journal_show_object(self, object_id):
+ """Invoke journal_show_object from sugar.activity.activity if it
+ exists."""
+ try:
+ from sugar.activity.activity import show_object_in_journal
+ show_object_in_journal(object_id)
+ except ImportError:
+ pass # no love from sugar.
diff --git a/conozco-nicaragua.activity/olpcgames/canvas.pyc b/conozco-nicaragua.activity/olpcgames/canvas.pyc
new file mode 100644
index 0000000..fbe4874
--- /dev/null
+++ b/conozco-nicaragua.activity/olpcgames/canvas.pyc
Binary files differ
diff --git a/conozco-nicaragua.activity/olpcgames/data/__init__.py b/conozco-nicaragua.activity/olpcgames/data/__init__.py
new file mode 100755
index 0000000..8510186
--- /dev/null
+++ b/conozco-nicaragua.activity/olpcgames/data/__init__.py
@@ -0,0 +1,36 @@
+"""Design-time __init__.py for resourcepackage
+
+This is the scanning version of __init__.py for your
+resource modules. You replace it with a blank or doc-only
+init when ready to release.
+"""
+try:
+ __file__
+except NameError:
+ pass
+else:
+ import os
+ if os.path.splitext(os.path.basename( __file__ ))[0] == "__init__":
+ try:
+ from resourcepackage import package, defaultgenerators
+ generators = defaultgenerators.generators.copy()
+
+ ### CUSTOMISATION POINT
+ ## import specialised generators here, such as for wxPython
+ #from resourcepackage import wxgenerators
+ #generators.update( wxgenerators.generators )
+ except ImportError:
+ pass
+ else:
+ package = package.Package(
+ packageName = __name__,
+ directory = os.path.dirname( os.path.abspath(__file__) ),
+ generators = generators,
+ )
+ package.scan(
+ ### CUSTOMISATION POINT
+ ## force true -> always re-loads from external files, otherwise
+ ## only reloads if the file is newer than the generated .py file.
+ # force = 1,
+ )
+
diff --git a/conozco-nicaragua.activity/olpcgames/data/sleeping_svg.py b/conozco-nicaragua.activity/olpcgames/data/sleeping_svg.py
new file mode 100755
index 0000000..c52398a
--- /dev/null
+++ b/conozco-nicaragua.activity/olpcgames/data/sleeping_svg.py
@@ -0,0 +1,61 @@
+# -*- coding: ISO-8859-1 -*-
+"""Resource sleeping_svg (from file sleeping.svg)"""
+# written by resourcepackage: (1, 0, 1)
+source = 'sleeping.svg'
+package = 'olpcgames.data'
+data = "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>\012<svg\012\
+ xmlns=\"http://www.w3.org/2000/svg\"\012 xmlns:xlink=\"http:/\
+/www.w3.org/1999/xlink\"\012 width=\"737\"\012 height=\"923\"\012 ve\
+rsion=\"1.0\">\012 <defs>\012 <linearGradient\012 id=\"linearG\
+radient3152\">\012 <stop\012 style=\"stop-color:#b8ffb4\
+;stop-opacity:1;\"\012 offset=\"0\" />\012 <stop\012 \
+ offset=\"0.5\"\012 style=\"stop-color:#2eff22;stop-opaci\
+ty:0.5;\" />\012 <stop\012 style=\"stop-color:#ffffff;s\
+top-opacity:0;\"\012 offset=\"1\" />\012 </linearGradient>\
+\012 <radialGradient\012 xlink:href=\"#linearGradient3152\"\
+\012 id=\"radialGradient3158\"\012 cx=\"260\"\012 cy=\"2\
+35\"\012 fx=\"260\"\012 fy=\"235\"\012 r=\"259\"\012 gr\
+adientTransform=\"matrix(1,0,0,1.2531846,0,-59.560934)\"\012 \
+ gradientUnits=\"userSpaceOnUse\" />\012 </defs>\012 <g\012 tran\
+sform=\"translate(-3,-73)\">\012 <path\012 style=\"opacity:1\
+;color:#000000;fill:url(#radialGradient3158);fill-opacity:1;\
+fill-rule:evenodd;stroke:none;stroke-width:1.5;stroke-lineca\
+p:butt;stroke-linejoin:miter;marker:none;marker-start:none;m\
+arker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-da\
+sharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility\
+:visible;display:inline;overflow:visible\"\012 id=\"path217\
+8\"\012 d=\"M 519 235 A 259 324 0 1 1 0,235 A 259 324 0 1 \
+1 519 235 z\"\012 transform=\"matrix(1.4203822,0,0,1.42038\
+22,0,200)\" />\012 <path\012 style=\"fill:#000000;fill-opac\
+ity:0.75;fill-rule:nonzero;stroke:none;stroke-width:1pt;stro\
+ke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1\"\012 \
+ d=\"M 420,366 C 438,381 455,400 478,408 C 523,427 576,424 \
+620,405 C 632,400 644,393 655,387 C 652,389 638,397 649,391 \
+C 658,385 666,379 676,376 C 688,370 673,379 669,382 C 637,40\
+1 604,421 566,427 C 526,435 482,429 446,408 C 431,398 419,38\
+5 405,374 C 410,371 415,368 420,366 z \" />\012 <path\012 \
+style=\"fill:#000000;fill-opacity:0.75;fill-rule:nonzero;stro\
+ke:none;stroke-width:1pt;stroke-linecap:butt;stroke-linejoin\
+:miter;stroke-opacity:1\"\012 d=\"M 322,366 C 303,381 286,4\
+00 263,408 C 218,427 166,424 121,405 C 109,400 98,393 86,387\
+ C 89,389 103,397 93,391 C 84,385 75,379 65,376 C 53,370 68,\
+379 72,382 C 104,401 137,421 175,427 C 216,435 260,429 295,4\
+08 C 310,398 322,385 336,374 C 331,371 326,368 322,366 z \" /\
+>\012 <path\012 style=\"fill:#000000;fill-opacity:0.75;fil\
+l-rule:nonzero;stroke:none;stroke-width:1pt;stroke-linecap:b\
+utt;stroke-linejoin:miter;stroke-opacity:1\"\012 d=\"M 363,\
+383 C 347,418 353,458 345,495 C 339,525 324,551 312,579 C 30\
+4,598 298,620 309,639 C 317,655 335,667 353,669 C 379,671 40\
+5,664 429,653 C 442,646 405,667 423,656 C 429,652 434,647 44\
+1,645 C 455,639 439,650 434,653 C 408,669 378,679 347,679 C \
+327,679 308,667 297,651 C 285,634 287,613 294,594 C 302,570 \
+316,548 324,523 C 335,493 335,460 338,428 C 340,415 342,401 \
+349,390 C 353,388 358,385 363,383 z \" />\012 <path\012 st\
+yle=\"fill:#000000;fill-opacity:0.75;fill-rule:nonzero;stroke\
+:none;stroke-width:1pt;stroke-linecap:butt;stroke-linejoin:m\
+iter;stroke-opacity:1\"\012 d=\"M 206,735 C 245,737 285,740\
+ 324,744 C 357,745 391,746 424,744 C 468,738 510,723 550,703\
+ C 552,703 544,709 541,711 C 531,718 518,722 507,727 C 474,7\
+40 440,751 405,754 C 360,756 314,754 268,749 C 243,747 218,7\
+46 193,745 C 197,741 201,738 206,735 z \" />\012 </g>\012</svg>\012"
+### end
diff --git a/conozco-nicaragua.activity/olpcgames/dbusproxy.py b/conozco-nicaragua.activity/olpcgames/dbusproxy.py
new file mode 100755
index 0000000..a103e28
--- /dev/null
+++ b/conozco-nicaragua.activity/olpcgames/dbusproxy.py
@@ -0,0 +1,93 @@
+"""Spike test for a safer networking system for DBUS-based objects"""
+from olpcgames import eventwrap, util
+from dbus import proxies
+import logging
+log = logging.getLogger( 'dbus' )
+log.setLevel( logging.DEBUG )
+
+def wrap( value, tube=None,path=None ):
+ """Wrap object with any required pygame-side proxies"""
+ if isinstance( value,proxies._ProxyMethod ):
+ return DBUSMethod( value, tube=tube, path=path )
+ elif isinstance( value, proxies._DeferredMethod ):
+ value._proxy_method = DBUSMethod( value._proxy_method, tube=tube, path=path )
+ return value
+ elif isinstance( value, proxies.ProxyObject ):
+ return DBUSProxy( value, tube=tube, path=path )
+ else:
+ return value
+
+class DBUSProxy( object ):
+ """Proxy for the DBUS Proxy object"""
+ def __init__( self, proxy, tube=None, path=None ):
+ log.info( 'Creating Pygame-side proxy for %s (%s)', proxy,path )
+ self.__proxy = proxy
+ self.__tube = tube
+ self.__path = path
+ def __getattr__( self, key ):
+ """Retrieve attribute of given key"""
+ from dbus import proxies
+ return wrap( getattr( self.__proxy, key ) )
+ def add_signal_receiver( self, callback, eventName, interface, path=None, sender_keyword='sender'):
+ """Add a new signal handler (which will be called many times) for given signal
+ """
+ log.info( """Setting signal receiver %s for event %s on interface %s (object path %s) with sender_keyword = %r""",
+ callback, eventName, interface, path, sender_keyword,
+ )
+ log.debug( """proxy: %s proxy.tube: %s""", self.__proxy, self.__proxy.tube )
+ self.__tube.add_signal_receiver(
+ Callback( callback ),
+ eventName,
+ interface,
+ path = path or self.__path,
+ sender_keyword = sender_keyword,
+ )
+
+class DBUSMethod( object ):
+ """DBUS method which does callbacks in the Pygame (eventwrapper) thread"""
+ def __init__( self, proxy, tube,path ):
+ log.info( 'Creating Pygame-side method proxy for %s', proxy )
+ self.__proxy = proxy
+ self.__tube = tube
+ self.__path = path
+ def __call__( self, *args, **named ):
+ """Perform the asynchronous call"""
+ log.info( 'Calling proxy for %s with *%s, **%s', self.__proxy, args, named )
+ callback, errback = named.get( 'reply_handler'), named.get( 'error_handler' )
+ if not callback:
+ raise TypeError( """Require a reply_handler named argument to do any asynchronous call""" )
+ else:
+ callback = Callback( callback )
+ if not errback:
+ errback = defaultErrback
+ else:
+ errback = Callback( errback )
+ named['reply_handler'] = callback
+ named['error_handler'] = errback
+ return self.__proxy( *args, **named )
+
+def defaultErrback( error ):
+ """Log the error to stderr/log"""
+ log.error( """Failure in DBUS call: %s""", error )
+
+class Callback( object ):
+ """PyGTK-side callback which generates a CallbackResult to process on the Pygame side"""
+ def __init__( self, callable, callContext = None):
+ """Initialize the callback to process results"""
+ self.callable = callable
+ if callContext is None:
+ callContext = util.get_traceback( None )
+ self.callContext = callContext
+ def __call__( self, *args, **named ):
+ """PyGTK-side callback operation"""
+ log.info( 'Callback %s return value *%s, **%s', self.callable, args, named )
+ from olpcgames import eventwrap
+ args = [wrap(a) for a in args]
+ named = dict([
+ (k,wrap(v)) for k,v in named.items()
+ ])
+ eventwrap.post(
+ eventwrap.CallbackResult(
+ self.callable, args, named, callContext = self.callContext
+ )
+ )
diff --git a/conozco-nicaragua.activity/olpcgames/eventwrap.py b/conozco-nicaragua.activity/olpcgames/eventwrap.py
new file mode 100755
index 0000000..402109c
--- /dev/null
+++ b/conozco-nicaragua.activity/olpcgames/eventwrap.py
@@ -0,0 +1,388 @@
+"""Provides substitute for Pygame's "event" module using gtkEvent
+
+Provides methods which will be substituted into Pygame in order to
+provide the synthetic events that we will feed into the Pygame queue.
+These methods are registered by the "install" method.
+
+This event queue does not support getting events only of a certain type.
+You need to get all pending events at a time, or filter them yourself. You
+can, however, block and unblock events of certain types, so that may be
+useful to you.
+
+Set_grab doesn't do anything (you are not allowed to grab events). Sorry.
+
+Extensions:
+
+ wait( timeout=None ) -- allows you to wait for only a specified period
+ before you return to the application. Can be used to e.g. wait for a
+ short period, then release some resources, then wait a bit more, then
+ release a few more resources, then a bit more...
+"""
+import pygame
+import gtk
+import Queue
+import thread, threading
+import logging
+from olpcgames import util
+
+log = logging.getLogger( 'olpcgames.eventwrap' )
+
+from pygame.event import Event, event_name, pump as pygame_pump, get as pygame_get
+
+class Event(object):
+ """Mock pygame events"""
+ def __init__(self, type, dict=None,**named):
+ """Initialise the new event variables from dictionary and named become attributes"""
+ self.type = type
+ if dict:
+ self.__dict__.update( dict )
+ self.__dict__.update( named )
+ def _get_dict( self ):
+ return self.__dict__
+ dict = property( _get_dict )
+ def __repr__( self ):
+ result = []
+ for key,value in self.__dict__.items():
+ if not key.startswith( '_' ):
+ result.append( '%s = %r'%( key, value ))
+ return '%s( %s, %s )'%(
+ self.__class__.__name__,
+ self.type,
+ ",".join( result ),
+ )
+ def block( self ):
+ """Block until this event is finished processing
+
+ Event process is only finalized on the *next* call to retrieve an event
+ after the processing operation in which the event is processed. In some
+ extremely rare cases we might actually see that happen, were the
+ file-saving event (for example) causes the Pygame event loop to exit.
+ In that case, the GTK event loop *could* hang.
+ """
+ log.info( '''Blocking GTK thread on event: %s''', self )
+ self.__lock = threading.Event()
+ self.__lock.wait()
+ def retire( self ):
+ """Block the GTK event loop until this event is processed"""
+ try:
+ self.__lock.set()
+ log.info( '''Released GTK thread on event: %s''', self )
+ except AttributeError, err:
+ pass
+
+class CallbackResult( object ):
+ def __init__( self, callable, args, named, callContext=None ):
+ """Perform callback in Pygame loop with args and named
+
+ callContext is used to provide more information when there is
+ a failure in the callback (for debugging purposes)
+ """
+ self.callable = callable
+ self.args = args
+ self.named = named
+ if callContext is None:
+ callContext = util.get_traceback( None )
+ self.callContext = callContext
+ def __call__( self ):
+ """Perform the actual callback in the Pygame event loop"""
+ try:
+ self.callable( *self.args, **self.named )
+ except Exception, err:
+ log.error(
+ """Failure in callback %s( *%s, **%s ): %s\n%s""",
+ getattr(self.callable, '__name__',self.callable),
+ self.args, self.named,
+ util.get_traceback( err ),
+ self.callContext
+ )
+
+
+_EVENTS_TO_RETIRE = []
+
+def _releaseEvents( ):
+ """Release/retire previously-processed events"""
+ if _EVENTS_TO_RETIRE:
+ for event in _EVENTS_TO_RETIRE:
+ try:
+ event.retire()
+ except AttributeError, err:
+ pass
+
+def _processCallbacks( events ):
+ """Process any callbacks in events and remove from the stream"""
+ result = []
+ for event in events:
+ if isinstance( event, CallbackResult ):
+ event()
+ else:
+ result.append( event )
+ if events and not result:
+ result.append(
+ Event( type=pygame.NOEVENT )
+ )
+ return result
+
+def _recordEvents( events ):
+ """Record the set of events to retire on the next iteration"""
+ global _EVENTS_TO_RETIRE
+ events = _processCallbacks( events )
+ _EVENTS_TO_RETIRE = events
+ return events
+
+def install():
+ """Installs this module (eventwrap) as an in-place replacement for the pygame.event module.
+
+ Use install() when you need to interact with Pygame code written
+ without reference to the olpcgames wrapper mechanisms to have the
+ code use this module's event queue.
+
+ XXX Really, use it everywhere you want to use olpcgames, as olpcgames
+ registers the handler itself, so you will always wind up with it registered when
+ you use olpcgames (the gtkEvent.Translator.hook_pygame method calls it).
+ """
+ log.info( 'Installing OLPCGames event wrapper' )
+ from olpcgames import eventwrap
+ import pygame
+ pygame.event = eventwrap
+ import sys
+ sys.modules["pygame.event"] = eventwrap
+
+# Event queue:
+class _FilterQueue( Queue.Queue ):
+ """Simple Queue sub-class with a put_left method"""
+ def get_type( self, filterFunction, block=True, timeout=None ):
+ """Get events of a given type
+
+ Note: can raise Empty *even* when blocking if someone else
+ pops the event off the queue before we get around to it.
+ """
+ self.not_empty.acquire()
+ try:
+ if not block:
+ if self._empty_type( filterFunction ):
+ raise Queue.Empty
+ elif timeout is None:
+ while self._empty_type( filterFunction ):
+ self.not_empty.wait()
+ else:
+ if timeout < 0:
+ raise ValueError("'timeout' must be a positive number")
+ endtime = _time() + timeout
+ while self._empty_type( filterFunction ):
+ remaining = endtime - _time()
+ if remaining <= 0.0:
+ raise Queue.Empty
+ self.not_empty.wait(remaining)
+ item = self._get_type( filterFunction )
+ self.not_full.notify()
+ return item
+ finally:
+ self.not_empty.release()
+ def _empty_type( self, filterFunction ):
+ """Are we empty with respect to filterFunction?"""
+ for element in self.queue:
+ if filterFunction( element ):
+ return False
+ return True
+ def _get_type( self, filterFunction ):
+ """Get the first instance which matches filterFunction"""
+ for element in self.queue:
+ if filterFunction( element ):
+ self.queue.remove( element )
+ return element
+ # someone popped the event off the queue before we got to it!
+ raise Queue.Empty
+ def peek_type( self, filterFunction= lambda x: True ):
+ """Peek to see if we have filterFunction-matching element
+
+ Note: obviously this is *not* thread safe, it's just informative...
+ """
+ try:
+ for element in self.queue:
+ if filterFunction( element ):
+ return element
+ return None
+ except RuntimeError, err:
+ return None # none yet, at least
+
+g_events = _FilterQueue()
+
+# Set of blocked events as set by set
+g_blocked = set()
+g_blockedlock = thread.allocate_lock() # should use threading instead
+g_blockAll = False
+
+def _typeChecker( types ):
+ """Create check whether an event is in types"""
+ try:
+ if 1 in types:
+ pass
+ def check( element ):
+ return element.type in types
+ return check
+ except TypeError, err:
+ def check( element ):
+ return element.type == types
+ return check
+
+def pump():
+ """Handle any window manager and other external events that aren't passed to the user
+
+ Call this periodically (once a frame) if you don't call get(), poll() or wait()
+ """
+ pygame_pump()
+ _releaseEvents()
+
+def get( types=None):
+ """Get a list of all pending events
+
+ types -- either an integer event-type or a sequence of integer event types
+ which restrict the set of event-types returned from the queue. Keep in mind
+ that if you do not remove events you may wind up with an eternally growing
+ queue or a full queue. Normally you will want to remove all events in your
+ top-level event-loop and propagate them yourself.
+
+ Note: if you use types you lose all event ordering guarantees, events
+ may show up after events which were originally produced before them due to
+ the re-ordering of the queue on filtering!
+ """
+ pump()
+ eventlist = []
+ try:
+ if types:
+ check = _typeChecker( types )
+ while True:
+ eventlist.append(g_events.get_type( check, block=False))
+ else:
+ while True:
+ eventlist.append(g_events.get(block=False))
+ except Queue.Empty:
+ pass
+
+ pygameEvents = pygame_get()
+ if pygameEvents:
+ log.info( 'Raw Pygame events: %s', pygameEvents)
+ eventlist.extend( pygameEvents )
+ return _recordEvents( eventlist )
+
+def poll():
+ """Get the next pending event if exists. Otherwise, return pygame.NOEVENT."""
+ pump()
+ try:
+ result = g_events.get(block=False)
+ return _recordEvents( [result] )[0]
+ except Queue.Empty:
+ return Event(pygame.NOEVENT)
+
+
+def wait( timeout = None):
+ """Get the next pending event, wait up to timeout if none
+
+ timeout -- if present, only wait up to timeout seconds, if we
+ do not find an event before then, return None. timeout
+ is an OLPCGames-specific extension.
+ """
+ pump()
+ try:
+ result = None
+ result = g_events.get(block=True, timeout=timeout)
+ try:
+ return _recordEvents( [result] )[0]
+ except IndexError, err:
+ return Event( type=pygame.NOEVENT )
+ except Queue.Empty, err:
+ return None
+
+def peek(types=None):
+ """True if there is any pending event
+
+ types -- optional set of event-types used to check whether
+ an event is of interest. If specified must be either a sequence
+ of integers/longs or an integer/long.
+ """
+ if types:
+ check = _typeChecker( types )
+ return g_events.peek_type( check ) is not None
+ return not g_events.empty()
+
+def clear():
+ """Clears the entire pending queue of events
+
+ Rarely used
+ """
+ try:
+ discarded = []
+ while True:
+ discarded.append( g_events.get(block=False) )
+ discarded = _recordEvents( discarded )
+ _releaseEvents()
+ return discarded
+ except Queue.Empty:
+ pass
+
+def set_blocked(item):
+ """Block item/items from being added to the event queue"""
+ g_blockedlock.acquire()
+ try:
+ # FIXME: we do not currently know how to block all event types when
+ # you set_blocked(none).
+ [g_blocked.add(x) for x in makeseq(item)]
+ finally:
+ g_blockedlock.release()
+
+def set_allowed(item):
+ """Allow item/items to be added to the event queue"""
+ g_blockedlock.acquire()
+ try:
+ if item is None:
+ # Allow all events when you set_allowed(none). Strange, eh?
+ # Pygame is a wonderful API.
+ g_blocked.clear()
+ else:
+ [g_blocked.remove(x) for x in makeseq(item)]
+ finally:
+ g_blockedlock.release()
+
+def get_blocked(*args, **kwargs):
+ g_blockedlock.acquire()
+ try:
+ blocked = frozenset(g_blocked)
+ return blocked
+ finally:
+ g_blockedlock.release()
+
+def set_grab(grabbing):
+ """This method will not be implemented"""
+
+def get_grab():
+ """This method will not be implemented"""
+
+def post(event):
+ """Post a new event to the Queue of events"""
+ g_blockedlock.acquire()
+ try:
+ if getattr(event,'type',None) not in g_blocked:
+ g_events.put(event, block=False)
+ finally:
+ g_blockedlock.release()
+
+def makeseq(obj):
+ """Accept either a scalar object or a sequence, and return a sequence
+ over which we can iterate. If we were passed a sequence, return it
+ unchanged. If we were passed a scalar, return a tuple containing only
+ that scalar. This allows the caller to easily support one-or-many.
+ """
+ # Strings are the exception because you can iterate over their chars
+ # -- yet, for all the purposes I've ever cared about, I want to treat
+ # a string as a scalar.
+ if isinstance(obj, basestring):
+ return (obj,)
+ try:
+ # Except as noted above, if you can get an iter() from an object,
+ # it's a collection.
+ iter(obj)
+ return obj
+ except TypeError:
+ # obj is a scalar. Wrap it in a tuple so we can iterate over the
+ # one item.
+ return (obj,)
diff --git a/conozco-nicaragua.activity/olpcgames/eventwrap.pyc b/conozco-nicaragua.activity/olpcgames/eventwrap.pyc
new file mode 100644
index 0000000..17c9f6e
--- /dev/null
+++ b/conozco-nicaragua.activity/olpcgames/eventwrap.pyc
Binary files differ
diff --git a/conozco-nicaragua.activity/olpcgames/gtkEvent.py b/conozco-nicaragua.activity/olpcgames/gtkEvent.py
new file mode 100755
index 0000000..6b20102
--- /dev/null
+++ b/conozco-nicaragua.activity/olpcgames/gtkEvent.py
@@ -0,0 +1,289 @@
+"""gtkEvent.py: translate GTK events into Pygame events."""
+import pygtk
+pygtk.require('2.0')
+import gtk
+import gobject
+import pygame
+from olpcgames import eventwrap
+import logging
+log = logging.getLogger( 'olpcgames.gtkevent' )
+##log.setLevel( logging.DEBUG )
+
+class _MockEvent(object):
+ """Used to inject key-repeat events on the gtk side."""
+ def __init__(self, keyval):
+ self.keyval = keyval
+
+class Translator(object):
+ """Utility class to translate GTK events into Pygame events
+
+ The Translator object interprets incoming GTK events and generates
+ Pygame events in the eventwrap module's queue as a result.
+ It also handles generating Pygame style key-repeat events
+ by synthesizing them via a GTK timer.
+ """
+ key_trans = {
+ 'Alt_L': pygame.K_LALT,
+ 'Alt_R': pygame.K_RALT,
+ 'Control_L': pygame.K_LCTRL,
+ 'Control_R': pygame.K_RCTRL,
+ 'Shift_L': pygame.K_LSHIFT,
+ 'Shift_R': pygame.K_RSHIFT,
+ 'Super_L': pygame.K_LSUPER,
+ 'Super_R': pygame.K_RSUPER,
+ 'KP_Page_Up' : pygame.K_KP9,
+ 'KP_Page_Down' : pygame.K_KP3,
+ 'KP_End' : pygame.K_KP1,
+ 'KP_Home' : pygame.K_KP7,
+ 'KP_Up' : pygame.K_KP8,
+ 'KP_Down' : pygame.K_KP2,
+ 'KP_Left' : pygame.K_KP4,
+ 'KP_Right' : pygame.K_KP6,
+
+ }
+
+ mod_map = {
+ pygame.K_LALT: pygame.KMOD_LALT,
+ pygame.K_RALT: pygame.KMOD_RALT,
+ pygame.K_LCTRL: pygame.KMOD_LCTRL,
+ pygame.K_RCTRL: pygame.KMOD_RCTRL,
+ pygame.K_LSHIFT: pygame.KMOD_LSHIFT,
+ pygame.K_RSHIFT: pygame.KMOD_RSHIFT,
+ }
+
+ def __init__(self, mainwindow, mouselistener=None):
+ """Initialise the Translator with the windows to which to listen"""
+ # _inner_evb is Mouselistener
+ self._mainwindow = mainwindow
+ if mouselistener is None:
+ mouselistener = mainwindow
+
+ self._inner_evb = mouselistener
+
+ # Need to set our X event masks so we see mouse motion and stuff --
+ mainwindow.set_events(
+ gtk.gdk.KEY_PRESS_MASK | \
+ gtk.gdk.KEY_RELEASE_MASK \
+ )
+
+ self._inner_evb.set_events(
+ gtk.gdk.POINTER_MOTION_MASK | \
+ gtk.gdk.POINTER_MOTION_HINT_MASK | \
+ gtk.gdk.BUTTON_MOTION_MASK | \
+ gtk.gdk.BUTTON_PRESS_MASK | \
+ gtk.gdk.BUTTON_RELEASE_MASK
+ )
+
+ # Callback functions to link the event systems
+ mainwindow.connect('unrealize', self._quit)
+ mainwindow.connect('key_press_event', self._keydown)
+ mainwindow.connect('key_release_event', self._keyup)
+ self._inner_evb.connect('button_press_event', self._mousedown)
+ self._inner_evb.connect('button_release_event', self._mouseup)
+ self._inner_evb.connect('motion-notify-event', self._mousemove)
+
+ # You might need to do this
+ mainwindow.set_flags(gtk.CAN_FOCUS)
+ self._inner_evb.set_flags(gtk.CAN_FOCUS)
+
+ # Internal data
+ self.__stopped = False
+ self.__keystate = [0] * 323
+ self.__button_state = [0,0,0]
+ self.__mouse_pos = (0,0)
+ self.__repeat = (None, None)
+ self.__held = set()
+ self.__held_time_left = {}
+ self.__held_last_time = {}
+ self.__tick_id = None
+
+ #print "translator initialized"
+ self._inner_evb.connect( 'expose-event', self.do_expose_event )
+# screen = gtk.gdk.screen_get_default()
+# screen.connect( 'size-changed', self.do_resize_event )
+ self._inner_evb.connect( 'configure-event', self.do_resize_event )
+ def do_expose_event(self, event, widget):
+ """Handle exposure event (trigger redraw by gst)"""
+ log.info( 'Expose event: %s', event )
+ from olpcgames import eventwrap
+ eventwrap.post( eventwrap.Event( eventwrap.pygame.VIDEOEXPOSE ))
+ return True
+ def do_resize_event( self, activity, event ):
+ """Our screen (actually, the default screen) has resized"""
+ log.info( 'Resize event: %s %s', activity, event )
+ log.info( 'Event values: %s', (event.width,event.height) )
+# from olpcgames import eventwrap
+# # shouldn't the activity's window have this information too?
+# eventwrap.post(
+# eventwrap.Event(
+# eventwrap.pygame.VIDEORESIZE,
+# dict(size=(event.width,event.height), width=event.width, height=event.height)
+# )
+# )
+ return False # continue processing
+ def hook_pygame(self):
+ """Hook the various Pygame features so that we implement the event APIs"""
+ # Pygame should be initialized. Hijack their key and mouse methods
+ pygame.key.get_pressed = self._get_pressed
+ pygame.key.set_repeat = self._set_repeat
+ pygame.mouse.get_pressed = self._get_mouse_pressed
+ pygame.mouse.get_pos = self._get_mouse_pos
+ import eventwrap
+ eventwrap.install()
+
+ def _quit(self, data=None):
+ self.__stopped = True
+ eventwrap.post(eventwrap.Event(pygame.QUIT))
+
+ def _keydown(self, widget, event):
+ key = event.keyval
+ log.debug( 'key down: %s', key )
+ if key in self.__held:
+ return True
+ else:
+ if self.__repeat[0] is not None:
+ self.__held_last_time[key] = pygame.time.get_ticks()
+ self.__held_time_left[key] = self.__repeat[0]
+ self.__held.add(key)
+
+ return self._keyevent(widget, event, pygame.KEYDOWN)
+
+ def _keyup(self, widget, event):
+ key = event.keyval
+ if self.__repeat[0] is not None:
+ if key in self.__held:
+ # This is possibly false if set_repeat() is called with a key held
+ del self.__held_time_left[key]
+ del self.__held_last_time[key]
+ self.__held.discard(key)
+
+ return self._keyevent(widget, event, pygame.KEYUP)
+
+ def _keymods(self):
+ """Extract the keymods as they stand currently."""
+ mod = 0
+ for key_val, mod_val in self.mod_map.iteritems():
+ mod |= self.__keystate[key_val] and mod_val
+ return mod
+
+
+ def _keyevent(self, widget, event, type):
+ key = gtk.gdk.keyval_name(event.keyval)
+ if key is None:
+ # No idea what this key is.
+ return False
+
+ keycode = None
+ if key in self.key_trans:
+ keycode = self.key_trans[key]
+ elif hasattr(pygame, 'K_'+key.upper()):
+ keycode = getattr(pygame, 'K_'+key.upper())
+ elif hasattr(pygame, 'K_'+key.lower()):
+ keycode = getattr(pygame, 'K_'+key.lower())
+ elif key == 'XF86Start':
+ # view source request, specially handled...
+ self._mainwindow.view_source()
+ else:
+ print 'Key %s unrecognized'%key
+
+ if keycode is not None:
+ if type == pygame.KEYDOWN:
+ mod = self._keymods()
+ self.__keystate[keycode] = type == pygame.KEYDOWN
+ if type == pygame.KEYUP:
+ mod = self._keymods()
+ ukey = unichr(gtk.gdk.keyval_to_unicode(event.keyval))
+ if ukey == '\000':
+ ukey = ''
+ evt = eventwrap.Event(type, key=keycode, unicode=ukey, mod=mod)
+ assert evt.key, evt
+ self._post(evt)
+ return True
+
+ def _get_pressed(self):
+ """Retrieve map/array of which keys are currently depressed (held down)"""
+ return self.__keystate
+
+ def _get_mouse_pressed(self):
+ """Return three-element array of which mouse-buttons are currently depressed (held down)"""
+ return self.__button_state
+
+ def _mousedown(self, widget, event):
+ self.__button_state[event.button-1] = 1
+ return self._mouseevent(widget, event, pygame.MOUSEBUTTONDOWN)
+
+ def _mouseup(self, widget, event):
+ self.__button_state[event.button-1] = 0
+ return self._mouseevent(widget, event, pygame.MOUSEBUTTONUP)
+
+ def _mouseevent(self, widget, event, type):
+
+ evt = eventwrap.Event(type,
+ button=event.button,
+ pos=(event.x, event.y))
+ self._post(evt)
+ return True
+
+ def _mousemove(self, widget, event):
+ # From http://www.learningpython.com/2006/07/25/writing-a-custom-widget-using-pygtk/
+ # if this is a hint, then let's get all the necessary
+ # information, if not it's all we need.
+ if event.is_hint:
+ x, y, state = event.window.get_pointer()
+ else:
+ x = event.x
+ y = event.y
+ state = event.state
+
+ rel = (x - self.__mouse_pos[0],
+ y - self.__mouse_pos[1])
+ self.__mouse_pos = (x, y)
+
+ self.__button_state = [
+ state & gtk.gdk.BUTTON1_MASK and 1 or 0,
+ state & gtk.gdk.BUTTON2_MASK and 1 or 0,
+ state & gtk.gdk.BUTTON3_MASK and 1 or 0,
+ ]
+
+ evt = eventwrap.Event(pygame.MOUSEMOTION,
+ pos=self.__mouse_pos,
+ rel=rel,
+ buttons=self.__button_state)
+ self._post(evt)
+ return True
+
+ def _tick(self):
+ """Generate synthetic events for held-down keys"""
+ cur_time = pygame.time.get_ticks()
+ for key in self.__held:
+ delta = cur_time - self.__held_last_time[key]
+ self.__held_last_time[key] = cur_time
+
+ self.__held_time_left[key] -= delta
+ if self.__held_time_left[key] <= 0:
+ self.__held_time_left[key] = self.__repeat[1]
+ self._keyevent(None, _MockEvent(key), pygame.KEYDOWN)
+
+ return True
+
+ def _set_repeat(self, delay=None, interval=None):
+ """Set the key-repetition frequency for held-down keys"""
+ if delay is not None and self.__repeat[0] is None:
+ self.__tick_id = gobject.timeout_add(10, self._tick)
+ elif delay is None and self.__repeat[0] is not None:
+ gobject.source_remove(self.__tick_id)
+ self.__repeat = (delay, interval)
+
+ def _get_mouse_pos(self):
+ """Retrieve the current mouse position as a two-tuple of integers"""
+ return self.__mouse_pos
+
+ def _post(self, evt):
+ try:
+ eventwrap.post(evt)
+ except pygame.error, e:
+ if str(e) == 'Event queue full':
+ print "Event queue full!"
+ pass
+ else:
+ raise e
diff --git a/conozco-nicaragua.activity/olpcgames/gtkEvent.pyc b/conozco-nicaragua.activity/olpcgames/gtkEvent.pyc
new file mode 100644
index 0000000..40a32c0
--- /dev/null
+++ b/conozco-nicaragua.activity/olpcgames/gtkEvent.pyc
Binary files differ
diff --git a/conozco-nicaragua.activity/olpcgames/mesh.py b/conozco-nicaragua.activity/olpcgames/mesh.py
new file mode 100755
index 0000000..1ad4c43
--- /dev/null
+++ b/conozco-nicaragua.activity/olpcgames/mesh.py
@@ -0,0 +1,583 @@
+'''Utilities for wrapping the telepathy network for Pygame
+
+The 'mesh' module allows your Pygame game to be Shared
+across the OLPC networking infrastructure (D-bus and Tubes).
+It offers a simplified view of the Telepathy system.
+
+All Sugar activities have a 'Share' menu (toolbar) which is
+intended to allow other people to join the activity instance
+and collaborate with you. When you select Share, the activity's
+icon appears on the Neighborhood view of other laptops.
+
+If you do nothing else with networking, this is all that will
+happen: if anyone selects your shared activity icon, they will
+just spawn a new instance of the activity, and they will get to
+play your game alone.
+
+The mesh module automatically sets up a connection from each
+participant to every other participant. It provides (string based)
+communications channels that let you either broadcast messages
+to other users or communicate point-to-point to one other user.
+
+You can use the "handles" which uniquely idenify users to send
+messages to an individual user (send_to( handle, message )) or
+broadcast( message ) to send a message to all participants.
+
+More advanced (structured) networking can be handled by using
+the get_object( handle, path ) function, which looks up an object
+(by DBUS path) shared by the user "handle" and returns a
+DBUS/Telepathy proxy for that object. The object you get back is
+actually an olpcgames.dbusproxy.DBUSProxy instance, which
+enforces asynchronous operations and runs your
+reply_handler/error_handler in the Pygame event loop.
+
+NOTE:
+ You *cannot* make synchronous calls on these objects!
+ You must use the named arguments:
+
+ reply_handler, error_handler
+
+ for every call which you perform on a shared object (normally
+ these are ExportedGObject instances).
+
+If you want to run your callbacks in the GTK event loop (for instance
+because they need to handle GTK-side objects), you can use the
+dbus_get_object function. This is *not* recommended for normal
+usage, as any call to Pygame operations within the GTK event loop
+can cause a segfault/core of your entire Activity.
+
+Note:
+
+ mesh sets up N**2 connections for each shared activity, obviously
+ that will not scale to very large shared activities.
+
+Note:
+
+ The intention is that mesh will be refactored, possibly as a
+ new module called "olpcgames.network", which would break out
+ the various components so that there is no longer an assumed
+ networking layout. We will attempt to retain the mesh module's
+ API as we do so.
+
+Events produced:
+
+ olpcgames.CONNECT -- The tube connection was started. (i.e., the
+ user clicked Share or started the activity from the Neighborhood
+ screen).
+
+ Event properties:
+
+ id -- a unique identifier for this connection. (shouldn't be needed
+ for anything)
+
+ olpcgames.PARTICIPANT_ADD -- A participant joined the activity.
+ This will trigger for the local user as well as any arriving remote
+ users. Note that this *only* occurs after the activity is shared,
+ that is, the local user does not appear until after they have
+ shared a locally-started activity.
+
+ Event properties:
+
+ handle -- the arriving user's handle (a uniquely identifying string
+ assigned to the user by the Telepathy system, not human
+ readable), see lookup_buddy to retrieve human-readable
+ descriptions of the user.
+
+ olpcgames.PARTICIPANT_REMOVE -- A participant quit the activity.
+
+ Event properties:
+
+ handle -- the departing user's handle.
+
+ olpcgames.MESSAGE_UNI -- A message was sent to you.
+
+ Event properties:
+
+ content -- the content of the message (a string)
+ handle -- the handle of the sending user.
+
+ olpcgames.MESSAGE_MULTI -- A message was sent to everyone.
+
+ Event properties:
+
+ content -- the content of the message (a string)
+ handle -- the handle of the sending user.
+
+Note:
+
+ Eventually we will stop using top-level Pygame event types for the
+ various networking message types (currently four of them). We will
+ likely use UserEvent with a sub-type specifier for the various events
+ that OLPCGames produces.
+
+See Also:
+
+ http://blog.vrplumber.com/2016 -- Discussion of how Productive uses
+ the mesh module and raw Telepathy (ExportedGObject instances)
+'''
+import logging
+log = logging.getLogger( 'olpcgames.mesh' )
+##log.setLevel( logging.DEBUG )
+import olpcgames
+from olpcgames.util import get_traceback
+try:
+ from sugar.presence.tubeconn import TubeConnection
+except ImportError, err:
+ TubeConnection = object
+try:
+ from dbus.gobject_service import ExportedGObject
+except ImportError, err:
+ ExportedGObject = object
+from dbus.service import method, signal
+
+try:
+ import telepathy
+except ImportError, err:
+ telepathy = None
+
+try:
+ import sugar.presence.presenceservice
+except Exception, err:
+ pass
+import pygame.event as PEvent
+
+class OfflineError( Exception ):
+ """Raised when we cannot complete an operation due to being offline"""
+
+DBUS_IFACE="org.laptop.games.pygame"
+DBUS_PATH="/org/laptop/games/pygame"
+DBUS_SERVICE = None
+
+
+### NEW PYGAME EVENTS ###
+
+CONNECT = olpcgames.CONNECT
+PARTICIPANT_ADD = olpcgames.PARTICIPANT_ADD
+PARTICIPANT_REMOVE = olpcgames.PARTICIPANT_REMOVE
+MESSAGE_UNI = olpcgames.MESSAGE_UNI
+MESSAGE_MULTI = olpcgames.MESSAGE_MULTI
+
+
+# Private objects for useful purposes!
+pygametubes = []
+text_chan, tubes_chan = (None, None)
+conn = None
+initiating = False
+joining = False
+
+connect_callback = None
+
+def is_initiating():
+ '''A version of is_initiator that's a bit less goofy, and can be used
+ before the Tube comes up.'''
+ global initiating
+ return initiating
+
+def is_joining():
+ '''Returns True if the activity was started up by means of the
+ Neighbourhood mesh view.'''
+ global joining
+ return joining
+
+def set_connect_callback(cb):
+ '''Just the same as the Pygame event loop can listen for CONNECT,
+ this is just an ugly callback that the glib side can use to be aware
+ of when the Tube is ready.'''
+ global connect_callback
+ connect_callback = cb
+
+def activity_shared(activity):
+ '''Called when the user clicks Share.'''
+
+ global initiating
+ initiating = True
+
+ _setup(activity)
+
+
+ log.debug('This is my activity: making a tube...')
+ channel = tubes_chan[telepathy.CHANNEL_TYPE_TUBES]
+ if hasattr( channel, 'OfferDBusTube' ):
+ id = channel.OfferDBusTube(
+ DBUS_SERVICE, {})
+ else:
+ id = channel.OfferTube(
+ telepathy.TUBE_TYPE_DBUS, DBUS_SERVICE, {})
+
+ global connect_callback
+ if connect_callback is not None:
+ connect_callback()
+
+def activity_joined(activity):
+ '''Called at the startup of our Activity, when the user started it via Neighborhood intending to join an existing activity.'''
+
+ # Find out who's already in the shared activity:
+ log.debug('Joined an existing shared activity')
+
+ for buddy in activity._shared_activity.get_joined_buddies():
+ log.debug('Buddy %s is already in the activity' % buddy.props.nick)
+
+
+ global initiating
+ global joining
+ initiating = False
+ joining = True
+
+
+ _setup(activity)
+
+ tubes_chan[telepathy.CHANNEL_TYPE_TUBES].ListTubes(
+ reply_handler=_list_tubes_reply_cb,
+ error_handler=_list_tubes_error_cb)
+
+ global connect_callback
+ if connect_callback is not None:
+ connect_callback()
+
+def _getConn( activity ):
+ log.debug( '_getConn' )
+ global conn
+ if conn:
+ return conn
+ else:
+ if hasattr( activity._shared_activity, 'telepathy_conn' ):
+ log.debug( '''new-style api for retrieving telepathy connection present''' )
+ conn = activity._shared_activity.telepathy_conn
+ else:
+ pservice = _get_presence_service()
+ log.debug( '_get_presence_service -> %s', pservice )
+ name, path = pservice.get_preferred_connection()
+ log.debug( '_get_presence_service -> %s, %s', name, path)
+ conn = telepathy.client.Connection(name, path)
+ log.debug( 'Telepathy Client Connection: %s', conn )
+ return conn
+
+
+
+def _setup(activity):
+ '''Determines text and tube channels for the current Activity. If no tube
+channel present, creates one. Updates text_chan and tubes_chan.
+
+setup(sugar.activity.Activity, telepathy.client.Connection)'''
+ global text_chan, tubes_chan, DBUS_SERVICE
+ log.info( 'Setup for %s', activity )
+ if not DBUS_SERVICE:
+ DBUS_SERVICE = activity.get_bundle_id()
+ if not activity.get_shared():
+ log.error('Failed to share or join activity')
+ raise "Failure"
+
+ if hasattr( activity._shared_activity, 'telepathy_tubes_chan' ):
+ log.debug( '''Improved channel setup API available''' )
+ _getConn( activity )
+ conn = activity._shared_activity.telepathy_conn
+ tubes_chan = activity._shared_activity.telepathy_tubes_chan
+ text_chan = activity._shared_activity.telepathy_text_chan
+ else:
+ log.debug( '''Old-style setup API''' )
+ bus_name, conn_path, channel_paths = activity._shared_activity.get_channels()
+ _getConn( activity )
+
+ # Work out what our room is called and whether we have Tubes already
+ room = None
+ tubes_chan = None
+ text_chan = None
+ for channel_path in channel_paths:
+ log.debug( 'Testing channel path: %s', channel_path)
+ channel = telepathy.client.Channel(bus_name, channel_path)
+ htype, handle = channel.GetHandle()
+ log.debug( ' Handle Type: %s Handle: %s', htype, handle)
+ if htype == telepathy.HANDLE_TYPE_ROOM:
+ log.debug('Found our room: it has handle#%d "%s"',
+ handle, conn.InspectHandles(htype, [handle])[0])
+ room = handle
+ ctype = channel.GetChannelType()
+ if ctype == telepathy.CHANNEL_TYPE_TUBES:
+ log.debug('Found our Tubes channel at %s', channel_path)
+ tubes_chan = channel
+ elif ctype == telepathy.CHANNEL_TYPE_TEXT:
+ log.debug('Found our Text channel at %s', channel_path)
+ text_chan = channel
+
+ if room is None:
+ log.error("Presence service didn't create a room")
+ raise "Failure"
+ if text_chan is None:
+ log.error("Presence service didn't create a text channel")
+ raise "Failure"
+
+ # Make sure we have a Tubes channel - PS doesn't yet provide one
+ if tubes_chan is None:
+ log.debug("Didn't find our Tubes channel, requesting one...")
+ tubes_chan = conn.request_channel(telepathy.CHANNEL_TYPE_TUBES,
+ telepathy.HANDLE_TYPE_ROOM, room, True)
+
+ tubes_chan[telepathy.CHANNEL_TYPE_TUBES].connect_to_signal('NewTube',
+ new_tube_cb)
+
+ log.info( 'Setup for %s complete', activity )
+ return (text_chan, tubes_chan)
+
+def new_tube_cb(id, initiator, type, service, params, state):
+ log.debug("New_tube_cb called: %s %s %s" % (id, initiator, type))
+ if (type == telepathy.TUBE_TYPE_DBUS and service == DBUS_SERVICE):
+ if state == telepathy.TUBE_STATE_LOCAL_PENDING:
+ channel = tubes_chan[telepathy.CHANNEL_TYPE_TUBES]
+ if hasattr( channel, 'AcceptDBusTube' ):
+ channel.AcceptDBusTube( id )
+ else:
+ channel.AcceptTube(id)
+
+ tube_conn = TubeConnection(conn,
+ tubes_chan[telepathy.CHANNEL_TYPE_TUBES],
+ id, group_iface=text_chan[telepathy.CHANNEL_INTERFACE_GROUP])
+
+ global pygametubes, initiating
+ pygametubes.append(PygameTube(tube_conn, initiating, len(pygametubes)))
+
+
+def _list_tubes_reply_cb(tubes):
+ for tube_info in tubes:
+ new_tube_cb(*tube_info)
+
+def _list_tubes_error_cb(e):
+ log.error('ListTubes() failed: %s', e)
+
+def lookup_buddy( dbus_handle, callback, errback=None ):
+ """Do a lookup on the buddy information, callback with the information
+
+ Calls callback( buddy ) with the result of the lookup, or errback( error ) with
+ a dbus description of the error in the lookup process.
+
+ returns None
+ """
+ log.debug('Trying to find owner of handle %s...', dbus_handle)
+ cs_handle = instance().tube.bus_name_to_handle[dbus_handle]
+ log.debug('Trying to find my handle in %s...', cs_handle)
+ group = text_chan[telepathy.CHANNEL_INTERFACE_GROUP]
+ log.debug( 'Calling GetSelfHandle' )
+ if not errback:
+ def errback( error ):
+ log.error( """Failure retrieving handle for buddy lookup: %s""", error )
+ def with_my_csh( my_csh ):
+ log.debug('My handle in that group is %s', my_csh)
+ def _withHandle( handle ):
+ """process the results of the handle values"""
+ # XXX: we're assuming that we have Buddy objects for all contacts -
+ # this might break when the server becomes scalable.
+ pservice = _get_presence_service()
+ name, path = pservice.get_preferred_connection()
+ callback( pservice.get_buddy_by_telepathy_handle(name, path, handle) )
+ if my_csh == cs_handle:
+ conn.GetSelfHandle(reply_handler = _withHandle, error_handler=errback)
+ log.debug('CS handle %s belongs to me, looking up with GetSelfHandle', cs_handle)
+ elif group.GetGroupFlags() & telepathy.CHANNEL_GROUP_FLAG_CHANNEL_SPECIFIC_HANDLES:
+ handle = group.GetHandleOwners([cs_handle])[0]
+ log.debug('CS handle %s belongs to %s', cs_handle, handle)
+ _withHandle( handle )
+ else:
+ handle = cs_handle
+ log.debug('non-CS handle %s belongs to itself', handle)
+ _withHandle( handle )
+ group.GetSelfHandle( reply_handler = with_my_csh, error_handler = errback)
+
+
+
+def get_buddy(dbus_handle):
+ """DEPRECATED: Get a Buddy from a handle
+
+ THIS API WAS NOT THREAD SAFE! It has been removed to avoid
+ extremely hard-to-debug failures in activities. Use lookup_buddy
+ instead!
+
+ Code that read:
+
+ get_buddy( handle )
+ doSomething( handle, buddy )
+ doSomethingElse( buddy )
+
+ Translates to:
+
+ def withBuddy( buddy ):
+ doSomething( handle, buddy )
+ doSomethingElse( buddy )
+ lookup_buddy( handle, callback=withBuddy )
+ """
+ raise RuntimeError(
+ """get_buddy is not thread safe and will crash your activity (hard). Use lookup_buddy."""
+ )
+
+def _get_presence_service( ):
+ """Attempt to retrieve the presence service (check for offline condition)
+
+ The presence service, when offline, has no preferred connection type,
+ so we check that before returning the object...
+ """
+ log.debug( """About to import sugar.presence.presenceservice""" )
+ try:
+ log.debug( 'About to retrieve presence service instance' )
+ pservice = sugar.presence.presenceservice.get_instance()
+ try:
+ log.debug( ' Retrieved presence service instance: %s', pservice )
+ name, path = pservice.get_preferred_connection()
+ log.debug( ' Name = %s Path = %s', name, path )
+ except (TypeError,ValueError), err:
+ log.warn('Working in offline mode, cannot retrieve buddy information for %s: %s', handle, err )
+ raise OfflineError( """Unable to retrieve buddy information, currently offline""" )
+ else:
+ return pservice
+ except Exception, err:
+ log.error( """Failure in _get_presence_service: %s""", get_traceback( err ))
+
+def instance(idx=0):
+ return pygametubes[idx]
+
+
+class PygameTube(ExportedGObject):
+ '''The object whose instance is shared across D-bus
+
+ Call instance() to get the instance of this object for your activity service.
+ Its 'tube' property contains the underlying D-bus Connection.
+ '''
+ def __init__(self, tube, is_initiator, tube_id):
+ super(PygameTube, self).__init__(tube, DBUS_PATH)
+ log.info( 'PygameTube init' )
+ self.tube = tube
+ self.is_initiator = is_initiator
+ self.entered = False
+ self.ordered_bus_names = []
+ PEvent.post(PEvent.Event(CONNECT, id=tube_id))
+
+ if not self.is_initiator:
+ self.tube.add_signal_receiver(self.new_participant_cb, 'NewParticipants', DBUS_IFACE, path=DBUS_PATH)
+ self.tube.watch_participants(self.participant_change_cb)
+ self.tube.add_signal_receiver(self.broadcast_cb, 'Broadcast', DBUS_IFACE, path=DBUS_PATH, sender_keyword='sender')
+
+
+ def participant_change_cb(self, added, removed):
+ log.debug( 'participant_change_cb: %s %s', added, removed )
+ for handle, bus_name in added:
+ dbus_handle = self.tube.participants[handle]
+ self.ordered_bus_names.append(dbus_handle)
+ PEvent.post(PEvent.Event(PARTICIPANT_ADD, handle=dbus_handle))
+
+ for handle in removed:
+ dbus_handle = self.tube.participants[handle]
+ self.ordered_bus_names.remove(dbus_handle)
+ PEvent.post(PEvent.Event(PARTICIPANT_REMOVE, handle=dbus_handle))
+
+ if self.is_initiator:
+ if not self.entered:
+ # Initiator will broadcast a new ordered_bus_names each time
+ # a participant joins.
+ self.ordered_bus_names = [self.tube.get_unique_name()]
+ self.NewParticipants(self.ordered_bus_names)
+
+ self.entered = True
+
+ @signal(dbus_interface=DBUS_IFACE, signature='as')
+ def NewParticipants(self, ordered_bus_names):
+ '''This is the NewParticipants signal, sent when the authoritative list of ordered_bus_names changes.'''
+ log.debug("sending NewParticipants: %s" % ordered_bus_names)
+ pass
+
+ @signal(dbus_interface=DBUS_IFACE, signature='s')
+ def Broadcast(self, content):
+ '''This is the Broadcast signal; it sends a message to all other activity participants.'''
+ pass
+
+ @method(dbus_interface=DBUS_IFACE, in_signature='s', out_signature='', sender_keyword='sender')
+ def Tell(self, content, sender=None):
+ '''This is the targeted-message interface; called when a message is received that was sent directly to me.'''
+ PEvent.post(PEvent.Event(MESSAGE_UNI, handle=sender, content=content))
+
+ def broadcast_cb(self, content, sender=None):
+ '''This is the Broadcast callback, fired when someone sends a Broadcast signal along the bus.'''
+ PEvent.post(PEvent.Event(MESSAGE_MULTI, handle=sender, content=content))
+
+ def new_participant_cb(self, new_bus_names):
+ '''This is the NewParticipants callback, fired when someone joins or leaves.'''
+ log.debug("new participant. new bus names %s, old %s" % (new_bus_names, self.ordered_bus_names))
+ if self.ordered_bus_names != new_bus_names:
+ log.warn("ordered bus names out of sync with server, resyncing")
+ self.ordered_bus_names = new_bus_names
+
+def send_to(handle, content=""):
+ '''Sends the given message to the given buddy identified by handle.'''
+ log.debug( 'send_to: %s %s', handle, content )
+ remote_proxy = dbus_get_object(handle, DBUS_PATH)
+ remote_proxy.Tell(content, reply_handler=dbus_msg, error_handler=dbus_err)
+
+def dbus_msg():
+ log.debug("async reply to send_to")
+def dbus_err(e):
+ log.error("async error: %s" % e)
+
+def broadcast(content=""):
+ '''Sends the given message to all participants.'''
+ log.debug( 'Broadcast: %s', content )
+ instance().Broadcast(content)
+
+def my_handle():
+ '''Returns the handle of this user
+
+ Note, you can get a DBusException from this if you have
+ not yet got a unique ID assigned by the bus. You may need
+ to delay calling until you are sure you are connected.
+ '''
+ log.debug( 'my handle' )
+ return instance().tube.get_unique_name()
+
+def is_initiator():
+ '''Returns the handle of this user.'''
+ log.debug( 'is initiator' )
+ return instance().is_initiator
+
+def get_participants():
+ '''Returns the list of active participants, in order of arrival.
+ List is maintained by the activity creator; if that person leaves it may not stay in sync.'''
+ log.debug( 'get_participants' )
+ try:
+ return instance().ordered_bus_names[:]
+ except IndexError, err:
+ return [] # no participants yet, as we don't yet have a connection
+
+def dbus_get_object(handle, path, warning=True):
+ '''Get a D-bus object from another participant
+
+ Note: this *must* be called *only* from the GTK mainloop, calling
+ it from Pygame will cause crashes! If you are *sure* you only ever
+ want to call methods on this proxy from GTK, you can use
+ warning=False to silence the warning log message.
+ '''
+ if warning:
+ log.warn( 'Use of dbus_get_object is only safe from the GTK mainloop, use dbus_get_object_proxy instead: %s %s', handle, path )
+ return instance().tube.get_object(handle, path)
+
+def get_object(handle, path):
+ '''Get a D-BUS proxy object from another participant for use in Pygame
+
+ This is how you can communicate with other participants using
+ arbitrary D-bus objects without having to manage the participants
+ yourself. You can use the returned proxy's methods from Pygame,
+ with your callbacks occuring in the Pygame thread, rather than
+ in the DBUS/GTK event loop.
+
+ Simply define a D-bus class with an interface and path that you
+ choose; when you want a reference to the corresponding remote
+ object on a participant, call this method.
+
+ returns an olpcgames.dbusproxy.DBUSProxy( ) object wrapping
+ the DBUSProxy object.
+
+ The dbus_get_object_proxy name is deprecated
+ '''
+ log.debug( 'DBUS get_object( %r %r )', handle, path )
+ from olpcgames import dbusproxy
+ return dbusproxy.DBUSProxy(
+ instance().tube.get_object( handle, path),
+ tube=instance().tube,
+ path=path
+ )
+
+dbus_get_object_proxy = get_object
diff --git a/conozco-nicaragua.activity/olpcgames/mesh.pyc b/conozco-nicaragua.activity/olpcgames/mesh.pyc
new file mode 100644
index 0000000..e759126
--- /dev/null
+++ b/conozco-nicaragua.activity/olpcgames/mesh.pyc
Binary files differ
diff --git a/conozco-nicaragua.activity/olpcgames/pangofont.py b/conozco-nicaragua.activity/olpcgames/pangofont.py
new file mode 100755
index 0000000..441dfd1
--- /dev/null
+++ b/conozco-nicaragua.activity/olpcgames/pangofont.py
@@ -0,0 +1,346 @@
+"""Implement Pygame's font interface using Pango for international support
+
+Depends on:
+
+ pygtk (to get the pango context)
+ pycairo (for the pango rendering context)
+ python-pango (obviously)
+ numpy
+ (pygame)
+
+As soon as you import this module you have loaded *all* of the above.
+You can still use pygame.font until you decide to call install(), which
+will replace pygame.font with this module.
+
+Notes:
+
+ * no ability to load TTF files, PangoFont uses the font files registered
+ with GTK/X to render graphics, it cannot load an arbitrary TTF file.
+ Most non-Sugar Pygame games use bundled TTF files, which means
+ that you will likely need at least some changes to your font handling.
+
+ Note, however, that the Pygame Font class is available to load the TTF
+ files, so if you don't want to take advantage of PangoFont for already
+ written code, but want to use it for "system font" operations, you can
+ mix the two.
+
+ * metrics are missing, Pango can provide the information, but the more
+ involved metrics system means that translating to the simplified model
+ in Pygame has as of yet not been accomplished.
+
+ * better support for "exotic" languages and scripts (which is why we use it)
+
+The main problem with SDL_ttf is that it doesn't handle internationalization
+nearly as well as Pango (in fact, pretty much nothing does). However, it is
+fairly fast and it has a rich interface. You should avoid fonts where possible,
+prerender using Pango for internationalizable text, and use Pango or SDL_ttf
+for text that really needs to be rerendered each frame. (Use SDL_ttf if profiling
+demonstrates that performance is poor with Pango.)
+
+Note:
+ Font -- is the original Pygame Font class, which allows you to load
+ fonts from TTF files/filenames
+ PangoFont -- is the Pango-specific rendering engine which allows
+ for the more involved cross-lingual rendering operations.
+"""
+import pango
+import logging
+import pangocairo
+import pygame.rect, pygame.image
+import gtk
+import struct
+from pygame import surface
+from pygame.font import Font
+from olpcgames import _cairoimage
+
+log = logging.getLogger( 'olpcgames.pangofont' )
+##log.setLevel( logging.DEBUG )
+
+# Install myself on top of pygame.font
+def install():
+ """Replace Pygame's font module with this module"""
+ log.info( 'installing' )
+ from olpcgames import pangofont
+ import pygame
+ pygame.font = pangofont
+ import sys
+ sys.modules["pygame.font"] = pangofont
+
+class PangoFont(object):
+ """Base class for a pygame.font.Font-like object drawn by Pango
+
+ Attributes of note:
+
+ fd -- instances Pango FontDescription object
+ WEIGHT_* -- parameters for use with set_weight
+ STYLE_* -- parameters for use with set_style
+
+ """
+ WEIGHT_BOLD = pango.WEIGHT_BOLD
+ WEIGHT_HEAVY = pango.WEIGHT_HEAVY
+ WEIGHT_LIGHT = pango.WEIGHT_LIGHT
+ WEIGHT_NORMAL = pango.WEIGHT_NORMAL
+ WEIGHT_SEMIBOLD = pango.WEIGHT_SEMIBOLD
+ WEIGHT_ULTRABOLD = pango.WEIGHT_ULTRABOLD
+ WEIGHT_ULTRALIGHT = pango.WEIGHT_ULTRALIGHT
+ STYLE_NORMAL = pango.STYLE_NORMAL
+ STYLE_ITALIC = pango.STYLE_ITALIC
+ STYLE_OBLIQUE = pango.STYLE_OBLIQUE
+ def __init__(self, family=None, size=None, bold=False, italic=False, underline=False, fd=None):
+ """If you know what pango.FontDescription (fd) you want, pass it in as
+ 'fd'. Otherwise, specify any number of family, size, bold, or italic,
+ and we will try to match something up for you."""
+
+ # Always set the FontDescription (FIXME - only set it if the user wants
+ # to change something?)
+ if fd is None:
+ fd = pango.FontDescription()
+ if family is not None:
+ fd.set_family(family)
+ if size is not None:
+ log.debug( 'Pre-conversion size: %s', size )
+ size = int(size*1024)
+ log.debug( 'Font size: %s', size, )
+ fd.set_size(size) # XXX magic number, pango's scaling
+ self.fd = fd
+ self.set_bold( bold )
+ self.set_italic( italic )
+ self.set_underline( underline )
+
+ def render(self, text, antialias=True, color=(255,255,255), background=None ):
+ """Render the font onto a new Surface and return it.
+ We ignore 'antialias' and use system settings.
+
+ text -- (unicode) string with the text to render
+ antialias -- attempt to antialias the text or not
+ color -- three or four-tuple of 0-255 values specifying rendering
+ colour for the text
+ background -- three or four-tuple of 0-255 values specifying rendering
+ colour for the background, or None for trasparent background
+
+ returns a pygame image instance
+ """
+ log.info( 'render: %r, antialias = %s, color=%s, background=%s', text, antialias, color, background )
+
+ layout = self._createLayout( text )
+ # determine pixel size
+ (logical, ink) = layout.get_pixel_extents()
+ ink = pygame.rect.Rect(ink)
+
+ # Create a new Cairo ImageSurface
+ csrf,cctx = _cairoimage.newContext( ink.w, ink.h )
+ cctx = pangocairo.CairoContext(cctx)
+
+ # Mangle the colors on little-endian machines. The reason for this
+ # is that Cairo writes native-endian 32-bit ARGB values whereas
+ # Pygame expects endian-independent values in whatever format. So we
+ # tell our users not to expect transparency here (avoiding the A issue)
+ # and we swizzle all the colors around.
+
+ # render onto it
+ if background is not None:
+ background = _cairoimage.mangle_color( background )
+ cctx.set_source_rgba(*background)
+ cctx.paint()
+
+ log.debug( 'incoming color: %s', color )
+ color = _cairoimage.mangle_color( color )
+ log.debug( ' translated color: %s', color )
+
+ cctx.new_path()
+ cctx.layout_path(layout)
+ cctx.set_source_rgba(*color)
+ cctx.fill()
+
+ # Create and return a new Pygame Image derived from the Cairo Surface
+ return _cairoimage.asImage( csrf )
+
+ def set_bold( self, bold=True):
+ """Set our font description's weight to "bold" or "normal"
+
+ bold -- boolean, whether to set the value to "bold" weight or not
+ """
+ if bold:
+ self.set_weight( self.WEIGHT_BOLD )
+ else:
+ self.set_weight( self.WEIGHT_NORMAL )
+ def set_weight( self, weight ):
+ """Explicitly set our pango-style weight value"""
+ self.fd.set_weight( weight )
+ return self.get_weight()
+ def get_weight( self ):
+ """Explicitly get our pango-style weight value"""
+ return self.fd.get_weight()
+ def get_bold( self ):
+ """Return whether our font's weight is bold (or above)"""
+ return self.fd.get_weight() >= pango.WEIGHT_BOLD
+
+ def set_italic( self, italic=True ):
+ """Set our "italic" value (style)"""
+ if italic:
+ self.set_style( self.STYLE_ITALIC )
+ else:
+ self.set_style( self.STYLE_NORMAL )
+ def set_style( self, style ):
+ """Set our font description's pango-style"""
+ self.fd.set_style( style )
+ return self.fd.get_style()
+ def get_style( self ):
+ """Get our font description's pango-style"""
+ return self.fd.get_style()
+ def get_italic( self ):
+ """Return whether we are currently italicised"""
+ return self.fd.get_style() == self.STYLE_ITALIC # what about oblique?
+
+ def set_underline( self, underline=True ):
+ """Set our current underlining properly"""
+ self.underline = underline
+ def get_underline( self ):
+ """Retrieve our current underline setting"""
+ return self.underline
+
+ def _createLayout( self, text ):
+ """Produces a Pango layout describing this text in this font"""
+ # create layout
+ layout = pango.Layout(gtk.gdk.pango_context_get())
+ layout.set_font_description(self.fd)
+ if self.underline:
+ attrs = layout.get_attributes()
+ if not attrs:
+ attrs = pango.AttrList()
+ attrs.insert(pango.AttrUnderline(pango.UNDERLINE_SINGLE, 0, 32767))
+ layout.set_attributes( attrs )
+ layout.set_text(text)
+ return layout
+
+ def size( self, text ):
+ """Determine space required to render given text
+
+ returns tuple of (width,height)
+ """
+ layout = self._createLayout( text )
+ (logical, ink) = layout.get_pixel_extents()
+ ink = pygame.rect.Rect(ink)
+ return (ink.width,ink.height)
+
+## def get_linesize( self ):
+## """Determine inter-line spacing for the font"""
+## font = self.get_context().load_font( self.fd )
+## metrics = font.get_metrics()
+## return pango.PIXELS( metrics.get_ascent() )
+## def get_height( self ):
+## def get_ascent( self ):
+## def get_descent( self ):
+
+
+class SysFont(PangoFont):
+ """Construct a PangoFont from a font description (name), size in pixels,
+ bold, and italic designation. Similar to SysFont from Pygame."""
+ def __init__(self, name, size, bold=False, italic=False):
+ fd = pango.FontDescription(name)
+ fd.set_absolute_size(size*pango.SCALE)
+ if bold:
+ fd.set_weight(pango.WEIGHT_BOLD)
+ if italic:
+ fd.set_style(pango.STYLE_OBLIQUE)
+ super(SysFont, self).__init__(fd=fd)
+
+# originally defined a new class, no reason for that...
+NotImplemented = NotImplementedError
+
+def match_font(name,bold=False,italic=False):
+ """Stub, does not work, use fontByDesc instead"""
+ raise NotImplementedError("PangoFont doesn't support match_font directly, use SysFont or .fontByDesc")
+
+def fontByDesc(desc="",bold=False,italic=False):
+ """Constructs a FontDescription from the given string representation.
+
+The format of the fontByDesc string representation is passed directly
+to the pango.FontDescription constructor and documented at:
+
+ http://www.pygtk.org/docs/pygtk/class-pangofontdescription.html#constructor-pangofontdescription
+
+Bold and italic are provided as a convenience.
+
+The format of the string representation is:
+
+ "[FAMILY-LIST] [STYLE-OPTIONS] [SIZE]"
+
+where FAMILY-LIST is a comma separated list of families optionally terminated by a comma, STYLE_OPTIONS is a whitespace separated list of words where each WORD describes one of style, variant, weight, or stretch, and SIZE is an decimal number (size in points). For example the following are all valid string representations:
+
+ "sans bold 12"
+ "serif,monospace bold italic condensed 16"
+ "normal 10"
+
+The commonly available font families are: Normal, Sans, Serif and Monospace. The available styles are:
+Normal the font is upright.
+Oblique the font is slanted, but in a roman style.
+Italic the font is slanted in an italic style.
+
+The available weights are:
+Ultra-Light the ultralight weight (= 200)
+Light the light weight (=300)
+Normal the default weight (= 400)
+Bold the bold weight (= 700)
+Ultra-Bold the ultra-bold weight (= 800)
+Heavy the heavy weight (= 900)
+
+The available variants are:
+Normal
+Small-Caps
+
+The available stretch styles are:
+Ultra-Condensed the smallest width
+Extra-Condensed
+Condensed
+Semi-Condensed
+Normal the normal width
+Semi-Expanded
+Expanded
+Extra-Expanded
+Ultra-Expanded the widest width
+ """
+ fd = pango.FontDescription(name)
+ if bold:
+ fd.set_weight(pango.WEIGHT_BOLD)
+ if italic:
+ fd.set_style(pango.STYLE_OBLIQUE)
+ return PangoFont(fd=fd)
+
+def get_init():
+ """Return boolean indicating whether we are initialised
+
+ Always returns True
+ """
+ return True
+
+def init():
+ """Initialise the module (null operation)"""
+ pass
+
+def quit():
+ """De-initialise the module (null operation)"""
+ pass
+
+def get_default_font():
+ """Return default-font specification to be passed to e.g. fontByDesc"""
+ return "sans"
+
+def get_fonts():
+ """Return the set of all fonts available (currently just 3 generic types)"""
+ return ["sans","serif","monospace"]
+
+
+def stdcolor(color):
+ """Produce a 4-element 0.0-1.0 color value from input"""
+ def fixlen(color):
+ if len(color) == 3:
+ return tuple(color) + (255,)
+ elif len(color) == 4:
+ return color
+ else:
+ raise TypeError("What sort of color is this: %s" % (color,))
+ return [_fixColorBase(x) for x in fixlen(color)]
+def _fixColorBase( v ):
+ """Return a properly clamped colour in floating-point space"""
+ return max((0,min((v,255.0))))/255.0
diff --git a/conozco-nicaragua.activity/olpcgames/pausescreen.py b/conozco-nicaragua.activity/olpcgames/pausescreen.py
new file mode 100755
index 0000000..113a0ea
--- /dev/null
+++ b/conozco-nicaragua.activity/olpcgames/pausescreen.py
@@ -0,0 +1,116 @@
+"""Display a "paused" version of the currently-displayed screen
+
+This code is largely cribbed from the Pippy activity's display code,
+but we try to be a little more generally usable than they are, as
+we have more involved activities using the code.
+
+We use svgsprite to render a graphic which is stored in the
+olpcgames data directory over a dimmed version of the current
+screen contents.
+
+_LAST_EVENT_TIME -- tracks the last time that we saw an event
+ come across the wire.
+"""
+import logging
+log = logging.getLogger( 'olpcgames.pausescreen' )
+import pygame
+from pygame import sprite
+
+_LAST_EVENT_TIME = 0
+
+def _set_last_event_time( time=None ):
+ """Set time as the last event time
+
+ time -- if None, pygame.time.get_ticks() is used
+
+ returns time set
+ """
+ global _LAST_EVENT_TIME
+ if time is None:
+ time = pygame.time.get_ticks()
+ _LAST_EVENT_TIME = time
+ return time
+
+def last_event_time( ):
+ """Return the duration since last event for pausing operations
+
+ returns time in seconds
+ """
+ global _LAST_EVENT_TIME
+ return (pygame.time.get_ticks() - _LAST_EVENT_TIME)/1000.
+
+
+def get_events( sleep_timeout = 10, pause=None, **args ):
+ """Retrieve the set of pending events or sleep
+
+ sleep_timeout -- dormant period before we invoke pause_screen
+ pause -- callable to produce visual notification of pausing, normally
+ by taking the current screen and modifying it in some way. Defaults
+ to pauseScreen in this module. If you return nothing from this
+ function then no restoration or display-flipping will occur
+ *args -- if present, passed to 'pause' to configuration operation (e.g.
+ to specify a different overlaySVG file)
+
+ returns set of pending events (potentially empty)
+ """
+ if not pause:
+ pause = pauseScreen
+ events = pygame.event.get( )
+ if not events:
+ log.info( 'No events in queue' )
+ old_screen = None
+ if last_event_time() > sleep_timeout:
+ # we've been waiting long enough, go to sleep visually
+ log.warn( 'Pausing activity after %s with function %s', sleep_timeout, pause )
+ old_screen = pause( )
+ if old_screen:
+ pygame.display.flip()
+ # now we wait until there *are* some events (efficiently)
+ # and retrieve any extra events that are waiting...
+ events = [ pygame.event.wait() ] + pygame.event.get()
+ log.warn( 'Activity restarted')
+ if old_screen:
+ restoreScreen( old_screen )
+ if events:
+ _set_last_event_time()
+ return events
+
+def pauseScreen( overlaySVG=None ):
+ """Display a "Paused" screen and suspend
+
+ This default implementation will not do anything to shut down your
+ simulation or other code running in other threads. It will merely block
+ this thread (the pygame thread) until an event shows up in the
+ eventwrap queue.
+
+ Returns a surface to pass to restoreScreen to continue...
+ """
+ from olpcgames import svgsprite
+ if not overlaySVG:
+ from olpcgames.data import sleeping_svg
+ overlaySVG = sleeping_svg.data
+ screen = pygame.display.get_surface()
+ old_screen = screen.copy() # save this for later.
+ pause_sprite = svgsprite.SVGSprite(
+ overlaySVG,
+ )
+ pause_sprite.rect.center = screen.get_rect().center
+ group = sprite.RenderUpdates( )
+ group.add( pause_sprite )
+
+ # dim the screen and display the 'paused' message in the center.
+ BLACK = (0,0,0)
+ WHITE = (255,255,255)
+ dimmed = screen.copy()
+ dimmed.set_alpha(128)
+ screen.fill(BLACK)
+ screen.blit(dimmed, (0,0))
+
+ group.draw( screen )
+ return old_screen
+
+def restoreScreen( old_screen ):
+ """Restore the original screen and return"""
+ screen = pygame.display.get_surface()
+ screen.blit(old_screen, (0,0))
+ return old_screen
diff --git a/conozco-nicaragua.activity/olpcgames/svgsprite.py b/conozco-nicaragua.activity/olpcgames/svgsprite.py
new file mode 100755
index 0000000..ad247dd
--- /dev/null
+++ b/conozco-nicaragua.activity/olpcgames/svgsprite.py
@@ -0,0 +1,84 @@
+"""RSVG/Cairo-based rendering of SVG into Pygame Images"""
+from pygame import sprite, Rect
+from olpcgames import _cairoimage
+
+class SVGSprite( sprite.Sprite ):
+ """Sprite class which renders SVG source-code as a Pygame image
+
+ Note:
+
+ Currently this sprite class is a bit over-engineered, it gets in the way
+ if you want to, e.g. animate among a number of SVG drawings, as it
+ assumes that setSVG will always set a single SVG file for rendering.
+ """
+ rect = image = None
+ resolution = None
+ def __init__(
+ self, svg=None, size=None, *args
+ ):
+ """Initialise the svg sprite
+
+ svg -- svg source text (i.e. content of an svg file)
+ size -- optional, to constrain size, (width,height), leaving one
+ as None or 0 causes proportional scaling, leaving both
+ as None or 0 causes natural scaling (screen resolution)
+ args -- if present, groups to which to automatically add
+ """
+ self.size = size
+ super( SVGSprite, self ).__init__( *args )
+ if svg:
+ self.setSVG( svg )
+ def setSVG( self, svg ):
+ """Set our SVG source"""
+ self.svg = svg
+ # XXX could delay this until actually asked to display...
+ if self.size:
+ width,height = self.size
+ else:
+ width,height = None,None
+ self.image = self._render( width,height ).convert_alpha()
+ rect = self.image.get_rect()
+ if self.rect:
+ rect.move( self.rect ) # should let something higher-level do that...
+ self.rect = rect
+
+ def _render( self, width, height ):
+ """Render our SVG to a Pygame image"""
+ import rsvg
+ handle = rsvg.Handle( data = self.svg )
+ originalSize = (width,height)
+ scale = 1.0
+ hw,hh = handle.get_dimension_data()[:2]
+ if hw and hh:
+ if not width:
+ if not height:
+ width,height = hw,hh
+ else:
+ scale = float(height)/hh
+ width = hh/float(hw) * height
+ elif not height:
+ scale = float(width)/hw
+ height = hw/float(hh) * width
+ else:
+ # scale only, only rendering as large as it is...
+ if width/height > hw/hh:
+ # want it taller than it is...
+ width = hh/float(hw) * height
+ else:
+ height = hw/float(hh) * width
+ scale = float(height)/hh
+
+ csrf, ctx = _cairoimage.newContext( int(width), int(height) )
+ ctx.scale( scale, scale )
+ handle.render_cairo( ctx )
+ return _cairoimage.asImage( csrf )
+ return None
+ def copy( self ):
+ """Create a copy of this sprite without reloading the svg image"""
+ result = self.__class__(
+ size = self.size
+ )
+ result.image = self.image
+ result.rect = Rect(self.rect)
+ result.resolution = self.resolution
+ return result
diff --git a/conozco-nicaragua.activity/olpcgames/textsprite.py b/conozco-nicaragua.activity/olpcgames/textsprite.py
new file mode 100755
index 0000000..7663630
--- /dev/null
+++ b/conozco-nicaragua.activity/olpcgames/textsprite.py
@@ -0,0 +1,40 @@
+"""Simple Sprite sub-class that renders via a PangoFont"""
+from pygame import sprite
+from olpcgames import pangofont
+
+class TextSprite( sprite.Sprite ):
+ """Sprite with a simple text renderer"""
+ image = rect = text = color = background = None
+ def __init__( self, text=None, family=None, size=None, bold=False, italic=False, color=None, background=None ):
+ super( TextSprite, self ).__init__( )
+ self.font = pangofont.PangoFont( family=family, size=size, bold=bold, italic=italic )
+ self.set_color( color )
+ self.set_background( background )
+ self.set_text( text )
+ def set_text( self, text ):
+ """Set our text string and render to a graphic"""
+ self.text = text
+ self.render( )
+ def set_color( self, color =None):
+ """Set our rendering colour (default white)"""
+ self.color = color or (255,255,255)
+ self.render()
+ def set_background( self, color=None ):
+ """Set our background color, default transparent"""
+ self.background = color
+ self.render()
+ def render( self ):
+ """Render our image and rect (or None,None)
+
+ After a render you will need to move the rect member to the
+ correct location on the screen.
+ """
+ if self.text:
+ self.image = self.font.render( self.text, color = self.color, background = self.background )
+ currentRect = self.rect
+ self.rect = self.image.get_rect()
+ if currentRect:
+ self.rect.center = currentRect.center
+ else:
+ self.rect = None
+ self.image = None
diff --git a/conozco-nicaragua.activity/olpcgames/util.py b/conozco-nicaragua.activity/olpcgames/util.py
new file mode 100755
index 0000000..49a23b0
--- /dev/null
+++ b/conozco-nicaragua.activity/olpcgames/util.py
@@ -0,0 +1,79 @@
+"""Abstraction layer for working outside the Sugar environment"""
+import traceback, cStringIO
+import logging
+log = logging.getLogger( 'olpcgames.util' )
+import os
+import os.path
+
+NON_SUGAR_ROOT = '~/.sugar/default/olpcgames'
+
+try:
+ from sugar.activity.activity import get_bundle_path as _get_bundle_path
+ def get_bundle_path( ):
+ """Retrieve bundle path from activity with fix for silly registration bug"""
+ path = _get_bundle_path()
+ if path.endswith( '.activity.activity' ):
+ log.warn( '''Found double .activity suffix in bundle path, truncating: %s''', path )
+ path = path[:-9]
+ return path
+except ImportError:
+ log.warn( '''Do not appear to be running under Sugar, stubbing-in get_bundle_path''' )
+ def get_bundle_path():
+ """Retrieve a substitute data-path for non OLPC systems"""
+ return os.getcwd()
+
+
+def get_activity_root( ):
+ """Return the activity root for data storage operations
+
+ If the activity is present, returns the activity's root,
+ otherwise returns NON_SUGAR_ROOT as the directory.
+ """
+ import olpcgames
+ if olpcgames.ACTIVITY:
+ return olpcgames.ACTIVITY.get_activity_root()
+ else:
+ return os.path.expanduser( NON_SUGAR_ROOT )
+
+def data_path(file_name):
+ """Return the full path to a file in the data sub-directory of the bundle"""
+ return os.path.join(get_bundle_path(), 'data', file_name)
+def tmp_path(file_name):
+ """Return the full path to a file in the temporary directory"""
+ return os.path.join(get_activity_root(), 'tmp', file_name)
+
+def get_traceback(error):
+ """Get formatted traceback from current exception
+
+ error -- Exception instance raised
+
+ Attempts to produce a 10-level traceback as a string
+ that you can log off. Use like so:
+
+ try:
+ doSomething()
+ except Exception, err:
+ log.error(
+ '''Failure during doSomething with X,Y,Z parameters: %s''',
+ util.get_traceback( err ),
+ )
+ """
+ if error is None:
+ error = []
+ for (f,l,func,statement) in traceback.extract_stack()[:-2]:
+ if statement:
+ statement = ': %s'%( statement, )
+ if func:
+ error.append( '%s.%s (%s)%s'%( f,func,l, statement))
+ else:
+ error.append( '%s (%s)%s'%( f,l, statement))
+ return "\n".join( error )
+ else:
+ exception = str(error)
+ file = cStringIO.StringIO()
+ try:
+ traceback.print_exc( limit=10, file = file )
+ exception = file.getvalue()
+ finally:
+ file.close()
+ return exception
diff --git a/conozco-nicaragua.activity/olpcgames/util.pyc b/conozco-nicaragua.activity/olpcgames/util.pyc
new file mode 100644
index 0000000..0c29228
--- /dev/null
+++ b/conozco-nicaragua.activity/olpcgames/util.pyc
Binary files differ
diff --git a/conozco-nicaragua.activity/olpcgames/video.py b/conozco-nicaragua.activity/olpcgames/video.py
new file mode 100755
index 0000000..032aa13
--- /dev/null
+++ b/conozco-nicaragua.activity/olpcgames/video.py
@@ -0,0 +1,178 @@
+"""Video widget for displaying a gstreamer pipe
+
+Note: currently this module is not all that elegant or useful,
+we need a better recipe for using and working with Video
+under OLPCGames.
+"""
+import logging
+log = logging.getLogger( 'olpcgames.video' )
+#log.setLevel( logging.INFO )
+import os
+import signal
+import pygame
+import weakref
+import olpcgames
+from olpcgames import _gtkmain
+
+import pygtk
+pygtk.require('2.0')
+import gtk
+import gst
+
+class VideoWidget(gtk.DrawingArea):
+ """Widget to render GStreamer video over our Pygame Canvas
+
+ The VideoWidget is a simple GTK window which is
+ held by the PygameCanvas, just as is the Pygame
+ window we normally use. As such this approach
+ *cannot* work without the GTK wrapper.
+
+ It *should* be possible to use raw X11 operations
+ to create a child window of the Pygame/SDL window
+ and use that for the same purpose, but that would
+ require some pretty low-level ctypes hacking.
+
+ Attributes of Note:
+
+ rect -- Pygame rectangle which tells us where to
+ display ourselves, setting the rect changes the
+ position and size of the window.
+ """
+ _imagesink = None
+ _renderedRect = None
+ def __init__(self, rect=None, force_aspect_ratio=True):
+ super(VideoWidget, self).__init__()
+ self.unset_flags(gtk.DOUBLE_BUFFERED)
+ if rect is None:
+ rect = pygame.Rect( (0,0), (160,120))
+ self.rect = rect
+ self.force_aspect_ratio = force_aspect_ratio
+ self.set_size_request(rect.width,rect.height)
+ olpcgames.WIDGET.put( self, rect.left,rect.top)
+ self._renderedRect = rect
+ self.show()
+
+ def set_rect( self, rect ):
+ """Set our rectangle (area of the screen)"""
+ log.debug( 'Set rectangle: %s', rect )
+ self.set_size_request(rect.width,rect.height)
+ olpcgames.WIDGET.move( self, rect.left,rect.top)
+ self.rect = rect
+
+ def do_expose_event(self, event):
+ """Handle exposure event (trigger redraw by gst)"""
+ if self._imagesink:
+ self._imagesink.expose()
+ return False
+ else:
+ return True
+
+ def set_sink(self, sink):
+ """Set our window-sink for output"""
+ assert self.window.xid
+ self._imagesink = sink
+ self._imagesink.set_xwindow_id(self.window.xid)
+ self._imagesink.set_property('force-aspect-ratio', self.force_aspect_ratio)
+
+class PygameWidget( object ):
+ """Render "full-screen" video to the entire Pygame screen
+
+ Not particularly useful unless this happens to be exactly what you need.
+ """
+ def __init__( self ):
+ try:
+ window_id = pygame.display.get_wm_info()['window']
+ except KeyError, err: # pygame-ctypes...
+ window_id = int(os.environ['SDL_WINDOWID'])
+ self.window_id = window_id
+ self._imagesink = None
+ #self._holder = _gtkmain.Holder()
+ def set_sink( self, sink ):
+ """Set up our gst sink"""
+ log.info( 'Setting sink: %s', sink )
+ self._imagesink = sink
+ sink.set_xwindow_id( self.window_id )
+
+#pipe_desc = 'v4l2src ! video/x-raw-yuv,width=160,height=120 ! ffmpegcolorspace ! xvimagesink'
+class Player(object):
+ pipe_desc = 'v4l2src ! ffmpegcolorspace ! video/x-raw-yuv ! xvimagesink'
+ test_pipe_desc = 'videotestsrc ! ffmpegcolorspace ! video/x-raw-yuv ! xvimagesink'
+ _synchronized = False
+ def __init__(self, videowidget, pipe_desc=pipe_desc):
+ self._playing = False
+ self._videowidget = videowidget
+
+ self._pipeline = gst.parse_launch(pipe_desc)
+
+ bus = self._pipeline.get_bus()
+ bus.enable_sync_message_emission()
+ bus.add_signal_watch()
+ bus.connect('sync-message::element', self.on_sync_message)
+ bus.connect('message', self.on_message)
+
+ def play(self):
+ log.info( 'Play' )
+ if self._playing == False:
+ self._pipeline.set_state(gst.STATE_PLAYING)
+ self._playing = True
+
+ def pause(self):
+ log.info( 'Pause' )
+ if self._playing == True:
+ if self._synchronized:
+ log.debug( ' pause already sync\'d' )
+ self._pipeline.set_state(gst.STATE_PAUSED)
+ self._playing = False
+ def stop( self ):
+ """Stop all playback"""
+ self._pipeline.set_state( gst.STATE_NULL )
+
+ def on_sync_message(self, bus, message):
+ log.info( 'Sync: %s', message )
+ if message.structure is None:
+ return
+ if message.structure.get_name() == 'prepare-xwindow-id':
+ self._synchronized = True
+ self._videowidget.set_sink(message.src)
+
+ def on_message(self, bus, message):
+ log.info( 'Message: %s', message )
+ t = message.type
+ if t == gst.MESSAGE_ERROR:
+ err, debug = message.parse_error()
+ log.warn("Video error: (%s) %s" ,err, debug)
+ self._playing = False
+
+if __name__ == "__main__":
+ # Simple testing code...
+ logging.basicConfig()
+ log.setLevel( logging.DEBUG )
+ from pygame import image,display, event
+ import pygame
+ def main():
+ display.init()
+ maxX,maxY = display.list_modes()[0]
+ screen = display.set_mode( (maxX/3, maxY/3 ) )
+
+ display.flip()
+
+ pgw = PygameWidget( )
+ p = Player( pgw, pipe_desc=Player.test_pipe_desc )
+ p.play()
+
+ clock = pygame.time.Clock()
+
+ running = True
+ while running:
+ clock.tick( 60 )
+ for evt in [pygame.event.wait()] + pygame.event.get():
+ if evt.type == pygame.KEYDOWN:
+ if p._playing:
+ p.pause()
+ else:
+ p.play()
+ elif evt.type == pygame.QUIT:
+ p.stop()
+ running = False
+ #display.flip()
+ main()
diff --git a/conozco-nicaragua.activity/po/POTFILES.in b/conozco-nicaragua.activity/po/POTFILES.in
new file mode 100755
index 0000000..acc27fc
--- /dev/null
+++ b/conozco-nicaragua.activity/po/POTFILES.in
@@ -0,0 +1,4 @@
+conozcouy.py
+run.py
+activity.py
+setup.py \ No newline at end of file
diff --git a/conozco-nicaragua.activity/recursos/0uruguay/datos/ciudades.txt b/conozco-nicaragua.activity/recursos/0uruguay/datos/ciudades.txt
new file mode 100755
index 0000000..ebac9e3
--- /dev/null
+++ b/conozco-nicaragua.activity/recursos/0uruguay/datos/ciudades.txt
@@ -0,0 +1,91 @@
+#Ciudad|posx|posy|tipo|textoxincremento|textoyincremento
+# tipo 1 = capital deptal, 2 = ciudad, 5 = cerro, 6 = punto de interes
+# capitales
+Artigas|293|65|1|35|-10
+Salto|91|237|1|30|0
+Paysandú|77|396|1|50|0
+Fray Bentos|51|562|1|55|4
+Rivera|446|162|1|30|-10
+Tacuarembó|376|299|1|60|0
+Mercedes|86|582|1|50|0
+Colonia del Sacramento|120|784|1|10|15
+Trinidad|245|619|1|42|0
+San José de Mayo|277|757|1|50|12
+Durazno|309|593|1|0|-12
+Florida|351|715|1|40|0
+Canelones|341|798|1|50|0
+Montevideo|355|847|1|0|18
+Melo|632|400|1|30|0
+Treinta y Tres|605|559|1|62|0
+Minas|499|755|1|35|0
+Rocha|618|774|1|15|-14
+Maldonado|532|853|1|55|0
+# ciudades
+Aiguá|558|726|2|30|0
+Ansina|466|328|2|0|12
+Atlántida|397|830|2|35|10
+Baltasar Brum|183|132|2|0|12
+Bella Unión|144|37|2|0|-10
+Belén|107|180|2|30|10
+Cardona|172|680|2|40|0
+Carmelo|54|709|2|40|0
+Castillos|689|715|2|0|-12
+Casupá|434|706|2|40|0
+Cebollatí|693|567|2|0|12
+Cerro Chato|494|550|2|57|0
+Chuy|739|640|2|15|-15
+Constitución|104|210|2|60|0
+Dolores|45|635|2|36|0
+Fraile Muerto|558|447|2|62|0
+Guichón|181|422|2|30|-10
+J. Batlle y Ordóñez|504|602|2|0|12
+J. Pedro Varela|585|600|2|0|-12
+José E. Rodó|143|650|2|0|12
+Juan Lacaze|154|776|2|53|-2
+La Coronilla|732|666|2|5|10
+La Paloma|633|803|2|30|12
+Las Piedras|348|822|2|0|12
+Lascano|636|638|2|0|12
+Libertad|281|812|2|40|0
+Minas de Corrales|467|280|2|60|12
+Nueva Helvecia|202|746|2|30|-12
+Nueva Palmira|36|690|2|56|-10
+Nuevo Berlín|86|525|2|55|0
+Ombúes de Lavalle|108|692|2|80|0
+Palmitas|112|620|2|40|0
+Pan de Azúcar|494|831|2|65|-5
+Pando|384|822|2|15|-12
+Paso de los Toros|297|490|2|0|-12
+Piriápolis|487|852|2|0|10
+Pueblo del Carmen|396|562|2|83|0
+Punta del Este|534|862|2|5|15
+Quebracho|94|353|2|40|-12
+Rosario|182|756|2|35|5
+Río Branco|753|453|2|-15|12
+San Carlos|537|839|2|55|0
+San Gregorio de Polanco|407|443|2|0|-12
+San Ramón|388|746|2|40|-12
+Santa Clara de Olimar|531|512|2|95|0
+Santa Lucía|326|781|2|45|5
+Sarandí Grande|325|643|2|70|0
+Sarandí del Yi|437|587|2|0|12
+Tala|410|761|2|25|0
+Tarariras|146|754|2|0|-12
+Tomás Gomensoro|172|78|2|20|12
+Tranqueras|404|202|2|50|0
+Vergara|677|499|2|40|0
+Vichadero|573|318|2|35|12
+Young|142|481|2|30|0
+# puntos historicos
+# puntos turisticos
+# cerros
+Cerro de Montevideo|341|849|5|0|15
+Cerro Pan de Azúcar|488|838|5|87|0
+Cerro Verdún|474|752|5|-5|15
+Cerro Arequita|482|729|5|0|-15
+Cerro Catedral|572|752|5|5|15
+Cerro de las Animas|476|820|5|0|-15
+Cerros de Batoví|364|335|5|0|14
+Cerro Bonito|566|304|5|0|14
+Cerro del Medio|444|282|5|0|14
+Cerro Chato|485|546|5|5|-15
diff --git a/conozco-nicaragua.activity/recursos/0uruguay/datos/cuchillas.txt b/conozco-nicaragua.activity/recursos/0uruguay/datos/cuchillas.txt
new file mode 100755
index 0000000..5f74220
--- /dev/null
+++ b/conozco-nicaragua.activity/recursos/0uruguay/datos/cuchillas.txt
@@ -0,0 +1,9 @@
+# Cuchilla|codigo color (rojo)|ubic. texto x|y|rotacion nombre
+# cuchillas
+Cuchilla de Haedo|254|331|247|65
+Cuchilla de Santa Ana|253|507|228|-45
+Cuchilla Grande|252|496|601|65
+Cuchilla Grande del Durazno|251|355|544|0
+Cuchilla Grande Inferior|250|291|660|0
+Cuchilla Negra|249|425|179|45
+# fin
diff --git a/conozco-nicaragua.activity/recursos/0uruguay/datos/departamentos.txt b/conozco-nicaragua.activity/recursos/0uruguay/datos/departamentos.txt
new file mode 100755
index 0000000..8a51bfa
--- /dev/null
+++ b/conozco-nicaragua.activity/recursos/0uruguay/datos/departamentos.txt
@@ -0,0 +1,25 @@
+# Depto|codigo color (rojo)|ubic. texto x|y|rotacion nombre
+# departamentos
+Artigas|236|212|126|0
+Salto|254|202|254|0
+Paysandú|253|156|362|0
+Río Negro|252|130|500|0
+Rivera|251|490|272|0
+Tacuarembó|250|446|380|0
+Soriano|249|128|630|0
+Colonia|248|132|726|0
+Flores|247|246|614|0
+Durazno|246|388|550|0
+Cerro Largo|245|624|436|0
+San José|244|280|742|0
+Florida|243|386|668|0
+Treinta y Tres|242|624|534|0
+Canelones|241|382|786|0
+Montevideo|240|348|838|0
+Lavalleja|239|532|656|0
+Maldonado|238|522|818|0
+Rocha|237|654|678|0
+# paises limitrofes
+República Federativa del Brasil|199|590|175|322
+República Argentina|198|22|350|90
+# fin
diff --git a/conozco-nicaragua.activity/recursos/0uruguay/datos/exploraciones.txt b/conozco-nicaragua.activity/recursos/0uruguay/datos/exploraciones.txt
new file mode 100755
index 0000000..a0ee3d9
--- /dev/null
+++ b/conozco-nicaragua.activity/recursos/0uruguay/datos/exploraciones.txt
@@ -0,0 +1,43 @@
+# Configuración de exploraciones
+# Formato:
+# Cada nivel empieza con su nombre entre parentesis rectos
+# Variables:
+# - dibujoInicial lista de cosas a dibujar en el mapa al inicio del nivel
+# lineasDepto,capitales
+# - nombreInicial lista de cosas a etiquetar en el mapa al inicio del nivel
+# deptos,capitales
+# - elementosActivos lista de cosas que se activan al cliquear
+
+[Exploro departamentos]
+dibujoInicial = lineasDepto
+nombreInicial =
+elementosActivos = deptos
+
+[Exploro capitales]
+dibujoInicial = lineasDepto, capitales
+nombreInicial = deptos
+elementosActivos = capitales
+
+[Exploro ciudades]
+dibujoInicial = lineasDepto, capitales, ciudades
+nombreInicial = deptos
+elementosActivos = capitales, ciudades
+
+[Exploro cursos de agua]
+dibujoInicial = rios
+nombreInicial =
+elementosActivos = rios
+
+[Exploro elevaciones]
+dibujoInicial = cuchillas, cerros
+nombreInicial =
+elementosActivos = cuchillas, cerros
+
+[Exploro rutas]
+dibujoInicial = rutas, capitales
+nombreInicial = capitales
+elementosActivos = rutas
+
+
+
+
diff --git a/conozco-nicaragua.activity/recursos/0uruguay/datos/niveles.txt b/conozco-nicaragua.activity/recursos/0uruguay/datos/niveles.txt
new file mode 100755
index 0000000..a091e9e
--- /dev/null
+++ b/conozco-nicaragua.activity/recursos/0uruguay/datos/niveles.txt
@@ -0,0 +1,254 @@
+# Configuración de niveles
+# Formato:
+# Prefijo indica una posible parte inicial de la pregunta
+# Sufijo indica una posible parte final de la pregunta
+# Cada nivel empieza con su nombre entre parentesis rectos
+# Variables:
+# - dibujoInicial lista de cosas a dibujar en el mapa al inicio del nivel
+# lineasDepto,capitales
+# - nombreInicial lista de cosas a etiquetar en el mapa al inicio del nivel
+# deptos,capitales
+# Cada pregunta es una linea que se inicia con Pregunta =
+# sigue el texto de la pregunta (lineas separadas con \)
+# sigue el tipo de respuesta y el ID de la respuesta correcta
+# finalmente el texto de ayuda si el estudiante se equivoca dos veces
+# tipo de respuesta: 1 depto, 2 ciudad, 3 rio, 4 cuchilla, 5 cerro, 6 ruta
+# ID de respuesta: string con el nombre
+# texto de ayuda: string (lineas separadas con \)
+
+Prefijo = Tenemos que buscar\una pieza de mi nave en
+Prefijo = Hay una pieza\de mi nave en
+Prefijo = Según mi información\tenemos que buscar en
+Prefijo = Tenemos que\ir hasta
+Prefijo = Una pieza de mi\cohete cayó en
+
+Sufijo = ¿Podés señalar dónde es?
+Sufijo = ¿Dónde queda?
+Sufijo = ¿Vamos hasta ahí?
+Sufijo = ¿Me llevás?
+Sufijo = ¿Podés mostrarme dónde es?
+
+Correcto = ¡Muy bien!
+Correcto = ¡Genial!
+Correcto = ¡Lo encontraste!
+Correcto = ¡Sí!
+
+Mal = No, intentá de nuevo
+Mal = Acá no está
+Mal = Parece que no es acá
+Mal = Seguí probando...
+
+Despedida = Ahora puedo volver\a mi planeta.\¡Gracias por tu ayuda!
+Despedida = Mi nave está pronta.\¡Chau y gracias por ayudarme!
+Despedida = ¡Lo hicimos!\Estoy listo para despegar.\¡Hasta la próxima!
+
+[Departamentos]
+dibujoInicial = lineasDepto
+nombreInicial =
+Pregunta = el departamento\de Artigas|1|Artigas|Dále, probá de nuevo
+Pregunta = el departamento\de Salto|1|Salto|Dále, probá de nuevo
+Pregunta = el departamento\de Paysandú|1|Paysandú|Dále, probá de nuevo
+Pregunta = el departamento\de Río Negro|1|Río Negro|Dále, probá de nuevo
+Pregunta = el departamento\de Rivera|1|Rivera|Dále, probá de nuevo
+Pregunta = el departamento\de Tacuarembó|1|Tacuarembó|Dále, probá de nuevo
+Pregunta = el departamento\de Soriano|1|Soriano|Dále, probá de nuevo
+Pregunta = el departamento\de Colonia|1|Colonia|Dále, probá de nuevo
+Pregunta = el departamento\de Florida|1|Florida|Dále, probá de nuevo
+Pregunta = el departamento\de Flores|1|Flores|Dále, probá de nuevo
+Pregunta = el departamento\de San José|1|San José|Dále, probá de nuevo
+Pregunta = el departamento\de Durazno|1|Durazno|Dále, probá de nuevo
+Pregunta = el departamento\de Treinta y Tres|1|Treinta y Tres|Dále, probá de nuevo
+Pregunta = el departamento\de Cerro Largo|1|Cerro Largo|Dále, probá de nuevo
+Pregunta = el departamento\de Rocha|1|Rocha|Dále, probá de nuevo
+Pregunta = el departamento\de Lavalleja|1|Lavalleja|Dále, probá de nuevo
+Pregunta = el departamento\de Maldonado|1|Maldonado|Dále, probá de nuevo
+Pregunta = el departamento\de Canelones|1|Canelones|Dále, probá de nuevo
+Pregunta = el departamento\de Montevideo|1|Montevideo|Dále, probá de nuevo
+
+[Capitales departamentales]
+dibujoInicial = lineasDepto, capitales
+nombreInicial = deptos
+Pregunta = la ciudad\de Artigas|2|Artigas|Dále, probá de nuevo
+Pregunta = la ciudad\de Salto|2|Salto|Dále, probá de nuevo
+Pregunta = la ciudad\de Paysandú|2|Paysandú|Dále, probá de nuevo
+Pregunta = la ciudad\de Fray Bentos|2|Fray Bentos|Dále, probá de nuevo
+Pregunta = la ciudad\de Rivera|2|Rivera|Dále, probá de nuevo
+Pregunta = la ciudad\de Tacuarembó|2|Tacuarembó|Dále, probá de nuevo
+Pregunta = la ciudad\de Mercedes|2|Mercedes|Dále, probá de nuevo
+Pregunta = la ciudad\de Colonia del Sacramento|2|Colonia del Sacramento|Dále, probá de nuevo
+Pregunta = la ciudad\de Florida|2|Florida|Dále, probá de nuevo
+Pregunta = la ciudad\de Trinidad|2|Trinidad|Dále, probá de nuevo
+Pregunta = la ciudad\de San José de Mayo|2|San José de Mayo|Dále, probá de nuevo
+Pregunta = la ciudad\de Durazno|2|Durazno|Dále, probá de nuevo
+Pregunta = la ciudad\de Treinta y Tres|2|Treinta y Tres|Dále, probá de nuevo
+Pregunta = la ciudad\de Melo|2|Melo|Dále, probá de nuevo
+Pregunta = la ciudad\de Rocha|2|Rocha|Dále, probá de nuevo
+Pregunta = la ciudad\de Minas|2|Minas|Dále, probá de nuevo
+Pregunta = la ciudad\de Maldonado|2|Maldonado|Dále, probá de nuevo
+Pregunta = la ciudad\de Canelones|2|Canelones|Dále, probá de nuevo
+Pregunta = la ciudad\de Montevideo|2|Montevideo|Dále, probá de nuevo
+
+[Ciudades]
+dibujoInicial = lineasDepto, capitales, ciudades
+nombreInicial = deptos
+Pregunta = la ciudad\de Aiguá|2|Aiguá|Queda en Maldonado
+Pregunta = la ciudad\de Ansina|2|Ansina|Queda en Tacuarembó
+Pregunta = la ciudad\de Artigas|2|Artigas|Dále, es fácil
+Pregunta = la ciudad\de Atlántida|2|Atlántida|Queda en Canelones
+Pregunta = la ciudad\de Baltasar Brum|2|Baltasar Brum|Queda en Artigas
+Pregunta = la ciudad\de Bella Unión|2|Bella Unión|Queda bien al norte
+Pregunta = la ciudad\de Belén|2|Belén|Queda en Salto
+Pregunta = la ciudad\de Canelones|2|Canelones|Dále, es fácil
+Pregunta = la ciudad\de Cardona|2|Cardona|Queda en Soriano
+Pregunta = la ciudad\de Carmelo|2|Carmelo|Queda en Colonia
+Pregunta = la ciudad\de Castillos|2|Castillos|Queda en Rocha
+Pregunta = la ciudad\de Casupá|2|Casupá|Queda en Florida
+Pregunta = la ciudad\de Cebollatí|2|Cebollatí|Queda en Rocha
+Pregunta = la ciudad\de Cerro Chato|2|Cerro Chato|Queda en Treinta y Tres
+Pregunta = la ciudad\de Chuy|2|Chuy|Queda contra Brasil
+Pregunta = la ciudad\de Colonia del Sacramento|2|Colonia del Sacramento|Probá de nuevo
+Pregunta = la ciudad\de Constitución|2|Constitución|Queda en Salto
+Pregunta = la ciudad\de Dolores|2|Dolores|Queda en Soriano
+Pregunta = la ciudad\de Durazno|2|Durazno|Queda en el centro
+Pregunta = la ciudad\de Florida|2|Florida|Dále, es fácil
+Pregunta = la ciudad\de Fraile Muerto|2|Fraile Muerto|Queda en Cerro Largo
+Pregunta = la ciudad\de Fray Bentos|2|Fray Bentos|Queda en Río Negro
+Pregunta = la ciudad\de Guichón|2|Guichón|Queda en Paysandú
+Pregunta = la ciudad\de J. Batlle y Ordóñez|2|J. Batlle y Ordóñez|Queda en Lavalleja
+Pregunta = la ciudad\de J. Pedro Varela|2|J. Pedro Varela|Queda en Lavalleja
+Pregunta = la ciudad\de José E. Rodó|2|José E. Rodó|Queda en Soriano
+Pregunta = la ciudad\de Juan Lacaze|2|Juan Lacaze|Queda en Colonia
+Pregunta = la ciudad\de La Coronilla|2|La Coronilla|Queda en Rocha
+Pregunta = la ciudad\de La Paloma|2|La Paloma|Queda en Rocha
+Pregunta = la ciudad\de Las Piedras|2|Las Piedras|Queda en Canelones
+Pregunta = la ciudad\de Lascano|2|Lascano|Queda en Rocha
+Pregunta = la ciudad\de Libertad|2|Libertad|Queda en San José
+Pregunta = la ciudad\de Maldonado|2|Maldonado|Dále, es fácil
+Pregunta = la ciudad\de Melo|2|Melo|Es una capital departamental
+Pregunta = la ciudad\de Mercedes|2|Mercedes|Es una capital departamental
+Pregunta = la ciudad\de Minas|2|Minas|Es una capital departamental
+Pregunta = la ciudad\de Minas de Corrales|2|Minas de Corrales|Queda en Rivera
+Pregunta = la ciudad\de Montevideo|2|Montevideo|Dále, es la capital nacional
+Pregunta = la ciudad\de Nueva Helvecia|2|Nueva Helvecia|Queda en Colonia
+Pregunta = la ciudad\de Nueva Palmira|2|Nueva Palmira|Queda en Colonia
+Pregunta = la ciudad\de Nuevo Berlín|2|Nuevo Berlín|Queda en Río Negro
+Pregunta = la ciudad\de Ombúes de Lavalle|2|Ombúes de Lavalle|Queda en Colonia
+Pregunta = la ciudad\de Palmitas|2|Palmitas|Queda en Soriano
+Pregunta = la ciudad\de Pan de Azúcar|2|Pan de Azúcar|Queda en Maldonado
+Pregunta = la ciudad\de Pando|2|Pando|Queda en Canelones
+Pregunta = la ciudad\de Paso de los Toros|2|Paso de los Toros|Queda en Tacuarembó
+Pregunta = la ciudad\de Paysandú|2|Paysandú|Dále, es fácil
+Pregunta = la ciudad\de Piriápolis|2|Piriápolis|Queda en Maldonado
+Pregunta = la ciudad\de Pueblo del Carmen|2|Pueblo del Carmen|Queda en Durazno
+Pregunta = la ciudad\de Punta del Este|2|Punta del Este|Queda en Maldonado
+Pregunta = la ciudad\de Quebracho|2|Quebracho|Queda en Paysandú
+Pregunta = la ciudad\de Rivera|2|Rivera|Queda contra Brasil
+Pregunta = la ciudad\de Rocha|2|Rocha|Es una capital departamental
+Pregunta = la ciudad\de Rosario|2|Rosario|Queda en Colonia
+Pregunta = la ciudad\de Río Branco|2|Río Branco|Queda en Cerro Largo
+Pregunta = la ciudad\de Salto|2|Salto|Dále, es fácil
+Pregunta = la ciudad\de San Carlos|2|San Carlos|Queda en Maldonado
+Pregunta = la ciudad\de San Gregorio de Polanco|2|San Gregorio de Polanco|Queda en Tacuarembó
+Pregunta = la ciudad\de San José de Mayo|2|San José de Mayo|Es una capital departamental
+Pregunta = la ciudad\de San Ramón|2|San Ramón|Queda en Canelones
+Pregunta = la ciudad\de Santa Clara de Olimar|2|Santa Clara de Olimar|Queda en Treinta y Tres
+Pregunta = la ciudad\de Santa Lucía|2|Santa Lucía|Queda en Canelones
+Pregunta = la ciudad\de Sarandí del Yi|2|Sarandí del Yi|Queda en Durazno
+Pregunta = la ciudad\de Sarandí Grande|2|Sarandí Grande|Queda en Florida
+Pregunta = la ciudad\de Tacuarembó|2|Tacuarembó|Dále, es fácil
+Pregunta = la ciudad\de Tala|2|Tala|Queda en Canelones
+Pregunta = la ciudad\de Tarariras|2|Tarariras|Queda en Colonia
+Pregunta = la ciudad\de Tomás Gomensoro|2|Tomás Gomensoro|Queda en Artigas
+Pregunta = la ciudad\de Tranqueras|2|Tranqueras|Queda en Rivera
+Pregunta = la ciudad\de Treinta y Tres|2|Treinta y Tres|Es una capital departamental
+Pregunta = la ciudad\de Trinidad|2|Trinidad|Es una capital departamental
+Pregunta = la ciudad\de Vergara|2|Vergara|Queda en Treinta y Tres
+Pregunta = la ciudad\de Vichadero|2|Vichadero|Queda en Rivera
+Pregunta = la ciudad\de Young|2|Young|Queda en Río Negro
+
+[Cursos de agua]
+dibujoInicial = lineasDepto, capitales, rios
+nombreInicial =
+Pregunta = el Río Arapey Chico|3|Río Arapey Chico|Queda al norte
+Pregunta = el Río Arapey Grande|3|Río Arapey Grande|Desemboca en el Río Uruguay
+Pregunta = el Río Cebollatí|3|Río Cebollatí|Desemboca en la Laguna Merín
+Pregunta = el Río Cuareim|3|Río Cuareim|Queda bien al norte
+Pregunta = el Río Daymán|3|Río Daymán|Desemboca en el Río Uruguay
+Pregunta = el Río Negro|3|Río Negro|Fijáte bien, tiene tres represas
+Pregunta = el Río Olimar Chico|3|Río Olimar Chico|Queda en Treinta y Tres
+Pregunta = el Río Olimar Grande|3|Río Olimar Grande|Queda en Treinta y Tres
+Pregunta = el Río Queguay Chico|3|Río Queguay Chico|Queda en Paysandú
+Pregunta = el Río Queguay|3|Río Queguay|Desemboca en el río Uruguay
+Pregunta = el Río Rosario|3|Río Rosario|Queda en Colonia
+Pregunta = el Río San José|3|Río San José|Queda en San José
+Pregunta = el Río San Juan|3|Río San Juan|Queda en Colonia
+Pregunta = el Río San Salvador|3|Río San Salvador|Queda en Soriano
+Pregunta = el Río Santa Lucía|3|Río Santa Lucía|Pasa por Lavalleja\Canelones y Montevideo
+Pregunta = el Río Sta Lucía Chico|3|Río Sta Lucía Chico|Queda en Canelones
+Pregunta = el Río Tacuarembó|3|Río Tacuarembó|Queda en Tacuarembó
+Pregunta = el Río Tacuarí|3|Río Tacuarí|Desemboca en la laguna Merín
+Pregunta = el Río Uruguay|3|Río Uruguay|Dále, es fácil
+Pregunta = el Río Yaguarón|3|Río Yaguarón|Queda en el límite con Brasil
+Pregunta = el Río Yi|3|Río Yi|Queda en Durazno
+Pregunta = el Río de la Plata|3|Río de la Plata|Dále, es fácil
+Pregunta = el Océano Atlántico|3|Océano Atlántico|Dále, es fácil
+Pregunta = la Laguna Merín|3|Laguna Merín|Queda bien al este
+Pregunta = la Laguna Negra|3|Laguna Negra|Queda en Rocha
+Pregunta = la Laguna de Castillos|3|Laguna de Castillos|Queda en Rocha
+Pregunta = la Laguna de Rocha|3|Laguna de Rocha|Queda en Rocha
+Pregunta = la Laguna del Sauce|3|Laguna del Sauce|Queda en Maldonado
+
+[Elevaciones]
+dibujoInicial = cuchillas, cerros
+nombreInicial =
+Pregunta = la Cuchilla de Haedo|4|Cuchilla de Haedo|Queda al norte
+Pregunta = la Cuchilla Negra|4|Cuchilla Negra|Queda en el límite con Brasil
+Pregunta = la Cuchilla de Santa Ana|4|Cuchilla de Santa Ana|Queda en Rivera
+Pregunta = la Cuchilla Grande|4|Cuchilla Grande|Queda en el sur
+Pregunta = la Cuchilla Grande del Durazno|4|Cuchilla Grande del Durazno|Queda en Durazno
+Pregunta = la Cuchilla Grande Inferior|4|Cuchilla Grande Inferior|Va de Lavalleja a Colonia
+Pregunta = el Cerro de Montevideo|5|Cerro de Montevideo|Queda en Montevideo
+Pregunta = el Cerro Pan de Azúcar|5|Cerro Pan de Azúcar|Queda en Maldonado
+Pregunta = el Cerro Verdún|5|Cerro Verdún|Queda en Lavalleja
+Pregunta = el Cerro Arequita|5|Cerro Arequita|Queda en Lavalleja
+Pregunta = el Cerro Catedral|5|Cerro Catedral|Queda en Maldonado
+Pregunta = el Cerro de las Animas|5|Cerro de las Animas|Queda en Maldonado
+Pregunta = los Cerros de Batoví|5|Cerros de Batoví|Quedan en el norte
+Pregunta = el Cerro Bonito|5|Cerro Bonito|Queda en la Cuchilla de Santa Ana
+Pregunta = el Cerro del Medio|5|Cerro del Medio|Queda en Tacuarembó
+Pregunta = el Cerro Chato|5|Cerro Chato|Queda en Durazno
+
+[Rutas]
+dibujoInicial = rutas, capitales
+nombreInicial = capitales
+Pregunta = el Río Arapey Chico|3|Río Arapey Chico|Queda al norte
+Pregunta = la Ruta 1|6|Ruta 1|Va de Montevideo\a Colonia
+Pregunta = la Ruta 2|6|Ruta 2|Pasa por Mercedes
+Pregunta = la Ruta 3|6|Ruta 3|Va por el litoral
+Pregunta = la Ruta 4|6|Ruta 4|Está en el norte
+Pregunta = la Ruta 5|6|Ruta 5|Va de Montevideo\a Rivera
+Pregunta = la Ruta 6|6|Ruta 6|Va hasta Vichadero
+Pregunta = la Ruta 7|6|Ruta 7|Pasa por Melo
+Pregunta = la Ruta 8|6|Ruta 8|Pasa por Minas
+Pregunta = la Ruta 9|6|Ruta 9|Pasa por Rocha
+Pregunta = la Ruta Interbalnearia|6|Ruta IB|Pasa por Punta del Este
+Pregunta = la Ruta 21|6|Ruta 21|Recorre el litoral\de Colonia
+Pregunta = la Ruta 11|6|Ruta 11|Pasa por San José\y Canelones
+Pregunta = la Ruta 14|6|Ruta 14|Va de Mercedes a\La Coronilla
+Pregunta = la Ruta 26|6|Ruta 26|Pasa por Tacuarembó
+
+[Lugares históricos]
+dibujoInicial = lineasDepto,capitales,ciudades
+nombreInicial =
+Pregunta = la ciudad fundada por los\portugueses en 1680|2|Colonia del Sacramento|Queda en el departamento\de Colonia
+Pregunta = la ciudad natal del\escritor Horacio Quiroga|2|Salto|Queda sobre el\Río Uruguay
+Pregunta = la Piedra Alta, donde\se declaró la independencia|2|Florida|Queda al sur del\Río Negro
+Pregunta = el departamento donde está\la Fortaleza de Santa Teresa|1|Rocha|Queda al este del país
+#Pregunta = la ciudad natal del\compositor Eduardo Fabini|2|Solís de Mataojo|Queda en Maldonado
+Pregunta = la ciudad natal de la\escritora Juana de Ibarborou|2|Melo|Queda en Cerro Largo
+Pregunta = donde está el museo\Carlos Gardel|2|Tacuarembó|Queda al norte del Río Negro
+Pregunta = el departamento donde se\hallaron los "cerritos\de indios"|1|Treinta y Tres|Queda al este del país
+Pregunta = el departamento donde el\Gral. Artigas estableció las\bases de su nuevo gobierno|1|Paysandú|Queda sobre el Río Uruguay
+Pregunta = donde se produjo el primer\triunfo importante de las\fuerzas artiguistas en 1811|2|Las Piedras|Queda en Canelones
+Pregunta = el departamento donde se\produjo el desembarco de\los 33 Orientales|1|Soriano|Queda sobre el Río Uruguay
+
diff --git a/conozco-nicaragua.activity/recursos/0uruguay/datos/rios.txt b/conozco-nicaragua.activity/recursos/0uruguay/datos/rios.txt
new file mode 100755
index 0000000..3c1bb38
--- /dev/null
+++ b/conozco-nicaragua.activity/recursos/0uruguay/datos/rios.txt
@@ -0,0 +1,32 @@
+# Rio o curso de agua|codigo color (rojo)|ubic. texto x|y|rotacion nombre
+# rios
+Río Arapey Chico|252|232|176|0
+Río Arapey Grande|253|254|199|15
+Río Cebollatí|236|624|601|45
+Río Cuareim|254|316|52|-45
+Río Daymán|251|191|295|-20
+Río Negro|245|288|524|20
+Río Olimar Chico|227|538|589|10
+Río Olimar Grande|228|604|554|-6
+Río Queguay Chico|249|208|365|10
+Río Queguay|250|106|382|0
+Río Rosario|242|176|735|90
+Río San José|230|280|725|-65
+Río San Juan|243|125|742|25
+Río San Salvador|244|95|652|-30
+Río Santa Lucía|240|380|733|15
+Río Sta Lucía Chico|229|357|710|40
+Río Tacuarembó|239|476|332|-90
+Río Tacuarí|237|718|472|0
+Río Uruguay|248|44|436|90
+Río Yaguarón|238|742|417|-50
+Río Yi|241|340|614|-15
+Río de la Plata|247|202|849|-15
+# otros
+Océano Atlántico|246|696|816|45
+Laguna Merín|235|744|533|50
+Laguna Negra|234|711|687|0
+Laguna de Castillos|233|676|732|0
+Laguna de Rocha|232|619|798|0
+Laguna del Sauce|231|506|836|0
+# fin
diff --git a/conozco-nicaragua.activity/recursos/0uruguay/datos/rutas.txt b/conozco-nicaragua.activity/recursos/0uruguay/datos/rutas.txt
new file mode 100755
index 0000000..d392762
--- /dev/null
+++ b/conozco-nicaragua.activity/recursos/0uruguay/datos/rutas.txt
@@ -0,0 +1,16 @@
+# Ruta|codigo color (rojo)|ubic. texto x|y|rotacion nombre
+Ruta 1|250|305|810|-25
+Ruta 2|249|151|646|-40
+Ruta 3|248|182|500|-45
+Ruta 4|247|214|193|60
+Ruta 5|246|307|430|60
+Ruta 6|245|440|528|75
+Ruta 7|244|475|652|60
+Ruta 8|243|563|695|80
+Ruta 9|242|573|807|40
+Ruta IB|241|442|844|0
+Ruta 21|240|86|708|-35
+Ruta 11|239|242|746|15
+Ruta 14|238|370|554|0
+Ruta 26|237|294|312|10
+# fin
diff --git a/conozco-nicaragua.activity/recursos/0uruguay/imagenes/LICENSE b/conozco-nicaragua.activity/recursos/0uruguay/imagenes/LICENSE
new file mode 100644
index 0000000..2479f35
--- /dev/null
+++ b/conozco-nicaragua.activity/recursos/0uruguay/imagenes/LICENSE
@@ -0,0 +1,9 @@
+
+Las imágenes en este directorio están licenciadas bajo una Licencia
+Atribución-No Comercial-Compartir Obras Derivadas Igual 3.0 Unported
+de Creative Commons. Para ver una copia de esta licencia, visite
+http://creativecommons.org/licenses/by-nc-sa/3.0/ o envíenos una carta
+a Creative Commons, 171 Second Street, Suite 300, San Francisco,
+California, 94105, USA.
+
+Todas las imágenes en este directorio fueron creadas por Gabriel Eirea.
diff --git a/conozco-nicaragua.activity/recursos/0uruguay/imagenes/cuchillas.png b/conozco-nicaragua.activity/recursos/0uruguay/imagenes/cuchillas.png
new file mode 100755
index 0000000..356ce43
--- /dev/null
+++ b/conozco-nicaragua.activity/recursos/0uruguay/imagenes/cuchillas.png
Binary files differ
diff --git a/conozco-nicaragua.activity/recursos/0uruguay/imagenes/cuchillasDetectar.png b/conozco-nicaragua.activity/recursos/0uruguay/imagenes/cuchillasDetectar.png
new file mode 100755
index 0000000..a43eadf
--- /dev/null
+++ b/conozco-nicaragua.activity/recursos/0uruguay/imagenes/cuchillasDetectar.png
Binary files differ
diff --git a/conozco-nicaragua.activity/recursos/0uruguay/imagenes/deptos.png b/conozco-nicaragua.activity/recursos/0uruguay/imagenes/deptos.png
new file mode 100755
index 0000000..d894f22
--- /dev/null
+++ b/conozco-nicaragua.activity/recursos/0uruguay/imagenes/deptos.png
Binary files differ
diff --git a/conozco-nicaragua.activity/recursos/0uruguay/imagenes/deptosLineas.png b/conozco-nicaragua.activity/recursos/0uruguay/imagenes/deptosLineas.png
new file mode 100755
index 0000000..bcca5a4
--- /dev/null
+++ b/conozco-nicaragua.activity/recursos/0uruguay/imagenes/deptosLineas.png
Binary files differ
diff --git a/conozco-nicaragua.activity/recursos/0uruguay/imagenes/fondo.png b/conozco-nicaragua.activity/recursos/0uruguay/imagenes/fondo.png
new file mode 100755
index 0000000..81f9e9e
--- /dev/null
+++ b/conozco-nicaragua.activity/recursos/0uruguay/imagenes/fondo.png
Binary files differ
diff --git a/conozco-nicaragua.activity/recursos/0uruguay/imagenes/rios.png b/conozco-nicaragua.activity/recursos/0uruguay/imagenes/rios.png
new file mode 100755
index 0000000..ade578e
--- /dev/null
+++ b/conozco-nicaragua.activity/recursos/0uruguay/imagenes/rios.png
Binary files differ
diff --git a/conozco-nicaragua.activity/recursos/0uruguay/imagenes/riosDetectar.png b/conozco-nicaragua.activity/recursos/0uruguay/imagenes/riosDetectar.png
new file mode 100755
index 0000000..eb69b2b
--- /dev/null
+++ b/conozco-nicaragua.activity/recursos/0uruguay/imagenes/riosDetectar.png
Binary files differ
diff --git a/conozco-nicaragua.activity/recursos/0uruguay/imagenes/rutas.png b/conozco-nicaragua.activity/recursos/0uruguay/imagenes/rutas.png
new file mode 100755
index 0000000..3ba19e7
--- /dev/null
+++ b/conozco-nicaragua.activity/recursos/0uruguay/imagenes/rutas.png
Binary files differ
diff --git a/conozco-nicaragua.activity/recursos/0uruguay/imagenes/rutasDetectar.png b/conozco-nicaragua.activity/recursos/0uruguay/imagenes/rutasDetectar.png
new file mode 100755
index 0000000..ea62cff
--- /dev/null
+++ b/conozco-nicaragua.activity/recursos/0uruguay/imagenes/rutasDetectar.png
Binary files differ
diff --git a/conozco-nicaragua.activity/recursos/0uruguay/nombre.txt b/conozco-nicaragua.activity/recursos/0uruguay/nombre.txt
new file mode 100644
index 0000000..543f202
--- /dev/null
+++ b/conozco-nicaragua.activity/recursos/0uruguay/nombre.txt
@@ -0,0 +1 @@
+Nicaragua
diff --git a/conozco-nicaragua.activity/recursos/comun/datos/creditos.txt b/conozco-nicaragua.activity/recursos/comun/datos/creditos.txt
new file mode 100755
index 0000000..b9dc5f4
--- /dev/null
+++ b/conozco-nicaragua.activity/recursos/comun/datos/creditos.txt
@@ -0,0 +1,12 @@
+Autor: Gabriel Eirea Ayudante: Fabio Eirea
+Por favor enviar comentarios y sugerencias a geirea@gmail.com
+
+Este programa es software libre y desarrollado por la comunidad
+Por más información visitá http://ceibaljam.org
+
+Gráficos y niveles para todos los departamentos menos Canelones: Alan Aguiar
+Información para el nivel "Lugares históricos" de Uruguay: Ana Trujillo y Ana Cichero (coordinación)
+Información para Canelones: Nancy Gómez, su hijo Matías y Ana Cichero (coordinación)
+Información para el nivel "Información de Montevideo": Miriam Martínez y Magdalena Lallo
+Sonidos bajados de freesound.org: btn045.wav por junggle y boom1.wav por de NoiseCollector
+Fuentes bajadas de urbanfonts.com: AllCaps.ttf por BobFrantic y Share-Regular.ttf por anónimo
diff --git a/conozco-nicaragua.activity/recursos/comun/datos/presentacion.txt b/conozco-nicaragua.activity/recursos/comun/datos/presentacion.txt
new file mode 100644
index 0000000..70518a3
--- /dev/null
+++ b/conozco-nicaragua.activity/recursos/comun/datos/presentacion.txt
@@ -0,0 +1,4 @@
+¡Qué hermoso planeta!\Voy a explorar aquella penillanura\contra el océano
+¡Oh, no!\La nave tiene problemas\¡Me voy a estrellar!
+¡Por suerte me salvé!\Ahora tengo que reconstruir\mi nave, pero no conozco\este lugar. ¡Necesito ayuda!
+
diff --git a/conozco-nicaragua.activity/recursos/comun/fuentes/AllCaps.ttf b/conozco-nicaragua.activity/recursos/comun/fuentes/AllCaps.ttf
new file mode 100644
index 0000000..f73338f
--- /dev/null
+++ b/conozco-nicaragua.activity/recursos/comun/fuentes/AllCaps.ttf
Binary files differ
diff --git a/conozco-nicaragua.activity/recursos/comun/fuentes/Share-Regular.ttf b/conozco-nicaragua.activity/recursos/comun/fuentes/Share-Regular.ttf
new file mode 100644
index 0000000..dc9378f
--- /dev/null
+++ b/conozco-nicaragua.activity/recursos/comun/fuentes/Share-Regular.ttf
Binary files differ
diff --git a/conozco-nicaragua.activity/recursos/comun/imagenes/LICENSE b/conozco-nicaragua.activity/recursos/comun/imagenes/LICENSE
new file mode 100644
index 0000000..2c92af3
--- /dev/null
+++ b/conozco-nicaragua.activity/recursos/comun/imagenes/LICENSE
@@ -0,0 +1,10 @@
+
+Las imágenes en este directorio están licenciadas bajo una Licencia
+Atribución-No Comercial-Compartir Obras Derivadas Igual 3.0 Unported
+de Creative Commons. Para ver una copia de esta licencia, visite
+http://creativecommons.org/licenses/by-nc-sa/3.0/ o envíenos una carta
+a Creative Commons, 171 Second Street, Suite 300, San Francisco,
+California, 94105, USA.
+
+Todas las imágenes fueron creadas por Gabriel Eirea, menos terron.png
+que fue creada por Alejandro Rodríguez Juele.
diff --git a/conozco-nicaragua.activity/recursos/comun/imagenes/alerta.png b/conozco-nicaragua.activity/recursos/comun/imagenes/alerta.png
new file mode 100644
index 0000000..62a0990
--- /dev/null
+++ b/conozco-nicaragua.activity/recursos/comun/imagenes/alerta.png
Binary files differ
diff --git a/conozco-nicaragua.activity/recursos/comun/imagenes/alertarojo.png b/conozco-nicaragua.activity/recursos/comun/imagenes/alertarojo.png
new file mode 100644
index 0000000..18baf9b
--- /dev/null
+++ b/conozco-nicaragua.activity/recursos/comun/imagenes/alertarojo.png
Binary files differ
diff --git a/conozco-nicaragua.activity/recursos/comun/imagenes/bicho.png b/conozco-nicaragua.activity/recursos/comun/imagenes/bicho.png
new file mode 100755
index 0000000..7dbee09
--- /dev/null
+++ b/conozco-nicaragua.activity/recursos/comun/imagenes/bicho.png
Binary files differ
diff --git a/conozco-nicaragua.activity/recursos/comun/imagenes/bichofrente.png b/conozco-nicaragua.activity/recursos/comun/imagenes/bichofrente.png
new file mode 100644
index 0000000..327cabd
--- /dev/null
+++ b/conozco-nicaragua.activity/recursos/comun/imagenes/bichofrente.png
Binary files differ
diff --git a/conozco-nicaragua.activity/recursos/comun/imagenes/bichopestanas.png b/conozco-nicaragua.activity/recursos/comun/imagenes/bichopestanas.png
new file mode 100644
index 0000000..68c25de
--- /dev/null
+++ b/conozco-nicaragua.activity/recursos/comun/imagenes/bichopestanas.png
Binary files differ
diff --git a/conozco-nicaragua.activity/recursos/comun/imagenes/bichotriste.png b/conozco-nicaragua.activity/recursos/comun/imagenes/bichotriste.png
new file mode 100644
index 0000000..d2f3c28
--- /dev/null
+++ b/conozco-nicaragua.activity/recursos/comun/imagenes/bichotriste.png
Binary files differ
diff --git a/conozco-nicaragua.activity/recursos/comun/imagenes/capital.png b/conozco-nicaragua.activity/recursos/comun/imagenes/capital.png
new file mode 100755
index 0000000..09ddbe7
--- /dev/null
+++ b/conozco-nicaragua.activity/recursos/comun/imagenes/capital.png
Binary files differ
diff --git a/conozco-nicaragua.activity/recursos/comun/imagenes/cerro.png b/conozco-nicaragua.activity/recursos/comun/imagenes/cerro.png
new file mode 100755
index 0000000..115148a
--- /dev/null
+++ b/conozco-nicaragua.activity/recursos/comun/imagenes/cerro.png
Binary files differ
diff --git a/conozco-nicaragua.activity/recursos/comun/imagenes/ciudad.png b/conozco-nicaragua.activity/recursos/comun/imagenes/ciudad.png
new file mode 100755
index 0000000..d267821
--- /dev/null
+++ b/conozco-nicaragua.activity/recursos/comun/imagenes/ciudad.png
Binary files differ
diff --git a/conozco-nicaragua.activity/recursos/comun/imagenes/fuego1.png b/conozco-nicaragua.activity/recursos/comun/imagenes/fuego1.png
new file mode 100755
index 0000000..29f7431
--- /dev/null
+++ b/conozco-nicaragua.activity/recursos/comun/imagenes/fuego1.png
Binary files differ
diff --git a/conozco-nicaragua.activity/recursos/comun/imagenes/fuego2.png b/conozco-nicaragua.activity/recursos/comun/imagenes/fuego2.png
new file mode 100755
index 0000000..98d87d0
--- /dev/null
+++ b/conozco-nicaragua.activity/recursos/comun/imagenes/fuego2.png
Binary files differ
diff --git a/conozco-nicaragua.activity/recursos/comun/imagenes/globito.png b/conozco-nicaragua.activity/recursos/comun/imagenes/globito.png
new file mode 100755
index 0000000..23eec7c
--- /dev/null
+++ b/conozco-nicaragua.activity/recursos/comun/imagenes/globito.png
Binary files differ
diff --git a/conozco-nicaragua.activity/recursos/comun/imagenes/localidad.png b/conozco-nicaragua.activity/recursos/comun/imagenes/localidad.png
new file mode 100755
index 0000000..4db3df1
--- /dev/null
+++ b/conozco-nicaragua.activity/recursos/comun/imagenes/localidad.png
Binary files differ
diff --git a/conozco-nicaragua.activity/recursos/comun/imagenes/nave1.png b/conozco-nicaragua.activity/recursos/comun/imagenes/nave1.png
new file mode 100755
index 0000000..3d16b27
--- /dev/null
+++ b/conozco-nicaragua.activity/recursos/comun/imagenes/nave1.png
Binary files differ
diff --git a/conozco-nicaragua.activity/recursos/comun/imagenes/nave2.png b/conozco-nicaragua.activity/recursos/comun/imagenes/nave2.png
new file mode 100755
index 0000000..f6bbcd3
--- /dev/null
+++ b/conozco-nicaragua.activity/recursos/comun/imagenes/nave2.png
Binary files differ
diff --git a/conozco-nicaragua.activity/recursos/comun/imagenes/nave3.png b/conozco-nicaragua.activity/recursos/comun/imagenes/nave3.png
new file mode 100755
index 0000000..bb9ba7f
--- /dev/null
+++ b/conozco-nicaragua.activity/recursos/comun/imagenes/nave3.png
Binary files differ
diff --git a/conozco-nicaragua.activity/recursos/comun/imagenes/nave4.png b/conozco-nicaragua.activity/recursos/comun/imagenes/nave4.png
new file mode 100755
index 0000000..5280b25
--- /dev/null
+++ b/conozco-nicaragua.activity/recursos/comun/imagenes/nave4.png
Binary files differ
diff --git a/conozco-nicaragua.activity/recursos/comun/imagenes/nave5.png b/conozco-nicaragua.activity/recursos/comun/imagenes/nave5.png
new file mode 100755
index 0000000..6156be1
--- /dev/null
+++ b/conozco-nicaragua.activity/recursos/comun/imagenes/nave5.png
Binary files differ
diff --git a/conozco-nicaragua.activity/recursos/comun/imagenes/nave6.png b/conozco-nicaragua.activity/recursos/comun/imagenes/nave6.png
new file mode 100755
index 0000000..b973a4b
--- /dev/null
+++ b/conozco-nicaragua.activity/recursos/comun/imagenes/nave6.png
Binary files differ
diff --git a/conozco-nicaragua.activity/recursos/comun/imagenes/nave7.png b/conozco-nicaragua.activity/recursos/comun/imagenes/nave7.png
new file mode 100755
index 0000000..12630bb
--- /dev/null
+++ b/conozco-nicaragua.activity/recursos/comun/imagenes/nave7.png
Binary files differ
diff --git a/conozco-nicaragua.activity/recursos/comun/imagenes/navellegando.png b/conozco-nicaragua.activity/recursos/comun/imagenes/navellegando.png
new file mode 100644
index 0000000..d43a81b
--- /dev/null
+++ b/conozco-nicaragua.activity/recursos/comun/imagenes/navellegando.png
Binary files differ
diff --git a/conozco-nicaragua.activity/recursos/comun/imagenes/paracaidas.png b/conozco-nicaragua.activity/recursos/comun/imagenes/paracaidas.png
new file mode 100644
index 0000000..f49835b
--- /dev/null
+++ b/conozco-nicaragua.activity/recursos/comun/imagenes/paracaidas.png
Binary files differ
diff --git a/conozco-nicaragua.activity/recursos/comun/imagenes/pedazo1.png b/conozco-nicaragua.activity/recursos/comun/imagenes/pedazo1.png
new file mode 100644
index 0000000..aa60110
--- /dev/null
+++ b/conozco-nicaragua.activity/recursos/comun/imagenes/pedazo1.png
Binary files differ
diff --git a/conozco-nicaragua.activity/recursos/comun/imagenes/pedazo2.png b/conozco-nicaragua.activity/recursos/comun/imagenes/pedazo2.png
new file mode 100644
index 0000000..ce9c809
--- /dev/null
+++ b/conozco-nicaragua.activity/recursos/comun/imagenes/pedazo2.png
Binary files differ
diff --git a/conozco-nicaragua.activity/recursos/comun/imagenes/terron.png b/conozco-nicaragua.activity/recursos/comun/imagenes/terron.png
new file mode 100644
index 0000000..375a8aa
--- /dev/null
+++ b/conozco-nicaragua.activity/recursos/comun/imagenes/terron.png
Binary files differ
diff --git a/conozco-nicaragua.activity/recursos/comun/imagenes/tierra.png b/conozco-nicaragua.activity/recursos/comun/imagenes/tierra.png
new file mode 100644
index 0000000..342920e
--- /dev/null
+++ b/conozco-nicaragua.activity/recursos/comun/imagenes/tierra.png
Binary files differ
diff --git a/conozco-nicaragua.activity/recursos/comun/sonidos/NoiseCollector_boom2.ogg b/conozco-nicaragua.activity/recursos/comun/sonidos/NoiseCollector_boom2.ogg
new file mode 100644
index 0000000..4d858e1
--- /dev/null
+++ b/conozco-nicaragua.activity/recursos/comun/sonidos/NoiseCollector_boom2.ogg
Binary files differ
diff --git a/conozco-nicaragua.activity/recursos/comun/sonidos/chirp_alerta.ogg b/conozco-nicaragua.activity/recursos/comun/sonidos/chirp_alerta.ogg
new file mode 100644
index 0000000..f7f9b44
--- /dev/null
+++ b/conozco-nicaragua.activity/recursos/comun/sonidos/chirp_alerta.ogg
Binary files differ
diff --git a/conozco-nicaragua.activity/recursos/comun/sonidos/junggle_btn045.wav b/conozco-nicaragua.activity/recursos/comun/sonidos/junggle_btn045.wav
new file mode 100755
index 0000000..8d5d7fd
--- /dev/null
+++ b/conozco-nicaragua.activity/recursos/comun/sonidos/junggle_btn045.wav
Binary files differ
diff --git a/conozco-nicaragua.activity/run.py b/conozco-nicaragua.activity/run.py
new file mode 100755
index 0000000..aeb5b36
--- /dev/null
+++ b/conozco-nicaragua.activity/run.py
@@ -0,0 +1,41 @@
+#! /usr/bin/env python
+"""Skeleton project file mainloop for new OLPCGames users"""
+import olpcgames, pygame, logging
+from olpcgames import pausescreen
+
+log = logging.getLogger( 'conozco-uruguay run' )
+log.setLevel( logging.DEBUG )
+
+def main():
+ """The mainloop which is specified in the activity.py file
+
+ "main" is the assumed function name
+ """
+ size = (800,600)
+ if olpcgames.ACTIVITY:
+ size = olpcgames.ACTIVITY.game_size
+ screen = pygame.display.set_mode(size)
+
+ clock = pygame.time.Clock()
+
+ running = True
+ while running:
+ screen.fill( (0,0,128))
+ milliseconds = clock.tick(25) # maximum number of frames per second
+
+ # Event-management loop with support for pausing after X seconds (20 here)
+ events = pausescreen.get_events()
+ # Now the main event-processing loop
+ if events:
+ for event in events:
+ log.debug( "Event: %s", event )
+ if event.type == pygame.QUIT:
+ running = False
+ elif event.type == pygame.KEYDOWN:
+ if event.key == pygame.K_ESCAPE:
+ running = False
+ pygame.display.flip()
+
+if __name__ == "__main__":
+ logging.basicConfig()
+ main()
diff --git a/conozco-nicaragua.activity/setup.py b/conozco-nicaragua.activity/setup.py
new file mode 100755
index 0000000..d357efe
--- /dev/null
+++ b/conozco-nicaragua.activity/setup.py
@@ -0,0 +1,4 @@
+#!/usr/bin/env python
+from sugar.activity import bundlebuilder
+if __name__ == "__main__":
+ bundlebuilder.start("conozco-uruguay")