Jakim Friant: Changes made to the Ancestor Tree.
svn: r15877
This commit is contained in:
parent
de436d58ca
commit
fd75d680ea
@ -528,6 +528,19 @@ def fn(%s):
|
|||||||
num = self._is_format_valid(name.sort_as)
|
num = self._is_format_valid(name.sort_as)
|
||||||
return self.name_formats[num][_F_FN](name)
|
return self.name_formats[num][_F_FN](name)
|
||||||
|
|
||||||
|
def truncate(self, full_name, max_length=15, elipsis="..."):
|
||||||
|
name_out = ""
|
||||||
|
if len(full_name) <= max_length:
|
||||||
|
name_out = full_name
|
||||||
|
else:
|
||||||
|
last_space = full_name.rfind(" ", max_length)
|
||||||
|
if (last_space) > -1:
|
||||||
|
name_out = full_name[:last_space]
|
||||||
|
else:
|
||||||
|
name_out = full_name[:max_length]
|
||||||
|
name_out += " " + elipsis
|
||||||
|
return name_out
|
||||||
|
|
||||||
def raw_sorted_name(self, raw_data):
|
def raw_sorted_name(self, raw_data):
|
||||||
"""
|
"""
|
||||||
Return a text string representing the L{Name} instance
|
Return a text string representing the L{Name} instance
|
||||||
|
@ -1798,7 +1798,7 @@ class BasePage(object):
|
|||||||
person_name = _get_short_name(person.gender, person.primary_name)
|
person_name = _get_short_name(person.gender, person.primary_name)
|
||||||
elif name_style == _NAME_STYLE_SHORT:
|
elif name_style == _NAME_STYLE_SHORT:
|
||||||
full_name = self.get_name(person)
|
full_name = self.get_name(person)
|
||||||
short_name = Html("span", full_name[:15] + "...", class_ = "shortname", inline = True)
|
short_name = Html("span", _nd.truncate(full_name), class_ = "shortname", inline = True)
|
||||||
person_name = Html("span", full_name, class_ = "fullname", inline = True)
|
person_name = Html("span", full_name, class_ = "fullname", inline = True)
|
||||||
elif name_style is None: # abnormal specialty situation
|
elif name_style is None: # abnormal specialty situation
|
||||||
person_name = person
|
person_name = person
|
||||||
@ -2124,6 +2124,9 @@ class IndividualListPage(BasePage):
|
|||||||
|
|
||||||
birth_date = _find_birth_date(db, person)
|
birth_date = _find_birth_date(db, person)
|
||||||
if birth_date is not None:
|
if birth_date is not None:
|
||||||
|
if birth_date.fallback:
|
||||||
|
tcell += Html('em', _dd.display(birth_date), inline = True)
|
||||||
|
else:
|
||||||
tcell += _dd.display(birth_date)
|
tcell += _dd.display(birth_date)
|
||||||
else:
|
else:
|
||||||
tcell += " "
|
tcell += " "
|
||||||
@ -2135,6 +2138,9 @@ class IndividualListPage(BasePage):
|
|||||||
|
|
||||||
death_date = _find_death_date(db, person)
|
death_date = _find_death_date(db, person)
|
||||||
if death_date is not None:
|
if death_date is not None:
|
||||||
|
if death_date.fallback:
|
||||||
|
tcell += Html('em', _dd.display(death_date), inline = True)
|
||||||
|
else:
|
||||||
tcell += _dd.display(death_date)
|
tcell += _dd.display(death_date)
|
||||||
else:
|
else:
|
||||||
tcell += " "
|
tcell += " "
|
||||||
@ -2280,6 +2286,9 @@ class SurnamePage(BasePage):
|
|||||||
|
|
||||||
birth_date = _find_birth_date(db, person)
|
birth_date = _find_birth_date(db, person)
|
||||||
if birth_date is not None:
|
if birth_date is not None:
|
||||||
|
if birth_date.fallback:
|
||||||
|
tcell += Html('em', _dd.display(birth_date), inline = True)
|
||||||
|
else:
|
||||||
tcell += _dd.display(birth_date)
|
tcell += _dd.display(birth_date)
|
||||||
else:
|
else:
|
||||||
tcell += " "
|
tcell += " "
|
||||||
@ -2291,6 +2300,9 @@ class SurnamePage(BasePage):
|
|||||||
|
|
||||||
death_date = _find_death_date(db, person)
|
death_date = _find_death_date(db, person)
|
||||||
if death_date is not None:
|
if death_date is not None:
|
||||||
|
if death_date.fallback:
|
||||||
|
tcell += Html('em', _dd.display(death_date), inline = True)
|
||||||
|
else:
|
||||||
tcell += _dd.display(death_date)
|
tcell += _dd.display(death_date)
|
||||||
else:
|
else:
|
||||||
tcell += " "
|
tcell += " "
|
||||||
@ -4200,12 +4212,11 @@ class IndividualPage(BasePage):
|
|||||||
divclass = "unknown"
|
divclass = "unknown"
|
||||||
|
|
||||||
boxbg = Html("div", class_ = "boxbg %s AncCol%s" % (divclass, col),
|
boxbg = Html("div", class_ = "boxbg %s AncCol%s" % (divclass, col),
|
||||||
style="top: %dpx; left: %dpx; min-height: 3em;" % (top, xoff+1)
|
style="top: %dpx; left: %dpx;" % (top, xoff+1)
|
||||||
)
|
)
|
||||||
|
|
||||||
full_name = self.get_name(person)
|
full_name = self.get_name(person)
|
||||||
short_name = Html("span", full_name[:15] + "...", class_ = "shortname", inline = True)
|
short_name = Html("span", _nd.truncate(full_name), class_ = "shortname", inline = True)
|
||||||
person_name = short_name + Html("span", full_name, class_ = "fullname")
|
|
||||||
|
|
||||||
if person.handle in self.ind_list:
|
if person.handle in self.ind_list:
|
||||||
thumbnailUrl = None
|
thumbnailUrl = None
|
||||||
@ -4236,7 +4247,8 @@ class IndividualPage(BasePage):
|
|||||||
url = self.report.build_url_fname_html(person.handle, "ppl", True)
|
url = self.report.build_url_fname_html(person.handle, "ppl", True)
|
||||||
boxbg += self.person_link(url, person, _NAME_STYLE_SHORT, thumbnailUrl=thumbnailUrl)
|
boxbg += self.person_link(url, person, _NAME_STYLE_SHORT, thumbnailUrl=thumbnailUrl)
|
||||||
else:
|
else:
|
||||||
boxbg += Html("span", person_name, class_ = "unlinked", inline = True)
|
boxbg += Html("span", short_name, class_ = "shortname unlinked", inline = True)
|
||||||
|
boxbg += Html("span", fullname, class_ = "fullname unlinked", inline = True)
|
||||||
shadow = Html("div", class_ = "shadow", inline = True, style="top: %dpx; left: %dpx;"
|
shadow = Html("div", class_ = "shadow", inline = True, style="top: %dpx; left: %dpx;"
|
||||||
% (top+_SHADOW, xoff+_SHADOW) )
|
% (top+_SHADOW, xoff+_SHADOW) )
|
||||||
|
|
||||||
@ -6953,40 +6965,52 @@ def add_birthdate(db, childlist):
|
|||||||
# return the list of child handles and their birthdates
|
# return the list of child handles and their birthdates
|
||||||
return sorted_children
|
return sorted_children
|
||||||
|
|
||||||
|
# TODO: See http://www.gramps-project.org/bugs/view.php?id=4200 for issues about
|
||||||
|
# marking the fall-back date with itallics
|
||||||
|
#
|
||||||
def _find_birth_date(db, person):
|
def _find_birth_date(db, person):
|
||||||
"""
|
"""
|
||||||
will look for a birth date within the person's events
|
will look for a birth date within the person's events
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
date_out = None
|
||||||
birth_ref = person.get_birth_ref()
|
birth_ref = person.get_birth_ref()
|
||||||
if birth_ref:
|
if birth_ref:
|
||||||
birth = db.get_event_from_handle(birth_ref.ref)
|
birth = db.get_event_from_handle(birth_ref.ref)
|
||||||
return birth.get_date_object()
|
date_out = birth.get_date_object()
|
||||||
|
date_out.fallback = False
|
||||||
else:
|
else:
|
||||||
event_list = person.get_primary_event_ref_list()
|
event_list = person.get_primary_event_ref_list()
|
||||||
for event_ref in event_list:
|
for event_ref in event_list:
|
||||||
event = db.get_event_from_handle(event_ref.ref)
|
event = db.get_event_from_handle(event_ref.ref)
|
||||||
if event.get_type().is_birth_fallback():
|
if event.get_type().is_birth_fallback():
|
||||||
return event.get_date_object()
|
date_out = event.get_date_object()
|
||||||
return None
|
date_out.fallback = True
|
||||||
|
log.debug("setting fallback to true for '%s'" % (event))
|
||||||
|
break
|
||||||
|
return date_out
|
||||||
|
|
||||||
def _find_death_date(db, person):
|
def _find_death_date(db, person):
|
||||||
"""
|
"""
|
||||||
will look for a death date within a person's events
|
will look for a death date within a person's events
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
date_out = None
|
||||||
death_ref = person.get_death_ref()
|
death_ref = person.get_death_ref()
|
||||||
if death_ref:
|
if death_ref:
|
||||||
death = db.get_event_from_handle(death_ref.ref)
|
death = db.get_event_from_handle(death_ref.ref)
|
||||||
if death:
|
if death:
|
||||||
return death.get_date_object()
|
date_out = death.get_date_object()
|
||||||
|
date_out.fallback = False
|
||||||
else:
|
else:
|
||||||
event_list = person.get_primary_event_ref_list()
|
event_list = person.get_primary_event_ref_list()
|
||||||
for event_ref in event_list:
|
for event_ref in event_list:
|
||||||
event = db.get_event_from_handle(event_ref.ref)
|
event = db.get_event_from_handle(event_ref.ref)
|
||||||
if event.get_type().is_death_fallback():
|
if event.get_type().is_death_fallback():
|
||||||
return event.get_date_object()
|
date_out = event.get_date_object()
|
||||||
return None
|
date_out.fallback = True
|
||||||
|
break
|
||||||
|
return date_out
|
||||||
|
|
||||||
def build_event_data(db, ind_list):
|
def build_event_data(db, ind_list):
|
||||||
"""
|
"""
|
||||||
|
@ -417,7 +417,7 @@ class WebCalReport(Report):
|
|||||||
body.attr = "id = '%(idtag)s'" % { 'idtag' : body_id }
|
body.attr = "id = '%(idtag)s'" % { 'idtag' : body_id }
|
||||||
|
|
||||||
# GRAMPS favicon
|
# GRAMPS favicon
|
||||||
fname1 = os.path.join(subdirs, "images", "favicon.ico")
|
fname1 = os.path.join(subdirs, "images", "favicon2.ico")
|
||||||
|
|
||||||
# _CALENDARSCREEN stylesheet
|
# _CALENDARSCREEN stylesheet
|
||||||
fname2 = os.path.join(subdirs, "styles", _CALENDARSCREEN)
|
fname2 = os.path.join(subdirs, "styles", _CALENDARSCREEN)
|
||||||
@ -442,7 +442,9 @@ class WebCalReport(Report):
|
|||||||
|
|
||||||
# Link to Navigation Menus stylesheet
|
# Link to Navigation Menus stylesheet
|
||||||
fname = os.path.join(subdirs, "styles", "Web_Navigation-Menus.css")
|
fname = os.path.join(subdirs, "styles", "Web_Navigation-Menus.css")
|
||||||
links.extend( Html("link", href = fname, type = "text/css", media = "screen", rel = "stylesheet") )
|
links.extend(
|
||||||
|
Html("link", href = fname, type = "text/css", media = "screen", rel = "stylesheet")
|
||||||
|
)
|
||||||
|
|
||||||
# add meta tags and links to head section
|
# add meta tags and links to head section
|
||||||
head += (meta, links)
|
head += (meta, links)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user