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
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