~osomon/moovida/launcher_no_rebuild

« back to all changes in this revision

Viewing changes to elisa-plugins/elisa/plugins/pigment/widgets/theme.py

  • Committer: Olivier Tilloy
  • Date: 2009-12-11 16:46:19 UTC
  • Revision ID: olivier@fluendo.com-20091211164619-1hlpwdmmdfct9aa4
Made the plugin registry a PEP 302 compliant import hook.
That breaks quite a lot of bits and pieces.

Show diffs side-by-side

added added

removed removed

Lines of Context:
22
22
from elisa.plugins.pigment.widgets.style import Style
23
23
 
24
24
from elisa.core import log
 
25
from elisa.core.plugin_registry import resource_filename
25
26
 
26
27
try:
27
28
    import gio
28
29
except ImportError:
29
30
    gio = None
30
31
 
31
 
import pkg_resources
32
 
 
33
32
import logging
34
33
import copy
35
34
import pprint
345
344
            # pkg_resources.resource_filename() handles strings in the
346
345
            # filesystem encoding, hence all these conversions.
347
346
            path = path.encode(locale_helper.filesystem_encoding())
348
 
            typed = pkg_resources.resource_filename(self._module_name, path)
 
347
            typed = resource_filename(self._module_name, path)
349
348
            typed = typed.decode(locale_helper.filesystem_encoding())
350
349
            return typed
351
350
 
428
427
                            filepath = basename
429
428
                        filepath = str(filepath.replace(os.path.sep, '/'))
430
429
                        resource_name = ".".join([resource_prefix, str(prop.name)])
431
 
                        abs_path = pkg_resources.resource_filename(module_name,
 
430
                        abs_path = resource_filename(module_name,
432
431
                                                                   filepath)
433
432
                        abs_path = abs_path.decode(locale_helper.system_encoding())
434
433
                        theme.stock_resources[resource_name] = abs_path
467
466
        log_category = 'theme'
468
467
 
469
468
        try:
470
 
            styles_conf = pkg_resources.resource_filename(module_name,
471
 
                                                          STYLES_FILENAME)
 
469
            styles_conf = resource_filename(module_name, STYLES_FILENAME)
472
470
            styles_conf = styles_conf.decode(locale_helper.system_encoding())
473
471
        except (ImportError, KeyError):
474
472
            # ImportError raised when resource not found in uninstalled plugin
482
480
            styles_conf = None
483
481
 
484
482
        try:
485
 
            resources_conf = pkg_resources.resource_filename(module_name,
486
 
                                                             RESOURCES_FILENAME)
 
483
            resources_conf = resource_filename(module_name, RESOURCES_FILENAME)
487
484
            resources_conf = resources_conf.decode(locale_helper.system_encoding())
488
485
        except (ImportError, KeyError):
489
486
            # ImportError raised when resource not found in uninstalled plugin