From 0bd96b3987b5f6e0be7e55f483278c93d27b698b Mon Sep 17 00:00:00 2001 From: Marco Pesenti Gritti Date: Thu, 5 Oct 2006 14:52:33 +0200 Subject: [PATCH] More stylsheets work --- shell/view/frame/ZoomBox.py | 2 -- .../view/{BuddyActivityView.py => home/FriendView.py} | 11 +++++++---- shell/view/home/FriendsBox.py | 4 ++-- shell/view/stylesheet.py | 8 ++++++++ sugar/graphics/menu.py | 2 ++ 5 files changed, 19 insertions(+), 8 deletions(-) rename shell/view/{BuddyActivityView.py => home/FriendView.py} (86%) diff --git a/shell/view/frame/ZoomBox.py b/shell/view/frame/ZoomBox.py index 5b3ad3c7..86b7040b 100644 --- a/shell/view/frame/ZoomBox.py +++ b/shell/view/frame/ZoomBox.py @@ -15,11 +15,9 @@ class ActivityMenu(Menu): Menu.__init__(self, activity_host.get_title()) icon = CanvasIcon(icon_name='stock-share-mesh') - style.apply_stylesheet(icon, 'menu.ActionIcon') self.add_action(icon, ActivityMenu.ACTION_SHARE) icon = CanvasIcon(icon_name='stock-close') - style.apply_stylesheet(icon, 'menu.ActionIcon') self.add_action(icon, ActivityMenu.ACTION_CLOSE) class ActivityIcon(MenuIcon): diff --git a/shell/view/BuddyActivityView.py b/shell/view/home/FriendView.py similarity index 86% rename from shell/view/BuddyActivityView.py rename to shell/view/home/FriendView.py index 93067110..eb967048 100644 --- a/shell/view/BuddyActivityView.py +++ b/shell/view/home/FriendView.py @@ -1,13 +1,14 @@ import hippo import gobject -import BuddyIcon +from view.BuddyIcon import BuddyIcon from sugar.graphics.canvasicon import CanvasIcon +from sugar.graphics import style from sugar.presence import PresenceService import conf -class BuddyActivityView(hippo.CanvasBox): +class FriendView(hippo.CanvasBox): def __init__(self, shell, menu_shell, buddy, **kwargs): hippo.CanvasBox.__init__(self, **kwargs) @@ -15,10 +16,12 @@ class BuddyActivityView(hippo.CanvasBox): self._activity_registry = conf.get_activity_registry() self._buddy = buddy - self._buddy_icon = BuddyIcon.BuddyIcon(shell, menu_shell, buddy) + self._buddy_icon = BuddyIcon(shell, menu_shell, buddy) + style.apply_stylesheet(self._buddy_icon, 'friends.FriendIcon') self.append(self._buddy_icon) - self._activity_icon = CanvasIcon(size=48) + self._activity_icon = CanvasIcon() + style.apply_stylesheet(self._activity_icon, 'friends.ActivityIcon') self._activity_icon_visible = False if self._buddy.is_present(): diff --git a/shell/view/home/FriendsBox.py b/shell/view/home/FriendsBox.py index 186d9989..cb8b3f6d 100644 --- a/shell/view/home/FriendsBox.py +++ b/shell/view/home/FriendsBox.py @@ -5,7 +5,7 @@ import hippo from sugar.graphics.spreadlayout import SpreadLayout from sugar.graphics import style from view.home.MyIcon import MyIcon -from view.BuddyActivityView import BuddyActivityView +from view.home.FriendView import FriendView class FriendsBox(hippo.CanvasBox, hippo.CanvasItem): __gtype_name__ = 'SugarFriendsBox' @@ -30,7 +30,7 @@ class FriendsBox(hippo.CanvasBox, hippo.CanvasItem): friends.connect('friend-removed', self._friend_removed_cb) def add_friend(self, buddy_info): - icon = BuddyActivityView(self._shell, self._menu_shell, buddy_info) + icon = FriendView(self._shell, self._menu_shell, buddy_info) self.append(icon, hippo.PACK_FIXED) self._friends[buddy_info.get_name()] = icon diff --git a/shell/view/stylesheet.py b/shell/view/stylesheet.py index 7e99c3cb..1577b69c 100644 --- a/shell/view/stylesheet.py +++ b/shell/view/stylesheet.py @@ -34,3 +34,11 @@ home_MyIcon = { friends_MyIcon = { 'size' : _large_icon_size } + +friends_FriendIcon = { + 'size' : _large_icon_size +} + +friends_ActivityIcon = { + 'size' : _standard_icon_size +} diff --git a/sugar/graphics/menu.py b/sugar/graphics/menu.py index 9a85bcf4..e38de18c 100644 --- a/sugar/graphics/menu.py +++ b/sugar/graphics/menu.py @@ -3,6 +3,7 @@ import hippo import gobject from sugar.graphics.canvasicon import CanvasIcon +from sugar.graphics import style class Menu(gtk.Window): __gsignals__ = { @@ -43,6 +44,7 @@ class Menu(gtk.Window): return separator def add_action(self, icon, action_id): + style.apply_stylesheet(icon, 'menu.ActionIcon') icon.connect('activated', self._action_clicked_cb, action_id) self._action_box.append(icon)