Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGonzalo Odiard <gonzalo@nautilus.localdomain>2009-10-22 03:48:01 (GMT)
committer Gonzalo Odiard <gonzalo@nautilus.localdomain>2009-10-22 03:48:01 (GMT)
commit29f122c98491893482a32f6d1f19e9f64a022f61 (patch)
treeb197575c55a1d0fcd494598507e442980d597ee4
agrego los archivos iniciales
-rw-r--r--Animals.py348
-rw-r--r--Green.py96
-rw-r--r--MANIFEST41
-rw-r--r--World.py54
-rw-r--r--activity/activity-ecomundo3.svg37
-rw-r--r--activity/activity.info9
-rw-r--r--ecomundoactivity.py250
-rw-r--r--images/fox.pngbin0 -> 1075 bytes
-rw-r--r--images/fox_f.pngbin0 -> 1368 bytes
-rw-r--r--images/fox_m.pngbin0 -> 1520 bytes
-rw-r--r--images/fox_small.pngbin0 -> 1022 bytes
-rw-r--r--images/fox_small_f.pngbin0 -> 1321 bytes
-rw-r--r--images/fox_small_m.pngbin0 -> 1455 bytes
-rw-r--r--images/green1.pngbin0 -> 471 bytes
-rw-r--r--images/green1.svg71
-rw-r--r--images/green2.pngbin0 -> 802 bytes
-rw-r--r--images/green2.svg79
-rw-r--r--images/green3.pngbin0 -> 1316 bytes
-rw-r--r--images/green3.svg95
-rw-r--r--images/green4.pngbin0 -> 1867 bytes
-rw-r--r--images/green4.svg123
-rw-r--r--images/rabbit.pngbin0 -> 1148 bytes
-rw-r--r--images/rabbit_f.pngbin0 -> 1541 bytes
-rw-r--r--images/rabbit_m.pngbin0 -> 1533 bytes
-rw-r--r--images/rabbit_small.pngbin0 -> 1012 bytes
-rw-r--r--images/rabbit_small_f.pngbin0 -> 1381 bytes
-rw-r--r--images/rabbit_small_m.pngbin0 -> 1399 bytes
-rw-r--r--locale/es/LC_MESSAGES/org.laptop.sample.Ecomundo.mobin0 -> 609 bytes
-rw-r--r--locale/es/activity.linfo2
-rw-r--r--po/Ecomundo.pot38
-rw-r--r--po/POTFILES.in7
-rw-r--r--po/es.mobin0 -> 537 bytes
-rw-r--r--po/es.po38
-rwxr-xr-xsetup.py5
34 files changed, 1293 insertions, 0 deletions
diff --git a/Animals.py b/Animals.py
new file mode 100644
index 0000000..9b3943e
--- /dev/null
+++ b/Animals.py
@@ -0,0 +1,348 @@
+### By Gonzalo Odiard, 2006 godiard at gmail.com
+### GPL License - http://www.gnu.org/copyleft/gpl.html
+
+import gobject, gtk , cairo,os
+import random
+import World
+
+print "Init aimals"
+
+def getRandomDirection():
+ return 1+int(random.random()*7)
+
+# Deltas
+# 1 2 3
+# 8 X 4
+# 7 6 5
+
+def getNextDirection(direction):
+ if (direction == 8):
+ return 1
+ else:
+ return direction + 1
+
+def getDeltaX(direction):
+ #print "getDeltaX",direction
+ if (direction == 1) or (direction == 8) or (direction == 7):
+ return -1
+ if (direction == 2) or (direction == 6):
+ return 0
+ if (direction == 3) or (direction == 4) or (direction == 5):
+ return 1
+ return 0
+def getDeltaY(direction):
+ #print "getDeltaY",direction
+ if (direction == 1) or (direction == 2) or (direction == 3):
+ return -1
+ if (direction == 8) or (direction == 4):
+ return 0
+ if (direction == 7) or (direction == 6) or (direction == 5):
+ return 1
+ return 0
+
+
+def getState(world,x,y):
+ # verify limits
+ if (x >= World.CANT_TILES-1):
+ x = 0
+ if (y >= World.CANT_TILES-1):
+ y = 0
+ if (x < 0):
+ x = World.CANT_TILES-2
+ if (y < 0):
+ y = World.CANT_TILES-2
+ #print "getState",x,y,world.state[x][y].STATE
+ return world.state[x][y].STATE
+
+def internalMove(world,x,y,direction):
+ tentativeX = x + int(getDeltaX(direction))
+ tentativeY = y + int(getDeltaY(direction))
+ if (tentativeX >= World.CANT_TILES-1):
+ tentativeX = 0
+ if (tentativeY >= World.CANT_TILES-1):
+ tentativeY = 0
+ if (tentativeX < 0):
+ tentativeX = World.CANT_TILES-2
+ if (tentativeY < 0):
+ tentativeY = World.CANT_TILES-2
+ return tentativeX,tentativeY
+
+
+
+class AbstractAnimal:
+
+ edadMaxima = 100
+ madurezSexual = 50
+ nivelCadenaAlimenticia = 1
+ minFrecuenciaAlimentacion = 10
+ maxFrecuenciaAlimentacion = 1
+ especie = "Indefinida"
+ maxNumeroCrias = 4
+ frecuenciaSexual = 10
+
+ def __init__(self,x,y):
+ print "Iniciando AbstractAnimal"
+ self.orden = 0
+ self.edad = 30
+ self.sexo = "F"
+ self.ultimaActSexual = self.edad
+ self.ultimaAlimentacion = self.edad
+ self.posX = x
+ self.posY = y
+ self.ultimaDireccion = -1
+
+ def draw(ctx):
+ print "Draw"
+
+ def move(self):
+ print "Move"
+
+ def checkLive(self):
+ if (self.edad > self.edadMaxima):
+ print "Muere por edad"
+ return False
+ elif ((self.edad - self.ultimaAlimentacion) > self.minFrecuenciaAlimentacion):
+ print "Muere por falta de alimentacion"
+ return False
+ else:
+ return True
+
+# RABBIT
+
+class Rabbit(AbstractAnimal):
+ #print "Inicio conejo"
+
+ path = os.path.join(os.path.dirname(os.path.abspath(__file__)),"images")
+
+ imageSmallMale = cairo.ImageSurface.create_from_png (os.path.join(path,"rabbit_small_m.png"))
+ imageSmallFem = cairo.ImageSurface.create_from_png (os.path.join(path,"rabbit_small_f.png"))
+ imageMale = cairo.ImageSurface.create_from_png (os.path.join(path,"rabbit_m.png"))
+ imageFem = cairo.ImageSurface.create_from_png (os.path.join(path,"rabbit_f.png"))
+
+ especie = "Rabbit"
+
+
+ def __init__(self,x,y,world):
+ #print "Iniciando Rabbit"
+ self._world = world
+
+ self.orden = 0
+ self.edad = 1
+ self.sexo = "F"
+ if (random.random() > 0.5):
+ self.sexo = "M"
+ self.ultimaActSexual = self.edad
+ self.ultimaAlimentacion = self.edad
+ self.posX = x
+ self.posY = y
+ self.ultimaDireccion = -1
+ self.edadMaxima = world.rabbit_data.edadMaxima
+ self.madurezSexual = world.rabbit_data.madurezSexual
+ self.frecuenciaSexual = world.rabbit_data.frecuenciaSexual
+ self.nivelCadenaAlimenticia = world.rabbit_data.nivelCadenaAlimenticia
+ self.minFrecuenciaAlimentacion = world.rabbit_data.minFrecuenciaAlimentacion
+ self.maxFrecuenciaAlimentacion = world.rabbit_data.maxFrecuenciaAlimentacion
+ self.maxNumeroCrias = world.rabbit_data.maxNumeroCrias
+
+ def draw(self,ctx):
+ #print "Draw"
+ x1 = World.MARGEN+(self.posX*World.SIZE_TILE)
+ y1 = World.MARGEN +(self.posY*World.SIZE_TILE)
+ ctx.move_to(x1,y1)
+ ctx.translate(x1,y1)
+ ctx.rectangle(0,0,World.SIZE_TILE,World.SIZE_TILE);
+ ctx.set_source_rgb(146.0/256.0,98.0/256.0,46.0/256.0)
+ if (self.sexo == "M"):
+ if (self.edad < self.madurezSexual):
+ ctx.set_source_surface(Rabbit.imageSmallMale,1,1)
+ else:
+ ctx.set_source_surface(Rabbit.imageMale,1,1)
+ if (self.sexo == "F"):
+ if (self.edad < self.madurezSexual):
+ ctx.set_source_surface(Rabbit.imageSmallFem,1,1)
+ else:
+ ctx.set_source_surface(Rabbit.imageFem,1,1)
+
+ ctx.fill()
+
+
+ def move(self,world):
+ self.edad = self.edad + 1
+
+ # eat
+ if (world.state[self.posX][self.posY].STATE >=1):
+ world.state[self.posX][self.posY].STATE = world.state[self.posX][self.posY].STATE - 3
+ if (world.state[self.posX][self.posY].STATE <0):
+ world.state[self.posX][self.posY].STATE = 0
+ self.ultimaAlimentacion = self.edad
+
+ # move
+ if (self.ultimaDireccion == -1) :
+ self.ultimaDireccion = getRandomDirection()
+ # verify green in the next position
+ self.tentativeX,self.tentativeY = internalMove(world,self.posX,self.posY,self.ultimaDireccion)
+ self.tentativeDirection = getNextDirection(self.ultimaDireccion)
+
+ while ((getState(world,self.tentativeX,self.tentativeY) == 0) and
+ (self.tentativeDirection != self.ultimaDireccion)):
+ #print self.tentativeX, self.tentativeY, self.tentativeDirection, self.ultimaDireccion
+ self.tentativeX,self.tentativeY = internalMove(world,self.posX,self.posY,self.tentativeDirection)
+ self.tentativeDirection = getNextDirection(self.tentativeDirection)
+
+ self.posX = self.tentativeX
+ self.posY = self.tentativeY
+
+ # if female verify for male rabbit
+ if ((self.sexo == "F") and
+ (self.edad > self.madurezSexual) and
+ ((self.edad - self.ultimaActSexual) > self.frecuenciaSexual)):
+
+ animalsNearArray = world.animalsNear(self.posX,self.posY)
+ if (len(animalsNearArray) > 0):
+ maleOk = False
+ n = 0
+ while (n < len(animalsNearArray) and not (maleOk)):
+ nearAnimal = animalsNearArray[n]
+ if ((nearAnimal.sexo == "M") and
+ (nearAnimal.especie == self.especie) and
+ (nearAnimal.edad > self.madurezSexual) and
+ ((nearAnimal.edad - nearAnimal.ultimaActSexual) > self.frecuenciaSexual)):
+ # born rabbits
+ self.ultimaActSexual = self.edad
+ cantCrias = int(random.random()*self.maxNumeroCrias)
+ for n in range(cantCrias):
+ child = Rabbit(self.posX,self.posY,self._world)
+ world.animals.append(child)
+ print "Nace conejo"
+ # salgo del while
+ maleOk = True
+
+ n = n + 1
+
+
+# FOX
+
+class Fox(AbstractAnimal):
+ #print "Inicio zorro"
+
+ path = os.path.join(os.path.dirname(os.path.abspath(__file__)),"images")
+
+ imageSmallMale = cairo.ImageSurface.create_from_png (os.path.join(path,"fox_small_m.png"))
+ imageSmallFem = cairo.ImageSurface.create_from_png (os.path.join(path,"fox_small_f.png"))
+ imageMale = cairo.ImageSurface.create_from_png (os.path.join(path,"fox_m.png"))
+ imageFem = cairo.ImageSurface.create_from_png (os.path.join(path,"fox_f.png"))
+
+ especie = "Fox"
+
+ def __init__(self,x,y,world):
+ #print "Iniciando Fox"
+ self._world = world
+
+ self.orden = 0
+ self.edad = 1
+ self.sexo = "F"
+ if (random.random() > 0.5):
+ self.sexo = "M"
+ self.ultimaActSexual = self.edad
+ self.minFrecuenciaAlimentacion = 30
+ self.ultimaAlimentacion = self.edad
+ self.posX = x
+ self.posY = y
+ self.ultimaDireccion = -1
+ self.maxNumeroCrias = 2
+
+ self.edadMaxima = world.fox_data.edadMaxima
+ self.madurezSexual = world.fox_data.madurezSexual
+ self.frecuenciaSexual = world.fox_data.frecuenciaSexual
+ self.nivelCadenaAlimenticia = world.fox_data.nivelCadenaAlimenticia
+ self.minFrecuenciaAlimentacion = world.fox_data.minFrecuenciaAlimentacion
+ self.maxFrecuenciaAlimentacion = world.fox_data.maxFrecuenciaAlimentacion
+ self.maxNumeroCrias = world.fox_data.maxNumeroCrias
+
+
+ def draw(self,ctx):
+ #print "Draw"
+ x1 = World.MARGEN+(self.posX*World.SIZE_TILE)
+ y1 = World.MARGEN +(self.posY*World.SIZE_TILE)
+ ctx.move_to(x1,y1)
+ ctx.translate(x1,y1)
+ ctx.rectangle(0,0,World.SIZE_TILE,World.SIZE_TILE);
+ ctx.set_source_rgb(146.0/256.0,98.0/256.0,46.0/256.0)
+ if (self.sexo == "M"):
+ if (self.edad < self.madurezSexual):
+ ctx.set_source_surface(Fox.imageSmallMale,1,1)
+ else:
+ ctx.set_source_surface(Fox.imageMale,1,1)
+ if (self.sexo == "F"):
+ if (self.edad < self.madurezSexual):
+ ctx.set_source_surface(Fox.imageSmallFem,1,1)
+ else:
+ ctx.set_source_surface(Fox.imageFem,1,1)
+
+ ctx.fill()
+
+
+ def move(self,world):
+ self.edad = self.edad + 1
+
+ # move
+ if (self.ultimaDireccion == -1) :
+ self.ultimaDireccion = getRandomDirection()
+ # verify green in the next position
+ self.tentativeX,self.tentativeY = internalMove(world,self.posX,self.posY,self.ultimaDireccion)
+ self.tentativeDirection = getNextDirection(self.ultimaDireccion)
+
+ while ((getState(world,self.tentativeX,self.tentativeY) == 0) and
+ (self.tentativeDirection != self.ultimaDireccion)):
+ #print self.tentativeX, self.tentativeY, self.tentativeDirection, self.ultimaDireccion
+ self.tentativeX,self.tentativeY = internalMove(world,self.posX,self.posY,self.tentativeDirection)
+ self.tentativeDirection = getNextDirection(self.tentativeDirection)
+
+ self.posX = self.tentativeX
+ self.posY = self.tentativeY
+
+ # eat
+ animalsNearArray = world.animalsNear(self.posX,self.posY)
+ if ((self.edad - self.ultimaAlimentacion) > self.maxFrecuenciaAlimentacion ):
+ if (len(animalsNearArray) > 0):
+ n = 0
+ eat = False
+ while ((n < len(animalsNearArray)) and not eat):
+ nearAnimal = animalsNearArray[n]
+ if (nearAnimal.nivelCadenaAlimenticia < self.nivelCadenaAlimenticia):
+ print "Comer conejo!!"
+ n = n+1
+ world.animals.remove(nearAnimal)
+ eat = True
+ self.ultimaAlimentacion = self.edad
+ n = n+1
+
+ # if female verify for male fox
+ if ((self.sexo == "F") and
+ (self.edad > self.madurezSexual) and
+ ((self.edad - self.ultimaActSexual) > self.frecuenciaSexual)):
+
+ if (len(animalsNearArray) > 0):
+ maleOk = False
+ n = 0
+ while (n < len(animalsNearArray) and not (maleOk)):
+ nearAnimal = animalsNearArray[n]
+ if ((nearAnimal.sexo == "M") and
+ (nearAnimal.especie == self.especie) and
+ (nearAnimal.edad > self.madurezSexual) and
+ ((nearAnimal.edad - nearAnimal.ultimaActSexual) > self.frecuenciaSexual) ):
+ #print "IUPI!!!!"
+ # born foxs
+ self.ultimaActSexual = self.edad
+ cantCrias = int(random.random()*self.maxNumeroCrias)
+ for n in range(cantCrias):
+ child = Fox(self.posX,self.posY,self._world)
+ world.animals.append(child)
+ print "Nace zorro"
+ # salgo del while
+ maleOk = True
+
+ n = n + 1
+
+
+
diff --git a/Green.py b/Green.py
new file mode 100644
index 0000000..41f04cf
--- /dev/null
+++ b/Green.py
@@ -0,0 +1,96 @@
+### By Gonzalo Odiard, 2006 godiard at gmail.com
+### GPL License - http://www.gnu.org/copyleft/gpl.html
+
+import gobject, gtk , cairo, os
+import World
+
+print "Init Green"
+path = os.path.join(os.path.dirname(os.path.abspath(__file__)),"images")
+
+print "Despues de ver el path"
+image1 = cairo.ImageSurface.create_from_png (os.path.join(path,"green1.png"))
+image2 = cairo.ImageSurface.create_from_png (os.path.join(path,"green2.png"))
+image3 = cairo.ImageSurface.create_from_png (os.path.join(path,"green3.png"))
+image4 = cairo.ImageSurface.create_from_png (os.path.join(path,"green4.png"))
+
+def getImagesGreen(world,ctx,n,p):
+ state = world.state[n][p].STATE
+ x1 = World.MARGEN+(World.SIZE_TILE*n)
+ y1 = World.MARGEN +(World.SIZE_TILE*p)
+ ctx.move_to(x1,y1)
+ ctx.translate(x1,y1)
+ ctx.rectangle(0,0,World.SIZE_TILE,World.SIZE_TILE);
+ ctx.set_source_rgb(146.0/256.0,98.0/256.0,46.0/256.0)
+ if state ==1:
+ ctx.set_source_surface(image1,1,1)
+ elif state ==2:
+ ctx.set_source_surface(image2,1,1)
+ elif state ==3:
+ ctx.set_source_surface(image3,1,1)
+ elif state ==4:
+ ctx.set_source_surface(image4,1,1)
+ ctx.fill()
+
+# MARRON RGB 146,98,46
+# VERDE1 166,202,128
+# VERDE2 127,175,76
+# VERDE3 102,160,40
+# VERDE4 78,143,8
+
+def getColorTile(world,ctx,n,p):
+ state = world.state[n][p].STATE
+ #print state
+ x1 = World.MARGEN+(World.SIZE_TILE*n)
+ y1 = World.MARGEN +(World.SIZE_TILE*p)
+ ctx.move_to(x1,y1)
+ ctx.rectangle(x1,y1,World.SIZE_TILE,World.SIZE_TILE);
+
+ if state == 0:
+ ctx.set_source_rgb(146.0/256.0,98.0/256.0,46.0/256.0)
+ elif state ==1:
+ ctx.set_source_rgb(166.0/256.0,202.0/256.0,128.0/256.0)
+ elif state ==2:
+ ctx.set_source_rgb(127.0/256.0,175.0/256.0,76.0/256.0)
+ elif state ==3:
+ ctx.set_source_rgb(102.0/256.0,160.0/256.0,40.0/256.0)
+ elif state ==4:
+ ctx.set_source_rgb(78.0/256.0,143.0/256.0,8.0/256.0)
+ ctx.fill()
+
+
+def grow(world):
+ for n in range(0,World.CANT_TILES-1):
+ for p in range(0,World.CANT_TILES-1):
+ if ((world.state[n][p].STATE != 0) and
+ (world.state[n][p].STATE < 4)):
+ world.state[n][p].STATE = world.state[n][p].STATE + 1
+ x1 = World.MARGEN+(World.SIZE_TILE*n)
+ y1 = World.MARGEN +(World.SIZE_TILE*p)
+ #drawingarea.queue_draw_area(x1, y1, World.SIZE_TILE, World.SIZE_TILE)
+ level = 0
+ if (world.state[n][p].STATE == 0):
+ if (n != 0) and (world.state[n-1][p].STATE > 1):
+ level = level + world.state[n-1][p].STATE
+ if ((n != 0) and (p != 0) and
+ (world.state[n-1][p-1].STATE > 1)):
+ level = level + world.state[n-1][p-1].STATE
+ if ((n != 0) and (p < World.CANT_TILES) and
+ (world.state[n-1][p+1].STATE > 1)):
+ level = level + world.state[n-1][p+1].STATE
+ if (p != 0) and (world.state[n][p-1].STATE > 1):
+ level = level + world.state[n][p-1].STATE
+ if (p < World.CANT_TILES) and (world.state[n][p+1].STATE > 1):
+ level = level + world.state[n][p+1].STATE
+ if (n < World.CANT_TILES) and (world.state[n+1][p].STATE > 1):
+ level = level + world.state[n+1][p].STATE
+ if ((n < World.CANT_TILES) and (p != 0) and
+ (world.state[n+1][p-1].STATE > 1)):
+ level = level + world.state[n+1][p-1].STATE
+ if ((n < World.CANT_TILES) and (p < World.CANT_TILES) and
+ (world.state[n+1][p+1].STATE > 1 )):
+ level = level + world.state[n+1][p+1].STATE
+ if (level > 3):
+ world.state[n][p].STATE = 1
+ x1 = World.MARGEN+(World.SIZE_TILE*n)
+ y1 = World.MARGEN +(World.SIZE_TILE*p)
+ #drawingarea.queue_draw_area(x1, y1, World.SIZE_TILE, World.SIZE_TILE)
diff --git a/MANIFEST b/MANIFEST
new file mode 100644
index 0000000..c4adb99
--- /dev/null
+++ b/MANIFEST
@@ -0,0 +1,41 @@
+Todo.txt
+World.py
+ecomundo.py
+ChangeLog
+glade_util.py
+Changelog.txt
+ecomundoactivity.py
+setup.py
+Animals.py
+Green.py
+locale/es/activity.linfo
+locale/es/LC_MESSAGES/org.laptop.sample.Ecomundo.mo
+po/Ecomundo.pot
+po/es.po
+po/es.mo
+po/POTFILES.in
+images/rabbit_small_f.png
+images/rabbit_small_m.png
+images/fox_m.png
+images/fox_small.png
+images/fox_f.png
+images/green3.png
+images/fox.png
+images/green2.png
+images/rabbit_f.png
+images/rabbit.png
+images/green4.svg
+images/green3.svg
+images/rabbit_small.png
+images/fox_small_m.png
+images/green4.png
+images/rabbit_m.png
+images/green1.svg
+images/fox_small_f.png
+images/green1.png
+images/green2.svg
+activity/activity-ecomundo.svg
+activity/activity-web.svg
+activity/activity-ecomundo3.svg
+activity/activity-ecomundo2.svg
+activity/activity.info
diff --git a/World.py b/World.py
new file mode 100644
index 0000000..58c6a3e
--- /dev/null
+++ b/World.py
@@ -0,0 +1,54 @@
+### By Gonzalo Odiard, 2006 godiard at gmail.com
+### GPL License - http://www.gnu.org/copyleft/gpl.html
+
+# inicializacion
+MARGEN = 10
+SIZE_WORLD = 800 # 700
+CANT_TILES = 25 # 30
+print "*** calculo SIZE "
+SIZE_TILE = int((SIZE_WORLD - MARGEN * 2) / CANT_TILES)
+print "Size tile:", SIZE_TILE
+
+class RabbitData:
+ edadMaxima = 100
+ madurezSexual = 20
+ frecuenciaSexual = 10
+ nivelCadenaAlimenticia = 1
+ minFrecuenciaAlimentacion = 10
+ maxFrecuenciaAlimentacion = 1
+ maxNumeroCrias = 5
+
+
+class FoxData:
+ edadMaxima = 150
+ madurezSexual = 20
+ frecuenciaSexual = 10
+ nivelCadenaAlimenticia = 2
+ minFrecuenciaAlimentacion = 20
+ maxFrecuenciaAlimentacion = 3
+ maxNumeroCrias = 3
+
+class World:
+ initialGreen = 10
+ initialRabbits = 10
+ initialFoxs = 10
+ playState = False
+ state = []
+ animals = []
+
+ rabbit_data = RabbitData()
+ fox_data = FoxData()
+
+
+ def animalsNear(self,x,y):
+ animalsNear = []
+ for n in range(len(self.animals)):
+ animal = self.animals[n]
+ if ((abs(animal.posX-x) == 1) and
+ (abs(animal.posY-y) == 1)):
+ animalsNear.append(animal)
+ #print "Encuentra",x,y,animal.posX,animal.posY
+ return animalsNear
+
+
+
diff --git a/activity/activity-ecomundo3.svg b/activity/activity-ecomundo3.svg
new file mode 100644
index 0000000..a6bb8d3
--- /dev/null
+++ b/activity/activity-ecomundo3.svg
@@ -0,0 +1,37 @@
+<?xml version="1.0" ?><!DOCTYPE svg PUBLIC '-//W3C//DTD SVG 1.1//EN' 'http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd' [
+ <!ENTITY stroke_color "#010101">
+ <!ENTITY fill_color "#FFFFFF">
+]>
+<svg
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg" version="1.0" width="55" height="55" viewBox="0 0 55 55" id="svg2491" xml:space="preserve">
+<defs id="defs2511"> </defs>
+<circle cx="27.375" cy="27.5" r="19.903" id="circle2494"
+ style="fill:&fill_color;;stroke:&stroke_color;;stroke-width:3.5;marker-start:none;marker-mid:none;display:inline" />
+<path
+ d="M 45.308012,64.59176 C 45.390908,64.986274 45.434782,65.397728 45.434782,65.820656 L 45.434784,65.820656 C 45.434782,68.757656 43.318956,71.141308 40.711956,71.141308 C 38.104956,71.141304 35.98913,68.757656 35.98913,65.820656 C 35.989131,63.920762 36.874513,62.25242 38.205497,61.31108"
+ id="path3358" style="opacity:1;fill:&stroke_color;;stroke-width:3.5;stroke-linecap:round;stroke-miterlimit:4;stroke-dasharray:none" />
+<path
+ d="M 38.205497,61.31108 C 38.932048,60.797226 39.791379,60.500004 40.711956,60.500004 C 42.943548,60.500004 44.815239,62.246592 45.308012,64.59176"
+ id="path3353" style="opacity:1;fill:&stroke_color;;stroke-width:3.5;stroke-linecap:round;stroke-miterlimit:4;stroke-dasharray:none" />
+<path
+ d="M 26.423914,21.043477 C 28.420271,20.734327 32.82088,10.006957 38.14298,16.713061 C 36.672298,16.645918 32.531905,19.651394 31.795412,20.985733 C 40.269779,21.559636 42.070953,36.433495 28.978491,42.446906 C 28.327724,42.689674 26.954932,43.039347 26.304347,43.282608"
+ id="path2401" style="fill:none;fill-rule:evenodd;stroke:&stroke_color;;stroke-width:3.20000005;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
+<path
+ d="M 28.025307,21.14078 C 26.02895,20.83163 21.867471,9.8651292 16.545371,16.571234 C 18.016053,16.504091 22.156446,19.509567 22.892939,20.843906 C 14.418572,21.417809 12.139137,36.052538 25.231599,42.065949 C 25.882366,42.308717 27.255158,43.13665 27.905743,43.379911"
+ id="path2413" style="fill:none;fill-rule:evenodd;stroke:&stroke_color;;stroke-width:3.20000005;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
+<path
+ d="M 24.75,28.516304 A 1.5543479,1.9728261 0 1 1 21.641304,28.516304 A 1.5543479,1.9728261 0 1 1 24.75,28.516304 z"
+ transform="translate(0.3586957,-1.3152174)" id="path3185"
+ style="opacity:1;fill:&stroke_color;;stroke-width:3.20000005;stroke-linecap:round;stroke-miterlimit:4;stroke-dasharray:none" />
+<path
+ d="M 24.75,28.516304 A 1.5543479,1.9728261 0 1 1 21.641304,28.516304 A 1.5543479,1.9728261 0 1 1 24.75,28.516304 z"
+ transform="translate(7.8913045,-1.1358692)" id="path3187"
+ style="opacity:1;fill:&stroke_color;;stroke-width:3.20000005;stroke-linecap:round;stroke-miterlimit:4;stroke-dasharray:none" />
+<path
+ d="M 23.434784,36.347824 C 26.531378,34.835423 28.552437,34.097734 31.445652,32.641304" id="path3189"
+ style="fill:none;fill-rule:evenodd;stroke:&stroke_color;;stroke-width:2.20000005;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
+<path
+ d="M 23.494566,32.820653 C 26.59116,34.333054 28.612219,35.070743 31.505434,36.527173"
+ id="path3195"
+ style="fill:none;fill-rule:evenodd;stroke:&stroke_color;;stroke-width:2.20000005;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /></svg>
diff --git a/activity/activity.info b/activity/activity.info
new file mode 100644
index 0000000..4ae03a5
--- /dev/null
+++ b/activity/activity.info
@@ -0,0 +1,9 @@
+[Activity]
+name = Ecomundo
+service_name = org.laptop.sample.Ecomundo
+icon = activity-ecomundo3
+class = ecomundoactivity.EcomundoActivity
+activity_version = 2
+host_version = 1
+show_launcher = yes
+license = GPLV2+ \ No newline at end of file
diff --git a/ecomundoactivity.py b/ecomundoactivity.py
new file mode 100644
index 0000000..5d4ef82
--- /dev/null
+++ b/ecomundoactivity.py
@@ -0,0 +1,250 @@
+#!/usr/bin/env python
+
+### Simulacion de un ecosistema, en el que existe pasto, conejos y zorros.
+### By Gonzalo Odiard, 2006 godiard at gmail.com
+### GPL License - http://www.gnu.org/copyleft/gpl.html
+
+import gobject, gtk , cairo
+import math, random
+import os
+import hippo
+
+import pango
+import logging
+from gettext import gettext as _
+import World,Animals,Green
+import sugar
+from sugar.activity import activity
+from sugar.graphics import style
+from sugar.graphics.toolbutton import ToolButton
+
+
+world = World.World()
+
+class Tile:
+ def __init__ (self,x,y):
+ self.X = x
+ self.Y = y
+ self.STATE = 0;
+
+
+def drawGrid(ctx):
+ ctx.set_line_width(2)
+ ctx.set_source_rgb(0,0,0)
+ for n in range(0,World.CANT_TILES):
+ ctx.move_to(World.MARGEN,World.MARGEN +(World.SIZE_TILE*n))
+ ctx.line_to(World.SIZE_TILE * (World.CANT_TILES-1) + World.MARGEN,
+ World.MARGEN +(World.SIZE_TILE*n))
+ ctx.move_to(World.MARGEN +(World.SIZE_TILE*n),World.MARGEN)
+ ctx.line_to(World.MARGEN +(World.SIZE_TILE*n),
+ World.SIZE_TILE * (World.CANT_TILES-1)+ World.MARGEN)
+ ctx.stroke()
+
+def initWorld():
+ world.state = []
+ world.animals = []
+ for n in range(0,World.CANT_TILES):
+ world.state.append([])
+ for p in range(0,World.CANT_TILES):
+ tile = Tile(n,p)
+ world.state[n].append(tile)
+
+
+def drawStateWorld(ctx):
+ #print "drawStateWorld"
+ ctx.move_to(0,0)
+ ctx.rectangle(0,0,World.SIZE_WORLD+(2*World.MARGEN),World.SIZE_WORLD+(2*World.MARGEN))
+ #ctx.set_source_rgb(style.COLOR_PANEL_GREY.get_gdk_color())
+ ctx.set_source_rgb(192.0/256.0,192.0/256.0,192.0/256.0)
+ ctx.fill()
+
+
+ for n in range(0,World.CANT_TILES-1):
+ for p in range(0,World.CANT_TILES-1):
+ ctx.save()
+ Green.getImagesGreen(world,ctx,n,p)
+ #Green.getColorTile(world,ctx,n,p)
+ ctx.restore()
+ for n in range(len(world.animals)):
+ #print "Animal",n
+ animal = world.animals[n]
+ ctx.save()
+ animal.draw(ctx)
+ ctx.restore()
+
+def initGreen():
+ for n in range(world.initialGreen):
+ x = int(random.random()*World.CANT_TILES)
+ y = int(random.random()*World.CANT_TILES)
+ world.state[x][y].STATE = 2
+
+def initAnimals():
+ for n in range(world.initialRabbits):
+ x = int(random.random()*(World.CANT_TILES-1))
+ y = int(random.random()*(World.CANT_TILES-1))
+ #print "Init Rabbit",x,y
+ animal = Animals.Rabbit(x,y,world)
+ world.animals.append(animal)
+ for n in range(world.initialFoxs):
+ x = int(random.random()*(World.CANT_TILES-1))
+ y = int(random.random()*(World.CANT_TILES-1))
+ #print "Init Fox",x,y
+ animal = Animals.Fox(x,y,world)
+ world.animals.append(animal)
+
+
+def updateState(drawingarea):
+ #print "update State"
+ if (world.playState):
+ Green.grow(world)
+ n = 0
+
+ while (n < len(world.animals)):
+ animal = world.animals[n]
+ animal.move(world)
+ if (not animal.checkLive()):
+ cantAnimals = len(world.animals)
+ world.animals[n] = cantAnimals
+ world.animals.remove(cantAnimals)
+ else :
+ #Actualizo donde esta
+ x1 = World.MARGEN+(World.SIZE_TILE*animal.posX)
+ y1 = World.MARGEN +(World.SIZE_TILE*animal.posY)
+ n = n+1
+ drawingarea.queue_draw_area(0, 0,World.SIZE_WORLD, World.SIZE_WORLD)
+ source_id = gobject.timeout_add(1000, updateState,drawingarea)
+
+
+class EcomundoActivity(activity.Activity):
+
+ def __init__(self,handle):
+ activity.Activity.__init__(self,handle)
+
+ self.set_title("Ecomundo")
+ print "Init activity Ecomundo"
+ #print os.path.abspath(__file__)
+
+ toolbox = activity.ActivityToolbox(self)
+ self.toolbar = gtk.Toolbar()
+
+ toolbox.add_toolbar(_('Ecomundo'), self.toolbar)
+ self.toolbar.show()
+ self.set_toolbox(toolbox)
+ toolbox.show()
+
+ self.btnNew = ToolButton('reload')
+ self.btnNew.connect('clicked', self.onBtNewClicked)
+ self.toolbar.insert(self.btnNew, -1)
+ self.btnNew.show()
+
+ self.btPlay = ToolButton('next')
+ self.btPlay.connect('clicked', self.onBtPlayClicked)
+ self.toolbar.insert(self.btPlay, -1)
+ self.btPlay.show()
+
+ self.btStop = ToolButton('process-stop')
+ self.btStop.connect('clicked', self.onBtStopClicked)
+ self.toolbar.insert(self.btStop, -1)
+ self.btStop.show()
+
+ self.btStop.props.sensitive = False;
+ self.btPlay.props.sensitive = True;
+
+ toolbox.set_current_toolbar(1)
+
+ hBox = gtk.HBox(False, 0)
+ self.set_canvas(hBox)
+
+ self.drawingarea1 = gtk.DrawingArea()
+ self.drawingarea1.set_size_request(World.SIZE_WORLD+(2*World.MARGEN),World.SIZE_WORLD+(2*World.MARGEN))
+ self.drawingarea1.show()
+
+ hBox.pack_start(self.drawingarea1, False, True, 5)
+
+ table = gtk.Table(rows=4, columns=2, homogeneous=False)
+ hBox.pack_start(table, False, False, 5)
+
+ label_attributes = pango.AttrList()
+ label_attributes.insert(pango.AttrSize(14000, 0, -1))
+ label_attributes.insert(pango.AttrForeground(65535, 65535, 65535, 0, -1))
+
+ lbTitle = gtk.Label()
+ lbTitle.set_attributes(label_attributes)
+ lbTitle.set_text(_('Initial Values'))
+ #table.attach(lbTitle, 0, 1, 0, 1,yoptions=gtk.SHRINK,xpadding=5)
+ table.attach(lbTitle, 0, 2, 0, 1,yoptions=gtk.SHRINK,xpadding=10)
+
+ lbGreen = gtk.Label()
+ lbGreen.set_attributes(label_attributes)
+ lbGreen.set_text(_('Green'))
+ table.attach(lbGreen, 0, 1, 1, 2,yoptions=gtk.SHRINK,xoptions=gtk.SHRINK,xpadding=10)
+
+ adjGreen = gtk.Adjustment(10, 1, 400, 1, 1, 0)
+ self.spbGreen = gtk.SpinButton(adjustment=adjGreen, climb_rate=1.0, digits=2)
+ table.attach(self.spbGreen, 1, 2, 1, 2,yoptions=gtk.SHRINK,xoptions=gtk.SHRINK,ypadding=10)
+
+ lbRabbit = gtk.Label()
+ lbRabbit.set_attributes(label_attributes)
+ lbRabbit.set_text(_('Rabbits'))
+ table.attach(lbRabbit, 0, 1, 2, 3,yoptions=gtk.SHRINK,xoptions=gtk.SHRINK,xpadding=10)
+
+ adjRabbit = gtk.Adjustment(10, 1, 400, 1, 1, 0)
+ self.spbRabbit = gtk.SpinButton(adjustment=adjRabbit, climb_rate=1.0, digits=2)
+ table.attach(self.spbRabbit, 1, 2, 2, 3,yoptions=gtk.SHRINK,xoptions=gtk.SHRINK,ypadding=10)
+
+ lbFox = gtk.Label()
+ lbFox.set_attributes(label_attributes)
+ lbFox.set_text(_('Foxs'))
+ table.attach(lbFox, 0, 1, 3, 4,yoptions=gtk.SHRINK,xoptions=gtk.SHRINK,xpadding=10)
+
+ adjFox = gtk.Adjustment(10, 1, 400, 1, 1, 0)
+ self.spbFox = gtk.SpinButton(adjustment=adjFox, climb_rate=1.0, digits=2)
+ table.attach(self.spbFox, 1, 2, 3, 4,yoptions=gtk.SHRINK,xoptions=gtk.SHRINK,ypadding=10)
+
+
+ print "test resize"
+ print "antes de initWorld"
+ initWorld()
+ print "antes de init Green"
+ initGreen()
+ print "antes de init Animals"
+ initAnimals()
+
+ hBox.resize_children()
+ hBox.show_all()
+
+ self.drawingarea1.connect('expose-event', self.onDrawingAreaExposed)
+
+
+ def onDrawingAreaExposed(self,da, event):
+ #print "drawingarea exposed"
+ x, y, width, height = da.allocation
+ ctx = da.window.cairo_create()
+ drawStateWorld(ctx)
+ drawGrid(ctx)
+
+ def onBtPlayClicked(self,widget):
+ self.btStop.props.sensitive = True;
+ self.btPlay.props.sensitive = False;
+ world.playState = True
+ source_id = gobject.timeout_add(2000, updateState,self.drawingarea1)
+ # http://www.pygtk.org/pygtk2tutorial-es/ch-TimeoutsIOAndIdleFunctions.html#sec-Timeouts
+
+ def onBtStopClicked(self,widget):
+ self.btStop.props.sensitive = False;
+ self.btPlay.props.sensitive = True;
+ world.playState = False
+
+ def onBtNewClicked(self,widget):
+ initWorld()
+ world.initialGreen = self.spbGreen.get_value_as_int()
+ world.initialRabbits = self.spbRabbit.get_value_as_int()
+ world.initialFoxs = self.spbFox.get_value_as_int()
+ initGreen()
+ initAnimals()
+ # Despues de esto hay que recargar la pantalla
+ drawingarea1 = self.drawingarea1
+ ctx = drawingarea1.window.cairo_create()
+ drawStateWorld(ctx)
+ drawGrid(ctx)
+
diff --git a/images/fox.png b/images/fox.png
new file mode 100644
index 0000000..6bef989
--- /dev/null
+++ b/images/fox.png
Binary files differ
diff --git a/images/fox_f.png b/images/fox_f.png
new file mode 100644
index 0000000..6c623a4
--- /dev/null
+++ b/images/fox_f.png
Binary files differ
diff --git a/images/fox_m.png b/images/fox_m.png
new file mode 100644
index 0000000..47dd530
--- /dev/null
+++ b/images/fox_m.png
Binary files differ
diff --git a/images/fox_small.png b/images/fox_small.png
new file mode 100644
index 0000000..ed10875
--- /dev/null
+++ b/images/fox_small.png
Binary files differ
diff --git a/images/fox_small_f.png b/images/fox_small_f.png
new file mode 100644
index 0000000..62f097c
--- /dev/null
+++ b/images/fox_small_f.png
Binary files differ
diff --git a/images/fox_small_m.png b/images/fox_small_m.png
new file mode 100644
index 0000000..e2d3f2d
--- /dev/null
+++ b/images/fox_small_m.png
Binary files differ
diff --git a/images/green1.png b/images/green1.png
new file mode 100644
index 0000000..64058f4
--- /dev/null
+++ b/images/green1.png
Binary files differ
diff --git a/images/green1.svg b/images/green1.svg
new file mode 100644
index 0000000..3beb113
--- /dev/null
+++ b/images/green1.svg
@@ -0,0 +1,71 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://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://inkscape.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ width="210mm"
+ height="297mm"
+ id="svg2"
+ sodipodi:version="0.32"
+ inkscape:version="0.43"
+ sodipodi:docbase="/home/gonzalo/Proyectos/ecomundo/images"
+ sodipodi:docname="green1.svg">
+ <defs
+ id="defs4" />
+ <sodipodi:namedview
+ id="base"
+ pagecolor="#ffffff"
+ bordercolor="#666666"
+ borderopacity="1.0"
+ inkscape:pageopacity="0.0"
+ inkscape:pageshadow="2"
+ inkscape:zoom="1.0119683"
+ inkscape:cx="372.04724"
+ inkscape:cy="862.7128"
+ inkscape:document-units="px"
+ inkscape:current-layer="layer1"
+ inkscape:window-width="851"
+ inkscape:window-height="586"
+ inkscape:window-x="0"
+ inkscape:window-y="46" />
+ <metadata
+ id="metadata7">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ </cc:Work>
+ </rdf:RDF>
+ </metadata>
+ <g
+ inkscape:label="Capa 1"
+ inkscape:groupmode="layer"
+ id="layer1">
+ <rect
+ style="fill:#92622e;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:3;stroke-linecap:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ id="rect1307"
+ width="200"
+ height="200"
+ x="182.85715"
+ y="89.505043"
+ ry="0"
+ inkscape:export-filename="/home/gonzalo/Proyectos/ecomundo/images/green1.png"
+ inkscape:export-xdpi="9"
+ inkscape:export-ydpi="9" />
+ <path
+ style="fill:#91ec41;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 269.58525,288.47933 C 271.05518,284.37363 282.22387,265.83556 273.17972,241.75121 C 268.70633,229.83866 252.90522,207.7529 231.47614,205.53597 C 213.57175,203.91531 268.39723,198.01072 282.76498,218.98624 C 306.86326,254.16739 290.56246,280.5166 292.15698,286.89466 C 293.15213,290.87525 269.8738,288.76788 269.58525,288.47933 z "
+ id="path1309"
+ sodipodi:nodetypes="cscssc"
+ inkscape:export-filename="/home/gonzalo/Proyectos/ecomundo/images/green1.png"
+ inkscape:export-xdpi="9"
+ inkscape:export-ydpi="9" />
+ </g>
+</svg>
diff --git a/images/green2.png b/images/green2.png
new file mode 100644
index 0000000..6a47dd6
--- /dev/null
+++ b/images/green2.png
Binary files differ
diff --git a/images/green2.svg b/images/green2.svg
new file mode 100644
index 0000000..4e6bb6d
--- /dev/null
+++ b/images/green2.svg
@@ -0,0 +1,79 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://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://inkscape.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ width="210mm"
+ height="297mm"
+ id="svg2"
+ sodipodi:version="0.32"
+ inkscape:version="0.43"
+ sodipodi:docbase="/home/gonzalo/Proyectos/ecomundo/images"
+ sodipodi:docname="green2.svg">
+ <defs
+ id="defs4" />
+ <sodipodi:namedview
+ id="base"
+ pagecolor="#ffffff"
+ bordercolor="#666666"
+ borderopacity="1.0"
+ inkscape:pageopacity="0.0"
+ inkscape:pageshadow="2"
+ inkscape:zoom="0.99511834"
+ inkscape:cx="372.04724"
+ inkscape:cy="801.44242"
+ inkscape:document-units="px"
+ inkscape:current-layer="layer1"
+ inkscape:window-width="851"
+ inkscape:window-height="692"
+ inkscape:window-x="0"
+ inkscape:window-y="25" />
+ <metadata
+ id="metadata7">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ </cc:Work>
+ </rdf:RDF>
+ </metadata>
+ <g
+ inkscape:label="Capa 1"
+ inkscape:groupmode="layer"
+ id="layer1">
+ <rect
+ style="fill:#92622e;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1;stroke-linecap:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ id="rect1307"
+ width="200"
+ height="200"
+ x="182.85715"
+ y="89.505043"
+ ry="0"
+ inkscape:export-filename="/home/gonzalo/Proyectos/ecomundo/images/green2.png"
+ inkscape:export-xdpi="9"
+ inkscape:export-ydpi="9" />
+ <path
+ style="fill:#91ec41;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 310.96959,287.49094 C 309.49966,283.38524 298.33097,264.84717 307.37512,240.76282 C 311.84851,228.85027 327.64962,206.76451 349.0787,204.54758 C 366.98309,202.92692 312.15761,197.02233 297.78986,217.99785 C 273.69159,253.179 289.99238,279.52821 288.39787,285.90627 C 287.40272,289.88686 310.68104,287.77949 310.96959,287.49094 z "
+ id="path2276"
+ sodipodi:nodetypes="cscssc"
+ inkscape:export-filename="/home/gonzalo/Proyectos/ecomundo/images/green1.png"
+ inkscape:export-xdpi="90"
+ inkscape:export-ydpi="90" />
+ <path
+ style="fill:#85cb48;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:1.6196177px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 258.2106,287.36804 C 260.29995,279.79104 276.17507,245.57933 263.31976,201.13206 C 256.96131,179.14764 234.50169,138.38873 204.0425,134.29743 C 178.59329,131.30652 256.52196,120.4097 276.94421,159.11968 C 311.19738,224.04592 288.02751,272.67295 290.29395,284.44356 C 291.70845,291.78967 258.62075,287.90056 258.2106,287.36804 z "
+ id="path1309"
+ sodipodi:nodetypes="cscssc"
+ inkscape:export-filename="/home/gonzalo/Proyectos/ecomundo/images/green1.png"
+ inkscape:export-xdpi="90"
+ inkscape:export-ydpi="90" />
+ </g>
+</svg>
diff --git a/images/green3.png b/images/green3.png
new file mode 100644
index 0000000..9d69f5a
--- /dev/null
+++ b/images/green3.png
Binary files differ
diff --git a/images/green3.svg b/images/green3.svg
new file mode 100644
index 0000000..953a0e7
--- /dev/null
+++ b/images/green3.svg
@@ -0,0 +1,95 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://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://inkscape.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ width="210mm"
+ height="297mm"
+ id="svg2"
+ sodipodi:version="0.32"
+ inkscape:version="0.43"
+ sodipodi:docbase="/home/gonzalo/Proyectos/ecomundo/images"
+ sodipodi:docname="green3.svg">
+ <defs
+ id="defs4" />
+ <sodipodi:namedview
+ id="base"
+ pagecolor="#ffffff"
+ bordercolor="#666666"
+ borderopacity="1.0"
+ inkscape:pageopacity="0.0"
+ inkscape:pageshadow="2"
+ inkscape:zoom="0.99511834"
+ inkscape:cx="504.14705"
+ inkscape:cy="801.44242"
+ inkscape:document-units="px"
+ inkscape:current-layer="layer1"
+ inkscape:window-width="851"
+ inkscape:window-height="692"
+ inkscape:window-x="0"
+ inkscape:window-y="25" />
+ <metadata
+ id="metadata7">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ </cc:Work>
+ </rdf:RDF>
+ </metadata>
+ <g
+ inkscape:label="Capa 1"
+ inkscape:groupmode="layer"
+ id="layer1">
+ <rect
+ style="fill:#92622e;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1;stroke-linecap:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ id="rect1307"
+ width="200"
+ height="200"
+ x="182.85715"
+ y="89.505043"
+ ry="0"
+ inkscape:export-filename="/home/gonzalo/Proyectos/ecomundo/images/green3.png"
+ inkscape:export-xdpi="9"
+ inkscape:export-ydpi="9" />
+ <path
+ style="fill:#91ec41;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 333.07752,287.49094 C 331.60759,283.38524 320.4389,264.84717 329.48305,240.76282 C 333.95644,228.85027 353.77717,203.74979 375.20625,185.45437 C 393.11064,183.83371 334.26554,197.02233 319.89779,217.99785 C 295.79952,253.179 312.10031,279.52821 310.5058,285.90627 C 309.51065,289.88686 332.78897,287.77949 333.07752,287.49094 z "
+ id="path2276"
+ sodipodi:nodetypes="cscssc"
+ inkscape:export-filename="/home/gonzalo/Proyectos/ecomundo/images/green2.png"
+ inkscape:export-xdpi="9"
+ inkscape:export-ydpi="9" />
+ <path
+ style="fill:#85cb48;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:1.6196177px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 258.2106,287.36804 C 260.29995,279.79104 276.17507,245.57933 263.31976,201.13206 C 256.96131,179.14764 237.51641,141.40345 217.10627,101.13555 C 197.68649,88.095579 256.52196,120.4097 276.94421,159.11968 C 311.19738,224.04592 288.02751,272.67295 290.29395,284.44356 C 291.70845,291.78967 258.62075,287.90056 258.2106,287.36804 z "
+ id="path1309"
+ sodipodi:nodetypes="cscssc"
+ inkscape:export-filename="/home/gonzalo/Proyectos/ecomundo/images/green2.png"
+ inkscape:export-xdpi="9"
+ inkscape:export-ydpi="9" />
+ <path
+ style="fill:#85cb48;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:1.6196177px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 319.83198,287.887 C 317.74263,280.31 301.86751,246.09829 314.72282,201.65102 C 321.08127,179.6666 331.48202,129.86354 361.94121,125.77224 C 387.39042,122.78133 321.52062,120.92866 301.09837,159.63864 C 266.8452,224.56488 290.01507,273.19191 287.74863,284.96252 C 286.33413,292.30863 319.42183,288.41952 319.83198,287.887 z "
+ id="path2434"
+ sodipodi:nodetypes="cscssc"
+ inkscape:export-filename="/home/gonzalo/Proyectos/ecomundo/images/green2.png"
+ inkscape:export-xdpi="9"
+ inkscape:export-ydpi="9" />
+ <path
+ style="fill:#91ec41;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 246.75301,287.49094 C 248.22294,283.38524 259.39163,264.84717 250.34748,240.76282 C 245.87409,228.85027 239.11713,208.77432 198.59484,174.40041 C 180.69045,172.77975 245.56499,197.02233 259.93274,217.99785 C 284.03101,253.179 267.73022,279.52821 269.32473,285.90627 C 270.31988,289.88686 247.04156,287.77949 246.75301,287.49094 z "
+ id="path2436"
+ sodipodi:nodetypes="cscssc"
+ inkscape:export-filename="/home/gonzalo/Proyectos/ecomundo/images/green2.png"
+ inkscape:export-xdpi="9"
+ inkscape:export-ydpi="9" />
+ </g>
+</svg>
diff --git a/images/green4.png b/images/green4.png
new file mode 100644
index 0000000..9481229
--- /dev/null
+++ b/images/green4.png
Binary files differ
diff --git a/images/green4.svg b/images/green4.svg
new file mode 100644
index 0000000..6bfca25
--- /dev/null
+++ b/images/green4.svg
@@ -0,0 +1,123 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://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://inkscape.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ width="210mm"
+ height="297mm"
+ id="svg2"
+ sodipodi:version="0.32"
+ inkscape:version="0.43"
+ sodipodi:docbase="/home/gonzalo/Proyectos/ecomundo/images"
+ sodipodi:docname="green4.svg">
+ <defs
+ id="defs4" />
+ <sodipodi:namedview
+ id="base"
+ pagecolor="#ffffff"
+ bordercolor="#666666"
+ borderopacity="1.0"
+ inkscape:pageopacity="0.0"
+ inkscape:pageshadow="2"
+ inkscape:zoom="0.99511834"
+ inkscape:cx="203.65616"
+ inkscape:cy="812.95125"
+ inkscape:document-units="px"
+ inkscape:current-layer="layer1"
+ inkscape:window-width="851"
+ inkscape:window-height="692"
+ inkscape:window-x="0"
+ inkscape:window-y="25" />
+ <metadata
+ id="metadata7">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ </cc:Work>
+ </rdf:RDF>
+ </metadata>
+ <g
+ inkscape:label="Capa 1"
+ inkscape:groupmode="layer"
+ id="layer1">
+ <path
+ style="fill:#92622e;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:1;stroke-linecap:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ d="M 182.85715,89.505043 C 249.52381,89.505043 316.19048,89.505043 382.85715,89.505043 C 382.85715,156.17171 382.85715,222.83837 382.85715,289.50504 C 316.19048,289.50504 249.52381,289.50504 182.85715,289.50504 C 182.85715,222.83837 182.85715,156.17171 182.85715,89.505043 z "
+ id="rect1307"
+ inkscape:export-filename="/home/gonzalo/Proyectos/ecomundo/images/green4.png"
+ inkscape:export-xdpi="9"
+ inkscape:export-ydpi="9" />
+ <path
+ style="fill:#85cb48;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:1.6196177px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 235.09777,286.36313 C 237.18712,278.78613 253.06224,244.57442 240.20693,200.12715 C 233.84848,178.14273 214.40358,140.39854 193.99344,100.13064 C 174.57366,87.090673 233.40913,119.40479 253.83138,158.11477 C 288.08455,223.04101 264.91468,271.66804 267.18112,283.43865 C 268.59562,290.78476 235.50792,286.89565 235.09777,286.36313 z "
+ id="path1309"
+ sodipodi:nodetypes="cscssc"
+ inkscape:export-filename="/home/gonzalo/Proyectos/ecomundo/images/green4.png"
+ inkscape:export-xdpi="9"
+ inkscape:export-ydpi="9" />
+ <path
+ style="fill:#91ec41;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 211.58131,287.49094 C 210.42748,283.76006 210.37661,283.63759 205.12672,257.84622 C 199.19019,228.68152 200.93071,234.90187 187.54087,183.44456 C 199.78365,216.9956 213.73852,225.33949 220.74142,244.1254 C 234.0903,279.93501 232.55852,279.52821 234.15303,285.90627 C 235.14818,289.88686 211.86986,287.77949 211.58131,287.49094 z "
+ id="path2436"
+ sodipodi:nodetypes="cscssc"
+ inkscape:export-filename="/home/gonzalo/Proyectos/ecomundo/images/green4.png"
+ inkscape:export-xdpi="9"
+ inkscape:export-ydpi="9" />
+ <path
+ style="fill:#85cb48;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:1.6196177px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 321.92786,287.00261 C 319.83851,279.42561 303.96339,245.2139 316.8187,200.76663 C 323.17715,178.78221 342.62205,141.03802 363.03219,100.77012 C 382.45197,87.730156 323.6165,120.04427 303.19425,158.75425 C 268.94108,223.68049 292.11095,272.30752 289.84451,284.07813 C 288.43001,291.42424 321.51771,287.53513 321.92786,287.00261 z "
+ id="path2438"
+ sodipodi:nodetypes="cscssc"
+ inkscape:export-filename="/home/gonzalo/Proyectos/ecomundo/images/green4.png"
+ inkscape:export-xdpi="9"
+ inkscape:export-ydpi="9" />
+ <path
+ style="fill:#85cb48;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:1.22725964px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 219.98394,288.80902 C 221.59116,283.15342 233.80305,257.61718 223.91415,224.44095 C 219.02293,208.03139 211.02218,170.85751 187.59153,167.80368 C 168.01481,165.57123 218.68496,164.18835 234.39472,193.08218 C 260.74386,241.54427 242.92051,277.84036 244.66396,286.62615 C 245.75206,292.10941 220.29944,289.20652 219.98394,288.80902 z "
+ id="path2440"
+ sodipodi:nodetypes="cscssc"
+ inkscape:export-filename="/home/gonzalo/Proyectos/ecomundo/images/green4.png"
+ inkscape:export-xdpi="9"
+ inkscape:export-ydpi="9" />
+ <path
+ style="fill:#85cb48;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:1.6196177px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 297.36871,287.24452 C 295.27936,279.66752 295.463,256.7114 292.25955,201.00854 C 290.98517,178.8492 323.69053,175.40662 286.21794,105.03165 C 263.43169,78.927913 299.05735,120.28618 278.6351,158.99616 C 244.38193,223.9224 267.5518,272.54943 265.28536,284.32004 C 263.87086,291.66615 296.95856,287.77704 297.36871,287.24452 z "
+ id="path2444"
+ sodipodi:nodetypes="cscssc"
+ inkscape:export-filename="/home/gonzalo/Proyectos/ecomundo/images/green4.png"
+ inkscape:export-xdpi="9"
+ inkscape:export-ydpi="9" />
+ <path
+ style="fill:#91ec41;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 285.67925,288.99973 C 286.83308,285.26885 276.83489,288.1611 282.08478,262.36973 C 288.02131,233.20503 279.24645,237.41557 282.58724,185.95826 C 270.34446,219.5093 264.42883,226.84828 257.42593,245.63419 C 244.07705,281.4438 264.70204,281.037 263.10753,287.41506 C 262.11238,291.39565 285.3907,289.28828 285.67925,288.99973 z "
+ id="path2446"
+ sodipodi:nodetypes="cscssc"
+ inkscape:export-filename="/home/gonzalo/Proyectos/ecomundo/images/green4.png"
+ inkscape:export-xdpi="9"
+ inkscape:export-ydpi="9" />
+ <path
+ style="fill:#91ec41;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:0.87201965px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 346.96715,289.57695 C 345.78059,285.70932 336.76495,268.24615 344.06561,245.5583 C 347.67664,234.33648 363.6764,210.69142 380.97447,193.45683 C 395.42733,191.93014 347.92615,204.35404 336.32816,224.11332 C 316.87545,257.25454 330.03384,282.07593 328.74672,288.08417 C 327.94341,291.83395 346.73423,289.84877 346.96715,289.57695 z "
+ id="path2276"
+ sodipodi:nodetypes="cscssc"
+ inkscape:export-filename="/home/gonzalo/Proyectos/ecomundo/images/green4.png"
+ inkscape:export-xdpi="9"
+ inkscape:export-ydpi="9" />
+ <path
+ style="fill:#85cb48;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:1.30912936px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 339.6332,288.41855 C 337.83347,282.67157 327.55594,257.44748 335.23224,223.01065 C 342.53751,190.23833 349.90844,166.4479 375.90555,165.45842 C 397.82717,163.18989 341.08777,161.78469 323.49632,191.14527 C 293.99108,240.39025 313.94931,277.27269 311.99702,286.20041 C 310.7786,291.77225 339.27991,288.82245 339.6332,288.41855 z "
+ id="path2434"
+ sodipodi:nodetypes="cscssc"
+ inkscape:export-filename="/home/gonzalo/Proyectos/ecomundo/images/green4.png"
+ inkscape:export-xdpi="9"
+ inkscape:export-ydpi="9" />
+ </g>
+</svg>
diff --git a/images/rabbit.png b/images/rabbit.png
new file mode 100644
index 0000000..71252b2
--- /dev/null
+++ b/images/rabbit.png
Binary files differ
diff --git a/images/rabbit_f.png b/images/rabbit_f.png
new file mode 100644
index 0000000..655d225
--- /dev/null
+++ b/images/rabbit_f.png
Binary files differ
diff --git a/images/rabbit_m.png b/images/rabbit_m.png
new file mode 100644
index 0000000..985b0d2
--- /dev/null
+++ b/images/rabbit_m.png
Binary files differ
diff --git a/images/rabbit_small.png b/images/rabbit_small.png
new file mode 100644
index 0000000..5215ec0
--- /dev/null
+++ b/images/rabbit_small.png
Binary files differ
diff --git a/images/rabbit_small_f.png b/images/rabbit_small_f.png
new file mode 100644
index 0000000..dd7aa06
--- /dev/null
+++ b/images/rabbit_small_f.png
Binary files differ
diff --git a/images/rabbit_small_m.png b/images/rabbit_small_m.png
new file mode 100644
index 0000000..19ec748
--- /dev/null
+++ b/images/rabbit_small_m.png
Binary files differ
diff --git a/locale/es/LC_MESSAGES/org.laptop.sample.Ecomundo.mo b/locale/es/LC_MESSAGES/org.laptop.sample.Ecomundo.mo
new file mode 100644
index 0000000..1857442
--- /dev/null
+++ b/locale/es/LC_MESSAGES/org.laptop.sample.Ecomundo.mo
Binary files differ
diff --git a/locale/es/activity.linfo b/locale/es/activity.linfo
new file mode 100644
index 0000000..bde805d
--- /dev/null
+++ b/locale/es/activity.linfo
@@ -0,0 +1,2 @@
+[Activity]
+name = Ecomundo
diff --git a/po/Ecomundo.pot b/po/Ecomundo.pot
new file mode 100644
index 0000000..b7edddd
--- /dev/null
+++ b/po/Ecomundo.pot
@@ -0,0 +1,38 @@
+# SOME DESCRIPTIVE TITLE.
+# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
+# This file is distributed under the same license as the PACKAGE package.
+# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
+#
+#, fuzzy
+msgid ""
+msgstr ""
+"Project-Id-Version: PACKAGE VERSION\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2009-09-28 20:24-0300\n"
+"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
+"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
+"Language-Team: LANGUAGE <LL@li.org>\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=CHARSET\n"
+"Content-Transfer-Encoding: 8bit\n"
+
+#: activity/activity.info:2
+#: /home/gonzalo/Activities/Ecomundo.activity/ecomundoactivity.py:130
+msgid "Ecomundo"
+msgstr ""
+
+#: /home/gonzalo/Activities/Ecomundo.activity/ecomundoactivity.py:173
+msgid "Initial Values"
+msgstr ""
+
+#: /home/gonzalo/Activities/Ecomundo.activity/ecomundoactivity.py:178
+msgid "Green"
+msgstr ""
+
+#: /home/gonzalo/Activities/Ecomundo.activity/ecomundoactivity.py:187
+msgid "Rabbits"
+msgstr ""
+
+#: /home/gonzalo/Activities/Ecomundo.activity/ecomundoactivity.py:196
+msgid "Foxs"
+msgstr ""
diff --git a/po/POTFILES.in b/po/POTFILES.in
new file mode 100644
index 0000000..d8b523f
--- /dev/null
+++ b/po/POTFILES.in
@@ -0,0 +1,7 @@
+encoding: UTF-8
+Animals.py
+ecomundoactivity.py
+ecomundo.py
+glade_util.py
+Green.py
+World.py
diff --git a/po/es.mo b/po/es.mo
new file mode 100644
index 0000000..f74a8ea
--- /dev/null
+++ b/po/es.mo
Binary files differ
diff --git a/po/es.po b/po/es.po
new file mode 100644
index 0000000..182d530
--- /dev/null
+++ b/po/es.po
@@ -0,0 +1,38 @@
+# Spanish translations for PACKAGE package.
+# Copyright (C) 2009 THE PACKAGE'S COPYRIGHT HOLDER
+# This file is distributed under the same license as the PACKAGE package.
+# Gonzalo Odiard <godiard@gmail.com>, 2009.
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: PACKAGE VERSION\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2009-09-28 20:24-0300\n"
+"PO-Revision-Date: 2009-09-28 20:25-0300\n"
+"Last-Translator: Gonzalo Odiard <godiard@gmail.com>\n"
+"Language-Team: Spanish\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=ASCII\n"
+"Content-Transfer-Encoding: 8bit\n"
+"Plural-Forms: nplurals=2; plural=(n != 1);\n"
+
+#: activity/activity.info:2
+#: /home/gonzalo/Activities/Ecomundo.activity/ecomundoactivity.py:130
+msgid "Ecomundo"
+msgstr "Ecomundo"
+
+#: /home/gonzalo/Activities/Ecomundo.activity/ecomundoactivity.py:173
+msgid "Initial Values"
+msgstr "Valores Iniciales"
+
+#: /home/gonzalo/Activities/Ecomundo.activity/ecomundoactivity.py:178
+msgid "Green"
+msgstr "Pasto"
+
+#: /home/gonzalo/Activities/Ecomundo.activity/ecomundoactivity.py:187
+msgid "Rabbits"
+msgstr "Conejos"
+
+#: /home/gonzalo/Activities/Ecomundo.activity/ecomundoactivity.py:196
+msgid "Foxs"
+msgstr "Zorros"
diff --git a/setup.py b/setup.py
new file mode 100755
index 0000000..bd1e319
--- /dev/null
+++ b/setup.py
@@ -0,0 +1,5 @@
+#!/usr/bin/env python
+from sugar.activity import bundlebuilder
+if __name__ == "__main__":
+ bundlebuilder.start()
+