Class e.p.p.w.t.Theme(gobject.GObject):

Part of elisa.plugins.pigment.widgets.theme View In Hierarchy

Known subclasses: elisa.plugins.pigment.tests.widgets.test_theme.ThemeCacheMock

A theme object, that adds styles to widgets properties and to stock resources.

A basic theme will be built from the default configuration files, providing necessary style information for the widgets: without that, widgets won't work.

Instance Variableswidget_stylesthe styles for the widgets, for each state (type: dict of states to elisa.plugins.pigment.widgets.Styles )
stock_resourcesthe map of resource names to file paths (type: a dict strings to strings )
fallback_themesa dictionary of plugin names to Themes, caching information necessary to do the right fallback for missing resources (type: dictionary of strings to elisa.core.components.theme.Theme )
Line # Kind Name Docs
87 Method __init__ DOCME
114 Method clean Undocumented
146 Method start_monitoring Undocumented
164 Method stop_monitoring Undocumented
180 Method __reduce__ Undocumented
184 Method __getstate__ Undocumented
193 Method __setstate__ Undocumented
411 Class Method load_from_module Build a elisa.plugins.pigment.widgets.Theme object using the
460 Method update Merge in-place another theme.
469 Method merge Merge with another theme, returning a new one.
509 Method get_style_for_widget Get the style for a widget class in the specified state.
537 Method get_resource Get the named resources, doing a lookup into the plugins' defaults if
559 Method lookup Dynamically search for the named resource ('style' or 'resource').
620 Method __repr__ Undocumented
628 Class Method get_default Get the default theme.
638 Static Method set_default Set the default theme.
94 Method _init Undocumented
127 Method _fallback_theme_styles_updated Undocumented
131 Method _fallback_theme_resources_updated Undocumented
135 Method _notify_cb Undocumented
204 Method _load_css Undocumented
214 Method _get_cache_directory Undocumented
223 Method _get_cached_file Undocumented
235 Method _get_from_cache Undocumented
269 Method _add_to_cache Undocumented
278 Method _guess_style_value_type Undocumented
332 Method _get_styles Undocumented
366 Method _get_resources Undocumented
396 Method _init_styles Read the configuration file and fill up the widgets styles.
403 Method _init_resources Read the configuration file and fill up the stock resources.
def __init__(self, module_name=None, styles_conf=None, resources_conf=None):
DOCME
def _init(self, module_name=None, styles_conf=None, resources_conf=None):
Undocumented
def clean(self):
Undocumented
def _fallback_theme_styles_updated(self, fallback_theme):
Undocumented
def _fallback_theme_resources_updated(self, fallback_theme):
Undocumented
def _notify_cb(self, iwp, filename, mask, parameter=None):
Undocumented
def start_monitoring(self):
Undocumented
def stop_monitoring(self):
Undocumented
def __reduce__(self):
Undocumented
def __getstate__(self):
Undocumented
def __setstate__(self, pickled):
Undocumented
def _load_css(self, filename):
Undocumented
def _get_cache_directory(self):
Undocumented
def _get_cached_file(self, filename):
Undocumented
def _get_from_cache(self, filename):
Undocumented
def _add_to_cache(self, filename, parsed):
Undocumented
def _guess_style_value_type(self, value, key=None):
Undocumented
def _get_styles(self, filename):
Undocumented
def _get_resources(self, module_name, filename):
Undocumented
def _init_styles(self, styles_conf):
Read the configuration file and fill up the widgets styles.
def _init_resources(self, module_name, resources_conf):
Read the configuration file and fill up the stock resources.
@classmethod
def load_from_module(cls, module_name):
Build a elisa.plugins.pigment.widgets.Theme object using the 'styles.conf' and 'resources.conf' files found in the specified module.
Parametersmodule_namethe module to search, in the absolute dotted notation (type: str )
Returnsthe new theme, or None (type: elisa.plugins.pigment.widgets.Theme )
def update(self, other):
Merge in-place another theme.
Parametersotherthe theme from which to update (type: elisa.plugins.pigment.widgets.Theme )
def merge(self, other, inplace=False):
Merge with another theme, returning a new one.

The new theme will have all the "properties" of the current style, with replaced values from the second, plus further "properties" coming from the other theme.

Parametersotherthe theme to merge (type: elisa.plugins.pigment.widgets.Theme )
inplacewhether to build another theme, or update the current one (type: bool )
Returnsthe new theme (type: elisa.plugins.pigment.widgets.Theme )
def get_style_for_widget(self, widget, state=const.STATE_NORMAL, search=True):
Get the style for a widget class in the specified state.
Parameterswidgetthe classname of the widget (type: str )
statethe state for which we want to retrieve the style (one of elisa.plugins.pigment.widgets.const.STATE_*) (type: int )
Returnsthe associated style, or None (type: elisa.plugins.pigment.widgets.Style )
def get_resource(self, name, search=True):
Get the named resources, doing a lookup into the plugins' defaults if not found, or None.
Parametersnamethe name of the resource (type: str )
searchwhether to do the lookup into the plugins defaults (type: bool )
def lookup(self, name, type, state=const.STATE_NORMAL):
Dynamically search for the named resource ('style' or 'resource').

If a suitable module is found during the search, a Theme object will be built and cached for later use: it will be stored in a dictionary indexed by absolute module names (in the Python dotted notation).

Parametersnamethe full qualified name to look for (e.g.: 'elisa.plugins.pigment.widgets.button.Button' or 'elisa.plugins.shelf.icon') (type: str )
type'style' or 'resource' (type: str )
statethe state of the widget. Only used if type == 'style'. One of elisa.plugins.pigment.widgets.const.STATE_* (type: int )
Returnsthe resource found (filepath or style), if any (type: str or elisa.plugins.pigment.widgets.Style or None )
def __repr__(self):
Undocumented
@classmethod
def get_default(cls):
Get the default theme.
@staticmethod
def set_default(theme):
Set the default theme.
API Documentation for Elisa Media Center, generated by pydoctor at 2009-02-16 19:15:05.