A possibly controvertial change: making bad dates stand out via color in main tables

svn: r10597
This commit is contained in:
Doug Blank 2008-04-19 22:41:48 +00:00
parent 6563af3d7a
commit dfdc81b768
4 changed files with 43 additions and 17 deletions

View File

@ -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.

View File

@ -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'<span background="#ffd5d5">%s</span>' % 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 "<i>%s</i>" % cgi.escape(date_str)
retval = u"<i>%s</i>" % cgi.escape(date_str)
if not DateHandler.get_date_valid(event):
return u'<span background="#ffd5d5">%s</span>' % 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'<span background="#ffd5d5">%s</span>' % 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 "<i>%s</i>" % cgi.escape(date_str)
retval = "<i>%s</i>" % cgi.escape(date_str)
if not DateHandler.get_date_valid(event):
return u'<span background="#ffd5d5">%s</span>' % retval
else:
return retval
return u""
def column_birth_place(self, data, node):

View File

@ -417,6 +417,9 @@ class EmbeddedList(ButtonTab):
name = self._column_names[pair[1]][0]
renderer = gtk.CellRendererText()
renderer.set_property('ellipsize', pango.ELLIPSIZE_END)
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

View File

@ -26,6 +26,7 @@
#
#-------------------------------------------------------------------------
import gtk
import cgi
#-------------------------------------------------------------------------
#
@ -46,8 +47,7 @@ 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()),
self.append(row=[str(event.get_type()),
event.get_description(),
event.get_gramps_id(),
self.column_date(event_ref),
@ -62,7 +62,11 @@ class EventRefModel(gtk.ListStore):
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'<span background="#ffd5d5">%s</span>' % cgi.escape(retval)
else:
return retval
def column_sort_date(self, event_ref):
event = self.db.get_event_from_handle(event_ref.ref)