ProjectController.py
changeset 2729 4e0cd7806776
parent 2712 a00f41d097f3
child 2741 3cc5663af196
child 3239 fe819b4c62c0
equal deleted inserted replaced
2728:10d8ca7a3d31 2729:4e0cd7806776
    97     return ExtractMenuItemsFromCatalog(features.catalog)
    97     return ExtractMenuItemsFromCatalog(features.catalog)
    98 
    98 
    99 
    99 
   100 class Iec2CSettings(object):
   100 class Iec2CSettings(object):
   101 
   101 
   102     def __init__(self):
   102     def __init__(self, controler):
   103         self.iec2c = None
   103         self.iec2c = None
   104         self.iec2c_buildopts = None
   104         self.iec2c_buildopts = None
   105         self.ieclib_path = self.findLibPath()
   105         self.ieclib_path = self.findLibPath()
   106         self.ieclib_c_path = self.findLibCPath()
   106         self.ieclib_c_path = self.findLibCPath()
       
   107         self.controler = controler
   107 
   108 
   108     def findObject(self, paths, test):
   109     def findObject(self, paths, test):
   109         path = None
   110         path = None
   110         for p in paths:
   111         for p in paths:
   111             if test(p):
   112             if test(p):
   153 
   154 
   154         buildopt = ""
   155         buildopt = ""
   155         try:
   156         try:
   156             # Invoke compiler.
   157             # Invoke compiler.
   157             # Output files are listed to stdout, errors to stderr
   158             # Output files are listed to stdout, errors to stderr
   158             _status, result, _err_result = ProcessLogger(None, buildcmd,
   159             _status, result, _err_result = ProcessLogger(self.controler.logger, buildcmd,
   159                                                          no_stdout=True,
   160                                                          no_stdout=True,
   160                                                          no_stderr=True).spin()
   161                                                          no_stderr=True).spin()
   161         except Exception:
   162         except Exception:
   162             self.logger.write_error(_("Couldn't launch IEC compiler to determine compatible options.\n"))
   163             self.controler.logger.write_error(_("Couldn't launch IEC compiler to determine compatible options.\n"))
   163             return buildopt
   164             return buildopt
   164 
   165 
   165         for opt in options:
   166         for opt in options:
   166             if opt in result:
   167             if opt in result:
   167                 buildopt = buildopt + " " + opt
   168                 buildopt = buildopt + " " + opt
   240     def __init__(self, frame, logger):
   241     def __init__(self, frame, logger):
   241         PLCControler.__init__(self)
   242         PLCControler.__init__(self)
   242         ConfigTreeNode.__init__(self)
   243         ConfigTreeNode.__init__(self)
   243 
   244 
   244         if ProjectController.iec2c_cfg is None:
   245         if ProjectController.iec2c_cfg is None:
   245             ProjectController.iec2c_cfg = Iec2CSettings()
   246             ProjectController.iec2c_cfg = Iec2CSettings(self)
   246 
   247 
   247         self.MandatoryParams = None
   248         self.MandatoryParams = None
   248         self._builder = None
   249         self._builder = None
   249         self._connector = None
   250         self._connector = None
   250         self.DispatchDebugValuesTimer = None
   251         self.DispatchDebugValuesTimer = None