[gcompris/gcomprisbraille] Created a BrailleMap class|Changed the text to black



commit 22437281493f3dd69d28f7fc535f4443334e48cb
Author: Srishti Sethi <srishakatux gmail com>
Date:   Tue Jul 12 11:31:50 2011 +0530

    Created a BrailleMap class|Changed the text to black

 src/braille_alphabets-activity/BrailleMap.py       |   61 ++++++++++++++++++++
 .../braille_alphabets.py                           |   34 ++---------
 src/braille_lotto-activity/braille_lotto.py        |    6 +-
 src/dicey_dicey-activity/dicey_dicey.py            |    5 +-
 src/rhymes_riddles-activity/rhymes_riddles.py      |    8 +--
 5 files changed, 74 insertions(+), 40 deletions(-)
---
diff --git a/src/braille_alphabets-activity/BrailleMap.py b/src/braille_alphabets-activity/BrailleMap.py
new file mode 100644
index 0000000..64a8f60
--- /dev/null
+++ b/src/braille_alphabets-activity/BrailleMap.py
@@ -0,0 +1,61 @@
+#  gcompris - BrailleMap.py
+#
+# Copyright (C) 2011 xxxx
+#
+#   This program is free software; you can redistribute it and/or modify
+#   it under the terms of the GNU General Public License as published by
+#   the Free Software Foundation; either version 3 of the License, or
+#   (at your option) any later version.
+#
+#   This program is distributed in the hope that it will be useful,
+#   but WITHOUT ANY WARRANTY; without even the implied warranty of
+#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#   GNU General Public License for more details.
+#
+#   You should have received a copy of the GNU General Public License
+#   along with this program; if not, see <http://www.gnu.org/licenses/>.
+#
+# This class display a braille char to a given location
+# The char may be static of dynamic. It maintains the value
+# of the dots and the char it represents in real time.
+#
+import gtk
+import gtk.gdk
+import gcompris
+import gcompris.utils
+import gcompris.skin
+import goocanvas
+import pango
+from BrailleChar import *
+from gcompris import gcompris_gettext as _
+
+SYMBOL = ['+','_','*','/']
+CELL_WIDTH = 30
+
+class BrailleMap:
+  """Braille Map"""
+  def __init__(self, rootitem, color_on, color_off, circle_fill, circle_stroke):
+
+      #Place alphabets & numbers in array format
+      for index, letter in enumerate(string.ascii_uppercase[:10]):
+          BrailleChar(rootitem, index*(CELL_WIDTH+40)+60,
+                              40, 38, letter ,color_on, color_off, circle_fill,
+                              circle_stroke,True ,False ,True , None)
+      for index, letter in enumerate(string.ascii_uppercase[10:20]):
+          BrailleChar(rootitem, index*(CELL_WIDTH+40)+60,
+                              130, 38, letter ,color_on, color_off, circle_fill,
+                              circle_stroke,True ,False ,True , None)
+      for index, letter in enumerate(string.ascii_uppercase[20:25]):
+          BrailleChar(rootitem, index*(CELL_WIDTH+40)+60,
+                              220, 38, letter ,color_on, color_off, circle_fill,
+                              circle_stroke,True ,False ,True , None)
+      BrailleChar(rootitem,60, 310, 38, "#",color_on, color_off, circle_fill,
+                              circle_stroke,True ,False ,True , None)
+      for index in range(10):
+          BrailleChar(rootitem,(index+1) *(CELL_WIDTH + 33)+60,
+                             310, 38, index ,color_on, color_off, circle_fill,
+                              circle_stroke,True ,False ,True , None)
+      for index in range(4):
+          BrailleChar(rootitem,index * (CELL_WIDTH + 40) + 60,
+                              400 , 38,SYMBOL[index],color_on, color_off, circle_fill,
+                              circle_stroke,True ,False ,True , None)
\ No newline at end of file
diff --git a/src/braille_alphabets-activity/braille_alphabets.py b/src/braille_alphabets-activity/braille_alphabets.py
index 09f58f7..b611528 100644
--- a/src/braille_alphabets-activity/braille_alphabets.py
+++ b/src/braille_alphabets-activity/braille_alphabets.py
@@ -29,12 +29,15 @@ import string
 import random
 from gcompris import gcompris_gettext as _
 from BrailleChar import *
