Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlan Aguiar <alanjas@hotmail.com>2013-12-26 13:22:08 (GMT)
committer Alan Aguiar <alanjas@hotmail.com>2013-12-26 13:22:08 (GMT)
commitb449b0e6e42f40db838c885e8fe8ad432ff49f41 (patch)
tree5b9798a326255ba44936529331ac8c922cd4e4c6
parentb59ddcaeecb413c08777c2288204954544bc807c (diff)
fix scale export problemsHEADmaster
-rwxr-xr-xactivity.py13
-rwxr-xr-xconozco.py10
-rw-r--r--save_util.py17
3 files changed, 32 insertions, 8 deletions
diff --git a/activity.py b/activity.py
index fff88b9..10323e7 100755
--- a/activity.py
+++ b/activity.py
@@ -17,7 +17,7 @@ from gettext import gettext as _
import sugargame.canvas
import conozco
from points_list import Data
-from save_util import save
+from save_util import save, fixValues
class Activity(activity.Activity):
@@ -96,17 +96,12 @@ class Activity(activity.Activity):
self.table.attach(self.box1, 0, 1, 0, 1)
self.table.attach(self.box2, 1, 2, 0, 1)
-
self.labels_and_values = Data(self)
-
self.labels_and_values.connect("some-changed", self._some_changed)
-
-
self.box2.add(self.labels_and_values)
self.set_canvas(self.table)
-
def run_canvas(self):
self._pygamecanvas = sugargame.canvas.PygameCanvas(self)
self.box1.add(self._pygamecanvas)
@@ -116,7 +111,11 @@ class Activity(activity.Activity):
def _save(self, widget):
l = self.labels_and_values.get_info()
- save(l)
+ scale = self.actividad.getScale()
+ shiftx = self.actividad.getShiftX()
+ shifty = self.actividad.getShiftY()
+ ready = fixValues(l, scale, shiftx, shifty)
+ save(ready)
def _new_picture(self, widget):
try:
diff --git a/conozco.py b/conozco.py
index 75ac5b8..20aebee 100755
--- a/conozco.py
+++ b/conozco.py
@@ -491,7 +491,15 @@ class Conozco():
pos_c = (x - 8, y - 8)
self.showName(name, pos_n, self.fuente9)
self.pantalla.blit(self.simboloCiudad, pos_c)
-
+
+ def getScale(self):
+ return scale
+
+ def getShiftX(self):
+ return shift_x
+
+ def getShiftY(self):
+ return shift_y
def principal(self):
"""Este es el loop principal del juego"""
diff --git a/save_util.py b/save_util.py
index b95e0e7..86b343c 100644
--- a/save_util.py
+++ b/save_util.py
@@ -11,6 +11,10 @@ def save(l):
f.write("\n")
f.write("from gettext import gettext as _\n")
f.write("\n")
+ f.write("NAME = _('Place')\n")
+ f.write("\n")
+ f.write("STATES = []\n")
+ f.write("\n")
f.write("CITIES = [\n")
first = True
for r in l:
@@ -27,3 +31,16 @@ def save(l):
f.write('\n')
f.write(']')
f.close()
+
+
+def fixValues(data, scale, shift_x, shift_y):
+ l = []
+ for e in data:
+ name = e[0]
+ pos_x = int((e[1] - shift_x) / scale)
+ pos_y = int((e[2] - shift_y) / scale)
+ dx = e[3]
+ dy = e[4]
+ l.append((name, pos_x, pos_y, dx, dy))
+ return l
+