diff --git a/sugar/canvas/CanvasBox.py b/sugar/canvas/CanvasBox.py index 15877a48..b990b895 100644 --- a/sugar/canvas/CanvasBox.py +++ b/sugar/canvas/CanvasBox.py @@ -18,26 +18,34 @@ class CanvasBox(goocanvas.Group): def set_constraints(self, item, width, height): self._constraints[item] = [width, height] - def _layout(self): - x = self._padding - y = self._padding + def _layout(self, start_item): + if start_item == -1: + start_item = self.get_n_children() - 1 + pos = 0 i = 0 while i < self.get_n_children(): item = self.get_child(i) [width, height] = self._constraints[item] - self._grid.set_constraints(item, x, y, width, height) + pos += self._padding if self._orientation == CanvasBox.VERTICAL: - y += height + self._padding + x = self._padding + y = pos + pos += height + self._padding else: - x += width + self._padding + x = pos + y = self._padding + pos += width + self._padding + + if i >= start_item: + self._grid.set_constraints(item, x, y, width, height) i += 1 def _child_added_cb(self, item, position): - self._layout() + self._layout(position) def _child_removed_cb(self, item, position): - self._layout() + self._layout(position) diff --git a/sugar/canvas/Menu.py b/sugar/canvas/Menu.py index ce34f5fa..7344ff46 100644 --- a/sugar/canvas/Menu.py +++ b/sugar/canvas/Menu.py @@ -22,7 +22,7 @@ class Menu(gtk.Window): def __init__(self, grid, title, color_scheme=MenuColorScheme()): gtk.Window.__init__(self, gtk.WINDOW_POPUP) - self._width = 13 + self._width = 15 self._grid = grid self._action_box = None self._color_scheme = color_scheme @@ -51,7 +51,7 @@ class Menu(gtk.Window): self._canvas.set_model(model) def _create_action_box(self): - separator = goocanvas.Path(data='M 15 0 L 185 0', line_width=3, + separator = goocanvas.Path(data='M 15 0 L 215 0', line_width=3, stroke_color=self._color_scheme.separator) self._grid.set_constraints(separator, 0, 4) self._root.add_child(separator)