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