# HG changeset patch
# User Andrey Skvortsov <andrej.skvortzov@gmail.com>
# Date 1475593268 -10800
# Node ID 3518d10487dbe684c54bbb36a355ddf7990a6b69
# Parent  b3c43aa29d9409c346f86158214d9112c0f56899
fix issue, that was impossible to change variable location IEC-address, when wx 3.0 is used

diff -r b3c43aa29d94 -r 3518d10487db controls/LocationCellEditor.py
--- a/controls/LocationCellEditor.py	Tue Oct 04 17:43:30 2016 +0300
+++ b/controls/LocationCellEditor.py	Tue Oct 04 18:01:08 2016 +0300
@@ -161,15 +161,22 @@
             self.CellControl.SetVarType(self.Table.GetValueByName(row, 'Type'))
         self.CellControl.SetFocus()
 
-    def EndEdit(self, row, col, grid):
+    def EndEditInternal(self, row, col, grid, old_loc):
         loc = self.CellControl.GetValue()
-        old_loc = self.Table.GetValueByName(row, 'Location')
         changed = loc != old_loc
         if changed:
             self.Table.SetValueByName(row, 'Location', loc)
             self.Table.SetValueByName(row, 'Type', self.CellControl.GetVarType())
         self.CellControl.Disable()
         return changed
+        
+    if wx.VERSION >= (3, 0, 0):
+        def EndEdit(self, row, col, grid, oldval):
+            self.EndEditInternal(row, col, grid, oldval)
+    else:
+        def EndEdit(self, row, col, grid):
+            old_loc = self.Table.GetValueByName(row, 'Location')            
+            self.EndEditInternal(row, col, grid, oldval)
     
     def SetSize(self, rect):
         self.CellControl.SetDimensions(rect.x + 1, rect.y,