Adding support for loading datatypes defined in plugins to allow to use them in PLC program
authorlaurent
Tue, 24 Jan 2012 21:39:26 +0100
changeset 669 472469f4d5ad
parent 668 048f5a923c86
child 670 fb03cb6da95c
Adding support for loading datatypes defined in plugins to allow to use them in PLC program
plugger.py
--- a/plugger.py	Mon Jan 23 15:11:49 2012 +0100
+++ b/plugger.py	Tue Jan 24 21:39:26 2012 +0100
@@ -303,18 +303,18 @@
         
         return LocationCFilesAndCFLAGS, LDFLAGS, extra_files
 
-    def BlockTypesFactory(self):
+    def PluginTypesFactory(self):
         if self.LibraryControler is not None:
-            return [{"name" : _("%s POUs") % self.PlugType, "list": self.LibraryControler.Project.GetCustomBlockTypes()}]
+            return [{"name" : self.PlugType, "types": self.LibraryControler.Project}]
         return []
 
-    def ParentsBlockTypesFactory(self):
-        return self.PlugParent.ParentsBlockTypesFactory() + self.BlockTypesFactory()
-
-    def PluginsBlockTypesFactory(self):
-        list = self.BlockTypesFactory()
+    def ParentsTypesFactory(self):
+        return self.PlugParent.ParentsTypesFactory() + self.PluginTypesFactory()
+
+    def PluginsTypesFactory(self):
+        list = self.PluginTypesFactory()
         for PlugChild in self.IterChilds():
-            list += PlugChild.PluginsBlockTypesFactory()
+            list += PlugChild.PluginsTypesFactory()
         return list
 
     def STLibraryFactory(self):
@@ -625,7 +625,7 @@
             self.LibraryControler = PLCControler()
             self.LibraryControler.OpenXMLFile(library_path)
             self.LibraryControler.ClearPluginTypes()
-            self.LibraryControler.AddPluginBlockList(self.ParentsBlockTypesFactory())
+            self.LibraryControler.AddPluginTypesList(self.ParentsTypesFactory())
 
     def LoadXMLParams(self, PlugName = None):
         methode_name = os.path.join(self.PlugPath(PlugName), "methods.py")
@@ -1017,7 +1017,7 @@
     def RefreshPluginsBlockLists(self):
         if getattr(self, "PluggedChilds", None) is not None:
             self.ClearPluginTypes()
-            self.AddPluginBlockList(self.PluginsBlockTypesFactory())
+            self.AddPluginTypesList(self.PluginsTypesFactory())
         if self.AppFrame is not None:
             self.AppFrame.RefreshLibraryTree()
             self.AppFrame.RefreshEditor()
@@ -1056,8 +1056,8 @@
     def PluginXmlFilePath(self, PlugName=None):
         return os.path.join(self.PlugPath(PlugName), "beremiz.xml")
 
-    def ParentsBlockTypesFactory(self):
-        return self.BlockTypesFactory()
+    def ParentsTypesFactory(self):
+        return self.PluginTypesFactory()
 
     def _setBuildPath(self, buildpath):
         if CheckPathPerm(buildpath):