Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTomeu Vizoso <tomeu.vizoso@collabora.co.uk>2010-10-04 14:56:26 (GMT)
committer Tomeu Vizoso <tomeu.vizoso@collabora.co.uk>2010-10-04 14:56:26 (GMT)
commit7dedaeb7bb68c852d60e2225ae205a2fbbbb2bbb (patch)
tree8f8e3272fc828f40cddbb0bbd30cb001a7cf465f
parent969421b0d5d2b133509cdf4ab89e075e0844b3cd (diff)
Cast floats to ints before calling cairo.ImageSurface() #2291
Otherwise Python 2.7 will raise an exception.
-rw-r--r--src/sugar/graphics/icon.py10
1 files changed, 6 insertions, 4 deletions
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)