diff options
author | Marco Pesenti Gritti <mpg@redhat.com> | 2007-09-02 23:48:03 (GMT) |
---|---|---|
committer | Marco Pesenti Gritti <mpg@redhat.com> | 2007-09-02 23:48:03 (GMT) |
commit | a09a786ff7a2ccc5657ac2708e048a183c90360c (patch) | |
tree | 7983a9438b6e31b96e44b28032156b5b00be87bc /shell/view | |
parent | 8a2cb49ffba017f1a7fc1ed138bfb9c58e7b70c7 (diff) |
Use Tray also for the frame friends view.
Drop the deprecated IconButton.
Diffstat (limited to 'shell/view')
-rw-r--r-- | shell/view/frame/ActivitiesBox.py | 1 | ||||
-rw-r--r-- | shell/view/frame/Makefile.am | 4 | ||||
-rw-r--r-- | shell/view/frame/frame.py | 7 | ||||
-rw-r--r-- | shell/view/frame/frameinvoker.py | 7 | ||||
-rw-r--r-- | shell/view/frame/friendstray.py (renamed from shell/view/frame/FriendsBox.py) | 37 |
5 files changed, 23 insertions, 33 deletions
diff --git a/shell/view/frame/ActivitiesBox.py b/shell/view/frame/ActivitiesBox.py index 28f3da8..ec79f86 100644 --- a/shell/view/frame/ActivitiesBox.py +++ b/shell/view/frame/ActivitiesBox.py @@ -24,7 +24,6 @@ from sugar.graphics import style from sugar import profile from sugar import activity -from frameinvoker import FrameCanvasInvoker from activitybutton import ActivityButton class InviteButton(TrayButton): diff --git a/shell/view/frame/Makefile.am b/shell/view/frame/Makefile.am index e40219e..7be9986 100644 --- a/shell/view/frame/Makefile.am +++ b/shell/view/frame/Makefile.am @@ -6,9 +6,9 @@ sugar_PYTHON = \ clipboardbox.py \ clipboardpanelwindow.py \ frameinvoker.py \ - FriendsBox.py \ + friendstray.py \ eventarea.py \ frame.py \ overlaybox.py \ framewindow.py \ - zoombox.py + zoomtoolbar.py diff --git a/shell/view/frame/frame.py b/shell/view/frame/frame.py index 1ce10ed..2784835 100644 --- a/shell/view/frame/frame.py +++ b/shell/view/frame/frame.py @@ -29,7 +29,7 @@ from view.frame.eventarea import EventArea from view.frame.ActivitiesBox import ActivitiesBox from view.frame.zoomtoolbar import ZoomToolbar from view.frame.overlaybox import OverlayBox -from view.frame.FriendsBox import FriendsBox +from view.frame.friendstray import FriendsTray from view.frame.framewindow import FrameWindow from view.frame.clipboardpanelwindow import ClipboardPanelWindow from model.shellmodel import ShellModel @@ -227,8 +227,9 @@ class Frame(object): def _create_right_panel(self): panel = self._create_panel(gtk.POS_RIGHT) - box = FriendsBox(self._shell) - panel.append(box) + tray = FriendsTray(self._shell) + panel.append(hippo.CanvasWidget(widget=tray), hippo.PACK_EXPAND) + tray.show() return panel diff --git a/shell/view/frame/frameinvoker.py b/shell/view/frame/frameinvoker.py index d06082a..2b41655 100644 --- a/shell/view/frame/frameinvoker.py +++ b/shell/view/frame/frameinvoker.py @@ -37,10 +37,3 @@ class FrameWidgetInvoker(WidgetInvoker): self._position_hint = self.ANCHORED self._screen_area = _get_screen_area() - -class FrameCanvasInvoker(CanvasInvoker): - def __init__(self, item): - CanvasInvoker.__init__(self, item) - - self._position_hint = self.ANCHORED - self._screen_area = _get_screen_area() diff --git a/shell/view/frame/FriendsBox.py b/shell/view/frame/friendstray.py index 2806926..b5c35d6 100644 --- a/shell/view/frame/FriendsBox.py +++ b/shell/view/frame/friendstray.py @@ -16,32 +16,27 @@ import hippo -from sugar.graphics.palette import Palette -from sugar.graphics.icon import CanvasIcon -from sugar.graphics import style from sugar.presence import presenceservice +from sugar.graphics.tray import VTray, TrayIcon -from view.BuddyIcon import BuddyIcon +from view.BuddyMenu import BuddyMenu +from view.frame.frameinvoker import FrameWidgetInvoker from model.BuddyModel import BuddyModel -from view.frame.frameinvoker import FrameCanvasInvoker -class FriendIcon(BuddyIcon): +class FriendIcon(TrayIcon): def __init__(self, shell, buddy): - BuddyIcon.__init__(self, shell, buddy) + TrayIcon.__init__(self, icon_name='computer-xo', + xo_color=buddy.get_color()) - palette = self.get_palette() + palette = BuddyMenu(shell, buddy) + self.set_palette(palette) palette.set_group_id('frame') - palette.props.invoker = FrameCanvasInvoker(self) + palette.props.invoker = FrameWidgetInvoker(self) - def prelight(self, enter): - if enter: - self.props.background_color = style.COLOR_BLACK.get_int() - else: - self.props.background_color = style.COLOR_TOOLBAR_GREY.get_int() - -class FriendsBox(hippo.CanvasBox): +class FriendsTray(VTray): def __init__(self, shell): - hippo.CanvasBox.__init__(self) + VTray.__init__(self) + self._shell = shell self._activity_ps = None self._joined_hid = -1 @@ -68,8 +63,10 @@ class FriendsBox(hippo.CanvasBox): return model = BuddyModel(buddy=buddy) + icon = FriendIcon(self._shell, model) - self.append(icon) + self.add_item(icon) + icon.show() self._buddies[buddy.props.key] = icon @@ -77,11 +74,11 @@ class FriendsBox(hippo.CanvasBox): if not self._buddies.has_key(buddy.props.key): return - self.remove(self._buddies[buddy.props.key]) + self.remove_item(self._buddies[buddy.props.key]) def clear(self): for item in self.get_children(): - self.remove(item) + self.remove_item(item) self._buddies = {} def __activity_appeared_cb(self, pservice, activity_ps): |