7198: Date editor crashes on invalid date
Now it just autoconverts into MOD_TEXT and returns whatever text was there. This fixes the crash on the master branch, but is not the final user experience yet.
This commit is contained in:
parent
3c93c1d164
commit
1d654a2b1a
@ -63,7 +63,7 @@ from gi.repository import Gtk
|
||||
#-------------------------------------------------------------------------
|
||||
from gramps.gen.const import GRAMPS_LOCALE as glocale
|
||||
_ = glocale.translation.sgettext
|
||||
from gramps.gen.lib.date import Date
|
||||
from gramps.gen.lib.date import Date, DateError
|
||||
from gramps.gen.datehandler import displayer
|
||||
from gramps.gen.const import URL_MANUAL_PAGE
|
||||
from ..display import display_help
|
||||
@ -216,13 +216,17 @@ class EditDate(ManagedWindow):
|
||||
(the_quality, the_modifier, the_calendar, the_value,
|
||||
the_text, the_newyear) = self.build_date_from_ui()
|
||||
self.return_date = Date(self.date)
|
||||
self.return_date.set(
|
||||
quality=the_quality,
|
||||
modifier=the_modifier,
|
||||
calendar=the_calendar,
|
||||
value=the_value,
|
||||
text=the_text,
|
||||
newyear=the_newyear)
|
||||
try:
|
||||
self.return_date.set(
|
||||
quality=the_quality,
|
||||
modifier=the_modifier,
|
||||
calendar=the_calendar,
|
||||
value=the_value,
|
||||
text=the_text,
|
||||
newyear=the_newyear)
|
||||
except DateError:
|
||||
self.return_date.set(modifier=Date.MOD_TEXTONLY,
|
||||
text=the_text)
|
||||
self.close()
|
||||
break
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user