fix issue, that was impossible to change variable location IEC-address, when wx 3.0 is used
authorAndrey Skvortsov <andrej.skvortzov@gmail.com>
Tue, 04 Oct 2016 18:01:08 +0300
changeset 1536 3518d10487db
parent 1535 b3c43aa29d94
child 1537 e8629f0cc93b
fix issue, that was impossible to change variable location IEC-address, when wx 3.0 is used
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,