From e56b381bd354ec9365c149f40068d3654c8ba783 Mon Sep 17 00:00:00 2001 From: Tomeu Vizoso Date: Mon, 12 Jan 2009 13:46:17 +0100 Subject: [PATCH] Add the file_name property to MenuItem and reduce a bit the size of its icons --- src/sugar/graphics/menuitem.py | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/sugar/graphics/menuitem.py b/src/sugar/graphics/menuitem.py index 954df1bc..c1be49a0 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)