120 def BeginEdit(self, row, col, grid): |
120 def BeginEdit(self, row, col, grid): |
121 self.CellControl.Enable() |
121 self.CellControl.Enable() |
122 self.CellControl.SetValue(self.Table.GetValueByName(row, self.Colname)) |
122 self.CellControl.SetValue(self.Table.GetValueByName(row, self.Colname)) |
123 self.CellControl.SetFocus() |
123 self.CellControl.SetFocus() |
124 |
124 |
125 def EndEditInternal(self, row, col, grid, old_duration): |
125 def EndEdit(self, row, col, grid, oldval): |
126 duration = self.CellControl.GetValue() |
126 value = self.CellControl.GetValue() |
127 changed = duration != old_duration |
127 changed = value != oldval |
128 if changed: |
128 if changed: |
129 self.Table.SetValueByName(row, self.Colname, duration) |
129 return value |
|
130 else: |
|
131 return None |
|
132 |
|
133 def ApplyEdit(self, row, col, grid): |
|
134 value = self.CellControl.GetValue() |
|
135 self.Table.SetValueByName(row, self.Colname, value) |
130 self.CellControl.Disable() |
136 self.CellControl.Disable() |
131 return changed |
|
132 |
|
133 if wx.VERSION >= (3, 0, 0): |
|
134 def EndEdit(self, row, col, grid, oldval): |
|
135 return self.EndEditInternal(row, col, grid, oldval) |
|
136 else: |
|
137 def EndEdit(self, row, col, grid): |
|
138 oldval = self.Table.GetValueByName(row, self.Colname) |
|
139 return self.EndEditInternal(row, col, grid, oldval) |
|
140 |
137 |
141 def SetSize(self, rect): |
138 def SetSize(self, rect): |
142 self.CellControl.SetDimensions(rect.x + 1, rect.y, |
139 self.CellControl.SetDimensions(rect.x + 1, rect.y, |
143 rect.width, rect.height, |
140 rect.width, rect.height, |
144 wx.SIZE_ALLOW_MINUS_ONE) |
141 wx.SIZE_ALLOW_MINUS_ONE) |