etherlab/ConfigEditor.py
branchpython3
changeset 3750 f62625418bff
parent 3660 0e41dbe6ddcd
equal deleted inserted replaced
3749:fda6c1a37662 3750:f62625418bff
     7 #                          RTES Lab : CRKim, JBLee, youcu
     7 #                          RTES Lab : CRKim, JBLee, youcu
     8 #                          Higen Motor : Donggu Kang
     8 #                          Higen Motor : Donggu Kang
     9 #
     9 #
    10 # See COPYING file for copyrights details.
    10 # See COPYING file for copyrights details.
    11 
    11 
    12 from __future__ import absolute_import
    12 
    13 from __future__ import division
    13 
    14 import os
    14 import os
    15 import re
    15 import re
    16 
    16 
    17 import wx
    17 import wx
    18 import wx.grid
    18 import wx.grid
    28 
    28 
    29 # -----------------------------------------------------------------------
    29 # -----------------------------------------------------------------------
    30 from etherlab.EtherCATManagementEditor import EtherCATManagementTreebook, MasterStatePanelClass
    30 from etherlab.EtherCATManagementEditor import EtherCATManagementTreebook, MasterStatePanelClass
    31 # -----------------------------------------------------------------------
    31 # -----------------------------------------------------------------------
    32 
    32 
    33 [ETHERCAT_VENDOR, ETHERCAT_GROUP, ETHERCAT_DEVICE] = range(3)
    33 [ETHERCAT_VENDOR, ETHERCAT_GROUP, ETHERCAT_DEVICE] = list(range(3))
    34 
    34 
    35 
    35 
    36 def GetVariablesTableColnames(position=False):
    36 def GetVariablesTableColnames(position=False):
    37     _ = NoTranslate
    37     _ = NoTranslate
    38     colname = ["#"]
    38     colname = ["#"]
   419         if values is not None and col != wx.NOT_FOUND and row != wx.NOT_FOUND and 2 <= col <= 3:
   419         if values is not None and col != wx.NOT_FOUND and row != wx.NOT_FOUND and 2 <= col <= 3:
   420             location = None
   420             location = None
   421             if values[1] == "location":
   421             if values[1] == "location":
   422                 result = LOCATION_MODEL.match(values[0])
   422                 result = LOCATION_MODEL.match(values[0])
   423                 if result is not None:
   423                 if result is not None:
   424                     location = map(int, result.group(1).split('.'))
   424                     location = list(map(int, result.group(1).split('.')))
   425                 master_location = self.ParentWindow.GetMasterLocation()
   425                 master_location = self.ParentWindow.GetMasterLocation()
   426                 if master_location == tuple(location[:len(master_location)]) and \
   426                 if master_location == tuple(location[:len(master_location)]) and \
   427                    len(location) - len(master_location) == 3:
   427                    len(location) - len(master_location) == 3:
   428                     values = tuple(location[len(master_location):])
   428                     values = tuple(location[len(master_location):])
   429                     var_type = self.ParentWindow.Controler.GetSlaveVariableDataType(*values)
   429                     var_type = self.ParentWindow.Controler.GetSlaveVariableDataType(*values)
   483         if values is not None:
   483         if values is not None:
   484             location = None
   484             location = None
   485             if values[1] == "location":
   485             if values[1] == "location":
   486                 result = LOCATION_MODEL.match(values[0])
   486                 result = LOCATION_MODEL.match(values[0])
   487                 if result is not None and len(values) > 5:
   487                 if result is not None and len(values) > 5:
   488                     location = map(int, result.group(1).split('.'))
   488                     location = list(map(int, result.group(1).split('.')))
   489                     access = values[5]
   489                     access = values[5]
   490             elif values[1] == "variable":
   490             elif values[1] == "variable":
   491                 location = values[0]
   491                 location = values[0]
   492                 access = values[2]
   492                 access = values[2]
   493             if location is not None:
   493             if location is not None: