[gcompris] lang activity, minor visual improvements.



commit 5666f8272f51a859d9e6e6a14515979b5d4b55fd
Author: Bruno Coudoin <bcoudoin gcompris net>
Date:   Sun Oct 20 17:15:51 2013 +0200

    lang activity, minor visual improvements.

 src/lang-activity/lang.py          |   37 ++++++++++++++++++++++--------
 src/lang-activity/langEnterText.py |   37 ++++++++++++++++++++++++-----
 src/lang-activity/langFindit.py    |   44 +++++++++++++++++++++++++++++++----
 3 files changed, 96 insertions(+), 22 deletions(-)
---
diff --git a/src/lang-activity/lang.py b/src/lang-activity/lang.py
index b3b68e9..065625e 100644
--- a/src/lang-activity/lang.py
+++ b/src/lang-activity/lang.py
@@ -64,7 +64,6 @@ class Gcompris_lang:
     handle = gcompris.utils.load_svg("lang/repeat.svg")
     gcompris.bar_set_repeat_icon(handle)
     gcompris.bar_set(gcompris.BAR_LEVEL|gcompris.BAR_REPEAT_ICON|gcompris.BAR_CONFIG)
-    gcompris.bar_location(gcompris.BOARD_WIDTH / 2 - 100, -1, 0.6)
 
     # Set a background image
     gcompris.set_background(self.gcomprisBoard.canvas.get_root_item(),
@@ -144,7 +143,10 @@ dialogue to\nenable the sound."), None)
     if self.currentExercise:
       self.currentExercise.repeat()
     else:
-      self.playVoice( self.currentLesson.getTriplets()[self.currentTripletId] )
+      try:
+        self.playVoice( self.currentLesson.getTriplets()[self.currentTripletId] )
+      except:
+        pass
 
   def init_config(self):
     default_config = { 'locale_sound' : 'NULL' }
@@ -277,8 +279,8 @@ dialogue to\nenable the sound."), None)
       x = gcompris.BOARD_WIDTH / 2,
       y = 40.0,
       text = gcompris.gcompris_gettext(lesson.name),
-      fill_color = "black",
       font = gcompris.skin.get_font("gcompris/title"),
+      fill_color = "white",
       anchor = gtk.ANCHOR_CENTER,
       alignment = pango.ALIGN_CENTER,
       width = 300
@@ -310,8 +312,8 @@ dialogue to\nenable the sound."), None)
       parent = self.lessonroot,
       x = gcompris.BOARD_WIDTH - 40,
       y = gcompris.BOARD_HEIGHT - 40,
-      fill_color = "black",
       font = gcompris.skin.get_font("gcompris/board/tiny"),
+      fill_color = "white",
       anchor = gtk.ANCHOR_CENTER,
       alignment = pango.ALIGN_CENTER
       )
@@ -322,21 +324,35 @@ dialogue to\nenable the sound."), None)
     goocanvas.Rect(
       parent = self.lessonroot,
       x = (gcompris.BOARD_WIDTH - w) / 2,
-      y = (gcompris.BOARD_HEIGHT - h) / 2 - 2,
+      y = (gcompris.BOARD_HEIGHT - h) / 2 - 20,
       width = w,
       height = h + 50,
-      fill_color_rgba = 0xCECECECCL,
+      fill_color_rgba = 0xCECECEAAL,
       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)
+
+    goocanvas.Rect(
+      parent = self.lessonroot,
+      x = (gcompris.BOARD_WIDTH - w) / 2,
+      y = (gcompris.BOARD_HEIGHT - h) / 2 - 10 + h,
+      width = w,
+      height = 40,
+      fill_color_rgba = 0x999999BBL,
+      stroke_color_rgba = 0x111111AAL,
+      line_width = 2.0,
+      radius_x = 3,
+      radius_y = 3)
+
+
     self.descriptionitem = goocanvas.Text(
       parent = self.lessonroot,
       x = gcompris.BOARD_WIDTH / 2,
-      y = gcompris.BOARD_HEIGHT - 80,
-      fill_color = "black",
+      y = gcompris.BOARD_HEIGHT - 100,
+      fill_color = "white",
       font = gcompris.skin.get_font("gcompris/subtitle"),
       anchor = gtk.ANCHOR_CENTER,
       alignment = pango.ALIGN_CENTER,
@@ -394,7 +410,7 @@ dialogue to\nenable the sound."), None)
     center_y =  pixbuf.get_height()/2
     self.imageitem.set_properties(pixbuf = pixbuf,
                                   x = gcompris.BOARD_WIDTH  / 2 - center_x,
-                                  y = gcompris.BOARD_HEIGHT / 2 - center_y )
+                                  y = gcompris.BOARD_HEIGHT / 2 - center_y - 18)
 
   def previous_event(self, event=None, target=None, item=None, dummy=None):
     self.currentTripletId -= 1
@@ -440,7 +456,8 @@ class TextButton:
             width=width,
             text=text,
             font = gcompris.skin.get_font("gcompris/board/small"),
-            fill_color="white", anchor=gtk.ANCHOR_CENTER,
+            fill_color="white",
+            anchor=gtk.ANCHOR_CENTER,
             alignment=pango.ALIGN_CENTER,
             pointer_events="GOO_CANVAS_EVENTS_NONE"
             )
diff --git a/src/lang-activity/langEnterText.py b/src/lang-activity/langEnterText.py
index d172d86..29d4f09 100644
--- a/src/lang-activity/langEnterText.py
+++ b/src/lang-activity/langEnterText.py
@@ -42,7 +42,7 @@ class TextEntry:
         parent = rootitem,
         x = x,
         y = y,
