7198: Date editor crashes on invalid date

Improve user experience as promised in [98d8e6].
Now, if one clicks OK in the date editor and the date is invalid,
it's switched into text mode and the dialog remains open,
so the user can either correct the date or type it as text,
no more loss of entered data happens.
This commit is contained in:
Vassilii Khachaturov 2013-11-16 10:21:12 +02:00
parent 98d8e64e04
commit d8acf8e875

View File

@ -225,8 +225,10 @@ class EditDate(ManagedWindow):
text=the_text,
newyear=the_newyear)
except DateError:
self.return_date.set(modifier=Date.MOD_TEXTONLY,
text=the_text)
# Switch to text only mode, leave the dialog open
# so the user sees the old data.
self.type_box.set_active(len(MOD_TEXT)-1)
continue
self.close()
break