Added reference to CTR in libraries
authorEdouard Tisserant
Sat, 19 May 2012 15:54:16 +0200
changeset 732 c4b0f117e106
parent 731 4fc681ed0c61
child 733 915be999f3f0
Added reference to CTR in libraries
POULibrary.py
ProjectController.py
--- a/POULibrary.py	Sat May 19 12:41:48 2012 +0200
+++ b/POULibrary.py	Sat May 19 15:54:16 2012 +0200
@@ -1,7 +1,9 @@
 from PLCControler import PLCControler
+from weakref import ref
 
 class POULibrary:
-    def __init__(self, LibName, TypeStack):
+    def __init__(self, CTR, LibName, TypeStack):
+        self.CTR = ref(CTR)
         self.LibName = LibName
         self.LibraryControler = PLCControler()
         self.LibraryControler.OpenXMLFile(self.GetLibraryPath())
@@ -16,6 +18,9 @@
 
     def GetName(self):
         return self.LibName
+
+    def GetCTR(self):
+        return self.CTR()
         
     def GetTypes(self):
         return {"name" : self.GetName(), "types": self.LibraryControler.Project}
--- a/ProjectController.py	Sat May 19 12:41:48 2012 +0200
+++ b/ProjectController.py	Sat May 19 15:54:16 2012 +0200
@@ -114,7 +114,7 @@
         TypeStack=[]
         for libname,clsname in features.libraries:
             if self.BeremizRoot.Libraries is None or getattr(self.BeremizRoot.Libraries, "Enable_"+libname+"_Library"):
-                Lib = GetClassImporter(clsname)()(libname, TypeStack)
+                Lib = GetClassImporter(clsname)()(self, libname, TypeStack)
                 TypeStack.append(Lib.GetTypes())
                 self.Libraries.append(Lib)