176 self.CellControl.SetValue(self.Table.GetValueByName(row, 'Location')) |
176 self.CellControl.SetValue(self.Table.GetValueByName(row, 'Location')) |
177 if isinstance(self.CellControl, LocationCellControl): |
177 if isinstance(self.CellControl, LocationCellControl): |
178 self.CellControl.SetVarType(self.Table.GetValueByName(row, 'Type')) |
178 self.CellControl.SetVarType(self.Table.GetValueByName(row, 'Type')) |
179 self.CellControl.SetFocus() |
179 self.CellControl.SetFocus() |
180 |
180 |
181 def EndEditInternal(self, row, col, grid, old_loc): |
181 def EndEdit(self, row, col, grid, old_loc): |
182 loc = self.CellControl.GetValue() |
182 loc = self.CellControl.GetValue() |
183 changed = loc != old_loc |
183 changed = loc != old_loc |
184 if changed: |
184 if changed: |
185 name = self.CellControl.GetName() |
185 name = self.CellControl.GetName() |
186 if name is not None: |
186 if name is not None: |
199 wx.CallAfter(self.Table.Parent.ShowErrorMessage, |
199 wx.CallAfter(self.Table.Parent.ShowErrorMessage, |
200 _("Selected location is identical to previous one")) |
200 _("Selected location is identical to previous one")) |
201 self.CellControl.Disable() |
201 self.CellControl.Disable() |
202 return changed |
202 return changed |
203 |
203 |
204 if wx.VERSION >= (3, 0, 0): |
204 def ApplyEdit(self, row, col, grid): |
205 def EndEdit(self, row, col, grid, oldval): |
205 pass |
206 return self.EndEditInternal(row, col, grid, oldval) |
|
207 else: |
|
208 def EndEdit(self, row, col, grid): |
|
209 old_loc = self.Table.GetValueByName(row, 'Location') |
|
210 return self.EndEditInternal(row, col, grid, old_loc) |
|
211 |
206 |
212 def SetSize(self, rect): |
207 def SetSize(self, rect): |
213 self.CellControl.SetDimensions(rect.x + 1, rect.y, |
208 self.CellControl.SetDimensions(rect.x + 1, rect.y, |
214 rect.width, rect.height, |
209 rect.width, rect.height, |
215 wx.SIZE_ALLOW_MINUS_ONE) |
210 wx.SIZE_ALLOW_MINUS_ONE) |