From 6bbb20c4c7fff8a9ca5797aac3522baefe037ab6 Mon Sep 17 00:00:00 2001 From: Marco Pesenti Gritti Date: Fri, 8 Sep 2006 02:20:11 +0200 Subject: [PATCH] Add padding in the constraints constructor --- shell/frame/BottomPanel.py | 6 ++++-- shell/frame/RightPanel.py | 4 ++-- shell/frame/TopPanel.py | 6 ++---- sugar/canvas/GridLayout.py | 4 ++-- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/shell/frame/BottomPanel.py b/shell/frame/BottomPanel.py index 937ffbcb..9c53be4c 100644 --- a/shell/frame/BottomPanel.py +++ b/shell/frame/BottomPanel.py @@ -67,9 +67,11 @@ class BottomPanel(GridGroup): item = ActivityItem(activity) item.connect('clicked', self.__activity_clicked_cb) - constraints = GridConstraints(self.get_n_children() + 1, 0, 1, 1) - constraints.padding = 6 + + col = self.get_n_children() + 1 + constraints = GridConstraints(col, 0, 1, 1, 6) self._layout.set_constraints(item, constraints) + self.add_child(item) def add_invite(self, invite): diff --git a/shell/frame/RightPanel.py b/shell/frame/RightPanel.py index d999660e..57b91f53 100644 --- a/shell/frame/RightPanel.py +++ b/shell/frame/RightPanel.py @@ -27,8 +27,8 @@ class RightPanel(GridGroup): color=IconColor(buddy.get_color())) icon.connect('clicked', self.__buddy_clicked_cb, buddy) - constraints = GridConstraints(0, self.get_n_children() + 2, 1, 1) - constraints.padding = 6 + row = self.get_n_children() + 2 + constraints = GridConstraints(0, row , 1, 1, 6) self._layout.set_constraints(icon, constraints) self.add_child(icon) diff --git a/shell/frame/TopPanel.py b/shell/frame/TopPanel.py index 8cd42847..2c33519a 100644 --- a/shell/frame/TopPanel.py +++ b/shell/frame/TopPanel.py @@ -31,14 +31,12 @@ class TopPanel(GridGroup): icon = IconItem(icon_name=icon_name, size=self._height) icon.connect('clicked', self.__level_clicked_cb, level) - constraints = GridConstraints(pos, 0, 1, 1) - constraints.padding = 6 + constraints = GridConstraints(pos, 0, 1, 1, 6) self._layout.set_constraints(icon, constraints) self.add_child(icon) def add_icon(self, icon, pos): - constraints = GridConstraints(pos, 0, 1, 1) - constraints.padding = 6 + constraints = GridConstraints(pos, 0, 1, 1, 6) self._layout.set_constraints(icon, constraints) self.add_child(icon) diff --git a/sugar/canvas/GridLayout.py b/sugar/canvas/GridLayout.py index 6484d3d3..a91d4b7d 100644 --- a/sugar/canvas/GridLayout.py +++ b/sugar/canvas/GridLayout.py @@ -2,12 +2,12 @@ import gobject import goocanvas class GridConstraints: - def __init__(self, x, y, width, height): + def __init__(self, x, y, width, height, padding=0): self.x = x self.y = y self.width = width self.height = height - self.padding = 0 + self.padding = padding class GridLayout: def __init__(self, cols=16, rows=12):