-        fill_color = "black",
+        fill_color = "white",
         font = gcompris.skin.get_font("gcompris/subtitle"),
         text = text,
         anchor = gtk.ANCHOR_CENTER,
@@ -104,6 +104,7 @@ 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,
@@ -122,16 +123,26 @@ class EnterText:
                                   )
 
         y = 380
-        goocanvas.Text(
+        backItem = goocanvas.Rect(
+          parent = self.gameroot,
+          fill_color_rgba = 0x999999BBL,
+          line_width = 0.0)
+
+        textItem = goocanvas.Text(
           parent = self.gameroot,
           x = gcompris.BOARD_WIDTH / 2,
           y = y,
-          fill_color = "black",
+          fill_color = "white",
           font = gcompris.skin.get_font("gcompris/subtitle"),
           anchor = gtk.ANCHOR_CENTER,
           alignment = pango.ALIGN_CENTER,
           text = _("Enter the text you hear:")
           )
+        bounds = textItem.get_bounds()
+        backItem.props.x = bounds.x1
+        backItem.props.y = bounds.y1
+        backItem.props.width = bounds.x2 - bounds.x1
+        backItem.props.height = bounds.y2 - bounds.y1
 
         extraCharAllowed = 5
         width = (len(self.tripletToFind.descriptionTranslated) + extraCharAllowed) * 20
@@ -141,8 +152,8 @@ class EnterText:
           y = y + 20,
           width = width,
           height = 40,
-          fill_color_rgba = 0xEEEEEECCL,
-          stroke_color_rgba = 0x111111CCL,
+          fill_color_rgba = 0x999999CCL,
+          stroke_color_rgba = 0x111111AAL,
           line_width = 2.0,
           radius_x = 5,
           radius_y = 10)
@@ -155,11 +166,23 @@ class EnterText:
 
         self.errorCount = 0
         if self.mode & EnterText.WITH_TEXT:
+          goocanvas.Rect(
+            parent = self.gameroot,
+            x = gcompris.BOARD_WIDTH / 2 - pixbuf.get_width() / 2,
+            y = 10,
+            width = pixbuf.get_width(),
+            height = 60,
+            fill_color_rgba = 0x999999BBL,
+            stroke_color_rgba = 0x11111111L,
+            line_width = 2.0,
+            radius_x = 3,
+            radius_y = 3)
+
           self.questionItem = goocanvas.Text(
             parent = self.gameroot,
             x = gcompris.BOARD_WIDTH / 2,
-            y = 40,
-            fill_color = "black",
+            y = 35,
+            fill_color = "white",
             font = gcompris.skin.get_font("gcompris/subtitle"),
             anchor = gtk.ANCHOR_CENTER,
             alignment = pango.ALIGN_CENTER,
diff --git a/src/lang-activity/langFindit.py b/src/lang-activity/langFindit.py
index 167999c..7624eec 100644
--- a/src/lang-activity/langFindit.py
+++ b/src/lang-activity/langFindit.py
@@ -61,16 +61,37 @@ class SpotTarget:
       # The text description
       textx = 120
       if mode & Findit.WITH_TEXT:
-        item = goocanvas.Text(
+
+        item = goocanvas.Rect(
           parent = rootitem,
           x = x + textx,
+          y = y,
+          width = self.width - textx,
+          height = self.height,
+          fill_color_rgba = 0x999999BBL,
+          stroke_color_rgba = 0x11111111L,
+          line_width = 2.0,
+          radius_x = 3,
+          radius_y = 3)
+
+        item.connect("button_press_event", callback, triplet)
+        item.connect("enter_notify_event",
+                     (lambda s,e,t,i: i.set_properties(fill_color_rgba = fill_color_on)),
+                     itembg )
+        item.connect("leave_notify_event",
+                     (lambda s,e,t,i: i.set_properties(fill_color_rgba = fill_color_off)),
+                     itembg )
+
+        item = goocanvas.Text(
+          parent = rootitem,
+          x = x + textx + 5,
           y = y + 10,
-          fill_color = "black",
+          fill_color = "white",
           font = gcompris.skin.get_font("gcompris/subtitle"),
           text = triplet.descriptionTranslated,
           anchor = gtk.ANCHOR_NW,
           alignment = pango.ALIGN_LEFT,
-          width = self.width - textx - 10
+          width = self.width - textx - 15
           )
         item.connect("button_press_event", callback, triplet)
         item.connect("enter_notify_event",
@@ -133,12 +154,25 @@ class Findit:
         self.currentIndex += 1
         # Display the triplet to find
         if self.mode & Findit.WITH_QUESTION:
+
+          goocanvas.Rect(
+            parent = self.gameroot,
+            x = gcompris.BOARD_WIDTH / 4,
+            y = 75,
+            width = gcompris.BOARD_WIDTH / 2,
+            height = 50,
+            fill_color_rgba = 0x999999BBL,
+            stroke_color_rgba = 0x111111AAL,
+            line_width = 2.0,
+            radius_x = 3,
+            radius_y = 3)
+
           goocanvas.Text(
             parent = self.gameroot,
             x = gcompris.BOARD_WIDTH / 2,
             y = 100,
-            fill_color = "black",
-            font = gcompris.skin.get_font("gcompris/subtitle"),
+            fill_color = "white",
+            font = gcompris.skin.get_font("gcompris/title"),
             text = self.tripletToFind.descriptionTranslated,
             anchor = gtk.ANCHOR_CENTER,
             alignment = pango.ALIGN_CENTER,


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