sugar-toolkit-gtk3/sugar/graphics/style.py

18 lines
493 B
Python
Raw Normal View History

_styles = {}
2006-10-05 13:26:02 +02:00
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
def apply_stylesheet(item, stylesheet_name):
if _styles.has_key(stylesheet_name):
style_sheet = _styles[stylesheet_name]
for name in style_sheet.keys():
item.set_property(name, style_sheet[name])