diff options
author | Raul Gutierrez Segales <rgs@collabora.co.uk> | 2011-10-30 23:08:51 (GMT) |
---|---|---|
committer | Simon Schampijer <simon@schampijer.de> | 2011-12-13 20:19:53 (GMT) |
commit | 82fcf0a0f0d5543eb11c503dbd510187d16de5c5 (patch) | |
tree | e270279c96883922e9277a4e6c7625b7c13bfed6 /src/sugar3/graphics/icon.py | |
parent | 3372317922025940b2a8a87e84cefae1e517faf4 (diff) |
Use rsvg wrapper while rsvg gains introspection support
Signed-off-by: Raul Gutierrez Segales <rgs@collabora.co.uk>
Diffstat (limited to 'src/sugar3/graphics/icon.py')
-rw-r--r-- | src/sugar3/graphics/icon.py | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/src/sugar3/graphics/icon.py b/src/sugar3/graphics/icon.py index c96e6f3..f6c9374 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() |