[gcompris/gcomprixogoo] Fixed frame counter.



commit d6b37daa8afc9bbfbd8b95a111572f0996564b14
Author: Bruno Coudoin <bruno coudoin free fr>
Date:   Mon Nov 23 23:54:27 2009 +0100

    Fixed frame counter.

 src/anim-activity/Timeline.py |   14 ++++++++++++++
 src/anim-activity/anim.py     |   23 ++++-------------------
 2 files changed, 18 insertions(+), 19 deletions(-)
---
diff --git a/src/anim-activity/Timeline.py b/src/anim-activity/Timeline.py
index 91de608..3ee8aee 100644
--- a/src/anim-activity/Timeline.py
+++ b/src/anim-activity/Timeline.py
@@ -41,6 +41,7 @@ class Timeline:
         self.current_time = 0
         self.lastmark = -1
 
+
     def hide(self):
         self.rootitem.props.visibility = goocanvas.ITEM_INVISIBLE
 
@@ -98,6 +99,16 @@ class Timeline:
             t += 1
 
 
+        # Frame Number
+        self.frame_counter = \
+            goocanvas.Text(
+            parent = self.anim.rootitem,
+            text = 0,
+            x = 43,
+            y = 460,
+            font = gcompris.skin.get_font("gcompris/board/medium"),
+            fill_color = "black")
+
         # Select the first item in the timeline
         self.current_time = 0
         self.select_it(self.selected)
@@ -139,6 +150,9 @@ class Timeline:
         # Let anim knows there is a new time set
         self.anim.doc.refresh(self.get_time())
 
+        self.frame_counter.set_properties(text = self.current_time)
+
+
     def lastmark_it(self, item):
         # Unmark previous mark
         if self.lastmark >= 0:
diff --git a/src/anim-activity/anim.py b/src/anim-activity/anim.py
index 21d93a9..4f404f3 100644
--- a/src/anim-activity/anim.py
+++ b/src/anim-activity/anim.py
@@ -131,14 +131,6 @@ class Gcompris_anim:
     self.drawing_area = [124.0, 20.0, gcompris.BOARD_WIDTH - 15, gcompris.BOARD_HEIGHT - 40]
     self.playing_area = [124.0, 20.0, gcompris.BOARD_WIDTH - 15, gcompris.BOARD_HEIGHT - 40]
 
-    # The frame counter
-    # TODO : check if used
-    self.item_frame_counter = []
-
-    # Not used for the moment in anim2
-    # TODO : fix that
-    #self.current_image = 0
-
     # Part of UI
     # The root items
     self.root_toolitem  = []
@@ -171,7 +163,9 @@ class Gcompris_anim:
     if self.gcomprisBoard.mode == 'draw':
       self.doc.timeline.hide()
 
-    self.color = Color(self.rootitem, self.drawing_area)
+    self.color_rootitem = goocanvas.Group(
+      parent =  self.gcomprisBoard.canvas.get_root_item())
+    self.color = Color(self.color_rootitem, self.drawing_area)
     self.color.draw()
 
     self.draw_drawing_area()
@@ -192,6 +186,7 @@ class Gcompris_anim:
     # Remove the root item removes all the others inside it
     gcompris.set_cursor(gcompris.CURSOR_DEFAULT);
     self.rootitem.remove()
+    self.color_rootitem.remove()
 
     del self.doc
 
@@ -668,16 +663,6 @@ class Gcompris_anim:
       height=34.0,
       )
 
-    # Image Number
-    self.item_frame_counter = \
-        goocanvas.Text(
-      parent = self.rootitem,
-      text = 1,
-      x = x_left + minibutton_width + 14,
-      y = y_top - 15,
-      font = gcompris.skin.get_font("gcompris/board/medium"),
-      fill_color = "white")
-
 
 class Document:
   """This holds everything releated to the animation itself"""



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