diff --git a/src/DateHandler/_DateUtils.py b/src/DateHandler/_DateUtils.py index e243dbfe3..8c473833d 100644 --- a/src/DateHandler/_DateUtils.py +++ b/src/DateHandler/_DateUtils.py @@ -77,6 +77,10 @@ def get_date(date_base) : """ return displayer.display(date_base.get_date_object()) +def get_date_valid(date_base): + date_obj = date_base.get_date_object() + return date_obj.get_valid() + def get_quote_date(date_base): """ Return a string representation of the date of the DateBase instance. diff --git a/src/DisplayModels/_PeopleModel.py b/src/DisplayModels/_PeopleModel.py index 06da0ecd3..a7afb26b7 100644 --- a/src/DisplayModels/_PeopleModel.py +++ b/src/DisplayModels/_PeopleModel.py @@ -547,7 +547,11 @@ class PeopleModel(gtk.GenericTreeModel): birth = self.db.get_event_from_handle(b.ref) date_str = DateHandler.get_date(birth) if date_str != "": - return cgi.escape(date_str) + retval = cgi.escape(date_str) + if not DateHandler.get_date_valid(birth): + return u'%s' % retval + else: + return retval except: return u'' @@ -560,7 +564,11 @@ class PeopleModel(gtk.GenericTreeModel): if (etype in [EventType.BAPTISM, EventType.CHRISTEN] and er.get_role() == EventRoleType.PRIMARY and date_str != ""): - return "%s" % cgi.escape(date_str) + retval = u"%s" % cgi.escape(date_str) + if not DateHandler.get_date_valid(event): + return u'%s' % retval + else: + return retval return u"" @@ -583,7 +591,11 @@ class PeopleModel(gtk.GenericTreeModel): event = self.db.get_event_from_handle(ref.ref) date_str = DateHandler.get_date(event) if date_str != "": - return cgi.escape(date_str) + retval = cgi.escape(date_str) + if not DateHandler.get_date_valid(event): + return u'%s' % retval + else: + return retval except: return u'' @@ -596,8 +608,11 @@ class PeopleModel(gtk.GenericTreeModel): if (etype in [EventType.BURIAL, EventType.CREMATION] and er.get_role() == EventRoleType.PRIMARY and date_str): - return "%s" % cgi.escape(date_str) - + retval = "%s" % cgi.escape(date_str) + if not DateHandler.get_date_valid(event): + return u'%s' % retval + else: + return retval return u"" def column_birth_place(self, data, node): diff --git a/src/DisplayTabs/_EmbeddedList.py b/src/DisplayTabs/_EmbeddedList.py index b54adf9fd..b4d137723 100644 --- a/src/DisplayTabs/_EmbeddedList.py +++ b/src/DisplayTabs/_EmbeddedList.py @@ -417,7 +417,10 @@ class EmbeddedList(ButtonTab): name = self._column_names[pair[1]][0] renderer = gtk.CellRendererText() renderer.set_property('ellipsize', pango.ELLIPSIZE_END) - column = gtk.TreeViewColumn(name, renderer, text=pair[1]) + if name == _("Date"): + column = gtk.TreeViewColumn(name, renderer, markup=pair[1]) + else: + column = gtk.TreeViewColumn(name, renderer, text=pair[1]) # insert the colum into the tree column.set_resizable(True) diff --git a/src/DisplayTabs/_EventRefModel.py b/src/DisplayTabs/_EventRefModel.py index 40d6e73a1..cdd09c19d 100644 --- a/src/DisplayTabs/_EventRefModel.py +++ b/src/DisplayTabs/_EventRefModel.py @@ -26,6 +26,7 @@ # #------------------------------------------------------------------------- import gtk +import cgi #------------------------------------------------------------------------- # @@ -46,23 +47,26 @@ class EventRefModel(gtk.ListStore): self.db = db for event_ref in event_list: event = db.get_event_from_handle(event_ref.ref) - self.append(row=[ - str(event.get_type()), - event.get_description(), - event.get_gramps_id(), - self.column_date(event_ref), - self.column_place(event_ref), - self.column_role(event_ref), - self.column_sort_date(event_ref), - event_ref - ]) + self.append(row=[str(event.get_type()), + event.get_description(), + event.get_gramps_id(), + self.column_date(event_ref), + self.column_place(event_ref), + self.column_role(event_ref), + self.column_sort_date(event_ref), + event_ref + ]) def column_role(self, event_ref): return str(event_ref.get_role()) def column_date(self, event_ref): event = self.db.get_event_from_handle(event_ref.ref) - return DateHandler.get_date(event) + retval = DateHandler.get_date(event) + if not DateHandler.get_date_valid(event): + return u'%s' % cgi.escape(retval) + else: + return retval def column_sort_date(self, event_ref): event = self.db.get_event_from_handle(event_ref.ref)