本文整理汇总了Python中yapsy.PluginManager.PluginManager.removePluginCandidate方法的典型用法代码示例。如果您正苦于以下问题:Python PluginManager.removePluginCandidate方法的具体用法?Python PluginManager.removePluginCandidate怎么用?Python PluginManager.removePluginCandidate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类yapsy.PluginManager.PluginManager
的用法示例。
在下文中一共展示了PluginManager.removePluginCandidate方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: testCandidatesManipulation
# 需要导入模块: from yapsy.PluginManager import PluginManager [as 别名]
# 或者: from yapsy.PluginManager.PluginManager import removePluginCandidate [as 别名]
def testCandidatesManipulation(self):
"""
Test querying, removing and adding plugins from/to the lkist
of plugins to load.
"""
spm = PluginManager(directories_list=[
os.path.join(
os.path.dirname(os.path.abspath(__file__)),"plugins")])
# locate the plugins that should be loaded
spm.locatePlugins()
# check nb of candidatesx
self.assertEqual(len(spm.getPluginCandidates()),1)
# get the description of the plugin candidate
candidate = spm.getPluginCandidates()[0]
self.assertTrue(isinstance(candidate,tuple))
# try removing the candidate
spm.removePluginCandidate(candidate)
self.assertEqual(len(spm.getPluginCandidates()),0)
# try re-adding it
spm.appendPluginCandidate(candidate)
self.assertEqual(len(spm.getPluginCandidates()),1)
示例2: load_plugins
# 需要导入模块: from yapsy.PluginManager import PluginManager [as 别名]
# 或者: from yapsy.PluginManager.PluginManager import removePluginCandidate [as 别名]
def load_plugins():
""" Load plugin for environment. See lib/base.py
"""
# Create plugin manager
manager = PluginManager()
# Tell it the default place(s) where to find plugins
manager.setPluginPlaces(["pylons_yapsy_plugin/plugins/"])
# Define the various categories corresponding to the different
# kinds of plugins you have defined
manager.setCategoriesFilter({
"Menu" : menu.Menu,
"Inline" : inline.Inline,
})
manager.locatePlugins()
# Deactivate plugin
# Список деактивированных плагинов из БД
deactivatedPlugins = [plugin.name for plugin in\
s.query(DeactivatedPlugins).all()]
# Список кандидатов на загрузку
candidates = manager.getPluginCandidates()
# Список деактивированных плагинов в формате yapsy
deactivatedList = []
for candidate in candidates:
if candidate[2].name in deactivatedPlugins:
deactivatedList.append(candidate)
# Исключаем плагины которые указанны в БД
for plugin in deactivatedList:
manager.removePluginCandidate(plugin)
# Load plugins
manager.loadPlugins()
return manager, [plugin[2] for plugin in deactivatedList]