Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/shell
diff options
context:
space:
mode:
authorMarco Pesenti Gritti <marco@localhost.localdomain>2006-09-14 23:01:26 (GMT)
committer Marco Pesenti Gritti <marco@localhost.localdomain>2006-09-14 23:01:26 (GMT)
commit3fc81ae94530fb19f1519da983605e33ca2b4cb1 (patch)
tree966fdc48d7c947a2b781c7bbc5c3d4215b9e6c6c /shell
parentfd92a6d7d92e8cad3b4ca9a69c5f73e2fbe03f54 (diff)
Add a popup shell which ensure only one popup is active at
the same time.
Diffstat (limited to 'shell')
-rw-r--r--shell/FriendIcon.py16
1 files changed, 15 insertions, 1 deletions
diff --git a/shell/FriendIcon.py b/shell/FriendIcon.py
index 94de02d..36e702c 100644
--- a/shell/FriendIcon.py
+++ b/shell/FriendIcon.py
@@ -2,7 +2,18 @@ from sugar.canvas.IconItem import IconItem
from FriendPopup import FriendPopup
from sugar.canvas.Grid import Grid
+class _PopupShell:
+ def __init__(self):
+ self._popup_controller = None
+
+ def set_active(self, controller):
+ if self._popup_controller:
+ self._popup_controller._popdown()
+ self._popup_controller = controller
+
class FriendIcon(IconItem):
+ _popup_shell = _PopupShell()
+
def __init__(self, shell, friend):
IconItem.__init__(self, icon_name='stock-buddy',
color=friend.get_color(), size=96)
@@ -31,9 +42,10 @@ class FriendIcon(IconItem):
def _popup_cb(self, icon, x1, y1, x2, y2):
self._popdown()
+ FriendIcon._popup_shell.set_active(None)
+
grid = Grid()
self._popup = FriendPopup(self._shell, grid, icon.get_friend())
-
self._popup.connect('enter-notify-event',
self._popup_enter_notify_event_cb)
self._popup.connect('leave-notify-event',
@@ -61,6 +73,8 @@ class FriendIcon(IconItem):
self._popup.show()
+ FriendIcon._popup_shell.set_active(self)
+
def _popdown_cb(self, friend):
if not self._hover_popup:
self._popdown()