etherlab/ConfigEditor.py
changeset 2124 1f2c3fdd70d0
parent 2110 e8c43f542eb1
child 2129 f1d93f44570f
equal deleted inserted replaced
2123:68beaf825a20 2124:1f2c3fdd70d0
   172             if col == -1 and data_size is not None:
   172             if col == -1 and data_size is not None:
   173                 pdo_mapping = entry.get("PDOMapping", "")
   173                 pdo_mapping = entry.get("PDOMapping", "")
   174                 access = entry.get("Access", "")
   174                 access = entry.get("Access", "")
   175                 entry_index = self.Controler.ExtractHexDecValue(entry.get("Index", "0"))
   175                 entry_index = self.Controler.ExtractHexDecValue(entry.get("Index", "0"))
   176                 entry_subindex = self.Controler.ExtractHexDecValue(entry.get("SubIndex", "0"))
   176                 entry_subindex = self.Controler.ExtractHexDecValue(entry.get("SubIndex", "0"))
       
   177                 location = self.Controler.GetCurrentLocation()
   177                 if self.PositionColumn:
   178                 if self.PositionColumn:
   178                     slave_pos = self.Controler.ExtractHexDecValue(entry.get("Position", "0"))
   179                     slave_pos = self.Controler.ExtractHexDecValue(entry.get("Position", "0"))
       
   180                     location += (slave_pos,)
       
   181                     node_name = self.Controler.GetSlaveName(slave_pos)
   179                 else:
   182                 else:
   180                     slave_pos = self.Controler.GetSlavePos()
   183                     node_name = self.Controler.CTNName()
   181                 
   184                 
   182                 if pdo_mapping != "":
   185                 if pdo_mapping != "":
   183                     var_name = "%s_%4.4x_%2.2x" % (self.Controler.CTNName(), entry_index, entry_subindex)
   186                     var_name = "%s_%4.4x_%2.2x" % (node_name, entry_index, entry_subindex)
   184                     if pdo_mapping == "R":
   187                     if pdo_mapping == "T":
   185                         dir = "%I"
   188                         dir = "%I"
   186                     else:
   189                     else:
   187                         dir = "%Q"
   190                         dir = "%Q"
   188                     location = "%s%s" % (dir, data_size) + \
   191                     location = "%s%s" % (dir, data_size) + \
   189                                ".".join(map(lambda x:str(x), self.Controler.GetCurrentLocation() + 
   192                                ".".join(map(lambda x:str(x), location + (entry_index, entry_subindex)))
   190                                                              (slave_pos, entry_index, entry_subindex)))
       
   191                     
   193                     
   192                     data = wx.TextDataObject(str((location, "location", data_type, var_name, "", access)))
   194                     data = wx.TextDataObject(str((location, "location", data_type, var_name, "", access)))
   193                     dragSource = wx.DropSource(self.VariablesGrid)
   195                     dragSource = wx.DropSource(self.VariablesGrid)
   194                     dragSource.SetData(data)
   196                     dragSource.SetData(data)
   195                     dragSource.DoDragDrop()
   197                     dragSource.DoDragDrop()
   196                     return
   198                     return
   197                 
   199                 
   198                 elif self.ColumnPosition:
   200                 elif self.PositionColumn:
   199                     location = self.Controler.GetCurrentLocation() +\
   201                     location = self.Controler.GetCurrentLocation() +\
   200                                (slave_pos, entry_index, entry_subindex)
   202                                (slave_pos, entry_index, entry_subindex)
   201                     data = wx.TextDataObject(str((location, "variable", access)))
   203                     data = wx.TextDataObject(str((location, "variable", access)))
   202                     dragSource = wx.DropSource(self.VariablesGrid)
   204                     dragSource = wx.DropSource(self.VariablesGrid)
   203                     dragSource.SetData(data)
   205                     dragSource.SetData(data)