Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/sugar/graphics
diff options
context:
space:
mode:
authorMarco Pesenti Gritti <mpg@redhat.com>2007-09-10 00:06:24 (GMT)
committer Marco Pesenti Gritti <mpg@redhat.com>2007-09-10 00:06:24 (GMT)
commitd757126a196d0cfd65b01c9befbf3b03f678e48b (patch)
tree5fbfb2626343c89cabc4398b81cf0e598805015d /sugar/graphics
parent547df751a762065292156bc321d335fb4158b48d (diff)
Move entity type checks at loader level so that they
are shared by all both icon implementations.
Diffstat (limited to 'sugar/graphics')
-rw-r--r--sugar/graphics/icon.py12
1 files changed, 6 insertions, 6 deletions
diff --git a/sugar/graphics/icon.py b/sugar/graphics/icon.py
index 4cb3044..6cb6372 100644
--- a/sugar/graphics/icon.py
+++ b/sugar/graphics/icon.py
@@ -51,8 +51,12 @@ class _SVGLoader(object):
self._cache[file_name] = icon
for entity, value in entities.items():
- xml = '<!ENTITY %s "%s">' % (entity, value)
- icon = re.sub('<!ENTITY %s .*>' % entity, xml, icon)
+ if isinstance(value, basestring):
+ xml = '<!ENTITY %s "%s">' % (entity, value)
+ icon = re.sub('<!ENTITY %s .*>' % entity, xml, icon)
+ else:
+ logging.error(
+ 'Icon %s, entity %s is invalid.', file_name, entity)
return rsvg.Handle(data=icon)
@@ -376,13 +380,9 @@ class CanvasIcon(hippo.CanvasBox, hippo.CanvasItem):
self.props.fill_color = value.get_fill_color()
self.props.stroke_color = value.get_stroke_color()
elif pspec.name == 'fill-color':
- if not isinstance(value, basestring) and value is not None:
- raise TypeError('fill-color must be a string, not %r' % type(value))
self._buffer.fill_color = value
self.emit_paint_needed(0, 0, -1, -1)
elif pspec.name == 'stroke-color':
- if not isinstance(value, basestring) and value is not None:
- raise TypeError('stroke-color must be a string, not %r' % type(value))
self._buffer.stroke_color = value
self.emit_paint_needed(0, 0, -1, -1)
elif pspec.name == 'size':