[gcompris] lang activity: added a background.



commit e3244ebb043f275bd9e8720eed7d181d4ddcf26d
Author: Bruno Coudoin <bcoudoin gcompris net>
Date:   Sun Jun 23 22:41:23 2013 +0200

    lang activity: added a background.
    
    The background come from openclipart.

 src/lang-activity/lang.py                        |   22 ++++++++++++++++++----
 src/lang-activity/langEnterText.py               |   17 ++++++++++++++---
 src/lang-activity/langFindit.py                  |    6 +++---
 src/lang-activity/resources/lang/Makefile.am     |    1 +
 src/lang-activity/resources/lang/background.svgz |  Bin 0 -> 25874 bytes
 5 files changed, 36 insertions(+), 10 deletions(-)
---
diff --git a/src/lang-activity/lang.py b/src/lang-activity/lang.py
index 5ef04a1..4b9a6ee 100644
--- a/src/lang-activity/lang.py
+++ b/src/lang-activity/lang.py
@@ -67,7 +67,8 @@ class Gcompris_lang:
     gcompris.bar_location(gcompris.BOARD_WIDTH / 2 - 100, -1, 0.6)
 
     # Set a background image
-    gcompris.set_default_background(self.gcomprisBoard.canvas.get_root_item())
+    gcompris.set_background(self.gcomprisBoard.canvas.get_root_item(),
+                            "lang/background.svgz")
 
     # 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
@@ -247,8 +248,8 @@ class Gcompris_lang:
       y = 10,
       width = gcompris.BOARD_WIDTH - 40,
       height = 65,
-      fill_color_rgba = 0x6666FF33L,
-      stroke_color_rgba = 0x1111FFAAL,
+      fill_color_rgba = 0xAAAAAA99L,
+      stroke_color_rgba = 0x111111AAL,
       line_width = 2.0,
       radius_x = 3,
       radius_y = 3)
@@ -298,6 +299,19 @@ class Gcompris_lang:
       )
 
     # The triplet area
+    w = 400
+    h = 300
+    goocanvas.Rect(
+      parent = self.lessonroot,
+      x = (gcompris.BOARD_WIDTH - w) / 2,
+      y = (gcompris.BOARD_HEIGHT - h) / 2,
+      width = w,
+      height = h + 50,
+      fill_color_rgba = 0xCECECECCL,
+      stroke_color_rgba = 0x111111CCL,
+      line_width = 2.0,
+      radius_x = 3,
+      radius_y = 3)
     self.imageitem = goocanvas.Image( parent = self.lessonroot )
     self.imageitem.connect("button_press_event", self.next_event, None)
     self.descriptionitem = goocanvas.Text(
@@ -334,7 +348,7 @@ class Gcompris_lang:
     # We will run the exercise 3 times in different modes
     self.currentExerciseModes = [ ["findit",Findit.WITH_QUESTION|Findit.WITH_TEXT|Findit.WITH_IMAGE],
                                   ["findit", Findit.WITH_QUESTION|Findit.WITH_IMAGE],
-                                  ["findit", Findit.WITH_IMAGE],                                  
+                                  ["findit", Findit.WITH_IMAGE],
                                   ["text", EnterText.WITH_TEXT|EnterText.WITH_IMAGE]
                                   ]
     self.currentExerciseModes.reverse()
diff --git a/src/lang-activity/langEnterText.py b/src/lang-activity/langEnterText.py
index 533d82e..7720f21 100644
--- a/src/lang-activity/langEnterText.py
+++ b/src/lang-activity/langEnterText.py
@@ -104,6 +104,17 @@ class EnterText:
         if self.mode & EnterText.WITH_IMAGE:
           pixbuf = gcompris.utils.load_pixmap(gcompris.DATA_DIR + "/" +
                                               self.tripletToFind.image)
+          goocanvas.Rect(
+              parent = self.gameroot,
+              x = gcompris.BOARD_WIDTH / 2 - pixbuf.get_width() / 2,
+              y = 10,
+              width = pixbuf.get_width(),
+              height = pixbuf.get_height() + 50,
+              fill_color_rgba = 0xCECECECCL,
+              stroke_color_rgba = 0x111111CCL,
+              line_width = 2.0,
+              radius_x = 3,
+              radius_y = 3)
           item = goocanvas.Image( parent = self.gameroot,
                                   pixbuf = pixbuf,
                                   x = gcompris.BOARD_WIDTH / 2 - pixbuf.get_width() / 2,
@@ -144,8 +155,8 @@ class EnterText:
           y = y + 20,
           width = width,
           height = 40,
-          fill_color_rgba = 0x6666FF33L,
-          stroke_color_rgba = 0x1111FFAAL,
+          fill_color_rgba = 0xEEEEEECCL,
+          stroke_color_rgba = 0x111111CCL,
           line_width = 2.0,
           radius_x = 5,
           radius_y = 10)
@@ -214,7 +225,7 @@ class EnterText:
 
     def repeat(self):
       self.lang.playVoice(self.tripletToFind)
-  
+
     def key_press(self, keyval, commit_str, preedit_str):
 
       if keyval == gtk.keysyms.KP_Enter or keyval == gtk.keysyms.Return:
diff --git a/src/lang-activity/langFindit.py b/src/lang-activity/langFindit.py
index 4da8d2f..167999c 100644
--- a/src/lang-activity/langFindit.py
+++ b/src/lang-activity/langFindit.py
@@ -37,8 +37,8 @@ class SpotTarget:
       self.width = 380
       self.height = 100
       # The background
-      fill_color_off = 0x33333366L
-      fill_color_on  = 0x99999966L
+      fill_color_off = 0xCCCCCCEEL
+      fill_color_on  = 0xEEEFFEEEL
       itembg = \
           goocanvas.Rect( parent = rootitem,
                           x = x,
@@ -47,7 +47,7 @@ class SpotTarget:
                           height = self.height,
                           radius_x = 5,
                           radius_y = 5,
-                          stroke_color_rgba = 0x666666FFL,
+                          stroke_color_rgba = 0x111111EEL,
                           fill_color_rgba = fill_color_off,
                           line_width = 2.0 )
       itembg.connect("button_press_event", callback, triplet)
diff --git a/src/lang-activity/resources/lang/Makefile.am b/src/lang-activity/resources/lang/Makefile.am
index 93227f6..d2ff779 100644
--- a/src/lang-activity/resources/lang/Makefile.am
+++ b/src/lang-activity/resources/lang/Makefile.am
@@ -16,6 +16,7 @@ $(xml_DATA): %.xml: %.xml.in
 
 imgdir = $(pkgdatadir)/@PACKAGE_DATA_DIR@/lang
 img_DATA = \
+       background.svgz \
        repeat.svg
 
 wordsimgdir = $(pkgdatadir)/@PACKAGE_DATA_DIR@/lang/words
diff --git a/src/lang-activity/resources/lang/background.svgz 
b/src/lang-activity/resources/lang/background.svgz
new file mode 100644
index 0000000..83fe832
Binary files /dev/null and b/src/lang-activity/resources/lang/background.svgz differ


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