From f8ab01b4182567d3639ece412f5b3958cf00af77 Mon Sep 17 00:00:00 2001 From: Yann Leboulanger Date: Tue, 11 May 2010 16:58:53 +0200 Subject: [PATCH] check birthday date format when editing profile window. Fixes #5692 --- data/gui/profile_window.ui | 1 + src/profile_window.py | 14 ++++++++++++++ 2 files changed, 15 insertions(+) diff --git a/data/gui/profile_window.ui b/data/gui/profile_window.ui index 0147c7369..c1e346b8c 100644 --- a/data/gui/profile_window.ui +++ b/data/gui/profile_window.ui @@ -432,6 +432,7 @@ True True + 3 diff --git a/src/profile_window.py b/src/profile_window.py index 32796a911..077ba4f24 100644 --- a/src/profile_window.py +++ b/src/profile_window.py @@ -203,6 +203,20 @@ class ProfileWindow: elif event.button == 1: # left click self.on_set_avatar_button_clicked(widget) + def on_BDAY_entry_focus_out_event(self, widget, event): + txt = widget.get_text() + if not txt: + return + try: + time.strptime(txt, '%Y-%m-%d') + except ValueError: + if not widget.is_focus(): + pritext = _('Wrong date format') + dialogs.ErrorDialog(pritext, _('Format of the date must be ' + 'YYYY-MM-DD')) + gobject.idle_add(lambda: widget.grab_focus()) + return True + def set_value(self, entry_name, value): try: self.xml.get_object(entry_name).set_text(value)