8950 : Narrative web : html elements emitted in different order
This commit is contained in:
parent
f9930c1bcf
commit
ee0e343e1e
@ -647,7 +647,7 @@ class BasePage(object):
|
|||||||
@param: place_lat_long -- for use in Family Map Pages. This will be None
|
@param: place_lat_long -- for use in Family Map Pages. This will be None
|
||||||
if called from Family pages, which do not create a Family Map
|
if called from Family pages, which do not create a Family Map
|
||||||
"""
|
"""
|
||||||
family_list = individual.get_family_handle_list()
|
family_list = sorted(individual.get_family_handle_list())
|
||||||
if not family_list:
|
if not family_list:
|
||||||
return None
|
return None
|
||||||
|
|
||||||
@ -1599,16 +1599,17 @@ class BasePage(object):
|
|||||||
user_footer += note
|
user_footer += note
|
||||||
|
|
||||||
msg = _('Generated by %(gramps_home_html_start)s'
|
msg = _('Generated by %(gramps_home_html_start)s'
|
||||||
'Gramps%(html_end)s %(version)s on %(date)s'
|
'Gramps%(html_end)s %(version)s'
|
||||||
) % {'gramps_home_html_start' :
|
) % {'gramps_home_html_start' :
|
||||||
'<a href="' + URL_HOMEPAGE + '">' ,
|
'<a href="' + URL_HOMEPAGE + '">' ,
|
||||||
'html_end' : '</a>' ,
|
'html_end' : '</a>' ,
|
||||||
'version' : VERSION ,
|
'version' : VERSION }
|
||||||
'date' : _dd.display(Today()) }
|
|
||||||
if date is not None:
|
if date is not None:
|
||||||
msg += "<br />"
|
msg += "<br />"
|
||||||
last_modif = datetime.datetime.fromtimestamp(date).strftime('%Y-%m-%d %H:%M:%S')
|
last_modif = datetime.datetime.fromtimestamp(date).strftime('%Y-%m-%d %H:%M:%S')
|
||||||
msg += _('Last change was the %(date)s') % { 'date' : last_modif }
|
msg += _('Last change was the %(date)s') % { 'date' : last_modif }
|
||||||
|
else:
|
||||||
|
msg += _(' on %(date)s') % { 'date' : _dd.display(Today()) }
|
||||||
|
|
||||||
# optional "link-home" feature; see bug report #2736
|
# optional "link-home" feature; see bug report #2736
|
||||||
if self.report.options['linkhome']:
|
if self.report.options['linkhome']:
|
||||||
@ -2070,7 +2071,11 @@ class BasePage(object):
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
# return media rectangles to its callers
|
# return media rectangles to its callers
|
||||||
return _region_items
|
# bug 8950 : it seems it's better to sort on name + coords of the rectangle.
|
||||||
|
def sort_by_name_and_rectangle(obj):
|
||||||
|
return(obj[0], obj[1], obj[2], obj[3], obj[4])
|
||||||
|
|
||||||
|
return sorted(_region_items, key=lambda x:sort_by_name_and_rectangle(x))
|
||||||
|
|
||||||
def media_ref_region_to_object(self, media_handle, obj):
|
def media_ref_region_to_object(self, media_handle, obj):
|
||||||
"""
|
"""
|
||||||
@ -2824,8 +2829,12 @@ class BasePage(object):
|
|||||||
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
|
||||||
|
# bug 8950 : it seems it's better to sort on name + gid.
|
||||||
|
def sort_by_name_and_gid(obj):
|
||||||
|
return (obj[1], obj[2])
|
||||||
|
|
||||||
for (bkref_class, bkref_handle) in sorted(
|
for (bkref_class, bkref_handle) in sorted(
|
||||||
bkref_list, key=lambda x:self.report.obj_dict[x[0]][x[1]][1]):
|
bkref_list, key=lambda x:sort_by_name_and_gid(self.report.obj_dict[x[0]][x[1]])):
|
||||||
list = Html("li")
|
list = Html("li")
|
||||||
path = self.report.obj_dict[bkref_class][bkref_handle][0]
|
path = self.report.obj_dict[bkref_class][bkref_handle][0]
|
||||||
name = self.report.obj_dict[bkref_class][bkref_handle][1]
|
name = self.report.obj_dict[bkref_class][bkref_handle][1]
|
||||||
@ -3163,10 +3172,10 @@ class FamilyPages(BasePage):
|
|||||||
letter =' '
|
letter =' '
|
||||||
|
|
||||||
# get person from sorted database list
|
# get person from sorted database list
|
||||||
for person_handle in handle_list:
|
for person_handle in sorted(handle_list):
|
||||||
person = self.dbase_.get_person_from_handle(person_handle)
|
person = self.dbase_.get_person_from_handle(person_handle)
|
||||||
if person:
|
if person:
|
||||||
family_list = pers_fam_dict[person_handle]
|
family_list = sorted(pers_fam_dict[person_handle], key=lambda x:x.get_gramps_id())
|
||||||
first_family = True
|
first_family = True
|
||||||
for family in family_list:
|
for family in family_list:
|
||||||
trow = Html("tr")
|
trow = Html("tr")
|
||||||
@ -4837,9 +4846,12 @@ class ThumbnailPreviewPage(BasePage):
|
|||||||
self.dbase_ = report.database
|
self.dbase_ = report.database
|
||||||
BasePage.__init__(self, report, title)
|
BasePage.__init__(self, report, title)
|
||||||
self.create_thumbs_only = report.options['create_thumbs_only']
|
self.create_thumbs_only = report.options['create_thumbs_only']
|
||||||
|
# bug 8950 : it seems it's better to sort on desc + gid.
|
||||||
|
def sort_by_desc_and_gid(obj):
|
||||||
|
return (obj.desc, obj.gramps_id)
|
||||||
|
|
||||||
self.photo_keys = sorted(self.report.obj_dict[MediaObject],
|
self.photo_keys = sorted(self.report.obj_dict[MediaObject],
|
||||||
key=lambda x: SORT_KEY(self.dbase_.get_object_from_handle(x).desc))
|
key=lambda x: sort_by_desc_and_gid(self.dbase_.get_object_from_handle(x)))
|
||||||
|
|
||||||
media_list = []
|
media_list = []
|
||||||
for person_handle in self.photo_keys:
|
for person_handle in self.photo_keys:
|
||||||
@ -5233,7 +5245,7 @@ class PersonPages(BasePage):
|
|||||||
len(self.report.obj_dict[Person]) + 1) as step:
|
len(self.report.obj_dict[Person]) + 1) as step:
|
||||||
self.IndividualListPage(self.report, title,
|
self.IndividualListPage(self.report, title,
|
||||||
self.report.obj_dict[Person].keys())
|
self.report.obj_dict[Person].keys())
|
||||||
for person_handle in self.report.obj_dict[Person]:
|
for person_handle in sorted(self.report.obj_dict[Person]):
|
||||||
step()
|
step()
|
||||||
person = self.report.database.get_person_from_handle(person_handle)
|
person = self.report.database.get_person_from_handle(person_handle)
|
||||||
self.IndividualPage(self.report, title, person)
|
self.IndividualPage(self.report, title, person)
|
||||||
@ -5314,7 +5326,7 @@ class PersonPages(BasePage):
|
|||||||
surname = _ABSENT
|
surname = _ABSENT
|
||||||
|
|
||||||
first_surname = True
|
first_surname = True
|
||||||
for person_handle in handle_list:
|
for person_handle in sorted(handle_list):
|
||||||
person = self.dbase_.get_person_from_handle(person_handle)
|
person = self.dbase_.get_person_from_handle(person_handle)
|
||||||
if person.get_change_time() > date: date = person.get_change_time()
|
if person.get_change_time() > date: date = person.get_change_time()
|
||||||
|
|
||||||
@ -7736,7 +7748,7 @@ class NavWebReport(Report):
|
|||||||
"surnames_count")
|
"surnames_count")
|
||||||
|
|
||||||
for (surname, handle_list) in local_list:
|
for (surname, handle_list) in local_list:
|
||||||
SurnamePage(self, self.title, surname, handle_list)
|
SurnamePage(self, self.title, surname, sorted(handle_list))
|
||||||
step()
|
step()
|
||||||
|
|
||||||
def thumbnail_preview_page(self):
|
def thumbnail_preview_page(self):
|
||||||
|
Loading…
Reference in New Issue
Block a user