[Sugar-devel] [PATCH] This patch fix the bug, accent nicknames are not displayed well
Rafael Ortiz
rafael at activitycentral.com
Mon Apr 16 15:23:52 EDT 2012
On Mon, Apr 16, 2012 at 2:13 PM, Ariel Calzada <ariel.calzada at gmail.com>wrote:
> This patch is for fixing the bug in the display of nicknames with accents
> like áéíóúñ
> in maze activity
>
> ---
> player.py | 18 ++++++++++--------
> 1 files changed, 10 insertions(+), 8 deletions(-)
>
> diff --git a/player.py b/player.py
> index 5e9e8db..a6636dc 100644
> --- a/player.py
> +++ b/player.py
> @@ -8,17 +8,17 @@
> #
> # Copyright (C) 2007 Joshua Minor
> # This file is part of Maze.activity
> -#
> +#
> # Maze.activity 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.
> -#
> +#
> # Maze.activity 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 Maze.activity. If not, see <
> http://www.gnu.org/licenses/>.
>
> @@ -29,14 +29,16 @@ from sugar.graphics.xocolor import XoColor
> import pygame
> import re
> import os
> +import unicodedata
>
>
> class Player:
> def __init__(self, buddy, shape='circle'):
> self.buddy = buddy
> - self.nick = buddy.props.nick.decode("utf-8")
> + name = buddy.props.nick.decode('utf-8')
> + self.nick = unicodedata.normalize('NFC',name)
> colors = buddy.props.color.split(",")
> -
> +
> def string2Color(str):
> return (int(str[1:3], 16), int(str[3:5], 16), int(str[5:7],
> 16))
> self.colors = map(string2Color, colors)
> @@ -70,7 +72,7 @@ class Player:
> self.position = (1, 1)
> self.previous = (1, 1)
> self.elapsed = None
> -
> +
> def animate(self, maze):
> # if the player finished the maze, then don't move
> if maze.map[self.position[0]][self.position[1]] == maze.GOAL:
> @@ -83,7 +85,7 @@ class Player:
> else:
> self.direction = (0, 0)
> return self.position
> -
> +
> def move(self, direction, maze):
> """Move the player in a given direction (deltax,deltay)"""
> newposition = (self.position[0] + direction[0], self.position[1] +
> direction[1])
> @@ -111,7 +113,7 @@ class Player:
> directions.remove(d)
> # is there only one possible direction?
> if len(directions) == 1:
> - self.direction = directions[0]
> + self.direction = directions[0]
> else:
> self.direction = (0, 0)
>
> --
> 1.7.5.4
>
> Thanks applied as:
http://git.sugarlabs.org/maze/mainline/commit/5f9ca2ed7e1143e23a86525dd1a1d1c86f604774
will be on v18.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.sugarlabs.org/archive/sugar-devel/attachments/20120416/7b43909b/attachment.html>
More information about the Sugar-devel
mailing list