gcompris r3204 - in branches/gcomprixogoo: . src/anim-activity src/anim-activity/resources src/anim-activity/resources/anim src/hexagon-activity/resources



Author: bcoudoin
Date: Mon Jan  7 22:00:36 2008
New Revision: 3204
URL: http://svn.gnome.org/viewvc/gcompris?rev=3204&view=rev

Log:
merge of commit gcomprixo 3303, missing draw.svg icon in anim


Added:
   branches/gcomprixogoo/src/anim-activity/resources/Makefile.am
      - copied unchanged from r3203, /branches/gcomprixo/src/anim-activity/resources/Makefile.am
   branches/gcomprixogoo/src/anim-activity/resources/anim/
      - copied from r3203, /branches/gcomprixo/src/anim-activity/resources/anim/
   branches/gcomprixogoo/src/hexagon-activity/resources/Makefile.am
Modified:
   branches/gcomprixogoo/configure.in
   branches/gcomprixogoo/src/anim-activity/Makefile.am
   branches/gcomprixogoo/src/anim-activity/anim.py

Modified: branches/gcomprixogoo/configure.in
==============================================================================
--- branches/gcomprixogoo/configure.in	(original)
+++ branches/gcomprixogoo/configure.in	Mon Jan  7 22:00:36 2008
@@ -771,6 +771,8 @@
 src/gnumch-equality-activity/resources/gnumch/Makefile
 src/erase_clic-activity/Makefile
 src/anim-activity/Makefile
+src/anim-activity/resources/Makefile
+src/anim-activity/resources/anim/Makefile
 src/target-activity/Makefile
 src/target-activity/resources/Makefile
 src/target-activity/resources/target/Makefile

Modified: branches/gcomprixogoo/src/anim-activity/Makefile.am
==============================================================================
--- branches/gcomprixogoo/src/anim-activity/Makefile.am	(original)
+++ branches/gcomprixogoo/src/anim-activity/Makefile.am	Mon Jan  7 22:00:36 2008
@@ -1,4 +1,4 @@
-SUBDIRS = 
+SUBDIRS = resources
 
 pythondir = $(PYTHON_PLUGIN_DIR)
 

Modified: branches/gcomprixogoo/src/anim-activity/anim.py
==============================================================================
--- branches/gcomprixogoo/src/anim-activity/anim.py	(original)
+++ branches/gcomprixogoo/src/anim-activity/anim.py	Mon Jan  7 22:00:36 2008
@@ -587,13 +587,13 @@
 
           if not self.running:
             # unselect object if necessary
-            self.unselect()
+            self.anim_item_unselect()
 
             self.playing_start()
             return False
 
         elif (self.tools[tool][0] != "SELECT") and (self.selected != None):
-          self.unselect()
+          self.anim_item_unselect()
 
         #
         # Normal case, tool button switch
@@ -790,7 +790,7 @@
     run = \
       goocanvas.Image(
         parent = self.root_playingitem,
-      pixbuf = gcompris.utils.load_pixmap(gcompris.skin.image_to_skin("boardicons/draw.svg")),
+      pixbuf = gcompris.utils.load_pixmap("anim/draw.svg"),
       x = 16,
       y = 110,
       )
@@ -883,7 +883,7 @@
 
     if event.type == gtk.gdk.BUTTON_PRESS and event.button == 1:
       gcompris.sound.play_ogg("sounds/bleep.wav")
-      self.unselect()
+      self.anim_item_unselect()
 
     if self.tools[self.current_tool][0] == "CCW":
       if ((event.type == gtk.gdk.BUTTON_PRESS) and
@@ -944,9 +944,9 @@
         if self.draw_created_object:
           self.draw_created_object = False
           return True
+
         # activate the anchors
-        self.selected = item.get_property("parent")
-        self.selected.get_child(1).props.visibility = goocanvas.ITEM_VISIBLE
+        self.anim_item_select(item)
 
         return True
 
@@ -1742,9 +1742,6 @@
       anchor.connect("motion_notify_event", self.resize_item_event, anchor_type)
 
   def select_item(self, group):
-    if (self.selected != None):
-      self.unselect()
-
     # Deactivate old button
     self.old_tool_item.set_properties(pixbuf = gcompris.utils.load_pixmap(gcompris.skin.image_to_skin(self.tools[self.current_tool][1])))
 
@@ -1754,8 +1751,7 @@
     self.old_tool_item.set_properties(pixbuf = gcompris.utils.load_pixmap(gcompris.skin.image_to_skin(self.tools[self.current_tool][2])))
     gcompris.set_cursor(self.tools[self.current_tool][3]);
 
-    self.selected = group
-    self.selected.get_child(1).props.visibility = goocanvas.ITEM_VISIBLE
+    self.anim_item_select(group)
 
   def rotate_relative(self, item, angle):
     bounds = item.get_bounds()
@@ -1966,7 +1962,8 @@
         #delta = len(self.playing.get_n_children()) - z -1
         #if delta != 0:
         #  item.canvas_item.lower(delta)
-        item.canvas_item.set_transform(matrice)
+        if matrice:
+          item.canvas_item.set_transform(matrice)
         continue
       else:
         if modif.has_key('z'):
@@ -1980,7 +1977,8 @@
         if  modif.has_key('matrice'):
           matrice = modif['matrice']
           del modif['matrice']
-          item.canvas_item.set_transform(matrice)
+          if matrice:
+            item.canvas_item.set_transform(matrice)
         if len(modif) != 0:
           item.canvas_item.set_properties(**modif)
 
@@ -2031,12 +2029,18 @@
     self.timeout=gobject.timeout_add(1000/self.anim_speed, self.run_anim2)
 
 
-  def unselect(self):
+  def anim_item_select(self, item):
+    if (self.selected != None):
+      self.anim_item_unselect()
+
+    self.selected = item.get_property("parent")
+    self.selected.get_child(1).props.visibility = goocanvas.ITEM_VISIBLE
+
+  def anim_item_unselect(self):
     if not self.selected:
       return
     if ((gobject.type_name(self.selected.get_child(0))=="GooCanvasText")
-        and
-        (self.last_commit != None)):
+        and (self.last_commit != None)):
       #suppress preedit
       self.selected.get_child(0).set_properties(markup=self.last_commit)
       self.last_commit = None
