POULibrary.py
changeset 732 c4b0f117e106
parent 731 4fc681ed0c61
child 772 98786137232d
equal deleted inserted replaced
731:4fc681ed0c61 732:c4b0f117e106
     1 from PLCControler import PLCControler
     1 from PLCControler import PLCControler
       
     2 from weakref import ref
     2 
     3 
     3 class POULibrary:
     4 class POULibrary:
     4     def __init__(self, LibName, TypeStack):
     5     def __init__(self, CTR, LibName, TypeStack):
       
     6         self.CTR = ref(CTR)
     5         self.LibName = LibName
     7         self.LibName = LibName
     6         self.LibraryControler = PLCControler()
     8         self.LibraryControler = PLCControler()
     7         self.LibraryControler.OpenXMLFile(self.GetLibraryPath())
     9         self.LibraryControler.OpenXMLFile(self.GetLibraryPath())
     8         self.LibraryControler.ClearConfNodeTypes()
    10         self.LibraryControler.ClearConfNodeTypes()
     9         self.LibraryControler.AddConfNodeTypesList(TypeStack)
    11         self.LibraryControler.AddConfNodeTypesList(TypeStack)
    14             self.program = self.LibraryControler.GenerateProgram()[0]+"\n"
    16             self.program = self.LibraryControler.GenerateProgram()[0]+"\n"
    15         return self.program 
    17         return self.program 
    16 
    18 
    17     def GetName(self):
    19     def GetName(self):
    18         return self.LibName
    20         return self.LibName
       
    21 
       
    22     def GetCTR(self):
       
    23         return self.CTR()
    19         
    24         
    20     def GetTypes(self):
    25     def GetTypes(self):
    21         return {"name" : self.GetName(), "types": self.LibraryControler.Project}
    26         return {"name" : self.GetName(), "types": self.LibraryControler.Project}
    22 
    27 
    23     def GetLibraryPath(self):
    28     def GetLibraryPath(self):