Set width/height the right way
This commit is contained in:
parent
d35413d8b0
commit
0eaa29ee9d
@ -145,6 +145,8 @@ class CanvasIcon(hippo.CanvasBox, hippo.CanvasItem):
|
|||||||
self._buffers = {}
|
self._buffers = {}
|
||||||
self._cur_buffer = None
|
self._cur_buffer = None
|
||||||
self._size = 24
|
self._size = 24
|
||||||
|
self.props.box_width = self._size
|
||||||
|
self.props.box_height = self._size
|
||||||
self._color = None
|
self._color = None
|
||||||
self._icon_name = None
|
self._icon_name = None
|
||||||
self._cache = False
|
self._cache = False
|
||||||
@ -175,6 +177,8 @@ class CanvasIcon(hippo.CanvasBox, hippo.CanvasItem):
|
|||||||
if self._size != value and not self._cache:
|
if self._size != value and not self._cache:
|
||||||
self._clear_buffers()
|
self._clear_buffers()
|
||||||
self._size = value
|
self._size = value
|
||||||
|
self.props.box_width = value
|
||||||
|
self.props.box_height = value
|
||||||
self.emit_request_changed()
|
self.emit_request_changed()
|
||||||
elif pspec.name == 'cache':
|
elif pspec.name == 'cache':
|
||||||
self._cache = value
|
self._cache = value
|
||||||
@ -229,11 +233,5 @@ class CanvasIcon(hippo.CanvasBox, hippo.CanvasItem):
|
|||||||
cr.set_source_surface(buf, x, y)
|
cr.set_source_surface(buf, x, y)
|
||||||
cr.paint()
|
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):
|
def _button_press_event_cb(self, item, event):
|
||||||
item.emit_activated()
|
item.emit_activated()
|
||||||
|
Loading…
Reference in New Issue
Block a user