@@ -2087,7 +2091,7 @@
   file = open(filename, 'wb')
 
   # Save the descriptif frame:
-  pickle.dump(fles.format_string['gcompris'],file,True)
+  pickle.dump(fles.format_string['gcompris'], file, True)
 
   # save the total of frames
   pickle.dump(fles.frames_total, file, True)
@@ -2123,7 +2127,7 @@
     list_frames = Sitem[1].keys()
     list_frames.sort()
     if ((Sitem[0] == 'TEXT') and (Sitem[1][list_frames[0]].has_key('anchor'))):
-        Sitem[1][list_frames[0]]['text-anchor']='middle'
+        Sitem[1][list_frames[0]]['text-anchor'] = 'middle'
         del Sitem[1][list_frames[0]]['anchor']
     list_to.append(Sitem)
 
@@ -2141,6 +2145,7 @@
     print 'Cannot load ', filename , " as a GCompris animation"
     return
 
+  print "file_to_anim2 A"
   if type(desc) == type('str'):
     # string
     if 'desc' != fles.format_string['gcompris']:
@@ -2161,13 +2166,16 @@
     # int
     fles.frames_total = desc
 
+  print "file_to_anim2 B"
   picklelist = pickle.load(file)
   file.close()
   list_restore(picklelist)
+  print "file_to_anim2 C"
 
 def list_restore(picklelist):
   global fles
 
+  print "list_restore"
   def update_anchors(item):
     global fles
 
@@ -2182,6 +2190,7 @@
 
     data = {}
     for prop in data_list[item.type]:
+      print prop
       data[prop] = item.canvas_item.get_property(prop)
 
     if item.type == 'LINE':
@@ -2195,6 +2204,7 @@
   fles.selected = None
 
   for item in fles.framelist:
+    print item
     try:
       # can have been removed before by a delete action. No matter
       item.canvas_item.get_property("parent").remove()
@@ -2205,6 +2215,8 @@
   fles.animlist=[]
 
   for Sitem in picklelist:
+    print "Sitem"
+    print Sitem
     AItem = fles.AnimItem()
     AItem.type = Sitem[0]
     AItem.frames_info = Sitem[1]
@@ -2215,7 +2227,7 @@
     for item in fles.animlist[:]:
       if fles.gcomprisBoard.mode == 'draw':
         item.z = fles.animlist.index(item)
-      restore_item( item, fles.current_frame, missing_images)
+      restore_item(item, fles.current_frame, missing_images)
 
   if missing_images:
     list_images = ''
@@ -2245,9 +2257,12 @@
 
 def restore_item(item, frame, missing):
   global fles
+
+  print "restore_item A"
   if not item.frames_info.has_key(frame):
     return
 
+  print "restore_item B"
   modif = item.frames_info[frame].copy()
 
   if modif.has_key('delete'):
@@ -2262,6 +2277,7 @@
   except:
     pass
 
+  print "restore_item C"
   # To be backward compatible, rename some properties
   if ( ((item.type == 'CIRCLE') or (item.type == 'FILL_CIRCLE')
         and (modif.has_key('x2'))) ):
@@ -2321,20 +2337,26 @@
       pixmap = gcompris.utils.load_pixmap(item.image_name)
       modif['pixbuf']= pixmap
 
+    print "restore_item D"
     newitemgroup = goocanvas.Group(
       parent = fles.root_anim,
         )
 
+    print modif
+    print "restore_item E %s" %(item.type,)
     item.canvas_item = fles.types[item.type](
       parent = newitemgroup,
       **modif)
+    print item.canvas_item
     item.canvas_item.set_data("AnimItem", item)
     fles.anchorize(newitemgroup)
     #delta = len(fles.root_anim.item_list) - item.z -1
     #if delta != 0:
     #  newitemgroup.lower(delta)
-    newitemgroup.set_transform(matrice)
+    if matrice:
+      newitemgroup.set_transform(matrice)
     fles.framelist.append(item)
+    print "restore_item F"
     return True
   else:
     if modif.has_key('z'):
@@ -2348,7 +2370,8 @@
     if  modif.has_key('matrice'):
       matrice = modif['matrice']
       del modif['matrice']
-      item.canvas_item.get_property("parent").set_transform(matrice)
+      if matrice:
+        item.canvas_item.get_property("parent").set_transform(matrice)
     if len(modif) != 0:
       # Bourrin: je supprime les ancres et je les remets apres les modifs
       # Pas envie de me faire ch*** a retraiter les resize et les move
@@ -2356,6 +2379,7 @@
       item.canvas_item.set_properties(**modif)
       #fles.anchorize(item.canvas_item.get_property("parent"))
     return True
+  print "restore_item END"
 
 def image_selected(image):
   #fles is used because self is not passed through callback

Added: branches/gcomprixogoo/src/hexagon-activity/resources/Makefile.am
==============================================================================
--- (empty file)
+++ branches/gcomprixogoo/src/hexagon-activity/resources/Makefile.am	Mon Jan  7 22:00:36 2008
@@ -0,0 +1 @@
+SUBDIRS = hexagon



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