Add padding in the constraints constructor
This commit is contained in:
parent
57d1221cd3
commit
6bbb20c4c7
@ -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):
|
||||
|
@ -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)
|
||||
|
@ -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)
|
||||
|
||||
|
@ -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):
|
||||
|
Loading…
Reference in New Issue
Block a user