Commit 22437281 authored by Srishti Sethi's avatar Srishti Sethi

Created a BrailleMap class|Changed the text to black

parent b5509552
# 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
......@@ -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
......@@ -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)
......
......@@ -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):
......
......@@ -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)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment