diff options
author | Marco Pesenti Gritti <marco@localhost.localdomain> | 2006-09-14 19:15:48 (GMT) |
---|---|---|
committer | Marco Pesenti Gritti <marco@localhost.localdomain> | 2006-09-14 19:15:48 (GMT) |
commit | 3ee23b3a92c0be2e6eae3be19a9922934bab4b4c (patch) | |
tree | 3eb0b828bad80602897a32a0090574d5800f6917 /shell | |
parent | e12881e36b760bd7ce703961f97a39c89da6c8de (diff) |
Keep popups out of the frame
Diffstat (limited to 'shell')
-rw-r--r-- | shell/FriendIcon.py | 12 | ||||
-rw-r--r-- | shell/frame/RightPanel.py | 1 |
2 files changed, 10 insertions, 3 deletions
diff --git a/shell/FriendIcon.py b/shell/FriendIcon.py index 384e745..3824bba 100644 --- a/shell/FriendIcon.py +++ b/shell/FriendIcon.py @@ -10,10 +10,14 @@ class FriendIcon(IconItem): self._shell = shell self._friend = friend self._popup = None + self._popup_distance = 0 self.connect('popup', self._popup_cb) self.connect('popdown', self._popdown_cb) + def set_popup_distance(self, distance): + self._popup_distance = distance + def get_friend(self): return self._friend @@ -23,13 +27,15 @@ class FriendIcon(IconItem): if not self._popup: self._popup = FriendPopup(self._shell, grid, icon.get_friend()) + distance = self._popup_distance + [grid_x1, grid_y1] = grid.convert_from_screen(x1, y1) [grid_x2, grid_y2] = grid.convert_from_screen(x2, y2) - if grid_x2 + self._popup.get_width() + 1 > Grid.ROWS: - grid_x = grid_x1 - self._popup.get_width() + 1 + if grid_x2 + self._popup.get_width() + distance > Grid.ROWS: + grid_x = grid_x1 - self._popup.get_width() - distance else: - grid_x = grid_x2 - 1 + grid_x = grid_x2 + distance grid_y = grid_y1 diff --git a/shell/frame/RightPanel.py b/shell/frame/RightPanel.py index cb2f4f1..be55abf 100644 --- a/shell/frame/RightPanel.py +++ b/shell/frame/RightPanel.py @@ -26,6 +26,7 @@ class RightPanel(CanvasBox): def add(self, buddy): friend = Friend(buddy.get_name(), buddy.get_color()) icon = FriendIcon(self._shell, friend) + icon.set_popup_distance(1) self.set_constraints(icon, 3, 3) self.add_child(icon) |