editors/CodeFileEditor.py
changeset 2459 21164625b393
parent 2437 105c20fdeb19
child 2518 c48470e2b383
equal deleted inserted replaced
2458:2a70d5240300 2459:21164625b393
    22 # along with this program; if not, write to the Free Software
    22 # along with this program; if not, write to the Free Software
    23 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
    23 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
    24 
    24 
    25 
    25 
    26 from __future__ import absolute_import
    26 from __future__ import absolute_import
       
    27 from __future__ import division
    27 import re
    28 import re
       
    29 from builtins import str as text
    28 
    30 
    29 import wx
    31 import wx
    30 import wx.grid
    32 import wx.grid
    31 import wx.stc as stc
    33 import wx.stc as stc
    32 import wx.lib.buttons
    34 import wx.lib.buttons
       
    35 from six.moves import xrange
       
    36 
    33 
    37 
    34 from plcopen.plcopen import TestTextElement
    38 from plcopen.plcopen import TestTextElement
    35 from plcopen.structures import TestIdentifier, IEC_KEYWORDS, DefaultType
    39 from plcopen.structures import TestIdentifier, IEC_KEYWORDS, DefaultType
    36 from controls import CustomGrid, CustomTable
    40 from controls import CustomGrid, CustomTable
    37 from controls.CustomStyledTextCtrl import CustomStyledTextCtrl, faces, GetCursorPos, NAVIGATION_KEYS
    41 from controls.CustomStyledTextCtrl import CustomStyledTextCtrl, faces, GetCursorPos, NAVIGATION_KEYS
   136         self.SectionsComments = {}
   140         self.SectionsComments = {}
   137         for section in self.Controler.SECTIONS_NAMES:
   141         for section in self.Controler.SECTIONS_NAMES:
   138             section_comment = " %s section " % (section)
   142             section_comment = " %s section " % (section)
   139             len_headers = EDGE_COLUMN - len(section_comment)
   143             len_headers = EDGE_COLUMN - len(section_comment)
   140             section_comment = \
   144             section_comment = \
   141                 self.COMMENT_HEADER * (len_headers / 2) + \
   145                 self.COMMENT_HEADER * (len_headers // 2) + \
   142                 section_comment + \
   146                 section_comment + \
   143                 self.COMMENT_HEADER * (len_headers - len_headers / 2)
   147                 self.COMMENT_HEADER * (len_headers - len_headers // 2)
   144 
   148 
   145             self.SectionsComments[section] = {
   149             self.SectionsComments[section] = {
   146                 "comment": section_comment,
   150                 "comment": section_comment,
   147             }
   151             }
   148 
   152 
   627     def GetValue(self, row, col):
   631     def GetValue(self, row, col):
   628         if row < self.GetNumberRows():
   632         if row < self.GetNumberRows():
   629             if col == 0:
   633             if col == 0:
   630                 return row + 1
   634                 return row + 1
   631             else:
   635             else:
   632                 return unicode(self.data[row].get(self.GetColLabelValue(col, False), ""))
   636                 return text(self.data[row].get(self.GetColLabelValue(col, False), ""))
   633 
   637 
   634     def _updateColAttrs(self, grid):
   638     def _updateColAttrs(self, grid):
   635         """
   639         """
   636         wxGrid -> update the column attributes to add the
   640         wxGrid -> update the column attributes to add the
   637         appropriate renderer given the column name.
   641         appropriate renderer given the column name.