gcompris r3273 - in branches/gcomprixogoo/src: algorithm-activity gcompris searace-activity



Author: bcoudoin
Date: Mon Feb 25 00:26:18 2008
New Revision: 3273
URL: http://svn.gnome.org/viewvc/gcompris?rev=3273&view=rev

Log:
improved bar management. searace works better but incomplete yet


Modified:
   branches/gcomprixogoo/src/algorithm-activity/algorithm.py
   branches/gcomprixogoo/src/gcompris/bar.c
   branches/gcomprixogoo/src/searace-activity/searace.py

Modified: branches/gcomprixogoo/src/algorithm-activity/algorithm.py
==============================================================================
--- branches/gcomprixogoo/src/algorithm-activity/algorithm.py	(original)
+++ branches/gcomprixogoo/src/algorithm-activity/algorithm.py	Mon Feb 25 00:26:18 2008
@@ -50,7 +50,6 @@
   def __init__(self, gcomprisBoard):
     self.gcomprisBoard = gcomprisBoard
     self.anzahl = 8
-    print("Gcompris_algorithm __init__.")
     self.algos = [algo, algo1, algo2, algo3]
     self.rootitem = None
     self.distance = 80
@@ -87,14 +86,12 @@
       INTERP_BILINEAR))
      del pixbuf2
     self.display_current_level()
-    print("Gcompris_algorithm start.")
 
   def end(self):
     self.cleanup()
-    print("Gcompris_algorithm end.")
 
   def ok(self):
-    print("Gcompris_algorithm ok.")
+    pass
 
   # Called by gcompris core
   def pause(self, pause):
@@ -137,6 +134,7 @@
     for i in range(len(self.symbollist)):
      s = self.paint_image(i ,i ,390)
      s.connect ("button_press_event", self.apple_click, i)
+     gcompris.utils.item_focus_init(s, None)
 
     # Display the algorithm
     self.algo = random.choice(self.algos)
@@ -169,7 +167,8 @@
     self.qm = goocanvas.Text(parent = self.rootitem,
                              text = "?",
                              x = self.place*self.distance+30+self.leftx,
-                             y = 185, fill_color_rgba = 0x000000ffL,
+                             y = 170,
+                             fill_color_rgba = 0x000000ffL,
                              font = gcompris.skin.get_font("gcompris/board/huge bold"))
 
   def key_press(self, keyval, commit_str, preedit_str):

