From b3abf30decf9804b492f938daaedd04cc2a9aed0 Mon Sep 17 00:00:00 2001 From: Marco Pesenti Gritti Date: Thu, 05 Oct 2006 11:26:02 +0000 Subject: Improve stylesheet loading --- (limited to 'shell') diff --git a/shell/view/Makefile.am b/shell/view/Makefile.am index e1db869..dc8570a 100644 --- a/shell/view/Makefile.am +++ b/shell/view/Makefile.am @@ -4,10 +4,11 @@ sugardir = $(pkgdatadir)/shell/view sugar_PYTHON = \ __init__.py \ ActivityHost.py \ - BuddyActivityView.py \ + BuddyActivityView.py \ ConsoleWindow.py \ FirstTimeDialog.py \ BuddyIcon.py \ BuddyMenu.py \ OverlayWindow.py \ - Shell.py + Shell.py \ + stylesheet.py diff --git a/shell/view/Shell.py b/shell/view/Shell.py index b4f6974..38ba9ac 100644 --- a/shell/view/Shell.py +++ b/shell/view/Shell.py @@ -2,6 +2,8 @@ import gtk 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 @@ -28,6 +30,8 @@ class Shell(gobject.GObject): self._hosts = {} self._screen = wnck.screen_get_default() + style.load_stylesheet(view.stylesheet) + self._key_grabber = KeyGrabber() self._key_grabber.connect('key-pressed', self.__global_key_pressed_cb) diff --git a/shell/view/frame/ActivitiesBox.py b/shell/view/frame/ActivitiesBox.py index d46f3be..5013a89 100644 --- a/shell/view/frame/ActivitiesBox.py +++ b/shell/view/frame/ActivitiesBox.py @@ -10,7 +10,7 @@ class ActivityItem(CanvasIcon): def __init__(self, activity): icon_name = activity.get_icon() CanvasIcon.__init__(self, icon_name=icon_name) - style.apply_stylesheet(self, 'frame-activity-icon') + style.apply_stylesheet(self, 'frame.ActivityIcon') self._activity = activity def get_bundle_id(self): diff --git a/shell/view/frame/ZoomBox.py b/shell/view/frame/ZoomBox.py index 7282da7..5b3ad3c 100644 --- a/shell/view/frame/ZoomBox.py +++ b/shell/view/frame/ZoomBox.py @@ -15,11 +15,11 @@ class ActivityMenu(Menu): Menu.__init__(self, activity_host.get_title()) icon = CanvasIcon(icon_name='stock-share-mesh') - style.apply_stylesheet(icon, 'menu-action-icon') + style.apply_stylesheet(icon, 'menu.ActionIcon') self.add_action(icon, ActivityMenu.ACTION_SHARE) icon = CanvasIcon(icon_name='stock-close') - style.apply_stylesheet(icon, 'menu-action-icon') + style.apply_stylesheet(icon, 'menu.ActionIcon') self.add_action(icon, ActivityMenu.ACTION_CLOSE) class ActivityIcon(MenuIcon): @@ -61,22 +61,22 @@ class ZoomBox(hippo.CanvasBox): self._activity_icon = None icon = CanvasIcon(icon_name='stock-zoom-mesh') - style.apply_stylesheet(icon, 'frame-zoom-icon') + style.apply_stylesheet(icon, 'frame.ZoomIcon') icon.connect('activated', self._level_clicked_cb, sugar.ZOOM_MESH) self.append(icon) icon = CanvasIcon(icon_name='stock-zoom-friends') - style.apply_stylesheet(icon, 'frame-zoom-icon') + style.apply_stylesheet(icon, 'frame.ZoomIcon') icon.connect('activated', self._level_clicked_cb, sugar.ZOOM_FRIENDS) self.append(icon) icon = CanvasIcon(icon_name='stock-zoom-home') - style.apply_stylesheet(icon, 'frame-zoom-icon') + style.apply_stylesheet(icon, 'frame.ZoomIcon') icon.connect('activated', self._level_clicked_cb, sugar.ZOOM_HOME) self.append(icon) icon = CanvasIcon(icon_name='stock-zoom-activity') - style.apply_stylesheet(icon, 'frame-zoom-icon') + style.apply_stylesheet(icon, 'frame.ZoomIcon') icon.connect('activated', self._level_clicked_cb, sugar.ZOOM_ACTIVITY) self.append(icon) @@ -89,7 +89,7 @@ class ZoomBox(hippo.CanvasBox): if activity: icon = ActivityIcon(self._shell, self._menu_shell, activity) - style.apply_stylesheet(icon, 'frame-zoom-icon') + style.apply_stylesheet(icon, 'frame.ZoomIcon') self.append(icon, 0) self._activity_icon = icon else: diff --git a/shell/view/stylesheet.py b/shell/view/stylesheet.py new file mode 100644 index 0000000..02f19f3 --- /dev/null +++ b/shell/view/stylesheet.py @@ -0,0 +1,21 @@ +import gtk + +from sugar.graphics.iconcolor import IconColor + +if gtk.gdk.screen_width() == 1200: + _medium_icon_size = 75 +else: + _medium_icon_size = 50 + +frame_ActivityIcon = { + 'color' : IconColor('white'), + 'size' : _medium_icon_size +} + +frame_ZoomIcon = { + 'size' : _medium_icon_size +} + +menu_ActionIcon = { + 'size' : _medium_icon_size +} -- cgit v0.9.1