From ee66b2237df8589170da9724f36fe28e86e1cee1 Mon Sep 17 00:00:00 2001 From: Marco Pesenti Gritti Date: Tue, 20 Feb 2007 14:57:50 +0100 Subject: [PATCH] More work to get rid of stylesheets, some regressions. --- shell/view/Shell.py | 4 ---- shell/view/clipboardmenu.py | 5 +---- shell/view/frame/ActivitiesBox.py | 15 ++++++++++----- shell/view/frame/FriendsBox.py | 2 -- shell/view/frame/clipboardbox.py | 2 -- shell/view/home/FriendView.py | 7 +++---- shell/view/home/activitiesdonut.py | 6 +++--- shell/view/stylesheet.py | 20 -------------------- sugar/graphics/__init__.py | 4 ---- 9 files changed, 17 insertions(+), 48 deletions(-) diff --git a/shell/view/Shell.py b/shell/view/Shell.py index 242bf51e..8d0fd493 100644 --- a/shell/view/Shell.py +++ b/shell/view/Shell.py @@ -19,8 +19,6 @@ import logging import gobject import wnck -import view.stylesheet -from sugar.graphics import style from view.home.HomeWindow import HomeWindow from sugar.presence import PresenceService from view.ActivityHost import ActivityHost @@ -41,8 +39,6 @@ class Shell(gobject.GObject): self._current_host = None self._screen_rotation = 0 - style.load_stylesheet(view.stylesheet) - self._hw_manager = HardwareManager() self._audio_manager = AudioManager() diff --git a/shell/view/clipboardmenu.py b/shell/view/clipboardmenu.py index bfe7cd0f..77e50387 100644 --- a/shell/view/clipboardmenu.py +++ b/shell/view/clipboardmenu.py @@ -3,17 +3,14 @@ import hippo from sugar.graphics.menu import Menu from sugar.graphics.canvasicon import CanvasIcon from sugar.graphics.ClipboardBubble import ClipboardBubble -from sugar.graphics import style class ClipboardMenuItem(ClipboardBubble): - def __init__(self, percent = 0, stylesheet="clipboard.Bubble"): + def __init__(self, percent = 0): self._text_item = None ClipboardBubble.__init__(self, percent=percent) - style.apply_stylesheet(self, stylesheet) self._text_item = hippo.CanvasText(text=str(percent) + ' %') - style.apply_stylesheet(self._text_item, 'clipboard.MenuItem.Title') self.append(self._text_item) def do_set_property(self, pspec, value): diff --git a/shell/view/frame/ActivitiesBox.py b/shell/view/frame/ActivitiesBox.py index c265b6c1..d63eee6a 100644 --- a/shell/view/frame/ActivitiesBox.py +++ b/shell/view/frame/ActivitiesBox.py @@ -17,16 +17,20 @@ import hippo import logging +from sugar.graphics import units +from sugar.graphics.iconcolor import IconColor from sugar.graphics.canvasicon import CanvasIcon from sugar.presence import PresenceService -from sugar.graphics import style from sugar import profile class ActivityItem(CanvasIcon): def __init__(self, activity): icon_name = activity.get_icon() - CanvasIcon.__init__(self, icon_name=icon_name) - style.apply_stylesheet(self, 'frame.ActivityIcon') + CanvasIcon.__init__(self, icon_name=icon_name, + box_width=units.grid_to_pixels(1), + box_height=units.grid_to_pixels(1), + color=IconColor('white')) + self._activity = activity self._normal_color = self.get_property('color') self._prelight_color = profile.get_color() @@ -44,9 +48,10 @@ class ActivityItem(CanvasIcon): class InviteItem(CanvasIcon): def __init__(self, activity, invite): - CanvasIcon.__init__(self, icon_name=activity.get_icon()) + CanvasIcon.__init__(self, icon_name=activity.get_icon(), + box_width=units.grid_to_pixels(1), + box_height=units.grid_to_pixels(1)) - style.apply_stylesheet(self, 'frame.ActivityIcon') self.props.color = activity.get_color() self._invite = invite diff --git a/shell/view/frame/FriendsBox.py b/shell/view/frame/FriendsBox.py index a0e5f92e..5b88fb13 100644 --- a/shell/view/frame/FriendsBox.py +++ b/shell/view/frame/FriendsBox.py @@ -18,7 +18,6 @@ import hippo from sugar.graphics.canvasicon import CanvasIcon from sugar.graphics.iconcolor import IconColor -from sugar.graphics import style from sugar.presence import PresenceService from view.BuddyIcon import BuddyIcon from model.BuddyModel import BuddyModel @@ -51,7 +50,6 @@ class FriendsBox(hippo.CanvasBox): model = BuddyModel(buddy=buddy) icon = BuddyIcon(self._shell, self._menu_shell, model) - style.apply_stylesheet(icon, 'frame.BuddyIcon') self.append(icon) self._buddies[buddy.get_name()] = icon diff --git a/shell/view/frame/clipboardbox.py b/shell/view/frame/clipboardbox.py index 5a902f9e..d230e062 100644 --- a/shell/view/frame/clipboardbox.py +++ b/shell/view/frame/clipboardbox.py @@ -3,7 +3,6 @@ import hippo import gtk from sugar import util -from sugar.graphics import style from view.clipboardicon import ClipboardIcon from sugar.clipboard import clipboardservice @@ -76,7 +75,6 @@ class ClipboardBox(hippo.CanvasBox): def _object_added_cb(self, cb_service, object_id, name): icon = ClipboardIcon(self._menu_shell, object_id, name) - style.apply_stylesheet(icon, 'frame.BuddyIcon') self.append(icon) self._icons[object_id] = icon diff --git a/shell/view/home/FriendView.py b/shell/view/home/FriendView.py index 6d24f767..c84cee54 100644 --- a/shell/view/home/FriendView.py +++ b/shell/view/home/FriendView.py @@ -19,7 +19,7 @@ import gobject from view.BuddyIcon import BuddyIcon from sugar.graphics.canvasicon import CanvasIcon -from sugar.graphics import style +from sugar.graphics import units from sugar.presence import PresenceService class FriendView(hippo.CanvasBox): @@ -30,11 +30,10 @@ class FriendView(hippo.CanvasBox): self._buddy = buddy self._buddy_icon = BuddyIcon(shell, menu_shell, buddy) - style.apply_stylesheet(self._buddy_icon, 'friends.FriendIcon') + self._buddy_icon.props.scale = units.LARGE_ICON_SCALE self.append(self._buddy_icon) - self._activity_icon = CanvasIcon() - style.apply_stylesheet(self._activity_icon, 'friends.ActivityIcon') + self._activity_icon = CanvasIcon(scale=units.LARGE_ICON_SCALE) self._activity_icon_visible = False if self._buddy.is_present(): diff --git a/shell/view/home/activitiesdonut.py b/shell/view/home/activitiesdonut.py index 383f7a30..b1ec62d6 100644 --- a/shell/view/home/activitiesdonut.py +++ b/shell/view/home/activitiesdonut.py @@ -20,7 +20,7 @@ import gobject import colorsys from sugar.graphics.canvasicon import CanvasIcon -from sugar.graphics import style +from sugar.graphics import units from sugar.graphics import iconcolor from sugar import profile @@ -55,8 +55,8 @@ class ActivityIcon(CanvasIcon): self._level = self._level_max color = self._icon_colors[self._level] - CanvasIcon.__init__(self, icon_name=icon_name, color=color, cache=True) - style.apply_stylesheet(self, 'ring.ActivityIcon') + CanvasIcon.__init__(self, icon_name=icon_name, color=color, + scale=units.MEDIUM_ICON_SCALE, cache=True) self._activity = activity self._launched = False diff --git a/shell/view/stylesheet.py b/shell/view/stylesheet.py index 6e983f32..70216442 100644 --- a/shell/view/stylesheet.py +++ b/shell/view/stylesheet.py @@ -23,30 +23,10 @@ from sugar.graphics.grid import Grid grid = Grid() -frame_ActivityIcon = { - 'color' : IconColor('white'), - 'box-width' : grid.dimension(1), - 'scale' : style.standard_icon_scale -} - -frame_BuddyIcon = { - 'box-width' : grid.dimension(1), - 'box-height' : grid.dimension(1), - 'scale' : style.standard_icon_scale -} - -ring_ActivityIcon = { - 'scale' : style.medium_icon_scale -} - friends_FriendIcon = { 'scale' : style.large_icon_scale } -friends_ActivityIcon = { - 'scale' : style.standard_icon_scale -} - clipboard_Bubble = { 'fill-color' : 0x646464FF, 'stroke-color' : 0x646464FF, diff --git a/sugar/graphics/__init__.py b/sugar/graphics/__init__.py index 420e0e5e..e69de29b 100644 --- a/sugar/graphics/__init__.py +++ b/sugar/graphics/__init__.py @@ -1,4 +0,0 @@ -from sugar.graphics import style -from sugar.graphics import stylesheet - -style.load_stylesheet(stylesheet)