--- a/controls/DurationCellEditor.py Sun Mar 18 19:18:23 2012 +0100
+++ b/controls/DurationCellEditor.py Sun Mar 18 21:47:58 2012 +0100
@@ -129,15 +129,17 @@
self.CellControl.PushEventHandler(evt_handler)
def BeginEdit(self, row, col, grid):
+ self.CellControl.Enable()
self.CellControl.SetValue(self.Table.GetValueByName(row, 'Interval'))
self.CellControl.SetFocus()
def EndEdit(self, row, col, grid):
duration = self.CellControl.GetValue()
old_duration = self.Table.GetValueByName(row, 'Interval')
- if duration != old_duration:
+ changed = duration != old_duration
+ if changed:
self.Table.SetValueByName(row, 'Interval', duration)
- return True
+ self.CellControl.Disable()
return False
def SetSize(self, rect):
--- a/controls/LocationCellEditor.py Sun Mar 18 19:18:23 2012 +0100
+++ b/controls/LocationCellEditor.py Sun Mar 18 21:47:58 2012 +0100
@@ -68,12 +68,15 @@
Custom cell editor control with a text box and a button that launches
the BrowseLocationsDialog.
'''
- def __init__(self, parent, locations):
+ def __init__(self, parent):
self._init_ctrls(parent)
- self.Locations = locations
+ self.Locations = None
self.VarType = None
self.Default = False
+ def SetLocations(self, locations):
+ self.Locations = locations
+
def SetVarType(self, vartype):
self.VarType = vartype
@@ -129,16 +132,14 @@
self.CellControl = None
def Create(self, parent, id, evt_handler):
- locations = self.Controler.GetVariableLocationTree()
- if len(locations) > 0:
- self.CellControl = LocationCellControl(parent, locations)
- else:
- self.CellControl = wx.TextCtrl(parent, -1)
+ self.CellControl = LocationCellControl(parent)
self.SetControl(self.CellControl)
if evt_handler:
self.CellControl.PushEventHandler(evt_handler)
def BeginEdit(self, row, col, grid):
+ self.CellControl.Enable()
+ self.CellControl.SetLocations(self.Controler.GetVariableLocationTree())
self.CellControl.SetValue(self.Table.GetValueByName(row, 'Location'))
if isinstance(self.CellControl, LocationCellControl):
self.CellControl.SetVarType(self.Controler.GetBaseType(self.Table.GetValueByName(row, 'Type')))
@@ -147,10 +148,11 @@
def EndEdit(self, row, col, grid):
loc = self.CellControl.GetValue()
old_loc = self.Table.GetValueByName(row, 'Location')
- if loc != old_loc:
+ changed = loc != old_loc
+ if changed:
self.Table.SetValueByName(row, 'Location', loc)
- return True
- return False
+ self.CellControl.Disable()
+ return changed
def SetSize(self, rect):
self.CellControl.SetDimensions(rect.x + 1, rect.y,