Commit 15b87fd7 authored by Srishti Sethi's avatar Srishti Sethi

Ticket focus issue FIXED| Added green check button for correct cross

parent 5cd77374
......@@ -88,9 +88,10 @@ class BrailleChar:
dot = 1
self.dot_items = []
self.cell_array = []
for u in range(2):
for v in range(3):
cell = goocanvas.Ellipse(parent=self.rootitem,
self.cell = goocanvas.Ellipse(parent=self.rootitem,
center_x=x + width / 3.0 * ( u + 1 ),
center_y=y + height / 4.0 * ( v + 1 ),
radius_x=cell_radius,
......@@ -98,10 +99,12 @@ class BrailleChar:
stroke_color=self.stroke,
fill_color=self.fill,
line_width=width/25)
self.cell_array.append(self.cell)
# To fill the circles in lower board with red color
if (clickable == True):
cell.connect("button_press_event", self.dot_event)
gcompris.utils.item_focus_init(cell, None)
self.cell.connect("button_press_event", self.dot_event)
gcompris.utils.item_focus_init(self.cell, None)
if isinstance(letter,int):
fillings = BRAILLE_LETTERS.get(letter)
......@@ -109,13 +112,13 @@ class BrailleChar:
fillings = BRAILLE_LETTERS.get(letter.upper())
if fillings == None:
"""only braille cell"""
"""only braille self.cell"""
elif dot in fillings:
cell.set_property("fill_color_rgba", self.DOT_ON)
self.cell.set_property("fill_color_rgba", self.DOT_ON)
else :
cell.set_property("fill_color_rgba", self.DOT_OFF)
self.cell.set_property("fill_color_rgba", self.DOT_OFF)
self.dot_items.append(cell)
self.dot_items.append(self.cell)
dot += 1
def get_letter(self):
......@@ -151,4 +154,11 @@ class BrailleChar:
target.set_property("fill_color_rgba", self.DOT_OFF)
else:
target.set_property("fill_color_rgba", self.DOT_ON)
self.calculate_char()
\ No newline at end of file
self.calculate_char()
#### This function has been added specially for BrailleLotto Activity
#### to fix the focus issue on ticket numbers
def ticket_focus(self, rectangle, number_cross_function, counter):
for index in range(6):
gcompris.utils.item_focus_init(self.cell_array[index], rectangle)
self.cell_array[index].connect("button_press_event", number_cross_function, counter)
\ No newline at end of file
......@@ -72,17 +72,19 @@ class Gcompris_braille_lotto:
#Boolean variable declaration
self.mapActive = False
#CONSTANT Declarations
self.board_paused = 0
self.timerAnim = 0
self.counter = 0
self.gamewon = 0
self.countAnim = 200
self.score_player_a = 0
self.score_player_b = 0
self.status_timer = 50
self.delay_one = 100
self.delay_two = 100
self.tile_counter = 0
self.rectangle_counter = 0
#REPEAT ICON
gcompris.bar_set(gcompris.BAR_REPEAT_ICON)
......@@ -109,7 +111,7 @@ class Gcompris_braille_lotto:
even = 0
while (index < 12):
if(even % 2 == 0):
gcompris.utils.item_focus_init(self.rect[even],self.rect[even])
gcompris.utils.item_focus_init(self.rect[even],None)
self.rect[even].connect("button_press_event",self.cross_number, index)
even += 2
index += 1
......@@ -139,7 +141,7 @@ class Gcompris_braille_lotto:
#Button to display the number to be checked in the ticket
goocanvas.Image(parent = self.root,
pixbuf = gcompris.utils.load_pixmap("braille_lotto/button.svg"),
x = -15,
x = 5,
y = 340,
)
......@@ -185,7 +187,7 @@ class Gcompris_braille_lotto:
for index in range(2):
clue_text = goocanvas.Text(
parent = self.root,
text = _("I don't have \n""this number \n\n" "PLAYER " + str(index + 1)),
text = _("I don't have \n""this number \n" " PLAYER " + str(index + 1)),
font = gcompris.skin.get_font("gcompris/board/medium"),
x = index * 230 + 295,
y = 395,
......@@ -381,30 +383,45 @@ class Gcompris_braille_lotto:
ticket = random.randint(a, b)
self.ticket_array.append(ticket)
if (ticket < 10):
BrailleChar(self.root, x, y, 50 , ticket, COLOR_ON, COLOR_OFF ,
obj = BrailleChar(self.root, x, y, 50 , ticket, COLOR_ON, COLOR_OFF ,
CIRCLE_FILL, CIRCLE_FILL, False, False ,False, None)
obj.ticket_focus(self.rect[self.rectangle_counter],self.cross_number, self.tile_counter)
else :
tens_digit = ticket / 10
ones_digit = ticket % 10
BrailleChar(self.root, x - 7, y, 50 ,tens_digit, COLOR_ON, COLOR_OFF ,
obj1 = BrailleChar(self.root, x - 7, y, 50 ,tens_digit, COLOR_ON, COLOR_OFF ,
CIRCLE_FILL, CIRCLE_FILL, False, False ,False, None)
BrailleChar(self.root, x + 25, y, 50 , ones_digit, COLOR_ON, COLOR_OFF ,
obj1.ticket_focus(self.rect[self.rectangle_counter], self.cross_number, self.tile_counter)
obj2 = BrailleChar(self.root, x + 25, y, 50 , ones_digit, COLOR_ON, COLOR_OFF ,
CIRCLE_FILL, CIRCLE_FILL, False, False ,False, None)
obj2.ticket_focus(self.rect[self.rectangle_counter], self.cross_number, self.tile_counter)
def cross_number(self,item, event, target, index):
#Cross Sign
goocanvas.Image(parent = self.root,
pixbuf = gcompris.utils.load_pixmap("braille_lotto/cross_button.png"),
x = self.rect_x[index * 2] + 8,
y = self.rect_y[index * 2] + 5,
)
self.rectangle_counter += 2
self.tile_counter += 1
def cross_number(self,item, event, target, index):
if( CHECK_RANDOM[self.counter] == self.ticket_array[index]):
if(index in (0, 1, 2, 3, 4, 5)):
self.score_player_a +=1
else:
self.score_player_b +=1
#Checked_button
goocanvas.Image(parent = self.root,
pixbuf = gcompris.utils.load_pixmap("braille_lotto/button_checked.png"),
x = self.rect_x[index * 2] + 8,
y = self.rect_y[index * 2] + 5,
)
else :
#Cross Sign
goocanvas.Image(parent = self.root,
pixbuf = gcompris.utils.load_pixmap("braille_lotto/cross_button.png"),
x = self.rect_x[index * 2] + 8,
y = self.rect_y[index * 2] + 5,
)
if(self.score_player_a == 6 or self.score_player_b == 6):
self.game = goocanvas.Image(parent = self.root,
pixbuf = gcompris.utils.load_pixmap("braille_lotto/game.svg"),
......
......@@ -10,8 +10,8 @@
xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
width="85mm"
height="54mm"
width="208.17999"
height="113.34"
id="svg3098"
version="1.1"
inkscape:version="0.48.0 r9654"
......@@ -59,7 +59,7 @@
inkscape:pageshadow="2"
inkscape:zoom="1.2"
inkscape:cx="160"
inkscape:cy="82.083333"
inkscape:cy="74.166666"
inkscape:document-units="mm"
inkscape:current-layer="layer1"
showgrid="false"
......@@ -76,17 +76,18 @@
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title></dc:title>
<dc:title />
</cc:Work>
</rdf:RDF>
</metadata>
<g
inkscape:label="Layer 1"
inkscape:groupmode="layer"
id="layer1">
id="layer1"
transform="translate(0,-77.998269)">
<g
id="g3327"
transform="matrix(2.3132409,0,0,1.3508219,261.22711,99.500916)"
transform="matrix(2.3132409,0,0,1.3508219,237.89378,178.66758)"
style="opacity:0.7">
<rect
rx="9.5005054"
......
......@@ -10,12 +10,12 @@
xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
width="90mm"
height="50mm"
width="318.89764"
height="120.17"
id="svg3195"
version="1.1"
inkscape:version="0.48.0 r9654"
sodipodi:docname="drawing.svg">
sodipodi:docname="button1.svg">
<defs
id="defs3">
<linearGradient
......@@ -23,7 +23,7 @@
x2="854.75134"
y1="211.73657"
x1="649.69342"
gradientTransform="matrix(0.09226556,0.62993533,-0.75623168,0.1856578,239.02994,-473.97677)"
gradientTransform="matrix(0.09226556,0.62993533,-0.75623168,0.1856578,239.02994,-421.47677)"
gradientUnits="userSpaceOnUse"
id="linearGradient3135"
xlink:href="#linearGradient752-9-2"
......@@ -65,7 +65,7 @@
x2="854.75134"
y1="211.73657"
x1="649.69342"
gradientTransform="matrix(-0.09226556,-0.62993533,0.75623168,-0.1856578,77.636559,604.97413)"
gradientTransform="matrix(-0.09226556,-0.62993533,0.75623168,-0.1856578,77.636559,657.47413)"
gradientUnits="userSpaceOnUse"
id="linearGradient3193"
xlink:href="#linearGradient752-9"
......@@ -80,7 +80,7 @@
inkscape:pageshadow="2"
inkscape:zoom="1.2"
inkscape:cx="160"
inkscape:cy="82.083333"
inkscape:cy="74.166666"
inkscape:document-units="mm"
inkscape:current-layer="layer1"
showgrid="false"
......@@ -97,23 +97,24 @@
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title></dc:title>
<dc:title />
</cc:Work>
</rdf:RDF>
</metadata>
<g
inkscape:label="Layer 1"
inkscape:groupmode="layer"
id="layer1">
id="layer1"
transform="translate(0,-56.995248)">
<path
style="font-size:12px;fill:url(#linearGradient3193);fill-opacity:1;fill-rule:evenodd"
d="m 170.69939,97.407537 c 3.84643,7.637603 10.33685,10.000253 14.25702,10.319443 l 118.21897,2.7129 c 6.28155,0.54614 9.75939,-1.80109 9.64472,-11.416523 -8.96622,-14.392977 -13.17646,-47.047936 -9.71595,-63.492488 -0.11474,-9.615527 -4.1272,-14.501285 -10.40867,-15.04734 l -112.98693,2.502105 c -6.28159,-0.545985 -9.0323,1.511018 -11.5979,10.167309 -4.11354,12.168839 -3.89954,48.472302 2.58874,64.254594 z"
d="m 170.69939,149.90754 c 3.84643,7.6376 10.33685,10.00025 14.25702,10.31944 l 118.21897,2.7129 c 6.28155,0.54614 9.75939,-1.80109 9.64472,-11.41652 -8.96622,-14.39298 -13.17646,-47.04794 -9.71595,-63.492491 -0.11474,-9.615527 -4.1272,-14.501285 -10.40867,-15.04734 l -112.98693,2.502105 c -6.28159,-0.545985 -9.0323,1.511018 -11.5979,10.167309 -4.11354,12.168839 -3.89954,48.472297 2.58874,64.254597 z"
id="FIG2"
sodipodi:nodetypes="cccccccsc"
inkscape:connector-curvature="0" />
<path
style="font-size:12px;fill:url(#linearGradient3135);fill-opacity:1;fill-rule:evenodd"
d="M 145.96711,33.589839 C 142.12067,25.952244 135.63026,23.589593 131.71009,23.270402 L 13.49111,20.557511 C 7.2095754,20.01137 3.7317364,22.358604 3.846399,31.97403 c 8.966213,14.392975 13.176455,47.047941 9.715949,63.492497 0.11474,9.615523 4.127211,14.501283 10.408666,15.047333 l 112.986926,-2.5021 c 6.28159,0.54598 9.03232,-1.51101 11.5979,-10.167323 4.11353,-12.168836 3.89955,-48.472305 -2.58873,-64.254598 z"
d="M 145.96711,86.089839 C 142.12067,78.452244 135.63026,76.089593 131.71009,75.770402 L 13.49111,73.057511 C 7.2095754,72.51137 3.7317364,74.858604 3.846399,84.47403 c 8.966213,14.392975 13.176455,47.04794 9.715949,63.4925 0.11474,9.61552 4.127211,14.50128 10.408666,15.04733 l 112.986926,-2.5021 c 6.28159,0.54598 9.03232,-1.51101 11.5979,-10.16732 4.11353,-12.16884 3.89955,-48.47231 -2.58873,-64.254601 z"
id="FIG1"
sodipodi:nodetypes="cccccccsc"
inkscape:connector-curvature="0" />
......
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