[Sugar-devel] [PATCH] fix two trivial shell.log warnings

Bernie Innocenti bernie at codewiz.org
Thu May 13 14:45:58 EDT 2010


El Mon, 10-05-2010 a las 15:06 +1000, James Cameron escribió:
> "DeprecationWarning: integer argument expected, got float" was happening
> in two places.  An issue that has been with us for at least 12 months,
> since it was also seen in logs attached to SL #870.
> ---
>  src/sugar/graphics/icon.py |    6 +++---
>  1 files changed, 3 insertions(+), 3 deletions(-)


Looks good, I've seen the same warnings as well.

Reviewed-by: Bernie Innocenti <bernie at codewiz.org>


> diff --git a/src/sugar/graphics/icon.py b/src/sugar/graphics/icon.py
> index 57c53f5..8e3861c 100644
> --- a/src/sugar/graphics/icon.py
> +++ b/src/sugar/graphics/icon.py
> @@ -133,7 +133,7 @@ class _IconBuffer(object):
>              if self.width != None:
>                  size = self.width
>  
> -            info = theme.lookup_icon(self.icon_name, size, 0)
> +            info = theme.lookup_icon(self.icon_name, int(size), 0)
>              if info:
>                  attach_x, attach_y = self._get_attach_points(info, size)
>  
> @@ -178,8 +178,8 @@ class _IconBuffer(object):
>  
>      def _get_size(self, icon_width, icon_height, padding):
>          if self.width is not None and self.height is not None:
> -            width = self.width + padding
> -            height = self.height + padding
> +            width = int(self.width) + padding
> +            height = int(self.height) + padding
>          else:
>              width = icon_width + padding
>              height = icon_height + padding

-- 
   // Bernie Innocenti - http://codewiz.org/
 \X/  Sugar Labs       - http://sugarlabs.org/



More information about the Sugar-devel mailing list