diff options
Diffstat (limited to 'sugar/graphics/iconbutton.py')
-rw-r--r-- | sugar/graphics/iconbutton.py | 37 |
1 files changed, 3 insertions, 34 deletions
diff --git a/sugar/graphics/iconbutton.py b/sugar/graphics/iconbutton.py index 33ea37a..85ea4e4 100644 --- a/sugar/graphics/iconbutton.py +++ b/sugar/graphics/iconbutton.py @@ -25,21 +25,11 @@ import gobject import hippo from sugar.graphics.canvasicon import CanvasIcon -from sugar.graphics import units from sugar.graphics import style -STANDARD_SIZE = 0 -SMALL_SIZE = 1 - class IconButton(CanvasIcon, hippo.CanvasItem): __gtype_name__ = 'SugarIconButton' - __gproperties__ = { - 'size' : (int, None, None, - 0, 32767, STANDARD_SIZE, - gobject.PARAM_READWRITE) - } - def __init__(self, **kwargs): CanvasIcon.__init__(self, cache=True, **kwargs) @@ -47,32 +37,11 @@ class IconButton(CanvasIcon, hippo.CanvasItem): self.props.fill_color = style.Color("#404040") self.props.stroke_color = style.Color("#FFFFFF") - self._set_size(STANDARD_SIZE) self.connect('activated', self._icon_clicked_cb) - def _set_size(self, size): - if size == SMALL_SIZE: - self.props.box_width = -1 - self.props.box_height = -1 - self.props.scale = units.SMALL_ICON_SCALE - else: - self.props.box_width = units.grid_to_pixels(1) - self.props.box_height = units.grid_to_pixels(1) - self.props.scale = units.STANDARD_ICON_SCALE - - self._size = size - - def do_set_property(self, pspec, value): - if pspec.name == 'size': - self._set_size(value) - else: - CanvasIcon.do_set_property(self, pspec, value) - - def do_get_property(self, pspec): - if pspec.name == 'size': - return self._size - else: - return CanvasIcon.do_get_property(self, pspec) + self.props.box_width = style.GRID_CELL_SIZE + self.props.box_height = style.GRID_CELL_SIZE + self.props.size = style.STANDARD_ICON_SIZE def do_button_press_event(self, event): if self._active: |