Narrative web features: 5592 + 5408 + 10031 (#389)
* Feature: 5592 show more details + 5408 children dates * NarrativeWeb: another translation problem. * Narrativeweb: different locales. * Feature 10031: maps not displaying all events
This commit is contained in:
parent
2a2a0d2766
commit
5791788f0e
@ -126,6 +126,7 @@ from gramps.gen.display.place import displayer as _pd
|
|||||||
from gramps.gen.proxy import CacheProxyDb
|
from gramps.gen.proxy import CacheProxyDb
|
||||||
from gramps.plugins.lib.libhtmlconst import _CHARACTER_SETS, _CC, _COPY_OPTIONS
|
from gramps.plugins.lib.libhtmlconst import _CHARACTER_SETS, _CC, _COPY_OPTIONS
|
||||||
from gramps.gen.datehandler import get_date
|
from gramps.gen.datehandler import get_date
|
||||||
|
from gramps.gen.utils.db import get_birth_or_fallback, get_death_or_fallback
|
||||||
|
|
||||||
# import HTML Class from src/plugins/lib/libhtml.py
|
# import HTML Class from src/plugins/lib/libhtml.py
|
||||||
from gramps.plugins.lib.libhtml import Html, xml_lang
|
from gramps.plugins.lib.libhtml import Html, xml_lang
|
||||||
@ -764,28 +765,52 @@ class BasePage:
|
|||||||
)
|
)
|
||||||
table = table + trow if table is not None else trow
|
table = table + trow if table is not None else trow
|
||||||
|
|
||||||
tcell = Html("td", class_="ColumnValue")
|
tcell = Html("td", class_="ColumnValue", close=False)
|
||||||
trow += tcell
|
trow += tcell
|
||||||
|
|
||||||
ordered = Html("ol")
|
with Html("table", class_="infolist eventlist") as table2:
|
||||||
tcell += ordered
|
thead = Html("thead")
|
||||||
childlist = [child_ref.ref for child_ref in childlist]
|
table2 += thead
|
||||||
|
header = Html("tr")
|
||||||
|
|
||||||
# add individual's children event places to family map...
|
header.extend(
|
||||||
if self.familymappages:
|
Html("th", label, class_=colclass, inline=True)
|
||||||
for handle in childlist:
|
for (label, colclass) in [
|
||||||
child = self.r_db.get_person_from_handle(handle)
|
[self._("Name"), "ColumnName"],
|
||||||
if child:
|
[self._("Birth Date"), "ColumnDate"],
|
||||||
self._get_event_place(child, place_lat_long)
|
[self._("Death Date"), "ColumnDate"],
|
||||||
|
]
|
||||||
|
)
|
||||||
|
thead += header
|
||||||
|
|
||||||
children = add_birthdate(self.r_db, childlist)
|
# begin table body
|
||||||
if birthorder:
|
tbody = Html("tbody")
|
||||||
children = sorted(children)
|
table2 += tbody
|
||||||
|
|
||||||
ordered.extend(
|
childlist = [child_ref.ref for child_ref in childlist]
|
||||||
(Html("li") + self.display_child_link(chandle))
|
|
||||||
for birth_date, chandle in children
|
# add individual's children event places to family map...
|
||||||
)
|
if self.familymappages:
|
||||||
|
for handle in childlist:
|
||||||
|
child = self.r_db.get_person_from_handle(handle)
|
||||||
|
if child:
|
||||||
|
self._get_event_place(child, place_lat_long)
|
||||||
|
|
||||||
|
children = add_birthdate(self.r_db, childlist, self.rlocale)
|
||||||
|
if birthorder:
|
||||||
|
children = sorted(children)
|
||||||
|
|
||||||
|
tbody.extend(
|
||||||
|
(
|
||||||
|
Html("tr", inline=True) +
|
||||||
|
Html("td", inline=True, close=False) +
|
||||||
|
self.display_child_link(chandle) +
|
||||||
|
Html("td", birth, inline=True) +
|
||||||
|
Html("td", death, inline=True)
|
||||||
|
)
|
||||||
|
for birth_date, birth, death, chandle in children
|
||||||
|
)
|
||||||
|
trow += table2
|
||||||
|
|
||||||
# family LDS ordinance list
|
# family LDS ordinance list
|
||||||
family_lds_ordinance_list = family.get_lds_ord_list()
|
family_lds_ordinance_list = family.get_lds_ord_list()
|
||||||
@ -819,6 +844,23 @@ class BasePage:
|
|||||||
self.display_attr_list(family_attribute_list, attrtable)
|
self.display_attr_list(family_attribute_list, attrtable)
|
||||||
return table
|
return table
|
||||||
|
|
||||||
|
def display_dates(self, handle):
|
||||||
|
"""
|
||||||
|
used to display the birth date
|
||||||
|
|
||||||
|
@param: handle -- handle to the person
|
||||||
|
"""
|
||||||
|
birth = death = ""
|
||||||
|
person = self.r_db.get_person_from_handle(handle)
|
||||||
|
if person:
|
||||||
|
bd_event = get_birth_or_fallback(self.r_db, child)
|
||||||
|
if bd_event:
|
||||||
|
birth = self.rlocale.get_date(bd_event.get_date_object())
|
||||||
|
dd_event = get_death_or_fallback(self.r_db, child)
|
||||||
|
if dd_event:
|
||||||
|
death = self.rlocale.get_date(dd_event.get_date_object())
|
||||||
|
return birth, death
|
||||||
|
|
||||||
def complete_people(self, tcell, first_person, handle_list, uplink=True):
|
def complete_people(self, tcell, first_person, handle_list, uplink=True):
|
||||||
"""
|
"""
|
||||||
completes the person column for classes EventListPage and EventPage
|
completes the person column for classes EventListPage and EventPage
|
||||||
@ -982,7 +1024,7 @@ class BasePage:
|
|||||||
for notehandle in notelist:
|
for notehandle in notelist:
|
||||||
this_note = self.r_db.get_note_from_handle(notehandle)
|
this_note = self.r_db.get_note_from_handle(notehandle)
|
||||||
if this_note is not None:
|
if this_note is not None:
|
||||||
notesection.extend(Html("i", str(this_note.type),
|
notesection.extend(Html("i", self._(this_note.type.xml_str()),
|
||||||
class_="NoteType"))
|
class_="NoteType"))
|
||||||
notesection.extend(self.get_note_format(this_note, True))
|
notesection.extend(self.get_note_format(this_note, True))
|
||||||
return notesection
|
return notesection
|
||||||
@ -1105,14 +1147,8 @@ class BasePage:
|
|||||||
latitude, longitude = conv_lat_lon(latitude, longitude, "D.D8")
|
latitude, longitude = conv_lat_lon(latitude, longitude, "D.D8")
|
||||||
if latitude is not None:
|
if latitude is not None:
|
||||||
etype = event.get_type()
|
etype = event.get_type()
|
||||||
|
place_lat_long.append([latitude, longitude, placetitle,
|
||||||
# only allow Birth, Death, Census, Marriage,
|
place_handle, event_date, etype])
|
||||||
# and Divorce events...
|
|
||||||
if etype in [EventType.BIRTH, EventType.DEATH,
|
|
||||||
EventType.CENSUS,
|
|
||||||
EventType.MARRIAGE, EventType.DIVORCE]:
|
|
||||||
place_lat_long.append([latitude, longitude, placetitle,
|
|
||||||
place_handle, event_date, etype])
|
|
||||||
|
|
||||||
def _get_event_place(self, person, place_lat_long):
|
def _get_event_place(self, person, place_lat_long):
|
||||||
"""
|
"""
|
||||||
@ -2757,6 +2793,18 @@ class BasePage:
|
|||||||
|
|
||||||
tcell += self.new_person_link(partner.get_handle(), uplink=True,
|
tcell += self.new_person_link(partner.get_handle(), uplink=True,
|
||||||
person=partner)
|
person=partner)
|
||||||
|
birth = death = ""
|
||||||
|
bd_event = get_birth_or_fallback(self.r_db, partner)
|
||||||
|
if bd_event:
|
||||||
|
birth = self.rlocale.get_date(bd_event.get_date_object())
|
||||||
|
dd_event = get_death_or_fallback(self.r_db, partner)
|
||||||
|
if dd_event:
|
||||||
|
death = self.rlocale.get_date(dd_event.get_date_object())
|
||||||
|
|
||||||
|
if death == "":
|
||||||
|
death = "..."
|
||||||
|
tcell += " ( * ", birth, " + ", death, " )"
|
||||||
|
|
||||||
return trow
|
return trow
|
||||||
|
|
||||||
def display_child_link(self, chandle):
|
def display_child_link(self, chandle):
|
||||||
@ -3131,7 +3179,7 @@ class BasePage:
|
|||||||
"""
|
"""
|
||||||
list_style = "1", "a", "I", "A", "i"
|
list_style = "1", "a", "I", "A", "i"
|
||||||
ordered = Html("ol", class_="Col1", role="Volume-n-Page")
|
ordered = Html("ol", class_="Col1", role="Volume-n-Page")
|
||||||
ordered.attr += "type = %s" % list_style[depth]
|
ordered.attr += " type=%s" % list_style[depth]
|
||||||
if depth > len(list_style):
|
if depth > len(list_style):
|
||||||
return ""
|
return ""
|
||||||
# Sort by the name of the object at the bkref_class, bkref_handle
|
# Sort by the name of the object at the bkref_class, bkref_handle
|
||||||
@ -6209,7 +6257,7 @@ class PersonPages(BasePage):
|
|||||||
elif first_surname:
|
elif first_surname:
|
||||||
first_surname = False
|
first_surname = False
|
||||||
tcell += Html("a", html_escape(surname),
|
tcell += Html("a", html_escape(surname),
|
||||||
title="Surnames " + surname)
|
title=self._("Surnames") + " " + surname)
|
||||||
else:
|
else:
|
||||||
tcell += " "
|
tcell += " "
|
||||||
|
|
||||||
@ -6920,12 +6968,22 @@ class PersonPages(BasePage):
|
|||||||
if win():
|
if win():
|
||||||
thumbnail_url = thumbnail_url.replace('\\', "/")
|
thumbnail_url = thumbnail_url.replace('\\', "/")
|
||||||
url = self.report.build_url_fname_html(person.handle, "ppl", True)
|
url = self.report.build_url_fname_html(person.handle, "ppl", True)
|
||||||
|
birth = death = ""
|
||||||
|
bd_event = get_birth_or_fallback(self.r_db, person)
|
||||||
|
if bd_event:
|
||||||
|
birth = self.rlocale.get_date(bd_event.get_date_object())
|
||||||
|
dd_event = get_death_or_fallback(self.r_db, person)
|
||||||
|
if dd_event:
|
||||||
|
death = self.rlocale.get_date(dd_event.get_date_object())
|
||||||
|
if death == "":
|
||||||
|
death = "..."
|
||||||
|
value = person_name + "<br/>*", birth, "<br/>+", death
|
||||||
if thumbnail_url is None:
|
if thumbnail_url is None:
|
||||||
boxbg += Html("a", href=url, class_="noThumb") + person_name
|
boxbg += Html("a", href=url, class_="noThumb") + value
|
||||||
else:
|
else:
|
||||||
thumb = Html("span", class_="thumbnail") + (
|
thumb = Html("span", class_="thumbnail") + (
|
||||||
Html("img", src=thumbnail_url, alt="Image: " + person_name))
|
Html("img", src=thumbnail_url, alt="Image: " + person_name))
|
||||||
boxbg += Html("a", href=url) + thumb + person_name
|
boxbg += Html("a", href=url) + thumb + value
|
||||||
shadow = Html(
|
shadow = Html(
|
||||||
"div", class_="shadow", inline=True,
|
"div", class_="shadow", inline=True,
|
||||||
style="top: %dpx; left: %dpx;" % (top + _SHADOW, xoff + _SHADOW))
|
style="top: %dpx; left: %dpx;" % (top + _SHADOW, xoff + _SHADOW))
|
||||||
@ -7144,12 +7202,12 @@ class PersonPages(BasePage):
|
|||||||
childlist = family.get_child_ref_list()
|
childlist = family.get_child_ref_list()
|
||||||
|
|
||||||
childlist = [child_ref.ref for child_ref in childlist]
|
childlist = [child_ref.ref for child_ref in childlist]
|
||||||
children = add_birthdate(self.r_db, childlist)
|
children = add_birthdate(self.r_db, childlist, self.rlocale)
|
||||||
|
|
||||||
if birthorder:
|
if birthorder:
|
||||||
children = sorted(children)
|
children = sorted(children)
|
||||||
|
|
||||||
for birthdate, handle in children:
|
for birthdate, birth, death, handle in children:
|
||||||
if handle == self.person.get_handle():
|
if handle == self.person.get_handle():
|
||||||
child_ped(ol_html)
|
child_ped(ol_html)
|
||||||
elif handle:
|
elif handle:
|
||||||
@ -7411,13 +7469,32 @@ class PersonPages(BasePage):
|
|||||||
@param: rel -- The relation
|
@param: rel -- The relation
|
||||||
"""
|
"""
|
||||||
tcell1 = Html("td", title, class_="ColumnAttribute", inline=True)
|
tcell1 = Html("td", title, class_="ColumnAttribute", inline=True)
|
||||||
tcell2 = Html("td", class_="ColumnValue")
|
tcell2 = Html("td", class_="ColumnValue", close=False, inline=True)
|
||||||
|
|
||||||
tcell2 += self.new_person_link(handle, uplink=True)
|
tcell2 += self.new_person_link(handle, uplink=True)
|
||||||
|
|
||||||
if rel and rel != ChildRefType(ChildRefType.BIRTH):
|
if rel and rel != ChildRefType(ChildRefType.BIRTH):
|
||||||
tcell2 += ''.join([' '] *3 + ['(%s)']) % str(rel)
|
tcell2 += ''.join([' '] *3 + ['(%s)']) % str(rel)
|
||||||
|
|
||||||
|
person = self.r_db.get_person_from_handle(handle)
|
||||||
|
birth = death = ""
|
||||||
|
if person:
|
||||||
|
bd_event = get_birth_or_fallback(self.r_db, person)
|
||||||
|
if bd_event:
|
||||||
|
birth = self.rlocale.get_date(bd_event.get_date_object())
|
||||||
|
dd_event = get_death_or_fallback(self.r_db, person)
|
||||||
|
if dd_event:
|
||||||
|
death = self.rlocale.get_date(dd_event.get_date_object())
|
||||||
|
|
||||||
|
tcell3 = Html("td", birth, class_="ColumnDate",
|
||||||
|
inline=False, close=False, indent=False)
|
||||||
|
|
||||||
|
tcell4 = Html("td", death, class_="ColumnDate",
|
||||||
|
inline=True, close=False, indent=False)
|
||||||
|
|
||||||
|
tcell2 += tcell3
|
||||||
|
tcell2 += tcell4
|
||||||
|
|
||||||
# return table columns to its caller
|
# return table columns to its caller
|
||||||
return tcell1, tcell2
|
return tcell1, tcell2
|
||||||
|
|
||||||
@ -7504,7 +7581,8 @@ class PersonPages(BasePage):
|
|||||||
except:
|
except:
|
||||||
reln = self._("Not siblings")
|
reln = self._("Not siblings")
|
||||||
|
|
||||||
reln = " " + reln
|
val1 = " "
|
||||||
|
reln = val1 + reln
|
||||||
# Now output reln, child_link, (frel, mrel)
|
# Now output reln, child_link, (frel, mrel)
|
||||||
frel = child_ref.get_father_relation()
|
frel = child_ref.get_father_relation()
|
||||||
mrel = child_ref.get_mother_relation()
|
mrel = child_ref.get_mother_relation()
|
||||||
@ -7515,10 +7593,27 @@ class PersonPages(BasePage):
|
|||||||
trow = Html("tr") + (
|
trow = Html("tr") + (
|
||||||
Html("td", reln, class_="ColumnAttribute", inline=True))
|
Html("td", reln, class_="ColumnAttribute", inline=True))
|
||||||
|
|
||||||
tcell = Html("td", class_="ColumnValue", inline=True)
|
tcell = Html("td", val1, class_="ColumnValue", inline=True)
|
||||||
tcell += " "
|
|
||||||
tcell += self.display_child_link(child_handle)
|
tcell += self.display_child_link(child_handle)
|
||||||
|
|
||||||
|
birth = death = ""
|
||||||
|
bd_event = get_birth_or_fallback(self.r_db, child)
|
||||||
|
if bd_event:
|
||||||
|
birth = self.rlocale.get_date(bd_event.get_date_object())
|
||||||
|
dd_event = get_death_or_fallback(self.r_db, child)
|
||||||
|
if dd_event:
|
||||||
|
death = self.rlocale.get_date(dd_event.get_date_object())
|
||||||
|
|
||||||
|
tcell2 = Html("td", birth, class_="ColumnDate",
|
||||||
|
inline=True)
|
||||||
|
|
||||||
|
tcell3 = Html("td", death, class_="ColumnDate",
|
||||||
|
inline=True)
|
||||||
|
|
||||||
trow += tcell
|
trow += tcell
|
||||||
|
trow += tcell2
|
||||||
|
trow += tcell3
|
||||||
|
|
||||||
tcell = Html("td", frelmrel, class_="ColumnValue",
|
tcell = Html("td", frelmrel, class_="ColumnValue",
|
||||||
inline=True)
|
inline=True)
|
||||||
trow += tcell
|
trow += tcell
|
||||||
@ -7603,6 +7698,8 @@ class PersonPages(BasePage):
|
|||||||
for (label, colclass) in [
|
for (label, colclass) in [
|
||||||
(self._("Relation to main person"), "ColumnAttribute"),
|
(self._("Relation to main person"), "ColumnAttribute"),
|
||||||
(self._("Name"), "ColumnValue"),
|
(self._("Name"), "ColumnValue"),
|
||||||
|
(self._("Birth date"), "ColumnValue"),
|
||||||
|
(self._("Death date"), "ColumnValue"),
|
||||||
(self._("Relation within this family "
|
(self._("Relation within this family "
|
||||||
"(if not by birth)"),
|
"(if not by birth)"),
|
||||||
"ColumnValue")
|
"ColumnValue")
|
||||||
@ -7610,7 +7707,6 @@ class PersonPages(BasePage):
|
|||||||
)
|
)
|
||||||
|
|
||||||
tbody = Html("tbody")
|
tbody = Html("tbody")
|
||||||
table += tbody
|
|
||||||
|
|
||||||
all_family_handles = list(parent_list)
|
all_family_handles = list(parent_list)
|
||||||
(birthmother, birthfather) = self.rel_class.get_birth_parents(
|
(birthmother, birthfather) = self.rel_class.get_birth_parents(
|
||||||
@ -7623,7 +7719,7 @@ class PersonPages(BasePage):
|
|||||||
# Display this family
|
# Display this family
|
||||||
self.display_ind_parent_family(birthmother,
|
self.display_ind_parent_family(birthmother,
|
||||||
birthfather,
|
birthfather,
|
||||||
family, table, first)
|
family, tbody, first)
|
||||||
first = False
|
first = False
|
||||||
|
|
||||||
if self.report.options['showhalfsiblings']:
|
if self.report.options['showhalfsiblings']:
|
||||||
@ -7633,11 +7729,12 @@ class PersonPages(BasePage):
|
|||||||
self.display_step_families(
|
self.display_step_families(
|
||||||
family.get_father_handle(), family,
|
family.get_father_handle(), family,
|
||||||
all_family_handles,
|
all_family_handles,
|
||||||
birthmother, birthfather, table)
|
birthmother, birthfather, tbody)
|
||||||
self.display_step_families(
|
self.display_step_families(
|
||||||
family.get_mother_handle(), family,
|
family.get_mother_handle(), family,
|
||||||
all_family_handles,
|
all_family_handles,
|
||||||
birthmother, birthfather, table)
|
birthmother, birthfather, tbody)
|
||||||
|
table += tbody
|
||||||
return section
|
return section
|
||||||
|
|
||||||
def pedigree_person(self, person):
|
def pedigree_person(self, person):
|
||||||
@ -10601,12 +10698,18 @@ def _has_webpage_extension(url):
|
|||||||
"""
|
"""
|
||||||
return any(url.endswith(ext) for ext in _WEB_EXT)
|
return any(url.endswith(ext) for ext in _WEB_EXT)
|
||||||
|
|
||||||
def add_birthdate(dbase, ppl_handle_list):
|
def add_birthdate(dbase, ppl_handle_list, rlocale):
|
||||||
"""
|
"""
|
||||||
This will sort a list of child handles in birth order
|
This will sort a list of child handles in birth order
|
||||||
|
For each entry in the list, we'll have :
|
||||||
|
birth date
|
||||||
|
The transtated birth date for the configured locale
|
||||||
|
The transtated death date for the configured locale
|
||||||
|
The handle for the child
|
||||||
|
|
||||||
@param: dbase -- The database to use
|
@param: dbase -- The database to use
|
||||||
@param: ppl_handle_list -- the handle for the people
|
@param: ppl_handle_list -- the handle for the people
|
||||||
|
@param: rlocale -- the locale for date translation
|
||||||
"""
|
"""
|
||||||
sortable_individuals = []
|
sortable_individuals = []
|
||||||
for person_handle in ppl_handle_list:
|
for person_handle in ppl_handle_list:
|
||||||
@ -10614,11 +10717,18 @@ def add_birthdate(dbase, ppl_handle_list):
|
|||||||
person = dbase.get_person_from_handle(person_handle)
|
person = dbase.get_person_from_handle(person_handle)
|
||||||
if person:
|
if person:
|
||||||
birth_ref = person.get_birth_ref()
|
birth_ref = person.get_birth_ref()
|
||||||
|
birth1 = ""
|
||||||
if birth_ref:
|
if birth_ref:
|
||||||
birth = dbase.get_event_from_handle(birth_ref.ref)
|
birth = dbase.get_event_from_handle(birth_ref.ref)
|
||||||
if birth:
|
if birth:
|
||||||
|
birth1 = rlocale.get_date(birth.get_date_object())
|
||||||
birth_date = birth.get_date_object().get_sort_value()
|
birth_date = birth.get_date_object().get_sort_value()
|
||||||
sortable_individuals.append((birth_date, person_handle))
|
death_event = get_death_or_fallback(dbase, person)
|
||||||
|
if death_event:
|
||||||
|
death = rlocale.get_date(death_event.get_date_object())
|
||||||
|
else:
|
||||||
|
death = ""
|
||||||
|
sortable_individuals.append((birth_date, birth1, death, person_handle))
|
||||||
|
|
||||||
# return a list of handles with the individual's birthdate attached
|
# return a list of handles with the individual's birthdate attached
|
||||||
return sortable_individuals
|
return sortable_individuals
|
||||||
|
Loading…
Reference in New Issue
Block a user