Fixup friends positioning and cleanup the code

This commit is contained in:
Marco Pesenti Gritti 2006-09-08 18:12:08 +02:00
parent f4d8e538f4
commit bfb09abf7d
2 changed files with 20 additions and 20 deletions

View File

@ -31,32 +31,32 @@ class HomeWindow(gtk.Window):
def set_owner(self, owner):
root = self._view.get_model().get_root_item()
icon_layout = IconLayout(MeshGroup.WIDTH, MeshGroup.HEIGHT)
x1 = (self._width - FriendsGroup.WIDTH) / 2
y1 = (self._height - FriendsGroup.HEIGHT) / 2
x2 = x1 + FriendsGroup.WIDTH
y2 = y1 + FriendsGroup.HEIGHT
icon_layout.set_bounds(x1, y1, x2, y2)
friends_x = (self._width - FriendsGroup.WIDTH) / 2
friends_y = (self._height - FriendsGroup.HEIGHT) / 2
self._mesh_group = MeshGroup(self._shell, icon_layout)
home_x = (self._width - HomeGroup.WIDTH) / 2
home_y = (self._height - HomeGroup.HEIGHT) / 2
layout = IconLayout(MeshGroup.WIDTH, MeshGroup.HEIGHT)
layout.set_internal_bounds(friends_x, friends_y,
friends_x + FriendsGroup.WIDTH,
friends_y + FriendsGroup.HEIGHT)
self._mesh_group = MeshGroup(self._shell, layout)
root.add_child(self._mesh_group)
icon_layout = IconLayout(FriendsGroup.WIDTH, FriendsGroup.HEIGHT)
x1 = (self._width - HomeGroup.WIDTH) / 2
y1 = (self._height - HomeGroup.HEIGHT) / 2
x2 = x1 + HomeGroup.WIDTH
y2 = y1 + HomeGroup.HEIGHT
icon_layout.set_bounds(x1, y1, x2, y2)
layout = IconLayout(FriendsGroup.WIDTH, FriendsGroup.HEIGHT)
layout.set_internal_bounds(home_x - friends_x, home_y - friends_y,
home_x - friends_x + HomeGroup.WIDTH,
home_y - friends_y + HomeGroup.HEIGHT)
self._friends_group = FriendsGroup(self._shell, owner.get_friends(),
icon_layout)
self._friends_group.translate((self._width - FriendsGroup.WIDTH) / 2,
(self._height - FriendsGroup.HEIGHT) / 2)
friends = owner.get_friends()
self._friends_group = FriendsGroup(self._shell, friends, layout)
self._friends_group.translate(friends_x, friends_y)
root.add_child(self._friends_group)
self._home_group = HomeGroup(self._shell)
self._home_group.translate((self._width - HomeGroup.WIDTH) / 2,
(self._height - HomeGroup.HEIGHT) / 2)
self._home_group.translate(home_x, home_y)
root.add_child(self._home_group)
def set_zoom_level(self, level):

View File

@ -6,7 +6,7 @@ class IconLayout:
self._width = width
self._height = height
def set_bounds(self, x1, y1, x2, y2):
def set_internal_bounds(self, x1, y1, x2, y2):
self._x1 = x1
self._y1 = y1
self._x2 = x2