ConfigTree.py
changeset 721 ecf4d203c4d4
parent 720 6be032177e2a
child 722 a94f361fc42e
equal deleted inserted replaced
720:6be032177e2a 721:ecf4d203c4d4
     2 Base definitions for beremiz confnodes
     2 Base definitions for beremiz confnodes
     3 """
     3 """
     4 
     4 
     5 import os,sys,traceback
     5 import os,sys,traceback
     6 import time
     6 import time
     7 import confnodes
     7 import features
     8 import types
     8 import types
     9 import shutil
     9 import shutil
    10 from xml.dom import minidom
    10 from xml.dom import minidom
    11 import wx
    11 import wx
    12 
    12 
   750     - ...
   750     - ...
   751     
   751     
   752     """
   752     """
   753 
   753 
   754     # For root object, available Children Types are modules of the confnode packages.
   754     # For root object, available Children Types are modules of the confnode packages.
   755     CTNChildrenTypes =  [(n, CTNClassFactory(c), d) for n,d,h,c in confnodes.catalog]
   755     CTNChildrenTypes =  [(n, CTNClassFactory(c), d) for n,d,h,c in features.catalog]
   756 
   756 
   757     XSD = """<?xml version="1.0" encoding="ISO-8859-1" ?>
   757     XSD = """<?xml version="1.0" encoding="ISO-8859-1" ?>
   758     <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
   758     <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
   759       <xsd:element name="BeremizRoot">
   759       <xsd:element name="BeremizRoot">
   760         <xsd:complexType>
   760         <xsd:complexType>
  1052         for child in self.IECSortedChildren():
  1052         for child in self.IECSortedChildren():
  1053             children.append(child.GetVariableLocationTree())
  1053             children.append(child.GetVariableLocationTree())
  1054         return children
  1054         return children
  1055     
  1055     
  1056     def ConfNodePath(self):
  1056     def ConfNodePath(self):
  1057         return os.path.join(os.path.split(__file__)[0], "confnodes")
  1057         return os.path.split(__file__)[0]
  1058     
  1058     
  1059     def CTNPath(self, CTNName=None):
  1059     def CTNPath(self, CTNName=None):
  1060         return self.ProjectPath
  1060         return self.ProjectPath
  1061     
  1061     
  1062     def ConfNodeXmlFilePath(self, CTNName=None):
  1062     def ConfNodeXmlFilePath(self, CTNName=None):
  1478         # Reset variable and program list that are parsed from
  1478         # Reset variable and program list that are parsed from
  1479         # CSV file generated by IEC2C compiler.
  1479         # CSV file generated by IEC2C compiler.
  1480         self.ResetIECProgramsAndVariables()
  1480         self.ResetIECProgramsAndVariables()
  1481         
  1481         
  1482         # Generate C code and compilation params from confnode hierarchy
  1482         # Generate C code and compilation params from confnode hierarchy
  1483         self.logger.write(_("Generating confnodes C code\n"))
       
  1484         try:
  1483         try:
  1485             self.LocationCFilesAndCFLAGS, self.LDFLAGS, ExtraFiles = self._Generate_C(
  1484             self.LocationCFilesAndCFLAGS, self.LDFLAGS, ExtraFiles = self._Generate_C(
  1486                 buildpath, 
  1485                 buildpath, 
  1487                 self.PLCGeneratedLocatedVars)
  1486                 self.PLCGeneratedLocatedVars)
  1488         except Exception, exc:
  1487         except Exception, exc:
  1489             self.logger.write_error(_("ConfNodes code generation failed !\n"))
  1488             self.logger.write_error(_("Runtime extensions C code generation failed !\n"))
  1490             self.logger.write_error(traceback.format_exc())
  1489             self.logger.write_error(traceback.format_exc())
  1491             self.ResetBuildMD5()
  1490             self.ResetBuildMD5()
  1492             return False
  1491             return False
  1493 
  1492 
  1494         # Get temporary directory path
  1493         # Get temporary directory path