LPCManager.py
changeset 4 e8a0af6b89d9
parent 2 0c697b8fc443
child 5 7a09e12267a9
child 6 8863b78144ee
--- a/LPCManager.py	Fri Jun 08 12:40:31 2012 +0200
+++ b/LPCManager.py	Thu Jun 14 15:16:42 2012 +0200
@@ -70,7 +70,7 @@
 import targets
 from LPCtarget import LPC_target 
 targets.targets["LPC"] = {"xsd": os.path.join(_base_path, "LPCtarget", "XSD"),
-                          "class": lambda:LPC_target,
+                          "class": lambda: LPC_target,
                           "code": os.path.join(_base_path,"LPCtarget","plc_LPC_main.c")} 
 targets.toolchains["makefile"] = os.path.join(_base_path, "LPCtarget", "XSD_toolchain_makefile")
 
@@ -79,6 +79,17 @@
 misc.opjimg = lambda imgname: os.path.join(_base_folder, "beremiz", "images", imgname+".png")
 
 from Beremiz import *
+
+import features
+from POULibrary import POULibrary
+
+class PLCLibrary(POULibrary):
+    def GetLibraryPath(self):
+        return os.path.join(_base_path, "pous.xml")
+
+features.libraries.append(
+    ('LPC', lambda: PLCLibrary))
+
 from ProjectController import ProjectController
 from ConfigTreeNode import ConfigTreeNode
 from ProjectNodeEditor import ProjectNodeEditor
@@ -583,12 +594,12 @@
             
             if self.GetChildByName("Master") is None:
                 master = self.CTNAddChild("Master", "CanOpenNode", 0)
-                master.BaseParams.setEnabled(False)
+                #master.BaseParams.setEnabled(False)
                 master.CTNRequestSave()
             
             if self.GetChildByName("Slave") is None:
                 slave = self.CTNAddChild("Slave", "CanOpenSlave", 1)
-                slave.BaseParams.setEnabled(False)
+                #slave.BaseParams.setEnabled(False)
                 slave.CTNRequestSave()
     
 
@@ -603,7 +614,7 @@
     @param dst: destination directory
     """
     for i in os.listdir(src):
-        if not i.startswith('.') and i != "pous.xml":
+        if not i.startswith('.'):
             srcpath = os.path.join(src,i)
             dstpath = os.path.join(dst,i)
             if os.path.isdir(srcpath):
@@ -686,12 +697,6 @@
             infos["values"].append(resources)
         return infos
     
-    def ConfNodeLibraryFilePath(self):
-        if self.OrigBuildPath is not None:
-            return os.path.join(self.OrigBuildPath, "pous.xml")
-        else:
-            return ProjectController.ConfNodeLibraryFilePath(self)
-    
     def GetProjectName(self):
         return self.Project.getname()
 
@@ -854,7 +859,7 @@
         
         if havecanfestival and self.GetChildByName("CanOpen") is None:
             canopen = self.CTNAddChild("CanOpen", "CanOpen", 0)
-            canopen.BaseParams.setEnabled(False)
+            #canopen.BaseParams.setEnabled(False)
             canopen.LoadChildren()
             canopen.CTNRequestSave()
         
@@ -1489,12 +1494,12 @@
         leftwindowsizer = wx.BoxSizer(wx.HORIZONTAL)
         leftwindowvsizer.AddSizer(leftwindowsizer, 0, border=0, flag=0)
         
-        self.GenerateEnableButton(leftwindow, leftwindowsizer, confnode)
+        #self.GenerateEnableButton(leftwindow, leftwindowsizer, confnode)
         
         st = wx.StaticText(leftwindow, -1)
         st.SetFont(wx.Font(faces["size"], wx.DEFAULT, wx.NORMAL, wx.BOLD, faceName = faces["helv"]))
         st.SetLabel(confnode.GetFullIEC_Channel())
-        leftwindowsizer.AddWindow(st, 0, border=5, flag=wx.RIGHT)
+        leftwindowsizer.AddWindow(st, 0, border=5, flag=wx.LEFT|wx.RIGHT)
         
         expandbutton_id = wx.NewId()
         expandbutton = wx.lib.buttons.GenBitmapToggleButton(id=expandbutton_id, bitmap=wx.Bitmap(Bpath( 'images', 'plus.png')),