[gcompris/gcomprixogoo] Improved the saving of text items. Sadly it does not work because



commit 75a523155c1ea38f22fdfa6c588c54890bd789f6
Author: Bruno Coudoin <bruno coudoin free fr>
Date:   Sun Nov 8 01:39:36 2009 +0100

    Improved the saving of text items. Sadly it does not work because
    it seems like my goocanvas version does not report the text items content properly when
    it has been updated.

 src/anim-activity/AnimItem.py |   12 ++++++------
 src/anim-activity/anim.py     |    1 -
 2 files changed, 6 insertions(+), 7 deletions(-)
---
diff --git a/src/anim-activity/AnimItem.py b/src/anim-activity/AnimItem.py
index 1f06d53..2678c39 100644
--- a/src/anim-activity/AnimItem.py
+++ b/src/anim-activity/AnimItem.py
@@ -71,12 +71,16 @@ class AnimItem:
     # excactly. This code transform the matrix as a regular
     # python list.
     def matrixDump(self, m):
+        if not m:
+            return None
         return [m[0],m[1],m[2],m[3],m[4],m[5]]
 
     # Sadly matrix are not saved by pickle, don't know why
     # excactly. This code transform a python list to
     # a cairo matrix.
     def matrixRestore(self, m):
+        if not m:
+            return None
         return cairo.Matrix(m[0], m[1], m[2],
                             m[3], m[4], m[5])
 
@@ -934,11 +938,6 @@ class AnimItemPixmap(AnimItem):
                                  y = y1,
                                  width = abs(x2-x1),
                                  height = abs(y2-y1) )
-#        sx = (x2 - x1) / (bounds.x2 - bounds.x1)
-#        sy = (y2 - y1) / (bounds.y2 - bounds.y1)
-#        print "sx=%f sy=%f" %(self.sx * sx, self.sy * sy)
-#        self.item.scale(2.0, 2.0)
-
 
     def get_x1y1(self):
         x = self.item.get_property("x")
@@ -1071,7 +1070,8 @@ class AnimItemText(AnimItem):
         AnimItem.restore(self, anim_)
         self.item = \
             goocanvas.Text(
-                parent = self.rootitem
+                parent = self.rootitem,
+                font = "Sans " + str(self.text_size),
                 )
         AnimItem.init_item(self)
 
diff --git a/src/anim-activity/anim.py b/src/anim-activity/anim.py
index c5f44bc..bf4141c 100644
--- a/src/anim-activity/anim.py
+++ b/src/anim-activity/anim.py
@@ -344,7 +344,6 @@ class Gcompris_anim:
         gcompris.sound.play_ogg("sounds/bleep.wav")
         # Some button have instant effects
         if (self.tools[tool][0] == "SAVE"):
-          print "SAVE"
           gcompris.file_selector_save( self.gcomprisBoard,
                                        self.selector_section, self.file_type,
                                        general_save, self)



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]