diff options
author | Dan Williams <dcbw@redhat.com> | 2007-01-26 23:27:59 (GMT) |
---|---|---|
committer | Dan Williams <dcbw@redhat.com> | 2007-01-26 23:27:59 (GMT) |
commit | 6930a8c11a38161a7dd192cc1452b84ad0b66e8a (patch) | |
tree | 997c6ad2a0fbb77193e0d9b521e8d0eb1334e7d9 /sugar/graphics/canvasicon.py | |
parent | 759c477e1f436661fd29679b2754456eee1f7a38 (diff) |
Correctly set height/width the right way
Diffstat (limited to 'sugar/graphics/canvasicon.py')
-rw-r--r-- | sugar/graphics/canvasicon.py | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/sugar/graphics/canvasicon.py b/sugar/graphics/canvasicon.py index 7da71f7..496d3c4 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() |