controls/LocationCellEditor.py
branchrename_on_location_change
changeset 2573 071d10c7ab8f
parent 1881 091005ec69c4
child 2574 48a486000e84
equal deleted inserted replaced
2572:9622418ac28c 2573:071d10c7ab8f
    78         self.Location.SetValue(value)
    78         self.Location.SetValue(value)
    79 
    79 
    80     def GetValue(self):
    80     def GetValue(self):
    81         return self.Location.GetValue()
    81         return self.Location.GetValue()
    82 
    82 
       
    83     def GetName(self):
       
    84         return self.VariableName
       
    85     
    83     def OnSize(self, event):
    86     def OnSize(self, event):
    84         self.Layout()
    87         self.Layout()
    85 
    88 
    86     def OnBrowseButtonClick(self, event):
    89     def OnBrowseButtonClick(self, event):
    87         # pop up the location browser dialog
    90         # pop up the location browser dialog
   116                     location = "%Q" + location
   119                     location = "%Q" + location
   117                 else:
   120                 else:
   118                     location = "%M" + location
   121                     location = "%M" + location
   119 
   122 
   120             self.Location.SetValue(location)
   123             self.Location.SetValue(location)
       
   124             self.VariableName = infos["name"]
   121             self.VarType = infos["IEC_type"]
   125             self.VarType = infos["IEC_type"]
   122 
   126 
   123         self.Location.SetFocus()
   127         self.Location.SetFocus()
   124 
   128 
   125     def OnLocationChar(self, event):
   129     def OnLocationChar(self, event):
   169 
   173 
   170     def EndEditInternal(self, row, col, grid, old_loc):
   174     def EndEditInternal(self, row, col, grid, old_loc):
   171         loc = self.CellControl.GetValue()
   175         loc = self.CellControl.GetValue()
   172         changed = loc != old_loc
   176         changed = loc != old_loc
   173         if changed:
   177         if changed:
       
   178             name = self.CellControl.GetName()
       
   179             old_name  = self.Table.GetValueByName(row, 'Name')
       
   180             self.Table.SetValueByName(row, 'Name', name)
       
   181             self.Table.Parent.OnVariableNameChange(old_name, name)
   174             self.Table.SetValueByName(row, 'Location', loc)
   182             self.Table.SetValueByName(row, 'Location', loc)
   175             self.Table.SetValueByName(row, 'Type', self.CellControl.GetVarType())
   183             self.Table.SetValueByName(row, 'Type', self.CellControl.GetVarType())
   176         self.CellControl.Disable()
   184         self.CellControl.Disable()
   177         return changed
   185         return changed
   178 
   186