Modified: branches/gcomprixogoo/src/gcompris/bar.c
==============================================================================
--- branches/gcomprixogoo/src/gcompris/bar.c	(original)
+++ branches/gcomprixogoo/src/gcompris/bar.c	Mon Feb 25 00:26:18 2008
@@ -306,6 +306,7 @@
 {
 
   _hidden = FALSE;
+  goo_canvas_item_raise(rootitem, NULL);
 
   /* Non yet initialized : Something Wrong */
   if(level_item==NULL)
@@ -432,15 +433,15 @@
 _bar_up()
 {
   goo_canvas_item_raise(rootitem, NULL);
-      goo_canvas_item_animate(rootitem,
-			      0,
-			      BOARDHEIGHT - BARHEIGHT,
-			      1,
-			      0,
-			      TRUE,
-			      700,
-			      80,
-			      GOO_CANVAS_ANIMATE_FREEZE);
+  goo_canvas_item_animate(rootitem,
+			  0,
+			  BOARDHEIGHT - BARHEIGHT,
+			  1,
+			  0,
+			  TRUE,
+			  700,
+			  80,
+			  GOO_CANVAS_ANIMATE_FREEZE);
 }
 
 /* Hide all icons in the control bar

Modified: branches/gcomprixogoo/src/searace-activity/searace.py
==============================================================================
--- branches/gcomprixogoo/src/searace-activity/searace.py	(original)
+++ branches/gcomprixogoo/src/searace-activity/searace.py	Mon Feb 25 00:26:18 2008
@@ -106,16 +106,6 @@
 
     self.board_paused = False
 
-    pixmap = gcompris.utils.load_pixmap(gcompris.skin.image_to_skin("button_reload.png"))
-    if(pixmap):
-      gcompris.bar_set_repeat_icon(pixmap)
-      gcompris.bar_set(gcompris.BAR_OK|gcompris.BAR_LEVEL|gcompris.BAR_REPEAT_ICON)
-    else:
-      gcompris.bar_set(gcompris.BAR_OK|gcompris.BAR_LEVEL|gcompris.BAR_REPEAT);
-
-
-    gcompris.bar_set_level(self.gcomprisBoard)
-
     # Create our rootitem. We put each canvas item in it so at the end we
     # only have to kill it. The canvas deletes all the items it contains automaticaly.
     self.rootitem = goocanvas.Group(parent =  self.gcomprisBoard.canvas.get_root_item())
@@ -140,7 +130,15 @@
     # And finaly the players boats
     self.init_boats()
 
-    #print("Gcompris_searace start.")
+    pixmap = gcompris.utils.load_pixmap(gcompris.skin.image_to_skin("button_reload.png"))
+    if(pixmap):
+      gcompris.bar_set_repeat_icon(pixmap)
+      gcompris.bar_set(gcompris.BAR_OK|gcompris.BAR_LEVEL|gcompris.BAR_REPEAT_ICON)
+    else:
+      gcompris.bar_set(gcompris.BAR_OK|gcompris.BAR_LEVEL|gcompris.BAR_REPEAT);
+
+
+    gcompris.bar_set_level(self.gcomprisBoard)
 
 
   def end(self):
@@ -160,11 +158,11 @@
     # There is a problem with GTK widgets, they are not covered by the help
     # We hide/show them here
     if(pause):
-      self.left_boat.sw.props.hide()
-      self.right_boat.sw.props.hide()
+      self.left_boat.sw.hide()
+      self.right_boat.sw.hide()
     else:
-      self.left_boat.sw.props.visibility = goocanvas.ITEM_VISIBLE
-      self.right_boat.sw.props.visibility = goocanvas.ITEM_VISIBLE
+      self.left_boat.sw.show()
+      self.right_boat.sw.show()
       self.repeat()
 
     return
@@ -397,8 +395,8 @@
     self.left_boat.sw.set_shadow_type(gtk.SHADOW_ETCHED_OUT)
 
     w = 250.0
-    h = 100.0
-    y = 400.0 # The upper limit of the text boxes
+    h = 90.0
+    y = 350.0 # The upper limit of the text boxes
     x_left  = gcompris.BOARD_WIDTH/4 - 30
     x_right = (gcompris.BOARD_WIDTH/4)*3 + 30
 
@@ -903,13 +901,13 @@
         y = by + math.sin(a_pi)*step_x
 
         # Manage the wrapping
-        line_style = gtk.gdk.LINE_SOLID
-        if(y<self.sea_area[1]):
+        line_style = goocanvas.LineDash([1.0])
+        if(y < self.sea_area[1]):
           y = self.sea_area[3] - (self.sea_area[1]-y)
-          line_style = gtk.gdk.LINE_DOUBLE_DASH
+          line_style = goocanvas.LineDash([5.0, 1.0, 5.0])
         elif(y>self.sea_area[3]):
           y = self.sea_area[1] + (y - self.sea_area[3])
-          line_style = gtk.gdk.LINE_DOUBLE_DASH
+          line_style = goocanvas.LineDash([5.0, 1.0, 5.0])
 
         # Find shortest path to previous calculated point
         condition = self.get_absolute_weather_condition(x, y)
@@ -919,13 +917,13 @@
           coord = (x, y, boat_angle, step_x, line_style) # x y angle distance line_style
 
       # ----------
-      self.root_weather_item.add(
-        goocanvas.Polyline,
-        points = goocanvas.Points([(bx, by), (coord[0], coord[1])]),
-        stroke_color_rgba=0x00CC00FFL,
-        line_width=2.0,
-        line_style=coord[4]
-        )
+        goocanvas.Polyline(
+          parent = self.root_weather_item,
+          points = goocanvas.Points([(bx, by), (coord[0], coord[1])]),
+          stroke_color_rgba = 0x00CC00FFL,
+          line_width = 2.0,
+          line_dash = coord[4]
+          )
       bx = coord[0]
       by = coord[1]
       ba = coord[2]



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