Redraw on properties changes

This commit is contained in:
Marco Pesenti Gritti 2006-09-10 23:41:11 +02:00
parent f43b97a202
commit a75adee698
2 changed files with 12 additions and 2 deletions

View File

@ -8,8 +8,8 @@ class GridModel:
def __init__(self, bg_color):
self._model = goocanvas.CanvasModelSimple()
self._width = 800
self._height = 600
self._width = 1200
self._height = 900
item = goocanvas.Rect(width=self._width, height=self._height,
line_width=0, fill_color=bg_color)

View File

@ -52,10 +52,13 @@ class IconView(goocanvas.ItemViewSimple, goocanvas.ItemView):
def __init__(self, canvas_view, parent_view, item):
goocanvas.ItemViewSimple.__init__(self)
self.parent_view = parent_view
self.canvas_view = canvas_view
self.item = item
item.connect('changed', goocanvas.item_view_simple_item_changed, self)
def do_get_item_view_at(self, x, y, cr, is_pointer_event, parent_is_visible):
result = self
@ -163,16 +166,23 @@ class IconItem(goocanvas.ItemSimple, goocanvas.Item):
goocanvas.ItemSimple.__init__(self, **kwargs)
def do_set_property(self, pspec, value):
recompute_bounds = False
if pspec.name == 'icon-name':
self.icon_name = value
elif pspec.name == 'color':
self.color = value
elif pspec.name == 'size':
self.size = value
recompute_bounds = True
elif pspec.name == 'x':
self.x = value
recompute_bounds = True
elif pspec.name == 'y':
self.y = value
recompute_bounds = True
self.emit('changed', recompute_bounds)
def do_get_property(self, pspec):
if pspec.name == 'x':