Esempio n. 1
0
def _load_plugins(ptype):
    D = dict()
    for pname, mod in loader.scan_submodules("plugin.%s" % ptype).iteritems():
        try:
            keys = frozenset([i["key"] for i in mod.Plugin.get_inputs()])
            s = Dict(id=pname, name=pname, description=mod.Plugin.get_description(), keys=keys, Plugin=mod.Plugin)
            D[pname] = s
            logging.info("Load plugin: %s.%s" % (ptype, pname))
        except:
            logging.exception("Failed to load plugin: %s.%s" % (ptype, pname))
    return D
Esempio n. 2
0
def _load_plugins(ptype):
    D = dict()
    for pname, mod in loader.scan_submodules('plugin.%s' % ptype).iteritems():
        try:
            keys = frozenset([i['key'] for i in mod.Plugin.get_inputs()])
            s = Dict(id=pname,
                     name=pname,
                     description=mod.Plugin.get_description(),
                     keys=keys,
                     Plugin=mod.Plugin)
            D[pname] = s
            logging.info('Load plugin: %s.%s' % (ptype, pname))
        except:
            logging.exception('Failed to load plugin: %s.%s' % (ptype, pname))
    return D
Esempio n. 3
0
def get_themes():
    global _themes
    if not _themes:
        L = []
        # scan folders:
        init_path = os.path.abspath(__file__)
        theme_dir = os.path.split(init_path)[0]
        d = loader.scan_submodules('plugin.theme')
        for k, v in d.iteritems():
            if os.path.isdir(os.path.join(theme_dir, k)):
                try:
                    L.append(dict(id=k, \
                                  name=getattr(v, 'name', k), \
                                  description=getattr(v, 'description', 'No description'), \
                                  author=getattr(v, 'author', 'unknown'), \
                                  url=getattr(v, 'url', '')))
                except BaseException:
                    logging.warning('load theme %s failed.' % k)
        logging.info('load themes: %s' % str(L))
        _themes = L
    return _themes
Esempio n. 4
0
def get_themes():
    global _themes
    if not _themes:
        L = []
        # scan folders:
        init_path = os.path.abspath(__file__)
        theme_dir = os.path.split(init_path)[0]
        d = loader.scan_submodules('plugin.theme')
        for k, v in d.iteritems():
            if os.path.isdir(os.path.join(theme_dir, k)):
                try:
                    L.append(dict(id=k, \
                                  name=getattr(v, 'name', k), \
                                  description=getattr(v, 'description', 'No description'), \
                                  author=getattr(v, 'author', 'unknown'), \
                                  url=getattr(v, 'url', '')))
                except BaseException:
                    logging.warning('load theme %s failed.' % k)
        logging.info('load themes: %s' % str(L))
        _themes = L
    return _themes