diff options
author | Tomeu Vizoso <tomeu@sugarlabs.org> | 2009-01-12 12:46:17 (GMT) |
---|---|---|
committer | Tomeu Vizoso <tomeu@sugarlabs.org> | 2009-01-12 12:46:17 (GMT) |
commit | e56b381bd354ec9365c149f40068d3654c8ba783 (patch) | |
tree | c443467a7ec316c130a87d1194dc95e13ab8e149 /src | |
parent | 9a3cbbfe3399106348c2fed184dee98d41349469 (diff) |
Add the file_name property to MenuItem and reduce a bit the size of its icons
Diffstat (limited to 'src')
-rw-r--r-- | src/sugar/graphics/menuitem.py | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/src/sugar/graphics/menuitem.py b/src/sugar/graphics/menuitem.py index 954df1b..c1be49a 100644 --- a/src/sugar/graphics/menuitem.py +++ b/src/sugar/graphics/menuitem.py @@ -29,7 +29,7 @@ from sugar.graphics.icon import Icon class MenuItem(gtk.ImageMenuItem): def __init__(self, text_label=None, icon_name=None, text_maxlen=0, - xo_color=None): + xo_color=None, file_name=None): gobject.GObject.__init__(self) self._accelerator = None @@ -42,8 +42,15 @@ class MenuItem(gtk.ImageMenuItem): self.add(label) label.show() - if icon_name: - icon = Icon(icon_name=icon_name, icon_size=gtk.ICON_SIZE_MENU) + if icon_name is not None: + icon = Icon(icon_name=icon_name, icon_size=gtk.ICON_SIZE_SMALL_TOOLBAR) + if xo_color is not None: + icon.props.xo_color = xo_color + self.set_image(icon) + icon.show() + + elif file_name is not None: + icon = Icon(file=file_name, icon_size=gtk.ICON_SIZE_SMALL_TOOLBAR) if xo_color is not None: icon.props.xo_color = xo_color self.set_image(icon) |