diff -r a1f9e514f708 -r f1f0edbeb313 plugger.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/plugger.py Mon Aug 27 17:54:55 2007 +0200 @@ -0,0 +1,90 @@ +import os +import plugins +from plugins import PlugTemplate + + +class PluginsRoot(PlugTemplate): + + # A special PlugChildsTypes + PlugChildsTypes = [(name,lambda : getattr(__import__("plugins." + name), name).RootClass) for name in plugins.__all__] + + XSD = """ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + """ + + def __init__(self, ProjectPath): + # self is the parent + self.PlugParent = None + # Keep track of the plugin type name + self.PlugType = "Beremiz" + # Keep track of the root plugin (i.e. project path) + self.ProjectPath = ProjectPath + # Change XSD into class members + self._AddParamsMembers() + self.PluggedChilds = {} + # No IEC channel, name, etc... + self.MandatoryParams = [] + # If dir have already be made, and file exist + if os.path.isdir(_self.PlugPath(PlugName)) and os.path.isfile(_self.PluginXmlFilePath(PlugName)): + #Load the plugin.xml file into parameters members + _self.LoadXMLParams() + #Load and init all the childs + _self.LoadChilds() + + def PlugPath(self,PlugName=None): + return self.ProjectPath + + def PluginXmlFilePath(self, PlugName=None): + return os.path.join(self.PlugPath(PlugName), "beremiz.xml") + +