7198: Date editor crashes on invalid date

Trying out the approach preferred by Nick, see 7198:32708
This commit is contained in:
Vassilii Khachaturov 2013-11-16 17:53:01 +02:00
parent 872bf57946
commit 531e6624b0

View File

@ -224,11 +224,12 @@ class EditDate(ManagedWindow):
value=the_value, value=the_value,
text=the_text, text=the_text,
newyear=the_newyear) newyear=the_newyear)
except DateError: except DateError as e:
# Switch to text only mode, leave the dialog open d = e.date # Invalid Date object!
# so the user sees the old data. d.set(modifier=Date.MOD_TEXTONLY,
self.type_box.set_active(len(MOD_TEXT)-1) # pray that the displayer doesn't choke here!
continue text=displayer.display(d))
self.return_date = d
self.close() self.close()
break break