Add padding in the constraints constructor

This commit is contained in:
Marco Pesenti Gritti 2006-09-08 02:20:11 +02:00
parent 57d1221cd3
commit 6bbb20c4c7
4 changed files with 10 additions and 10 deletions

View File

@ -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):

View File

@ -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)

View File

@ -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)

View File

@ -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):