Implement a simple box group and use it for the dynamic panels
This commit is contained in:
parent
dd9e09ab1c
commit
678cab55f9
@ -7,7 +7,7 @@ from sugar.canvas.IconItem import IconItem
|
|||||||
from sugar.canvas.IconColor import IconColor
|
from sugar.canvas.IconColor import IconColor
|
||||||
from sugar.presence import PresenceService
|
from sugar.presence import PresenceService
|
||||||
from sugar.canvas.GridLayout import GridGroup
|
from sugar.canvas.GridLayout import GridGroup
|
||||||
from sugar.canvas.GridLayout import GridConstraints
|
from sugar.canvas.GridBox import GridBox
|
||||||
|
|
||||||
class ActivityItem(IconItem):
|
class ActivityItem(IconItem):
|
||||||
def __init__(self, activity):
|
def __init__(self, activity):
|
||||||
@ -33,9 +33,9 @@ class InviteItem(IconItem):
|
|||||||
def get_bundle_id(self):
|
def get_bundle_id(self):
|
||||||
return self._invite.get_bundle_id()
|
return self._invite.get_bundle_id()
|
||||||
|
|
||||||
class BottomPanel(GridGroup):
|
class BottomPanel(GridBox):
|
||||||
def __init__(self, shell, invites):
|
def __init__(self, shell, invites):
|
||||||
GridGroup.__init__(self, 16, 1)
|
GridBox.__init__(self, GridBox.HORIZONTAL, 14, 6)
|
||||||
|
|
||||||
self._shell = shell
|
self._shell = shell
|
||||||
|
|
||||||
@ -67,19 +67,9 @@ class BottomPanel(GridGroup):
|
|||||||
|
|
||||||
item = ActivityItem(activity)
|
item = ActivityItem(activity)
|
||||||
item.connect('clicked', self.__activity_clicked_cb)
|
item.connect('clicked', self.__activity_clicked_cb)
|
||||||
|
|
||||||
col = self.get_n_children() + 1
|
|
||||||
constraints = GridConstraints(col, 0, 1, 1, 6)
|
|
||||||
self._layout.set_constraints(item, constraints)
|
|
||||||
|
|
||||||
self.add_child(item)
|
self.add_child(item)
|
||||||
|
|
||||||
def add_invite(self, invite):
|
def add_invite(self, invite):
|
||||||
item = InviteItem(invite)
|
item = InviteItem(invite)
|
||||||
item.connect('clicked', self.__invite_clicked_cb)
|
item.connect('clicked', self.__invite_clicked_cb)
|
||||||
|
|
||||||
col = self.get_n_children() + 1
|
|
||||||
constraints = GridConstraints(col, 0, 1, 1, 6)
|
|
||||||
self._layout.set_constraints(item, constraints)
|
|
||||||
|
|
||||||
self.add_child(item)
|
self.add_child(item)
|
||||||
|
@ -37,11 +37,10 @@ class Frame:
|
|||||||
layout.set_constraints(panel, constraints)
|
layout.set_constraints(panel, constraints)
|
||||||
self._model.add(panel)
|
self._model.add(panel)
|
||||||
|
|
||||||
constraints = GridConstraints(0, 11, 16, 1)
|
self._create_window(GridConstraints(0, 11, 16, 1))
|
||||||
self._create_window(constraints)
|
|
||||||
|
|
||||||
panel = BottomPanel(shell, owner.get_invites())
|
panel = BottomPanel(shell, owner.get_invites())
|
||||||
layout.set_constraints(panel, constraints)
|
layout.set_constraints(panel, GridConstraints(1, 11, 14, 1))
|
||||||
self._model.add(panel)
|
self._model.add(panel)
|
||||||
|
|
||||||
# Left
|
# Left
|
||||||
|
@ -4,12 +4,12 @@ from frame.PanelWindow import PanelWindow
|
|||||||
from sugar.canvas.IconItem import IconItem
|
from sugar.canvas.IconItem import IconItem
|
||||||
from sugar.canvas.IconColor import IconColor
|
from sugar.canvas.IconColor import IconColor
|
||||||
from sugar.canvas.GridLayout import GridGroup
|
from sugar.canvas.GridLayout import GridGroup
|
||||||
from sugar.canvas.GridLayout import GridConstraints
|
from sugar.canvas.GridBox import GridBox
|
||||||
from sugar.presence import PresenceService
|
from sugar.presence import PresenceService
|
||||||
|
|
||||||
class RightPanel(GridGroup):
|
class RightPanel(GridBox):
|
||||||
def __init__(self, shell, friends):
|
def __init__(self, shell, friends):
|
||||||
GridGroup.__init__(self, 1, 10)
|
GridBox.__init__(self, GridBox.VERTICAL, 10, 6)
|
||||||
self._shell = shell
|
self._shell = shell
|
||||||
self._friends = friends
|
self._friends = friends
|
||||||
self._activity_ps = None
|
self._activity_ps = None
|
||||||
@ -27,11 +27,6 @@ class RightPanel(GridGroup):
|
|||||||
icon = IconItem(icon_name='stock-buddy',
|
icon = IconItem(icon_name='stock-buddy',
|
||||||
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)
|
||||||
|
|
||||||
row = self.get_n_children()
|
|
||||||
constraints = GridConstraints(0, row , 1, 1, 6)
|
|
||||||
self._layout.set_constraints(icon, constraints)
|
|
||||||
|
|
||||||
self.add_child(icon)
|
self.add_child(icon)
|
||||||
|
|
||||||
self._buddies[buddy.get_name()] = icon
|
self._buddies[buddy.get_name()] = icon
|
||||||
|
Loading…
Reference in New Issue
Block a user