本文整理汇总了Python中plugin.Plugin.getInstances方法的典型用法代码示例。如果您正苦于以下问题:Python Plugin.getInstances方法的具体用法?Python Plugin.getInstances怎么用?Python Plugin.getInstances使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类plugin.Plugin
的用法示例。
在下文中一共展示了Plugin.getInstances方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: loadPluginsFrom
# 需要导入模块: from plugin import Plugin [as 别名]
# 或者: from plugin.Plugin import getInstances [as 别名]
def loadPluginsFrom(self, newPath):
self.selectTechniqueByName(None)
self._techniques = {}
if newPath:
Plugin.load(newPath)
for p in Plugin.getInstances():
origName = p.name.strip()
if not origName:
continue
name = origName
i = 1
while self._techniques.has_key(name):
name = "%s %d" % (origName, i)
i += 1
self._techniques[name] = p
示例2: loadPluginsFrom
# 需要导入模块: from plugin import Plugin [as 别名]
# 或者: from plugin.Plugin import getInstances [as 别名]
def loadPluginsFrom(self, newPath):
# force the teardown of the current selected technique (if any)
self.selectTechniqueByName(None)
self._pluginsPath = newPath
self._techniques = {}
if newPath:
Plugin.load(newPath)
for p in Plugin.getInstances():
origName = p.getName()
# some sanity check
origName = unicode(origName).strip() if origName is not None \
else None
if not origName:
continue
# append a discriminant id if the name is already being used
name = origName
i = 1
while name in self._techniques:
name = "%s %d" % (origName, i)
i += 1
self._techniques[name] = p