def Validate(self, win): textCtrl = self.GetWindow() if strToDeg(textCtrl.GetValue(), self.mode) == None: textCtrl.SetBackgroundColour('pink') message = _( 'The highlighted field must be in one of the following formats:' ) if self.mode == 'lat': message = message + ''' N12 34.345 S12 34 45.6 S12.34567 -12.34567''' elif self.mode == 'lon': message = message + ''' E12 34.345 W12 34 45.6 W12.34567 -12.34567''' else: message = message + ''' 12 34.345 12 34 45.6 12.34567''' wx.MessageBox(message, _('Input Error')) textCtrl.SetFocus() textCtrl.Refresh() return False else: textCtrl.SetBackgroundColour( wx.SystemSettings_GetColour(wx.SYS_COLOUR_WINDOW)) textCtrl.Refresh() return True
def EndEdit(self, row, col, grid): changed = False value = strToDeg(self._tc.GetValue(), self.mode) if value != self.startValue: changed = True grid.GetTable().SetValue(row, col, value) return changed
def Validate(self, win): textCtrl = self.GetWindow() if strToDeg(textCtrl.GetValue(), self.mode) == None: textCtrl.SetBackgroundColour("pink") message = _("The highlighted field must be in one of the following formats:") if self.mode == "lat": message = ( message + """ N12 34.345 S12 34 45.6 S12.34567 -12.34567""" ) elif self.mode == "lon": message = ( message + """ E12 34.345 W12 34 45.6 W12.34567 -12.34567""" ) else: message = ( message + """ 12 34.345 12 34 45.6 12.34567""" ) wx.MessageBox(message, _("Input Error")) textCtrl.SetFocus() textCtrl.Refresh() return False else: textCtrl.SetBackgroundColour(wx.SystemSettings_GetColour(wx.SYS_COLOUR_WINDOW)) textCtrl.Refresh() return True
def TransferFromWindow(self): textCtrl = self.GetWindow() self.data[self.key] = strToDeg(textCtrl.GetValue(), self.mode) return True