From 6930a8c11a38161a7dd192cc1452b84ad0b66e8a Mon Sep 17 00:00:00 2001 From: Dan Williams Date: Fri, 26 Jan 2007 18:27:59 -0500 Subject: [PATCH] Correctly set height/width the right way --- sugar/graphics/canvasicon.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/sugar/graphics/canvasicon.py b/sugar/graphics/canvasicon.py index 7da71f7a..496d3c4b 100644 --- a/sugar/graphics/canvasicon.py +++ b/sugar/graphics/canvasicon.py @@ -144,13 +144,17 @@ class CanvasIcon(hippo.CanvasBox, hippo.CanvasItem): def __init__(self, **kwargs): self._buffers = {} self._cur_buffer = None - self._size = 24 + self._size = None self._color = None self._icon_name = None self._cache = False hippo.CanvasBox.__init__(self, **kwargs) + # If no size was given, set a default here + if not self._size: + self.props.size = 24 + self.connect('button-press-event', self._button_press_event_cb) def _clear_buffers(self): @@ -175,6 +179,8 @@ class CanvasIcon(hippo.CanvasBox, hippo.CanvasItem): if self._size != value and not self._cache: self._clear_buffers() self._size = value + self.props.box_width = value + self.props.box_height = value self.emit_request_changed() elif pspec.name == 'cache': self._cache = value @@ -229,11 +235,5 @@ class CanvasIcon(hippo.CanvasBox, hippo.CanvasItem): cr.set_source_surface(buf, x, y) cr.paint() - def do_get_width_request(self): - return self._size - - def do_get_height_request(self, for_width): - return self._size - def _button_press_event_cb(self, item, event): item.emit_activated()