Implement a simple box group and use it for the dynamic panels

This commit is contained in:
Marco Pesenti Gritti 2006-09-09 11:43:52 +02:00
parent dd9e09ab1c
commit 678cab55f9
3 changed files with 8 additions and 24 deletions

View File

@ -7,7 +7,7 @@ from sugar.canvas.IconItem import IconItem
from sugar.canvas.IconColor import IconColor
from sugar.presence import PresenceService
from sugar.canvas.GridLayout import GridGroup
from sugar.canvas.GridLayout import GridConstraints
from sugar.canvas.GridBox import GridBox
class ActivityItem(IconItem):
def __init__(self, activity):
@ -33,9 +33,9 @@ class InviteItem(IconItem):
def get_bundle_id(self):
return self._invite.get_bundle_id()
class BottomPanel(GridGroup):
class BottomPanel(GridBox):
def __init__(self, shell, invites):
GridGroup.__init__(self, 16, 1)
GridBox.__init__(self, GridBox.HORIZONTAL, 14, 6)
self._shell = shell
@ -67,19 +67,9 @@ class BottomPanel(GridGroup):
item = ActivityItem(activity)
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)
def add_invite(self, invite):
item = InviteItem(invite)
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)

View File

@ -37,11 +37,10 @@ class Frame:
layout.set_constraints(panel, constraints)
self._model.add(panel)
constraints = GridConstraints(0, 11, 16, 1)
self._create_window(constraints)
self._create_window(GridConstraints(0, 11, 16, 1))
panel = BottomPanel(shell, owner.get_invites())
layout.set_constraints(panel, constraints)
layout.set_constraints(panel, GridConstraints(1, 11, 14, 1))
self._model.add(panel)
# Left

View File

@ -4,12 +4,12 @@ from frame.PanelWindow import PanelWindow
from sugar.canvas.IconItem import IconItem
from sugar.canvas.IconColor import IconColor
from sugar.canvas.GridLayout import GridGroup
from sugar.canvas.GridLayout import GridConstraints
from sugar.canvas.GridBox import GridBox
from sugar.presence import PresenceService
class RightPanel(GridGroup):
class RightPanel(GridBox):
def __init__(self, shell, friends):
GridGroup.__init__(self, 1, 10)
GridBox.__init__(self, GridBox.VERTICAL, 10, 6)
self._shell = shell
self._friends = friends
self._activity_ps = None
@ -27,11 +27,6 @@ class RightPanel(GridGroup):
icon = IconItem(icon_name='stock-buddy',
color=IconColor(buddy.get_color()))
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._buddies[buddy.get_name()] = icon