py_ext/PythonFileCTNMixin.py
changeset 1680 6db967480b7d
parent 1511 91538d0c242c
child 1732 94ffe74e6895
equal deleted inserted replaced
1679:2fcea15858a5 1680:6db967480b7d
     3 
     3 
     4 # This file is part of Beremiz, a Integrated Development Environment for
     4 # This file is part of Beremiz, a Integrated Development Environment for
     5 # programming IEC 61131-3 automates supporting plcopen standard and CanFestival.
     5 # programming IEC 61131-3 automates supporting plcopen standard and CanFestival.
     6 #
     6 #
     7 # Copyright (C) 2007: Edouard TISSERANT and Laurent BESSARD
     7 # Copyright (C) 2007: Edouard TISSERANT and Laurent BESSARD
       
     8 # Copyright (C) 2017: Andrey Skvortsov
     8 #
     9 #
     9 # See COPYING file for copyrights details.
    10 # See COPYING file for copyrights details.
    10 #
    11 #
    11 # This program is free software; you can redistribute it and/or
    12 # This program is free software; you can redistribute it and/or
    12 # modify it under the terms of the GNU General Public License
    13 # modify it under the terms of the GNU General Public License
    22 # along with this program; if not, write to the Free Software
    23 # along with this program; if not, write to the Free Software
    23 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
    24 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
    24 
    25 
    25 import os, re
    26 import os, re
    26 from lxml import etree
    27 from lxml import etree
       
    28 import util.paths as paths
    27 
    29 
    28 from xmlclass import GenerateParserFromXSD
    30 from xmlclass import GenerateParserFromXSD
    29 
    31 
    30 from CodeFileTreeNode import CodeFile
    32 from CodeFileTreeNode import CodeFile
    31 from PythonEditor import PythonEditor
    33 from PythonEditor import PythonEditor
    45         CodeFile.__init__(self)
    47         CodeFile.__init__(self)
    46 
    48 
    47         filepath = self.PythonFileName()
    49         filepath = self.PythonFileName()
    48 
    50 
    49         if os.path.isfile(filepath):
    51         if os.path.isfile(filepath):
    50             PythonParser = GenerateParserFromXSD(
    52             PythonParser = GenerateParserFromXSD(paths.AbsNeighbourFile(__file__, "py_ext_xsd.xsd"))
    51                 os.path.join(os.path.dirname(__file__), "py_ext_xsd.xsd"))
       
    52 
    53 
    53             xmlfile = open(filepath, 'r')
    54             xmlfile = open(filepath, 'r')
    54             pythonfile_xml = xmlfile.read()
    55             pythonfile_xml = xmlfile.read()
    55             xmlfile.close()
    56             xmlfile.close()
    56 
    57