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 = ActivityItem(activity)
|
||||||
item.connect('clicked', self.__activity_clicked_cb)
|
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._layout.set_constraints(item, constraints)
|
||||||
|
|
||||||
self.add_child(item)
|
self.add_child(item)
|
||||||
|
|
||||||
def add_invite(self, invite):
|
def add_invite(self, invite):
|
||||||
|
@ -27,8 +27,8 @@ class RightPanel(GridGroup):
|
|||||||
color=IconColor(buddy.get_color()))
|
color=IconColor(buddy.get_color()))
|
||||||
icon.connect('clicked', self.__buddy_clicked_cb, buddy)
|
icon.connect('clicked', self.__buddy_clicked_cb, buddy)
|
||||||
|
|
||||||
constraints = GridConstraints(0, self.get_n_children() + 2, 1, 1)
|
row = self.get_n_children() + 2
|
||||||
constraints.padding = 6
|
constraints = GridConstraints(0, row , 1, 1, 6)
|
||||||
self._layout.set_constraints(icon, constraints)
|
self._layout.set_constraints(icon, constraints)
|
||||||
|
|
||||||
self.add_child(icon)
|
self.add_child(icon)
|
||||||
|
@ -31,14 +31,12 @@ class TopPanel(GridGroup):
|
|||||||
icon = IconItem(icon_name=icon_name, size=self._height)
|
icon = IconItem(icon_name=icon_name, size=self._height)
|
||||||
icon.connect('clicked', self.__level_clicked_cb, level)
|
icon.connect('clicked', self.__level_clicked_cb, level)
|
||||||
|
|
||||||
constraints = GridConstraints(pos, 0, 1, 1)
|
constraints = GridConstraints(pos, 0, 1, 1, 6)
|
||||||
constraints.padding = 6
|
|
||||||
self._layout.set_constraints(icon, constraints)
|
self._layout.set_constraints(icon, constraints)
|
||||||
self.add_child(icon)
|
self.add_child(icon)
|
||||||
|
|
||||||
def add_icon(self, icon, pos):
|
def add_icon(self, icon, pos):
|
||||||
constraints = GridConstraints(pos, 0, 1, 1)
|
constraints = GridConstraints(pos, 0, 1, 1, 6)
|
||||||
constraints.padding = 6
|
|
||||||
self._layout.set_constraints(icon, constraints)
|
self._layout.set_constraints(icon, constraints)
|
||||||
self.add_child(icon)
|
self.add_child(icon)
|
||||||
|
|
||||||
|
@ -2,12 +2,12 @@ import gobject
|
|||||||
import goocanvas
|
import goocanvas
|
||||||
|
|
||||||
class GridConstraints:
|
class GridConstraints:
|
||||||
def __init__(self, x, y, width, height):
|
def __init__(self, x, y, width, height, padding=0):
|
||||||
self.x = x
|
self.x = x
|
||||||
self.y = y
|
self.y = y
|
||||||
self.width = width
|
self.width = width
|
||||||
self.height = height
|
self.height = height
|
||||||
self.padding = 0
|
self.padding = padding
|
||||||
|
|
||||||
class GridLayout:
|
class GridLayout:
|
||||||
def __init__(self, cols=16, rows=12):
|
def __init__(self, cols=16, rows=12):
|
||||||
|
Loading…
Reference in New Issue
Block a user