+from BrailleMap import *
 
 CELL_WIDTH = 30
 COLOR_ON = 0xFF0000FFL
 COLOR_OFF = 0X00000000L
 CIRCLE_FILL = "#DfDfDf"
 CIRCLE_STROKE = "blue"
+MAP_STROKE = "black"
+MAP_FILL = "light blue"
 
 braille_desc = {'intro' : "A system of writing for the blinds that \n"
                 "uses characters made of raised dots. \n\n"
@@ -113,7 +116,7 @@ class Gcompris_braille_alphabets:
                                    self.gcomprisBoard.canvas.get_root_item())
           gcompris.set_default_background(self.gcomprisBoard.canvas.get_root_item())
 
-          self.Braille_Map(self.rootitem, COLOR_ON, COLOR_OFF,CIRCLE_FILL, CIRCLE_STROKE)
+          map_obj = BrailleMap(self.rootitem, COLOR_ON, COLOR_OFF,MAP_FILL, MAP_STROKE)
           #Move back item
           self.backitem = goocanvas.Image(parent = self.rootitem,
                     pixbuf = gcompris.utils.load_pixmap("braille_alphabets/back.png"),
@@ -320,31 +323,4 @@ class Gcompris_braille_alphabets:
 
 
   def letter_change(self,letter):
-      self.correct_letter = letter
-
-  def Braille_Map(self, rootitem, color_on, color_off, circle_fill, circle_stroke):
-      SYMBOL = ['+','_','*','/']
-      #Place alphabets & numbers in array format
-
-      for index, letter in enumerate(string.ascii_uppercase[:10]):
-          BrailleChar(rootitem, index*(CELL_WIDTH+40)+60,
-                              40, 38, letter ,color_on, color_off, circle_fill,
-                              circle_stroke,True ,False ,True , None)
-      for index, letter in enumerate(string.ascii_uppercase[10:20]):
-          BrailleChar(rootitem, index*(CELL_WIDTH+40)+60,
-                              130, 38, letter ,color_on, color_off, circle_fill,
-                              circle_stroke,True ,False ,True , None)
-      for index, letter in enumerate(string.ascii_uppercase[20:25]):
-          BrailleChar(rootitem, index*(CELL_WIDTH+40)+60,
-                              220, 38, letter ,color_on, color_off, circle_fill,
-                              circle_stroke,True ,False ,True , None)
-      BrailleChar(rootitem,60, 310, 38, "#",color_on, color_off, circle_fill,
-                              circle_stroke,True ,False ,True , None)
-      for index in range(10):
-          BrailleChar(rootitem,(index+1) *(CELL_WIDTH + 33)+60,
-                             310, 38, index ,color_on, color_off, circle_fill,
-                              circle_stroke,True ,False ,True , None)
-      for index in range(4):
-          BrailleChar(rootitem,index * (CELL_WIDTH + 40) + 60,
-                              400 , 38,SYMBOL[index],color_on, color_off, circle_fill,
-                              circle_stroke,True ,False ,True , None)
\ No newline at end of file
+      self.correct_letter = letter
\ No newline at end of file
diff --git a/src/braille_lotto-activity/braille_lotto.py b/src/braille_lotto-activity/braille_lotto.py
index dd9f9a4..56a864c 100644
--- a/src/braille_lotto-activity/braille_lotto.py
+++ b/src/braille_lotto-activity/braille_lotto.py
@@ -30,12 +30,13 @@ import random
 import pango
 
 from BrailleChar import *
-from braille_alphabets import *
+from BrailleMap import *
 from gcompris import gcompris_gettext as _
 
 COLOR_ON = 0X00FFFFL
 COLOR_OFF = 0X00000000L
 CIRCLE_FILL = "light green"
+CIRCLE_STROKE = "black"
 CELL_WIDTH = 30
 
 CHECK_RANDOM = []
@@ -371,8 +372,7 @@ class Gcompris_braille_lotto:
           self.rootitem = goocanvas.Group(parent=
                                    self.gcomprisBoard.canvas.get_root_item())
           gcompris.set_default_background(self.gcomprisBoard.canvas.get_root_item())
-          map_obj = Gcompris_braille_alphabets(self.gcomprisBoard)
-          map_obj.Braille_Map(self.rootitem, COLOR_ON, COLOR_OFF, CIRCLE_FILL, CIRCLE_STROKE)
+          map_obj = BrailleMap(self.rootitem, COLOR_ON, COLOR_OFF, CIRCLE_FILL, CIRCLE_STROKE)
           self.mapActive = True
           self.pause(1)
 
diff --git a/src/dicey_dicey-activity/dicey_dicey.py b/src/dicey_dicey-activity/dicey_dicey.py
index c7d767a..e0ce251 100644
--- a/src/dicey_dicey-activity/dicey_dicey.py
+++ b/src/dicey_dicey-activity/dicey_dicey.py
@@ -27,7 +27,7 @@ import pango
 import random
 import gcompris.bonus
 from BrailleChar import *
-from braille_alphabets import *
+from BrailleMap import *
 from gcompris import gcompris_gettext as _
 
 #Constants Declaration
@@ -314,8 +314,7 @@ class Gcompris_dicey_dicey:
           self.rootitem = goocanvas.Group(parent=
                                    self.gcomprisBoard.canvas.get_root_item())
           gcompris.set_default_background(self.gcomprisBoard.canvas.get_root_item())
-          map_obj = Gcompris_braille_alphabets(self.gcomprisBoard)
-          map_obj.Braille_Map(self.rootitem, COLOR_ON, COLOR_OFF, CIRCLE_FILL, CIRCLE_STROKE)
+          map_obj = BrailleMap(self.rootitem, COLOR_ON, COLOR_OFF, CIRCLE_FILL, CIRCLE_STROKE)
           self.mapActive = True
 
   def config(self):
diff --git a/src/rhymes_riddles-activity/rhymes_riddles.py b/src/rhymes_riddles-activity/rhymes_riddles.py
index 112fc9d..f9063f5 100644
--- a/src/rhymes_riddles-activity/rhymes_riddles.py
+++ b/src/rhymes_riddles-activity/rhymes_riddles.py
@@ -26,16 +26,15 @@ import goocanvas
 import pango
 import random
 import string
-
+from BrailleMap import *
 from BrailleChar import *
-from braille_alphabets import *
 from gcompris import gcompris_gettext as _
 
 #Constants Declaration
 COLOR_ON = 0XCC3399L
 COLOR_OFF = 0X00000000L
 CIRCLE_FILL = "#CC3399"
-CIRCLE_STROKE = "#CC3399"
+CIRCLE_STROKE = "black"
 CELL_WIDTH = 30
 RHYMES_RIDDLES_LIST = [
       [ # Level 1
@@ -188,8 +187,7 @@ class Gcompris_rhymes_riddles:
           self.rootitem = goocanvas.Group(parent=
                                    self.gcomprisBoard.canvas.get_root_item())
           gcompris.set_default_background(self.gcomprisBoard.canvas.get_root_item())
-          map_obj = Gcompris_braille_alphabets(self.gcomprisBoard)
-          map_obj.Braille_Map(self.rootitem, COLOR_ON, COLOR_OFF, CIRCLE_FILL, CIRCLE_STROKE)
+          map_obj = BrailleMap(self.rootitem, COLOR_ON, COLOR_OFF, CIRCLE_FILL, CIRCLE_STROKE)
           self.mapActive = True
           self.pause(1)
 



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