controls/DurationCellEditor.py
changeset 1275 8d4de18c9f29
parent 814 5743cbdff669
child 1499 8626bba4b2a8
--- a/controls/DurationCellEditor.py	Fri Jul 05 00:10:29 2013 +0200
+++ b/controls/DurationCellEditor.py	Fri Jul 05 00:11:21 2013 +0200
@@ -98,10 +98,11 @@
     '''
     Grid cell editor that uses DurationCellControl to display an edit button.
     '''
-    def __init__(self, table):
+    def __init__(self, table, colname):
         wx.grid.PyGridCellEditor.__init__(self)
         
         self.Table = table
+        self.Colname = colname
     
     def __del__(self):
         self.CellControl = None
@@ -114,15 +115,15 @@
 
     def BeginEdit(self, row, col, grid):
         self.CellControl.Enable()
-        self.CellControl.SetValue(self.Table.GetValueByName(row, 'Interval'))
+        self.CellControl.SetValue(self.Table.GetValueByName(row, self.Colname))
         self.CellControl.SetFocus()
 
     def EndEdit(self, row, col, grid):
         duration = self.CellControl.GetValue()
-        old_duration = self.Table.GetValueByName(row, 'Interval')
+        old_duration = self.Table.GetValueByName(row, self.Colname)
         changed = duration != old_duration
         if changed:
-            self.Table.SetValueByName(row, 'Interval', duration)
+            self.Table.SetValueByName(row, self.Colname, duration)
         self.CellControl.Disable()
         return changed