Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRaul Gutierrez Segales <rgs@collabora.co.uk>2011-10-30 23:08:51 (GMT)
committer Sascha Silbe <silbe@activitycentral.com>2011-11-22 12:28:58 (GMT)
commiteedb5f2ca72db9bab49c3c3dd50823ec736fce35 (patch)
tree6cb0c686b67d12a55b1794a1f7e3bb49d8242583
parent90e708bc8e57f7b5dd65e433f840722b8a034c2e (diff)
Use rsvg wrapper while rsvg gains introspection support
-rw-r--r--src/sugar3/graphics/icon.py15
1 files changed, 6 insertions, 9 deletions
diff --git a/src/sugar3/graphics/icon.py b/src/sugar3/graphics/icon.py
index 7ecf88e..4a71a6d 100644
--- a/src/sugar3/graphics/icon.py
+++ b/src/sugar3/graphics/icon.py
@@ -32,6 +32,7 @@ import cairo
from sugar3.graphics.xocolor import XoColor
from sugar3.util import LRU
+from gi.repository import SugarExt
_BADGE_SIZE = 0.45
@@ -60,9 +61,7 @@ class _SVGLoader(object):
logging.error(
'Icon %s, entity %s is invalid.', file_name, entity)
- # XXX this is very slow! why?
- import rsvg
- return rsvg.Handle(data=icon)
+ return SugarExt.RsvgWrapper.new(icon)
class _IconInfo(object):
@@ -165,9 +164,8 @@ class _IconBuffer(object):
if badge_file_name.endswith('.svg'):
handle = self._loader.load(badge_file_name, {}, self.cache)
- dimensions = handle.get_dimension_data()
- icon_width = int(dimensions[0])
- icon_height = int(dimensions[1])
+ icon_width = handle.get_width()
+ icon_height = handle.get_height()
pixbuf = handle.get_pixbuf()
else:
@@ -259,9 +257,8 @@ class _IconBuffer(object):
if is_svg:
handle = self._load_svg(icon_info.file_name)
- dimensions = handle.get_dimension_data()
- icon_width = int(dimensions[0])
- icon_height = int(dimensions[1])
+ icon_width = handle.get_width()
+ icon_height = handle.get_height()
else:
pixbuf = GdkPixbuf.Pixbuf.new_from_file(icon_info.file_name)
icon_width = pixbuf.get_width()