controls/LocationCellEditor.py
changeset 2579 8fb5c6eddc72
parent 2575 aee08bd135d8
child 3303 0ffb41625592
equal deleted inserted replaced
2578:eed31489c909 2579:8fb5c6eddc72
    83     def GetValue(self):
    83     def GetValue(self):
    84         return self.Location.GetValue()
    84         return self.Location.GetValue()
    85 
    85 
    86     def GetName(self):
    86     def GetName(self):
    87         return self.VariableName
    87         return self.VariableName
    88     
    88 
    89     def OnSize(self, event):
    89     def OnSize(self, event):
    90         self.Layout()
    90         self.Layout()
    91 
    91 
    92     def OnBrowseButtonClick(self, event):
    92     def OnBrowseButtonClick(self, event):
    93         # pop up the location browser dialog
    93         # pop up the location browser dialog
   186             if name is not None:
   186             if name is not None:
   187                 message = self.Table.Parent.CheckVariableName(name, row)
   187                 message = self.Table.Parent.CheckVariableName(name, row)
   188                 if message is not None:
   188                 if message is not None:
   189                     wx.CallAfter(self.Table.Parent.ShowErrorMessage, message)
   189                     wx.CallAfter(self.Table.Parent.ShowErrorMessage, message)
   190                     return None
   190                     return None
   191                 old_name  = self.Table.GetValueByName(row, 'Name')
   191                 old_name = self.Table.GetValueByName(row, 'Name')
   192                 self.Table.SetValueByName(row, 'Name', name)
   192                 self.Table.SetValueByName(row, 'Name', name)
   193                 self.Table.Parent.OnVariableNameChange(old_name, name)
   193                 self.Table.Parent.OnVariableNameChange(old_name, name)
   194             self.Table.SetValueByName(row, 'Location', loc)
   194             self.Table.SetValueByName(row, 'Location', loc)
   195             var_type = self.CellControl.GetVarType()
   195             var_type = self.CellControl.GetVarType()
   196             if var_type is not None:
   196             if var_type is not None:
   197                 self.Table.SetValueByName(row, 'Type', var_type)
   197                 self.Table.SetValueByName(row, 'Type', var_type)
   198         else:
   198         else:
   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     if wx.VERSION >= (3, 0, 0):
   205         def EndEdit(self, row, col, grid, oldval):
   205         def EndEdit(self, row, col, grid, oldval):