Further than addons that could not be loaded for some reason (code errors, damaged files, etc) if we want to support activation and deactivation of specific addons without removal from the first system, this separation is needed.
def getRunningAddons():
""" Returns currently loaded addons.
"""
- return iter(_runningAddons)
+ return itertools.ifilter(lambda a : a.isLoaded, getAvailableAddons())
def initialize():
""" Initializes the add-ons subsystem. """
- global _runningAddons
- _runningAddons = []
for addon in getAvailableAddons():
try:
addon.load()
except:
log.exception("Error loading addon.")
continue
- _runningAddons.append(addon)
log.debug("Loadded addon from %s", addon.path)
def terminate():
""" Terminates the add-ons subsystem. """
- global _runningAddons
addons = getRunningAddons()
for addon in addons:
addon.unload()
- _runningAddons = []
def runHook(hookName, *args, **kwargs):