From 5ca728b1d31139f059a3b3c94610db65d17e9c57 Mon Sep 17 00:00:00 2001 From: Marco Pesenti Gritti Date: Fri, 19 Jan 2007 15:47:33 +0100 Subject: [PATCH] Fix API for hippo-canvas 0.2 --- shell/view/frame/Frame.py | 8 ++++---- shell/view/home/FriendsBox.py | 8 ++++---- shell/view/home/HomeBox.py | 8 ++++---- shell/view/home/activitiesdonut.py | 6 +++--- sugar/graphics/snowflakebox.py | 6 +++--- sugar/graphics/spreadbox.py | 8 ++++---- 6 files changed, 22 insertions(+), 22 deletions(-) diff --git a/shell/view/frame/Frame.py b/shell/view/frame/Frame.py index b0a19a8c..01791159 100644 --- a/shell/view/frame/Frame.py +++ b/shell/view/frame/Frame.py @@ -186,7 +186,7 @@ class Frame: [x, y] = grid.point(1, 0) root.append(box, hippo.PACK_FIXED) - root.move(box, x, y) + root.set_position(box, x, y) tray = NotificationTray() tray_box = hippo.CanvasBox(box_width=grid.dimension(1), @@ -199,13 +199,13 @@ class Frame: [x, y] = grid.point(13, 0) root.append(tray_box, hippo.PACK_FIXED) - root.move(tray_box, x, y) + root.set_position(tray_box, x, y) box = OverlayBox(self._shell) [x, y] = grid.point(14, 0) root.append(box, hippo.PACK_FIXED) - root.move(box, x, y) + root.set_position(box, x, y) # Bottom panel panel = self._create_panel(grid, 0, 11, 16, 1) @@ -218,7 +218,7 @@ class Frame: root.append(box, hippo.PACK_FIXED) [x, y] = grid.point(1, 0) - root.move(box, x, y) + root.set_position(box, x, y) # Right panel panel = self._create_panel(grid, 15, 1, 1, 10) diff --git a/shell/view/home/FriendsBox.py b/shell/view/home/FriendsBox.py index ec4aad6e..a0c467c6 100644 --- a/shell/view/home/FriendsBox.py +++ b/shell/view/home/FriendsBox.py @@ -58,9 +58,9 @@ class FriendsBox(SpreadBox, hippo.CanvasItem): self.remove_item(self._friends[name]) del self._friends[name] - def do_allocate(self, width, height): - SpreadBox.do_allocate(self, width, height) + def do_allocate(self, width, height, origin_changed): + SpreadBox.do_allocate(self, width, height, origin_changed) [icon_width, icon_height] = self._my_icon.get_allocation() - self.move(self._my_icon, (width - icon_width) / 2, - (height - icon_height) / 2) + self.set_position(self._my_icon, (width - icon_width) / 2, + (height - icon_height) / 2) diff --git a/shell/view/home/HomeBox.py b/shell/view/home/HomeBox.py index daef97d2..cca03559 100644 --- a/shell/view/home/HomeBox.py +++ b/shell/view/home/HomeBox.py @@ -49,12 +49,12 @@ class HomeBox(hippo.CanvasBox, hippo.CanvasItem): self._donut = None self._my_icon.props.color = IconColor('insensitive') - def do_allocate(self, width, height): - hippo.CanvasBox.do_allocate(self, width, height) + def do_allocate(self, width, height, origin_changed): + hippo.CanvasBox.do_allocate(self, width, height, origin_changed) [icon_width, icon_height] = self._my_icon.get_allocation() - self.move(self._my_icon, (width - icon_width) / 2, - (height - icon_height) / 2) + self.set_position(self._my_icon, (width - icon_width) / 2, + (height - icon_height) / 2) def has_activities(self): return self._donut.has_activities() diff --git a/shell/view/home/activitiesdonut.py b/shell/view/home/activitiesdonut.py index c9d8664d..75d0b4da 100644 --- a/shell/view/home/activitiesdonut.py +++ b/shell/view/home/activitiesdonut.py @@ -221,8 +221,8 @@ class ActivitiesDonut(hippo.CanvasBox, hippo.CanvasItem): cr.arc(0, 0, self._get_inner_radius(), 0, 2 * math.pi) cr.fill() - def do_allocate(self, width, height): - hippo.CanvasBox.do_allocate(self, width, height) + def do_allocate(self, width, height, origin_changed): + hippo.CanvasBox.do_allocate(self, width, height, origin_changed) radius = (self._get_inner_radius() + self._get_radius()) / 2 @@ -235,6 +235,6 @@ class ActivitiesDonut(hippo.CanvasBox, hippo.CanvasItem): x = int(radius * math.cos(angle)) - icon_width / 2 y = int(radius * math.sin(angle)) - icon_height / 2 - self.move(icon, x + width / 2, y + height / 2) + self.set_position(icon, x + width / 2, y + height / 2) i += 1 diff --git a/sugar/graphics/snowflakebox.py b/sugar/graphics/snowflakebox.py index 30f5b053..9e2fd784 100644 --- a/sugar/graphics/snowflakebox.py +++ b/sugar/graphics/snowflakebox.py @@ -47,7 +47,7 @@ class SnowflakeBox(hippo.CanvasBox, hippo.CanvasItem): x = cx - (width / 2) y = cy - (height / 2) - self.move(self._root, int(x), int(y)) + self.set_position(self._root, int(x), int(y)) def _get_n_children(self): return len(self.get_children()) - 1 @@ -65,7 +65,7 @@ class SnowflakeBox(hippo.CanvasBox, hippo.CanvasItem): x = cx + math.cos(angle) * r - (width / 2) y = cy + math.sin(angle) * r - (height / 2) - self.move(child, int(x), int(y)) + self.set_position(child, int(x), int(y)) def do_get_width_request(self): hippo.CanvasBox.do_get_width_request(self) @@ -84,7 +84,7 @@ class SnowflakeBox(hippo.CanvasBox, hippo.CanvasItem): hippo.CanvasBox.do_get_height_request(self, width) return width - def do_allocate(self, width, height): + def do_allocate(self, width, height, origin_changed): hippo.CanvasBox.do_allocate(self, width, height) self._layout_root() diff --git a/sugar/graphics/spreadbox.py b/sugar/graphics/spreadbox.py index 59dfe9c6..13eddf77 100644 --- a/sugar/graphics/spreadbox.py +++ b/sugar/graphics/spreadbox.py @@ -109,10 +109,10 @@ class SpreadBox(hippo.CanvasBox, hippo.CanvasItem): [new_x, new_y] = self._clamp_position(icon1, new_x, new_y) - self.move(icon1, new_x, new_y) + self.set_position(icon1, new_x, new_y) - def do_allocate(self, width, height): - hippo.CanvasBox.do_allocate(self, width, height) + def do_allocate(self, width, height, origin_changed): + hippo.CanvasBox.do_allocate(self, width, height, origin_changed) for item in self._items_to_position: [item_w, item_h] = item.get_request() @@ -121,7 +121,7 @@ class SpreadBox(hippo.CanvasBox, hippo.CanvasItem): y = int(random.random() * height - item_h) [x, y] = self._clamp_position(item, x, y) - self.move(item, x, y) + self.set_position(item, x, y) self._items_to_position = []