From 3ee23b3a92c0be2e6eae3be19a9922934bab4b4c Mon Sep 17 00:00:00 2001 From: Marco Pesenti Gritti Date: Thu, 14 Sep 2006 21:15:48 +0200 Subject: [PATCH] Keep popups out of the frame --- shell/FriendIcon.py | 12 +++++++++--- shell/frame/RightPanel.py | 1 + 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/shell/FriendIcon.py b/shell/FriendIcon.py index 384e7455..3824bba6 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 cb2f4f14..be55abf2 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)