etherlab/etherlab.py
changeset 2086 8e4992e0f147
parent 2085 ae263886ae92
child 2088 c0952932d74b
equal deleted inserted replaced
2085:ae263886ae92 2086:8e4992e0f147
     3 from xml.dom import minidom
     3 from xml.dom import minidom
     4 
     4 
     5 import wx
     5 import wx
     6 
     6 
     7 from xmlclass import *
     7 from xmlclass import *
       
     8 from POULibrary import POULibrary
     8 from ConfigTreeNode import ConfigTreeNode
     9 from ConfigTreeNode import ConfigTreeNode
     9 from PLCControler import UndoBuffer, LOCATION_CONFNODE, LOCATION_MODULE, LOCATION_GROUP, LOCATION_VAR_INPUT, LOCATION_VAR_OUTPUT, LOCATION_VAR_MEMORY
    10 from PLCControler import UndoBuffer, LOCATION_CONFNODE, LOCATION_MODULE, LOCATION_GROUP, LOCATION_VAR_INPUT, LOCATION_VAR_OUTPUT, LOCATION_VAR_MEMORY
    10 from ConfigEditor import NodeEditor, CIA402NodeEditor, ETHERCAT_VENDOR, ETHERCAT_GROUP, ETHERCAT_DEVICE
    11 from ConfigEditor import NodeEditor, CIA402NodeEditor, ETHERCAT_VENDOR, ETHERCAT_GROUP, ETHERCAT_DEVICE
    11 
    12 
    12 try:
    13 try:
    52                 slave[param] = details_line.split()[-1]
    53                 slave[param] = details_line.split()[-1]
    53                 break
    54                 break
    54     slaves.append(slave)
    55     slaves.append(slave)
    55 returnVal = slaves
    56 returnVal = slaves
    56 """
    57 """
       
    58 
       
    59 #--------------------------------------------------
       
    60 #      Etherlab Specific Blocks Library
       
    61 #--------------------------------------------------
       
    62 
       
    63 def GetLocalPath(filename):
       
    64     return os.path.join(os.path.split(__file__)[0], filename)
       
    65 
       
    66 class EtherlabLibrary(POULibrary):
       
    67     def GetLibraryPath(self):
       
    68         return GetLocalPath("pous.xml")
       
    69 
       
    70     def Generate_C(self, buildpath, varlist, IECCFLAGS):
       
    71         etherlab_ext_file = open(GetLocalPath("etherlab_ext.c"), 'r')
       
    72         etherlab_ext_code = etherlab_ext_file.read()
       
    73         etherlab_ext_file.close()
       
    74         
       
    75         Gen_etherlabfile_path = os.path.join(buildpath, "etherlab_ext.c")
       
    76         ethelabfile = open(Gen_etherlabfile_path,'w')
       
    77         ethelabfile.write(etherlab_ext_code)
       
    78         ethelabfile.close()
       
    79         
       
    80         runtimefile_path = os.path.join(os.path.split(__file__)[0], "runtime_etherlab.py")
       
    81         return ((["etherlab_ext"], [(Gen_etherlabfile_path, IECCFLAGS)], True), "", 
       
    82                 ("runtime_etherlab.py", file(GetLocalPath("runtime_etherlab.py"))))
    57 
    83 
    58 #--------------------------------------------------
    84 #--------------------------------------------------
    59 #                    Ethercat Node
    85 #                    Ethercat Node
    60 #--------------------------------------------------
    86 #--------------------------------------------------
    61 
    87