etherlab/ConfigEditor.py
changeset 2392 aad985da14f7
parent 2381 1c40e3976cc2
child 2395 d47666f33923
equal deleted inserted replaced
2391:3315e621d7fb 2392:aad985da14f7
    18 import wx.gizmos
    18 import wx.gizmos
    19 import wx.lib.buttons
    19 import wx.lib.buttons
    20 
    20 
    21 from plcopen.structures import IEC_KEYWORDS, TestIdentifier
    21 from plcopen.structures import IEC_KEYWORDS, TestIdentifier
    22 from controls import CustomGrid, CustomTable, FolderTree
    22 from controls import CustomGrid, CustomTable, FolderTree
       
    23 from controls.CustomStyledTextCtrl import NAVIGATION_KEYS
    23 from editors.ConfTreeNodeEditor import ConfTreeNodeEditor, SCROLLBAR_UNIT
    24 from editors.ConfTreeNodeEditor import ConfTreeNodeEditor, SCROLLBAR_UNIT
    24 from util.BitmapLibrary import GetBitmap
    25 from util.BitmapLibrary import GetBitmap
    25 from controls.CustomStyledTextCtrl import NAVIGATION_KEYS
    26 from util.TranslationCatalogs import NoTranslate
    26 
    27 
    27 # -----------------------------------------------------------------------
    28 # -----------------------------------------------------------------------
    28 from EtherCATManagementEditor import EtherCATManagementTreebook, MasterStatePanelClass
    29 from EtherCATManagementEditor import EtherCATManagementTreebook, MasterStatePanelClass
    29 from util.TranslationCatalogs import NoTranslate
       
    30 # -----------------------------------------------------------------------
    30 # -----------------------------------------------------------------------
    31 
    31 
    32 [ETHERCAT_VENDOR, ETHERCAT_GROUP, ETHERCAT_DEVICE] = range(3)
    32 [ETHERCAT_VENDOR, ETHERCAT_GROUP, ETHERCAT_DEVICE] = range(3)
    33 
    33 
    34 
    34 
   238                     if pdo_mapping == "T":
   238                     if pdo_mapping == "T":
   239                         dir = "%I"
   239                         dir = "%I"
   240                     else:
   240                     else:
   241                         dir = "%Q"
   241                         dir = "%Q"
   242                     location = "%s%s" % (dir, data_size) + \
   242                     location = "%s%s" % (dir, data_size) + \
   243                                ".".join(map(lambda x: str(x), location + (entry_index, entry_subindex)))
   243                                ".".join(map(str, location + (entry_index, entry_subindex)))
   244 
   244 
   245                     data = wx.TextDataObject(str((location, "location", data_type, var_name, "", access)))
   245                     data = wx.TextDataObject(str((location, "location", data_type, var_name, "", access)))
   246                     dragSource = wx.DropSource(self.VariablesGrid)
   246                     dragSource = wx.DropSource(self.VariablesGrid)
   247                     dragSource.SetData(data)
   247                     dragSource.SetData(data)
   248                     dragSource.DoDragDrop()
   248                     dragSource.DoDragDrop()
  1003             var_type = self.Controler.GetSlaveVariableDataType(
  1003             var_type = self.Controler.GetSlaveVariableDataType(
  1004                 *self.ProcessVariablesTable.GetValueByName(row, "ReadFrom"))
  1004                 *self.ProcessVariablesTable.GetValueByName(row, "ReadFrom"))
  1005             data_size = self.Controler.GetSizeOfType(var_type)
  1005             data_size = self.Controler.GetSizeOfType(var_type)
  1006             number = self.ProcessVariablesTable.GetValueByName(row, "Number")
  1006             number = self.ProcessVariablesTable.GetValueByName(row, "Number")
  1007             location = "%%M%s" % data_size + \
  1007             location = "%%M%s" % data_size + \
  1008                        ".".join(map(lambda x: str(x), self.Controler.GetCurrentLocation() + (number,)))
  1008                        ".".join(map(str, self.Controler.GetCurrentLocation() + (number,)))
  1009 
  1009 
  1010             data = wx.TextDataObject(str((location, "location", var_type, var_name, "")))
  1010             data = wx.TextDataObject(str((location, "location", var_type, var_name, "")))
  1011             dragSource = wx.DropSource(self.ProcessVariablesGrid)
  1011             dragSource = wx.DropSource(self.ProcessVariablesGrid)
  1012             dragSource.SetData(data)
  1012             dragSource.SetData(data)
  1013             dragSource.DoDragDrop()
  1013             dragSource.DoDragDrop()