ProjectController.py
changeset 4042 03df7946c2fa
parent 3969 22870ae8d8e1
child 4043 b217fb367574
equal deleted inserted replaced
4041:af7671a9945a 4042:03df7946c2fa
    44 
    44 
    45 import wx
    45 import wx
    46 
    46 
    47 import features
    47 import features
    48 import connectors
    48 import connectors
    49 import util.paths as paths
    49 import util.paths as pathutils
    50 from util.misc import CheckPathPerm, GetClassImporter
    50 from util.misc import CheckPathPerm, GetClassImporter
    51 from util.MiniTextControler import MiniTextControler
    51 from util.MiniTextControler import MiniTextControler
    52 from util.ProcessLogger import ProcessLogger
    52 from util.ProcessLogger import ProcessLogger
    53 from util.BitmapLibrary import GetBitmap
    53 from util.BitmapLibrary import GetBitmap
    54 from editors.FileManagementPanel import FileManagementPanel
    54 from editors.FileManagementPanel import FileManagementPanel
    63 from runtime.typemapping import DebugTypesSize, UnpackDebugBuffer, ValueToIECBytes
    63 from runtime.typemapping import DebugTypesSize, UnpackDebugBuffer, ValueToIECBytes
    64 from runtime import PlcStatus
    64 from runtime import PlcStatus
    65 from ConfigTreeNode import ConfigTreeNode, XSDSchemaErrorMessage
    65 from ConfigTreeNode import ConfigTreeNode, XSDSchemaErrorMessage
    66 from POULibrary import UserAddressedException
    66 from POULibrary import UserAddressedException
    67 
    67 
    68 base_folder = paths.AbsParentDir(__file__)
       
    69 
    68 
    70 MATIEC_ERROR_MODEL = re.compile(
    69 MATIEC_ERROR_MODEL = re.compile(
    71     r".*\.st:(\d+)-(\d+)\.\.(\d+)-(\d+): (?:error)|(?:warning) : (.*)$")
    70     r".*\.st:(\d+)-(\d+)\.\.(\d+)-(\d+): (?:error)|(?:warning) : (.*)$")
    72 
    71 
    73 
    72 
   114         return path
   113         return path
   115 
   114 
   116     def findCmd(self):
   115     def findCmd(self):
   117         cmd = "iec2c" + (".exe" if os.name == 'nt' else "")
   116         cmd = "iec2c" + (".exe" if os.name == 'nt' else "")
   118         paths = [
   117         paths = [
   119             os.path.join(base_folder, "matiec")
   118             pathutils.ThirdPartyPath("matiec")
   120         ]
   119         ]
   121         path = self.findObject(
   120         path = self.findObject(
   122             paths, lambda p: os.path.isfile(os.path.join(p, cmd)))
   121             paths, lambda p: os.path.isfile(os.path.join(p, cmd)))
   123 
   122 
   124         # otherwise use iec2c from PATH
   123         # otherwise use iec2c from PATH
   127 
   126 
   128         return cmd
   127         return cmd
   129 
   128 
   130     def findLibPath(self):
   129     def findLibPath(self):
   131         paths = [
   130         paths = [
   132             os.path.join(base_folder, "matiec", "lib"),
   131             pathutils.ThirdPartyPath("matiec", "lib"),
   133             "/usr/lib/matiec"
   132             "/usr/lib/matiec"
   134         ]
   133         ]
   135         path = self.findObject(
   134         path = self.findObject(
   136             paths, lambda p: os.path.isfile(os.path.join(p, "ieclib.txt")))
   135             paths, lambda p: os.path.isfile(os.path.join(p, "ieclib.txt")))
   137         return path
   136         return path