controls/LocationCellEditor.py
branchrename_on_location_change
changeset 2575 aee08bd135d8
parent 2574 48a486000e84
child 2579 8fb5c6eddc72
equal deleted inserted replaced
2574:48a486000e84 2575:aee08bd135d8
   125 
   125 
   126             self.Location.SetValue(location)
   126             self.Location.SetValue(location)
   127             self.VariableName = infos["var_name"]
   127             self.VariableName = infos["var_name"]
   128             self.VarType = infos["IEC_type"]
   128             self.VarType = infos["IEC_type"]
   129 
   129 
       
   130             # when user selected something, end editing immediately
       
   131             # so that changes over multiple colums appear
       
   132             wx.CallAfter(self.Parent.Parent.CloseEditControl)
       
   133 
   130         self.Location.SetFocus()
   134         self.Location.SetFocus()
   131 
   135 
   132     def OnLocationChar(self, event):
   136     def OnLocationChar(self, event):
   133         keycode = event.GetKeyCode()
   137         keycode = event.GetKeyCode()
   134         if keycode in [wx.WXK_RETURN, wx.WXK_TAB]:
   138         if keycode in [wx.WXK_RETURN, wx.WXK_TAB]:
   189                 self.Table.Parent.OnVariableNameChange(old_name, name)
   193                 self.Table.Parent.OnVariableNameChange(old_name, name)
   190             self.Table.SetValueByName(row, 'Location', loc)
   194             self.Table.SetValueByName(row, 'Location', loc)
   191             var_type = self.CellControl.GetVarType()
   195             var_type = self.CellControl.GetVarType()
   192             if var_type is not None:
   196             if var_type is not None:
   193                 self.Table.SetValueByName(row, 'Type', var_type)
   197                 self.Table.SetValueByName(row, 'Type', var_type)
       
   198         else:
       
   199             wx.CallAfter(self.Table.Parent.ShowErrorMessage,
       
   200                 _("Selected location is identical to previous one"))
   194         self.CellControl.Disable()
   201         self.CellControl.Disable()
   195         return changed
   202         return changed
   196 
   203 
   197     if wx.VERSION >= (3, 0, 0):
   204     if wx.VERSION >= (3, 0, 0):
   198         def EndEdit(self, row, col, grid, oldval):
   205         def EndEdit(self, row, col, grid, oldval):