Example #1
0
def plugins(category=None):
    """List loaded plugins.

    If no argument is given return a dictionary of all loaded plugins.
    Keys are category name. Values are lists of plugin names in each
    category.

    If a category is specified (for example 'splitters') return a list
    of all plugin names in this category.
    """
    from Ganga.Utility.Plugin import allPlugins
    if category:
        return allPlugins.allClasses(category).keys()
    else:
        d = {}
        for c in allPlugins.allCategories():
            d[c] = allPlugins.allCategories()[c].keys()
        return d
Example #2
0
def plugins(category=None):
    """List loaded plugins.

    If no argument is given return a dictionary of all loaded plugins.
    Keys are category name. Values are lists of plugin names in each
    category.

    If a category is specified (for example 'splitters') return a list
    of all plugin names in this category.
    """
    from Ganga.Utility.Plugin import allPlugins
    if category:
        return allPlugins.allClasses(category).keys()
    else:
        d = {}
        for c in allPlugins.allCategories():
            d[c] = allPlugins.allCategories()[c].keys()
        return d
Example #3
0
def autoPopulateGPI(my_interface=None):
    """
    Fully expose all plugins registered with the interface in a single line.
    By default only populate GPI, but also populate any other interface requested
    """
    if not my_interface:
        import Ganga.GPI
        my_interface = Ganga.GPI
    from Ganga.Runtime.GPIexport import exportToInterface
    from Ganga.Utility.Plugin import allPlugins
    # make all plugins visible in GPI
    for k in allPlugins.allCategories():
        for n in allPlugins.allClasses(k):
            cls = allPlugins.find(k, n)
            if not cls._declared_property('hidden'):
                if n != cls.__name__:
                    exportToInterface(my_interface, cls.__name__, cls, 'Classes')
                exportToInterface(my_interface, n, cls, 'Classes')
Example #4
0
def autoPopulateGPI(my_interface=None):
    """
    Fully expose all plugins registered with the interface in a single line.
    By default only populate GPI, but also populate any other interface requested
    """
    if not my_interface:
        import Ganga.GPI
        my_interface = Ganga.GPI
    from Ganga.Runtime.GPIexport import exportToInterface
    from Ganga.Utility.Plugin import allPlugins
    # make all plugins visible in GPI
    for k in allPlugins.allCategories():
        for n in allPlugins.allClasses(k):
            cls = allPlugins.find(k, n)
            if not cls._declared_property('hidden'):
                if n != cls.__name__:
                    exportToInterface(my_interface, cls.__name__, cls, 'Classes')
                exportToInterface(my_interface, n, cls, 'Classes')
Example #5
0
            ['namedTemplates_pickle'])
    except Exception as err:
        logger.error('problems with loading Named Templates for %s', n)
        logger.error('Reason: %s' % str(err))

for r in allRuntimes.values():
    try:
        r.loadPlugins()
    except Exception as err:
        logger.error("problems with loading plugins for %s -- ignored" %
                     r.name)
        logger.error('Reason: %s' % str(err))

# ------------------------------------------------------------------------------------
# make all plugins visible in GPI
for k in allPlugins.allCategories():
    for n in allPlugins.allClasses(k):
        cls = allPlugins.find(k, n)
        if not cls._declared_property('hidden'):
            exportToPublicInterface(n, cls._proxyClass, 'Classes')

# ------------------------------------------------------------------------------------
# set the default value for the plugins
default_plugins_cfg = getConfig("Plugins")

for opt in default_plugins_cfg:
    try:
        category, tag = opt.split('_')
    except ValueError, err:
        logger.warning("do not understand option %s in [Plugins]", opt)
        logger.debug('Reason: want %s' % str(err))
Example #6
0
                             Ganga.Utility.Config.getConfig('Configuration')['namedTemplates_ext'],
                             Ganga.Utility.Config.getConfig('Configuration')['namedTemplates_pickle'])
    except Exception as err:
        logger.error('problems with loading Named Templates for %s', n)
        logger.error('Reason: %s' % str(err))

for r in allRuntimes.values():
    try:
        r.loadPlugins()
    except Exception as err:
        logger.error("problems with loading plugins for %s -- ignored" % r.name)
        logger.error('Reason: %s' % str(err))

# ------------------------------------------------------------------------------------
# make all plugins visible in GPI
for k in allPlugins.allCategories():
    for n in allPlugins.allClasses(k):
        cls = allPlugins.find(k, n)
        if not cls._declared_property('hidden'):
            exportToPublicInterface(n, getProxyClass(cls), 'Classes')

# ------------------------------------------------------------------------------------
# set the default value for the plugins
default_plugins_cfg = getConfig("Plugins")

for opt in default_plugins_cfg:
    try:
        category, tag = opt.split('_')
    except ValueError, err:
        logger.warning("do not understand option %s in [Plugins]", opt)
        logger.debug('Reason: want %s' % str(err))