<br><br><div class="gmail_quote">On Mon, Apr 16, 2012 at 2:13 PM, Ariel Calzada <span dir="ltr"><<a href="mailto:ariel.calzada@gmail.com">ariel.calzada@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="im">This patch is for fixing the bug in the display of nicknames with accents like áéíóúñ<br>
</div>in maze activity<br>
<div class="HOEnZb"><div class="h5"><br>
---<br>
player.py | 18 ++++++++++--------<br>
1 files changed, 10 insertions(+), 8 deletions(-)<br>
<br>
diff --git a/player.py b/player.py<br>
index 5e9e8db..a6636dc 100644<br>
--- a/player.py<br>
+++ b/player.py<br>
@@ -8,17 +8,17 @@<br>
#<br>
# Copyright (C) 2007 Joshua Minor<br>
# This file is part of Maze.activity<br>
-#<br>
+#<br>
# Maze.activity is free software: you can redistribute it and/or modify<br>
# it under the terms of the GNU General Public License as published by<br>
# the Free Software Foundation, either version 3 of the License, or<br>
# (at your option) any later version.<br>
-#<br>
+#<br>
# Maze.activity is distributed in the hope that it will be useful,<br>
# but WITHOUT ANY WARRANTY; without even the implied warranty of<br>
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the<br>
# GNU General Public License for more details.<br>
-#<br>
+#<br>
# You should have received a copy of the GNU General Public License<br>
# along with Maze.activity. If not, see <<a href="http://www.gnu.org/licenses/" target="_blank">http://www.gnu.org/licenses/</a>>.<br>
<br>
@@ -29,14 +29,16 @@ from sugar.graphics.xocolor import XoColor<br>
import pygame<br>
import re<br>
import os<br>
+import unicodedata<br>
<br>
<br>
class Player:<br>
def __init__(self, buddy, shape='circle'):<br>
self.buddy = buddy<br>
- self.nick = buddy.props.nick.decode("utf-8")<br>
+ name = buddy.props.nick.decode('utf-8')<br>
+ self.nick = unicodedata.normalize('NFC',name)<br>
colors = buddy.props.color.split(",")<br>
-<br>
+<br>
def string2Color(str):<br>
return (int(str[1:3], 16), int(str[3:5], 16), int(str[5:7], 16))<br>
self.colors = map(string2Color, colors)<br>
@@ -70,7 +72,7 @@ class Player:<br>
self.position = (1, 1)<br>
self.previous = (1, 1)<br>
self.elapsed = None<br>
-<br>
+<br>
def animate(self, maze):<br>
# if the player finished the maze, then don't move<br>
if maze.map[self.position[0]][self.position[1]] == maze.GOAL:<br>
@@ -83,7 +85,7 @@ class Player:<br>
else:<br>
self.direction = (0, 0)<br>
return self.position<br>
-<br>
+<br>
def move(self, direction, maze):<br>
"""Move the player in a given direction (deltax,deltay)"""<br>
newposition = (self.position[0] + direction[0], self.position[1] + direction[1])<br>
@@ -111,7 +113,7 @@ class Player:<br>
directions.remove(d)<br>
# is there only one possible direction?<br>
if len(directions) == 1:<br>
- self.direction = directions[0]<br>
+ self.direction = directions[0]<br>
else:<br>
self.direction = (0, 0)<br>
<br>
--<br>
1.7.5.4<br>
<br>
</div></div></blockquote></div>Thanks applied as:<div><br></div><div><a href="http://git.sugarlabs.org/maze/mainline/commit/5f9ca2ed7e1143e23a86525dd1a1d1c86f604774">http://git.sugarlabs.org/maze/mainline/commit/5f9ca2ed7e1143e23a86525dd1a1d1c86f604774</a></div>
<div><br></div><div>will be on v18.</div><div><br></div><div><br></div>