diff options
author | Marco Pesenti Gritti <mpg@redhat.com> | 2007-08-26 22:55:56 (GMT) |
---|---|---|
committer | Marco Pesenti Gritti <mpg@redhat.com> | 2007-08-26 22:55:56 (GMT) |
commit | 823918a69b14b136998572089eba00f6d07a1360 (patch) | |
tree | 57ddd0a349e6b76c2629e942c2e9c89e4e5d6ffc /sugar | |
parent | 60c5e564cc5241200bb2c4a9fa6e827949fcdff4 (diff) | |
parent | 8c288d7deeda09cf9d98b9ce57186bed5c808f3e (diff) |
Merge branch 'master' of git+ssh://dev.laptop.org/git/sugar
Diffstat (limited to 'sugar')
-rw-r--r-- | sugar/activity/activity.py | 4 | ||||
-rw-r--r-- | sugar/graphics/button.py | 2 | ||||
-rw-r--r-- | sugar/graphics/combobox.py | 15 | ||||
-rw-r--r-- | sugar/graphics/icon.py | 6 | ||||
-rw-r--r-- | sugar/graphics/objectchooser.py | 2 |
5 files changed, 18 insertions, 11 deletions
diff --git a/sugar/activity/activity.py b/sugar/activity/activity.py index 3f782b5..6655b24 100644 --- a/sugar/activity/activity.py +++ b/sugar/activity/activity.py @@ -75,9 +75,9 @@ class ActivityToolbar(gtk.Toolbar): self.share = ToolComboBox(label_text='Share with:') self.share.combo.connect('changed', self._share_changed_cb) self.share.combo.append_item(None, _('Private'), - 'theme:zoom-home-mini') + 'zoom-home-mini') self.share.combo.append_item(None, _('My Neighborhood'), - 'theme:zoom-neighborhood-mini') + 'zoom-neighborhood-mini') self.insert(self.share, -1) self.share.show() diff --git a/sugar/graphics/button.py b/sugar/graphics/button.py index fc869f9..647f36d 100644 --- a/sugar/graphics/button.py +++ b/sugar/graphics/button.py @@ -25,7 +25,7 @@ class CanvasButton(hippo.CanvasButton): hippo.CanvasButton.__init__(self, text=label) if icon_name: - icon = Icon(icon_name,icon_size=gtk.ICON_SIZE_BUTTON) + icon = Icon(icon_name=icon_name, icon_size=gtk.ICON_SIZE_BUTTON) self.props.widget.set_image(icon) icon.show() diff --git a/sugar/graphics/combobox.py b/sugar/graphics/combobox.py index 3251dc2..75573f0 100644 --- a/sugar/graphics/combobox.py +++ b/sugar/graphics/combobox.py @@ -61,8 +61,8 @@ class ComboBox(gtk.ComboBox): del info return fname - def append_item(self, action_id, text, icon_name=None): - if not self._icon_renderer and icon_name: + def append_item(self, action_id, text, icon_name=None, file_name=None): + if not self._icon_renderer and (icon_name or file_name): self._icon_renderer = gtk.CellRendererPixbuf() settings = self.get_settings() @@ -77,16 +77,17 @@ class ComboBox(gtk.ComboBox): self.pack_end(self._text_renderer, True) self.add_attribute(self._text_renderer, 'text', 1) - if icon_name: + if icon_name or file_name: if text: size = gtk.ICON_SIZE_MENU else: size = gtk.ICON_SIZE_LARGE_TOOLBAR - width, height = gtk.icon_size_lookup(size) - if icon_name[0:6] == "theme:": - icon_name = self._get_real_name_from_theme(icon_name[6:], size) - pixbuf = gtk.gdk.pixbuf_new_from_file_at_size(icon_name, width, height) + + if icon_name: + file_name = self._get_real_name_from_theme(icon_name[6:], size) + + pixbuf = gtk.gdk.pixbuf_new_from_file_at_size(file_name, width, height) else: pixbuf = None diff --git a/sugar/graphics/icon.py b/sugar/graphics/icon.py index 3ab65fa..41df32b 100644 --- a/sugar/graphics/icon.py +++ b/sugar/graphics/icon.py @@ -182,6 +182,8 @@ class _IconBuffer(object): icon_info.file_name = info.get_filename() icon_info.attach_x = attach_x icon_info.attach_y = attach_y + else: + logging.warning('No icon with the name %s was found in the theme.' % self.icon_name) return icon_info @@ -413,9 +415,13 @@ 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': diff --git a/sugar/graphics/objectchooser.py b/sugar/graphics/objectchooser.py index 56a5a31..4128cf3 100644 --- a/sugar/graphics/objectchooser.py +++ b/sugar/graphics/objectchooser.py @@ -150,7 +150,7 @@ class CollapsedEntry(CanvasRoundBox): self._icon_name = type.icon if not self._icon_name: - self._icon_name = 'theme:image-missing' + self._icon_name = 'image-missing' return self._icon_name |