From 7dedaeb7bb68c852d60e2225ae205a2fbbbb2bbb Mon Sep 17 00:00:00 2001 From: Tomeu Vizoso Date: Mon, 04 Oct 2010 14:56:26 +0000 Subject: Cast floats to ints before calling cairo.ImageSurface() #2291 Otherwise Python 2.7 will raise an exception. --- (limited to 'src/sugar') diff --git a/src/sugar/graphics/icon.py b/src/sugar/graphics/icon.py index 4a94479..100f05a 100644 --- a/src/sugar/graphics/icon.py +++ b/src/sugar/graphics/icon.py @@ -142,7 +142,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) @@ -159,7 +159,7 @@ class _IconBuffer(object): def _draw_badge(self, context, size, sensitive, widget): theme = gtk.icon_theme_get_default() - badge_info = theme.lookup_icon(self.badge_name, size, 0) + badge_info = theme.lookup_icon(self.badge_name, int(size), 0) if badge_info: badge_file_name = badge_info.get_filename() if badge_file_name.endswith('.svg'): @@ -276,10 +276,12 @@ class _IconBuffer(object): padding = badge_info.icon_padding width, height = self._get_size(icon_width, icon_height, padding) if self.background_color is None: - surface = cairo.ImageSurface(cairo.FORMAT_ARGB32, width, height) + surface = cairo.ImageSurface(cairo.FORMAT_ARGB32, int(width), + int(height)) context = cairo.Context(surface) else: - surface = cairo.ImageSurface(cairo.FORMAT_RGB24, width, height) + surface = cairo.ImageSurface(cairo.FORMAT_RGB24, int(width), + int(height)) context = cairo.Context(surface) context = gtk.gdk.CairoContext(context) context.set_source_color(self.background_color) -- cgit v0.9.1