2006-10-01 19:08:26 +02:00
|
|
|
_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)
|
|
|
|
|
2006-10-02 01:50:43 +02:00
|
|
|
def register_stylesheet(name, style):
|
2006-10-01 19:08:26 +02:00
|
|
|
_styles[name] = style
|
|
|
|
|
2006-10-02 01:50:43 +02:00
|
|
|
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])
|