Insert the invites before the activities
This commit is contained in:
parent
4cca5dc9ff
commit
9d4911d1e3
@ -63,4 +63,4 @@ class BottomPanel(GridBox):
|
||||
def add_invite(self, invite):
|
||||
item = InviteItem(invite)
|
||||
item.connect('clicked', self.__invite_clicked_cb)
|
||||
self.add_child(item)
|
||||
self.add_child(item, 0)
|
||||
|
@ -16,10 +16,7 @@ class GridBox(GridGroup, goocanvas.Item):
|
||||
self._direction = direction
|
||||
self._padding = padding
|
||||
|
||||
def add_child(self, item, position=-1):
|
||||
if position == -1:
|
||||
position = self.get_n_children()
|
||||
|
||||
def _update_constraints(self, item, position):
|
||||
if self._direction == GridBox.HORIZONTAL:
|
||||
col = position
|
||||
row = 0
|
||||
@ -30,4 +27,15 @@ class GridBox(GridGroup, goocanvas.Item):
|
||||
constraints = GridConstraints(col, row, 1, 1, self._padding)
|
||||
self._layout.set_constraints(item, constraints)
|
||||
|
||||
def add_child(self, item, position=-1):
|
||||
if position == -1:
|
||||
position = self.get_n_children()
|
||||
|
||||
self._update_constraints(item, position)
|
||||
|
||||
i = position
|
||||
while i < self.get_n_children():
|
||||
self._update_constraints(self.get_child(i), i + 1)
|
||||
i += 1
|
||||
|
||||
GridGroup.add_child(self, item, position)
|
||||
|
@ -19,6 +19,8 @@ class GridLayout:
|
||||
|
||||
def set_constraints(self, component, constraints):
|
||||
self._constraints[component] = constraints
|
||||
if isinstance(component, goocanvas.Item):
|
||||
self.layout_canvas_item(component)
|
||||
|
||||
def _get_geometry(self, container, component):
|
||||
constraints = self._constraints[component]
|
||||
@ -45,6 +47,9 @@ class GridLayout:
|
||||
|
||||
def layout_canvas_item(self, item):
|
||||
group = item.get_parent()
|
||||
if group == None:
|
||||
return
|
||||
|
||||
[x, y, width, height] = self._get_geometry(group, item)
|
||||
|
||||
item.props.x = x
|
||||
|
Loading…
Reference in New Issue
Block a user