diff options
author | Marco Pesenti Gritti <marco@localhost.localdomain> | 2006-10-05 11:26:02 (GMT) |
---|---|---|
committer | Marco Pesenti Gritti <marco@localhost.localdomain> | 2006-10-05 11:26:02 (GMT) |
commit | b3abf30decf9804b492f938daaedd04cc2a9aed0 (patch) | |
tree | 0e2a7a1785dc698b1afd063bb36748e031d4e5cb /sugar | |
parent | 3972ff86511a09ff4e86e8f293d8bee0122667ea (diff) |
Improve stylesheet loading
Diffstat (limited to 'sugar')
-rw-r--r-- | sugar/graphics/__init__.py | 25 | ||||
-rw-r--r-- | sugar/graphics/style.py | 7 |
2 files changed, 7 insertions, 25 deletions
diff --git a/sugar/graphics/__init__.py b/sugar/graphics/__init__.py index b3c54e1..e69de29 100644 --- a/sugar/graphics/__init__.py +++ b/sugar/graphics/__init__.py @@ -1,25 +0,0 @@ -import gtk - -from sugar.graphics import style -from sugar.graphics.iconcolor import IconColor - -if gtk.gdk.screen_width() == 1200: - _medium_icon_size = 75 -else: - _medium_icon_size = 50 - -_stylesheet = { - 'color' : IconColor('white'), - 'size' : _medium_icon_size -} -style.register_stylesheet('frame-activity-icon', _stylesheet) - -_stylesheet = { - 'size' : _medium_icon_size -} -style.register_stylesheet('frame-zoom-icon', _stylesheet) - -_stylesheet = { - 'size' : _medium_icon_size -} -style.register_stylesheet('menu-action-icon', _stylesheet) diff --git a/sugar/graphics/style.py b/sugar/graphics/style.py index 4b1bc53..ae1e424 100644 --- a/sugar/graphics/style.py +++ b/sugar/graphics/style.py @@ -1,5 +1,12 @@ _styles = {} +def load_stylesheet(module): + for objname in dir(module): + if not objname.startswith('_'): + obj = getattr(module, objname) + if isinstance(obj, dict): + register_stylesheet(objname.replace('_', '.'), obj) + def register_stylesheet(name, style): _styles[name] = style |