8950 : Narrated Web Site Report: html elements emitted in different order
This commit is contained in:
parent
f15f6a14b0
commit
2dc332a78c
@ -168,7 +168,7 @@ class HtmlDoc(BaseDoc, TextDoc):
|
|||||||
|
|
||||||
text = []
|
text = []
|
||||||
|
|
||||||
for sname in styles.get_cell_style_names():
|
for sname in sorted(styles.get_cell_style_names()):
|
||||||
style = styles.get_cell_style(sname)
|
style = styles.get_cell_style(sname)
|
||||||
pad = "%.3fcm" % style.get_padding()
|
pad = "%.3fcm" % style.get_padding()
|
||||||
top = bottom = left = right = 'none'
|
top = bottom = left = right = 'none'
|
||||||
@ -188,7 +188,7 @@ class HtmlDoc(BaseDoc, TextDoc):
|
|||||||
left, right))
|
left, right))
|
||||||
|
|
||||||
|
|
||||||
for style_name in styles.get_paragraph_style_names():
|
for style_name in sorted(styles.get_paragraph_style_names()):
|
||||||
style = styles.get_paragraph_style(style_name)
|
style = styles.get_paragraph_style(style_name)
|
||||||
font = style.get_font()
|
font = style.get_font()
|
||||||
font_size = font.get_size()
|
font_size = font.get_size()
|
||||||
|
@ -12,7 +12,7 @@
|
|||||||
# Copyright (C) 2008-2011 Rob G. Healey <robhealey1@gmail.com>
|
# Copyright (C) 2008-2011 Rob G. Healey <robhealey1@gmail.com>
|
||||||
# Copyright (C) 2010 Doug Blank <doug.blank@gmail.com>
|
# Copyright (C) 2010 Doug Blank <doug.blank@gmail.com>
|
||||||
# Copyright (C) 2010 Jakim Friant
|
# Copyright (C) 2010 Jakim Friant
|
||||||
# Copyright (C) 2010 Serge Noiraud
|
# Copyright (C) 2010,2015 Serge Noiraud
|
||||||
# Copyright (C) 2011 Tim G L Lyons
|
# Copyright (C) 2011 Tim G L Lyons
|
||||||
# Copyright (C) 2013 Benny Malengier
|
# Copyright (C) 2013 Benny Malengier
|
||||||
#
|
#
|
||||||
@ -543,11 +543,12 @@ def copy_thumbnail(report, handle, photo, region=None):
|
|||||||
)
|
)
|
||||||
|
|
||||||
if photo.get_mime_type():
|
if photo.get_mime_type():
|
||||||
from_path = get_thumbnail_path(media_path_full(
|
full_path = media_path_full(report.database, photo.get_path())
|
||||||
report.database,
|
from_path = get_thumbnail_path(full_path,
|
||||||
photo.get_path()),
|
photo.get_mime_type(),
|
||||||
photo.get_mime_type(),
|
region)
|
||||||
region)
|
mtime = os.stat(full_path).st_mtime
|
||||||
|
os.utime(from_path, (mtime, mtime))
|
||||||
if not os.path.isfile(from_path):
|
if not os.path.isfile(from_path):
|
||||||
from_path = CSS["Document"]["filename"]
|
from_path = CSS["Document"]["filename"]
|
||||||
else:
|
else:
|
||||||
@ -1573,7 +1574,7 @@ class BasePage(object):
|
|||||||
self.dump_attribute(attr) for attr in attrlist
|
self.dump_attribute(attr) for attr in attrlist
|
||||||
)
|
)
|
||||||
|
|
||||||
def write_footer(self):
|
def write_footer(self, date):
|
||||||
"""
|
"""
|
||||||
Will create and display the footer section of each page...
|
Will create and display the footer section of each page...
|
||||||
|
|
||||||
@ -1602,6 +1603,10 @@ class BasePage(object):
|
|||||||
'html_end' : '</a>' ,
|
'html_end' : '</a>' ,
|
||||||
'version' : VERSION ,
|
'version' : VERSION ,
|
||||||
'date' : _dd.display(Today()) }
|
'date' : _dd.display(Today()) }
|
||||||
|
if date is not None:
|
||||||
|
msg += "<br />"
|
||||||
|
last_modif = datetime.datetime.fromtimestamp(date).strftime('%Y-%m-%d %H:%M:%S')
|
||||||
|
msg += _('Last change was the %(date)s') % { 'date' : last_modif }
|
||||||
|
|
||||||
# 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']:
|
||||||
@ -2831,7 +2836,7 @@ class BasePage(object):
|
|||||||
# ---------------------------------------------------------------------------------------
|
# ---------------------------------------------------------------------------------------
|
||||||
# # Web Page Fortmatter and writer
|
# # Web Page Fortmatter and writer
|
||||||
# ---------------------------------------------------------------------------------------
|
# ---------------------------------------------------------------------------------------
|
||||||
def XHTMLWriter(self, htmlinstance, of, sio):
|
def XHTMLWriter(self, htmlinstance, of, sio, date):
|
||||||
"""
|
"""
|
||||||
Will format, write, and close the file
|
Will format, write, and close the file
|
||||||
|
|
||||||
@ -2843,7 +2848,7 @@ class BasePage(object):
|
|||||||
htmlinstance.write(partial(print, file=of))
|
htmlinstance.write(partial(print, file=of))
|
||||||
|
|
||||||
# closes the file
|
# closes the file
|
||||||
self.report.close_file(of, sio)
|
self.report.close_file(of, sio, date)
|
||||||
|
|
||||||
#################################################
|
#################################################
|
||||||
#
|
#
|
||||||
@ -2871,6 +2876,7 @@ class SurnamePage(BasePage):
|
|||||||
of, sio = self.report.create_file(name_to_md5(surname), "srn")
|
of, sio = self.report.create_file(name_to_md5(surname), "srn")
|
||||||
self.up = True
|
self.up = True
|
||||||
surnamepage, head, body = self.write_header("%s - %s" % (_("Surname"), surname))
|
surnamepage, head, body = self.write_header("%s - %s" % (_("Surname"), surname))
|
||||||
|
ldatec = 0
|
||||||
|
|
||||||
# begin SurnameDetail division
|
# begin SurnameDetail division
|
||||||
with Html("div", class_ = "content", id = "SurnameDetail") as surnamedetail:
|
with Html("div", class_ = "content", id = "SurnameDetail") as surnamedetail:
|
||||||
@ -2918,6 +2924,7 @@ class SurnamePage(BasePage):
|
|||||||
for person_handle in ppl_handle_list:
|
for person_handle in ppl_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() > ldatec: ldatec = person.get_change_time()
|
||||||
trow = Html("tr")
|
trow = Html("tr")
|
||||||
tbody += trow
|
tbody += trow
|
||||||
|
|
||||||
@ -3003,12 +3010,12 @@ class SurnamePage(BasePage):
|
|||||||
|
|
||||||
# add clearline for proper styling
|
# add clearline for proper styling
|
||||||
# add footer section
|
# add footer section
|
||||||
footer = self.write_footer()
|
footer = self.write_footer(ldatec)
|
||||||
body += (fullclear, footer)
|
body += (fullclear, footer)
|
||||||
|
|
||||||
# send page out for processing
|
# send page out for processing
|
||||||
# and close the file
|
# and close the file
|
||||||
self.XHTMLWriter(surnamepage, of, sio)
|
self.XHTMLWriter(surnamepage, of, sio, ldatec)
|
||||||
|
|
||||||
#################################################
|
#################################################
|
||||||
#
|
#
|
||||||
@ -3057,6 +3064,7 @@ class FamilyPages(BasePage):
|
|||||||
|
|
||||||
of, sio = self.report.create_file("families")
|
of, sio = self.report.create_file("families")
|
||||||
familiesListPage, head, body = self.write_header(_("Families"))
|
familiesListPage, head, body = self.write_header(_("Families"))
|
||||||
|
ldatec = 0
|
||||||
|
|
||||||
# begin Family Division
|
# begin Family Division
|
||||||
with Html("div", class_ ="content", id ="Relationships") as relationlist:
|
with Html("div", class_ ="content", id ="Relationships") as relationlist:
|
||||||
@ -3079,6 +3087,7 @@ class FamilyPages(BasePage):
|
|||||||
for family_handle in fam_list:
|
for family_handle in fam_list:
|
||||||
family = self.dbase_.get_family_from_handle(family_handle)
|
family = self.dbase_.get_family_from_handle(family_handle)
|
||||||
if family:
|
if family:
|
||||||
|
if family.get_change_time() > ldatec: ldatec = family.get_change_time()
|
||||||
husband_handle = family.get_father_handle()
|
husband_handle = family.get_father_handle()
|
||||||
spouse_handle = family.get_mother_handle()
|
spouse_handle = family.get_mother_handle()
|
||||||
if husband_handle:
|
if husband_handle:
|
||||||
@ -3200,12 +3209,13 @@ class FamilyPages(BasePage):
|
|||||||
|
|
||||||
# add clearline for proper styling
|
# add clearline for proper styling
|
||||||
# add footer section
|
# add footer section
|
||||||
footer = self.write_footer()
|
if ldatec == 0: date = None
|
||||||
|
footer = self.write_footer(ldatec)
|
||||||
body += (fullclear, footer)
|
body += (fullclear, footer)
|
||||||
|
|
||||||
# send page out for processing
|
# send page out for processing
|
||||||
# and close the file
|
# and close the file
|
||||||
self.XHTMLWriter(familiesListPage, of, sio)
|
self.XHTMLWriter(familiesListPage, of, sio, ldatec)
|
||||||
|
|
||||||
def FamilyPage(self, report, title, family_handle):
|
def FamilyPage(self, report, title, family_handle):
|
||||||
self.dbase_ = report.database
|
self.dbase_ = report.database
|
||||||
@ -3213,6 +3223,7 @@ class FamilyPages(BasePage):
|
|||||||
if not family:
|
if not family:
|
||||||
return
|
return
|
||||||
BasePage.__init__(self, report, title, family.get_gramps_id())
|
BasePage.__init__(self, report, title, family.get_gramps_id())
|
||||||
|
ldatec = family.get_change_time()
|
||||||
|
|
||||||
self.bibli = Bibliography()
|
self.bibli = Bibliography()
|
||||||
self.up = True
|
self.up = True
|
||||||
@ -3283,12 +3294,12 @@ class FamilyPages(BasePage):
|
|||||||
|
|
||||||
# add clearline for proper styling
|
# add clearline for proper styling
|
||||||
# add footer section
|
# add footer section
|
||||||
footer = self.write_footer()
|
footer = self.write_footer(ldatec)
|
||||||
body += (fullclear, footer)
|
body += (fullclear, footer)
|
||||||
|
|
||||||
# send page out for processing
|
# send page out for processing
|
||||||
# and close the file
|
# and close the file
|
||||||
self.XHTMLWriter(familydetailpage, of, sio)
|
self.XHTMLWriter(familydetailpage, of, sio, ldatec)
|
||||||
|
|
||||||
######################################################
|
######################################################
|
||||||
# #
|
# #
|
||||||
@ -3338,6 +3349,7 @@ class PlacePages(BasePage):
|
|||||||
|
|
||||||
of, sio = self.report.create_file("places")
|
of, sio = self.report.create_file("places")
|
||||||
placelistpage, head, body = self.write_header(_("Places"))
|
placelistpage, head, body = self.write_header(_("Places"))
|
||||||
|
ldatec = 0
|
||||||
|
|
||||||
# begin places division
|
# begin places division
|
||||||
with Html("div", class_ = "content", id = "Places") as placelist:
|
with Html("div", class_ = "content", id = "Places") as placelist:
|
||||||
@ -3389,6 +3401,7 @@ class PlacePages(BasePage):
|
|||||||
for place_handle in handle_list:
|
for place_handle in handle_list:
|
||||||
place = self.dbase_.get_place_from_handle(place_handle)
|
place = self.dbase_.get_place_from_handle(place_handle)
|
||||||
if place:
|
if place:
|
||||||
|
if place.get_change_time() > ldatec: ldatec = place.get_change_time()
|
||||||
place_title = _pd.display(self.dbase_, place)
|
place_title = _pd.display(self.dbase_, place)
|
||||||
ml = get_main_location(self.dbase_, place)
|
ml = get_main_location(self.dbase_, place)
|
||||||
|
|
||||||
@ -3440,12 +3453,12 @@ class PlacePages(BasePage):
|
|||||||
|
|
||||||
# add clearline for proper styling
|
# add clearline for proper styling
|
||||||
# add footer section
|
# add footer section
|
||||||
footer = self.write_footer()
|
footer = self.write_footer(ldatec)
|
||||||
body += (fullclear, footer)
|
body += (fullclear, footer)
|
||||||
|
|
||||||
# send page out for processing
|
# send page out for processing
|
||||||
# and close the file
|
# and close the file
|
||||||
self.XHTMLWriter(placelistpage, of, sio)
|
self.XHTMLWriter(placelistpage, of, sio, ldatec)
|
||||||
|
|
||||||
def PlacePage(self, report, title, place_handle):
|
def PlacePage(self, report, title, place_handle):
|
||||||
self.bibli = Bibliography()
|
self.bibli = Bibliography()
|
||||||
@ -3453,6 +3466,7 @@ class PlacePages(BasePage):
|
|||||||
place = self.dbase_.get_place_from_handle(place_handle)
|
place = self.dbase_.get_place_from_handle(place_handle)
|
||||||
if not place:
|
if not place:
|
||||||
return None
|
return None
|
||||||
|
ldatec = place.get_change_time()
|
||||||
BasePage.__init__(self, report, title, place.get_gramps_id())
|
BasePage.__init__(self, report, title, place.get_gramps_id())
|
||||||
|
|
||||||
of, sio = self.report.create_file(place_handle, "plc")
|
of, sio = self.report.create_file(place_handle, "plc")
|
||||||
@ -3561,12 +3575,12 @@ class PlacePages(BasePage):
|
|||||||
|
|
||||||
# add clearline for proper styling
|
# add clearline for proper styling
|
||||||
# add footer section
|
# add footer section
|
||||||
footer = self.write_footer()
|
footer = self.write_footer(ldatec)
|
||||||
body += (fullclear, footer)
|
body += (fullclear, footer)
|
||||||
|
|
||||||
# send page out for processing
|
# send page out for processing
|
||||||
# and close the file
|
# and close the file
|
||||||
self.XHTMLWriter(placepage, of, sio)
|
self.XHTMLWriter(placepage, of, sio, ldatec)
|
||||||
|
|
||||||
#################################################
|
#################################################
|
||||||
#
|
#
|
||||||
@ -3624,6 +3638,7 @@ class EventPages(BasePage):
|
|||||||
"""
|
"""
|
||||||
self.dbase_ = report.database
|
self.dbase_ = report.database
|
||||||
BasePage.__init__(self, report, title)
|
BasePage.__init__(self, report, title)
|
||||||
|
ldatec = 0
|
||||||
|
|
||||||
of, sio = self.report.create_file("events")
|
of, sio = self.report.create_file("events")
|
||||||
eventslistpage, head, body = self.write_header(_("Events"))
|
eventslistpage, head, body = self.write_header(_("Events"))
|
||||||
@ -3681,6 +3696,7 @@ class EventPages(BasePage):
|
|||||||
event = self.dbase_.get_event_from_handle(event_handle)
|
event = self.dbase_.get_event_from_handle(event_handle)
|
||||||
_type = event.get_type()
|
_type = event.get_type()
|
||||||
gid = event.get_gramps_id()
|
gid = event.get_gramps_id()
|
||||||
|
if event.get_change_time() > ldatec: ldatec = event.get_change_time()
|
||||||
|
|
||||||
# check to see if we have listed this gramps_id yet?
|
# check to see if we have listed this gramps_id yet?
|
||||||
if gid not in _EVENT_DISPLAYED:
|
if gid not in _EVENT_DISPLAYED:
|
||||||
@ -3761,12 +3777,13 @@ class EventPages(BasePage):
|
|||||||
|
|
||||||
# add clearline for proper styling
|
# add clearline for proper styling
|
||||||
# add footer section
|
# add footer section
|
||||||
footer = self.write_footer()
|
if ldatec == 0: ldatec = None
|
||||||
|
footer = self.write_footer(ldatec)
|
||||||
body += (fullclear, footer)
|
body += (fullclear, footer)
|
||||||
|
|
||||||
# send page ut for processing
|
# send page ut for processing
|
||||||
# and close the file
|
# and close the file
|
||||||
self.XHTMLWriter(eventslistpage, of, sio)
|
self.XHTMLWriter(eventslistpage, of, sio, ldatec)
|
||||||
|
|
||||||
def _getEventDate(self, event_handle):
|
def _getEventDate(self, event_handle):
|
||||||
event_date = Date.EMPTY
|
event_date = Date.EMPTY
|
||||||
@ -3804,6 +3821,7 @@ class EventPages(BasePage):
|
|||||||
if not event:
|
if not event:
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
ldatec = event.get_change_time()
|
||||||
event_media_list = event.get_media_list()
|
event_media_list = event.get_media_list()
|
||||||
BasePage.__init__(self, report, title, event.get_gramps_id())
|
BasePage.__init__(self, report, title, event.get_gramps_id())
|
||||||
|
|
||||||
@ -3887,12 +3905,12 @@ class EventPages(BasePage):
|
|||||||
|
|
||||||
# add clearline for proper styling
|
# add clearline for proper styling
|
||||||
# add footer section
|
# add footer section
|
||||||
footer = self.write_footer()
|
footer = self.write_footer(ldatec)
|
||||||
body += (fullclear, footer)
|
body += (fullclear, footer)
|
||||||
|
|
||||||
# send page out for processing
|
# send page out for processing
|
||||||
# and close the page
|
# and close the page
|
||||||
self.XHTMLWriter(eventpage, of, sio)
|
self.XHTMLWriter(eventpage, of, sio, ldatec)
|
||||||
|
|
||||||
#################################################
|
#################################################
|
||||||
#
|
#
|
||||||
@ -4021,12 +4039,12 @@ class SurnameListPage(BasePage):
|
|||||||
|
|
||||||
# create footer section
|
# create footer section
|
||||||
# add clearline for proper styling
|
# add clearline for proper styling
|
||||||
footer = self.write_footer()
|
footer = self.write_footer(None)
|
||||||
body += (fullclear, footer)
|
body += (fullclear, footer)
|
||||||
|
|
||||||
# send page out for processing
|
# send page out for processing
|
||||||
# and close the file
|
# and close the file
|
||||||
self.XHTMLWriter(surnamelistpage, of, sio)
|
self.XHTMLWriter(surnamelistpage, of, sio, None) # None => current date modification
|
||||||
|
|
||||||
def surname_link(self, fname, name, opt_val = None, up = False):
|
def surname_link(self, fname, name, opt_val = None, up = False):
|
||||||
url = self.report.build_url_fname_html(fname, "srn", up)
|
url = self.report.build_url_fname_html(fname, "srn", up)
|
||||||
@ -4041,6 +4059,7 @@ class IntroductionPage(BasePage):
|
|||||||
def __init__(self, report, title):
|
def __init__(self, report, title):
|
||||||
self.dbase_ = report.database
|
self.dbase_ = report.database
|
||||||
BasePage.__init__(self, report, title)
|
BasePage.__init__(self, report, title)
|
||||||
|
ldatec = None
|
||||||
|
|
||||||
of, sio = self.report.create_file(report.intro_fname)
|
of, sio = self.report.create_file(report.intro_fname)
|
||||||
intropage, head, body = self.write_header(_('Introduction'))
|
intropage, head, body = self.write_header(_('Introduction'))
|
||||||
@ -4061,19 +4080,23 @@ class IntroductionPage(BasePage):
|
|||||||
# attach note
|
# attach note
|
||||||
section += note_text
|
section += note_text
|
||||||
|
|
||||||
|
# last modification of this note
|
||||||
|
ldatec = note.get_change_time()
|
||||||
|
|
||||||
# add clearline for proper styling
|
# add clearline for proper styling
|
||||||
# create footer section
|
# create footer section
|
||||||
footer = self.write_footer()
|
footer = self.write_footer(ldatec)
|
||||||
body += (fullclear, footer)
|
body += (fullclear, footer)
|
||||||
|
|
||||||
# send page out for processing
|
# send page out for processing
|
||||||
# and close the file
|
# and close the file
|
||||||
self.XHTMLWriter(intropage, of, sio)
|
self.XHTMLWriter(intropage, of, sio, ldatec)
|
||||||
|
|
||||||
class HomePage(BasePage):
|
class HomePage(BasePage):
|
||||||
def __init__(self, report, title):
|
def __init__(self, report, title):
|
||||||
self.dbase_ = report.database
|
self.dbase_ = report.database
|
||||||
BasePage.__init__(self, report, title)
|
BasePage.__init__(self, report, title)
|
||||||
|
ldatec = None
|
||||||
|
|
||||||
of, sio = self.report.create_file("index")
|
of, sio = self.report.create_file("index")
|
||||||
homepage, head, body = self.write_header(_('Home'))
|
homepage, head, body = self.write_header(_('Home'))
|
||||||
@ -4094,14 +4117,17 @@ class HomePage(BasePage):
|
|||||||
# attach note
|
# attach note
|
||||||
section += note_text
|
section += note_text
|
||||||
|
|
||||||
|
# last modification of this note
|
||||||
|
ldatec = note.get_change_time()
|
||||||
|
|
||||||
# create clear line for proper styling
|
# create clear line for proper styling
|
||||||
# create footer section
|
# create footer section
|
||||||
footer = self.write_footer()
|
footer = self.write_footer(ldatec)
|
||||||
body += (fullclear, footer)
|
body += (fullclear, footer)
|
||||||
|
|
||||||
# send page out for processing
|
# send page out for processing
|
||||||
# and close the file
|
# and close the file
|
||||||
self.XHTMLWriter(homepage, of, sio)
|
self.XHTMLWriter(homepage, of, sio, ldatec)
|
||||||
|
|
||||||
#################################################
|
#################################################
|
||||||
#
|
#
|
||||||
@ -4231,12 +4257,12 @@ class SourcePages(BasePage):
|
|||||||
|
|
||||||
# add clearline for proper styling
|
# add clearline for proper styling
|
||||||
# add footer section
|
# add footer section
|
||||||
footer = self.write_footer()
|
footer = self.write_footer(None)
|
||||||
body += (fullclear, footer)
|
body += (fullclear, footer)
|
||||||
|
|
||||||
# send page out for processing
|
# send page out for processing
|
||||||
# and close the file
|
# and close the file
|
||||||
self.XHTMLWriter(sourcelistpage, of, sio)
|
self.XHTMLWriter(sourcelistpage, of, sio, None)
|
||||||
|
|
||||||
def SourcePage(self, report, title, source_handle):
|
def SourcePage(self, report, title, source_handle):
|
||||||
"""
|
"""
|
||||||
@ -4262,6 +4288,7 @@ class SourcePages(BasePage):
|
|||||||
sourcepage, head, body = self.write_header("%s - %s" % (_('Sources'),
|
sourcepage, head, body = self.write_header("%s - %s" % (_('Sources'),
|
||||||
self.page_title))
|
self.page_title))
|
||||||
|
|
||||||
|
ldatec = None
|
||||||
# begin source detail division
|
# begin source detail division
|
||||||
with Html("div", class_ = "content", id = "SourceDetail") as sourcedetail:
|
with Html("div", class_ = "content", id = "SourceDetail") as sourcedetail:
|
||||||
body += sourcedetail
|
body += sourcedetail
|
||||||
@ -4286,6 +4313,9 @@ class SourcePages(BasePage):
|
|||||||
if not self.noid and self.gid:
|
if not self.noid and self.gid:
|
||||||
source_gid = source.get_gramps_id()
|
source_gid = source.get_gramps_id()
|
||||||
|
|
||||||
|
# last modification of this source
|
||||||
|
ldatec = source.get_change_time()
|
||||||
|
|
||||||
for (label, value) in [
|
for (label, value) in [
|
||||||
(_("Gramps ID"), source_gid),
|
(_("Gramps ID"), source_gid),
|
||||||
(_("Author"), source.get_author()),
|
(_("Author"), source.get_author()),
|
||||||
@ -4327,12 +4357,12 @@ class SourcePages(BasePage):
|
|||||||
|
|
||||||
# add clearline for proper styling
|
# add clearline for proper styling
|
||||||
# add footer section
|
# add footer section
|
||||||
footer = self.write_footer()
|
footer = self.write_footer(ldatec)
|
||||||
body += (fullclear, footer)
|
body += (fullclear, footer)
|
||||||
|
|
||||||
# send page out for processing
|
# send page out for processing
|
||||||
# and close the file
|
# and close the file
|
||||||
self.XHTMLWriter(sourcepage, of, sio)
|
self.XHTMLWriter(sourcepage, of, sio, ldatec)
|
||||||
|
|
||||||
#################################################
|
#################################################
|
||||||
#
|
#
|
||||||
@ -4398,6 +4428,7 @@ class MediaPages(BasePage):
|
|||||||
of, sio = self.report.create_file("media")
|
of, sio = self.report.create_file("media")
|
||||||
medialistpage, head, body = self.write_header(_('Media'))
|
medialistpage, head, body = self.write_header(_('Media'))
|
||||||
|
|
||||||
|
ldatec = 0
|
||||||
# begin gallery division
|
# begin gallery division
|
||||||
with Html("div", class_ = "content", id = "Gallery") as medialist:
|
with Html("div", class_ = "content", id = "Gallery") as medialist:
|
||||||
body += medialist
|
body += medialist
|
||||||
@ -4440,6 +4471,7 @@ class MediaPages(BasePage):
|
|||||||
for media_handle in sorted_media_handles:
|
for media_handle in sorted_media_handles:
|
||||||
media = self.dbase_.get_object_from_handle(media_handle)
|
media = self.dbase_.get_object_from_handle(media_handle)
|
||||||
if media:
|
if media:
|
||||||
|
if media.get_change_time() > ldatec: ldatec = media.get_change_time()
|
||||||
title = media.get_description() or "[untitled]"
|
title = media.get_description() or "[untitled]"
|
||||||
|
|
||||||
trow = Html("tr")
|
trow = Html("tr")
|
||||||
@ -4459,12 +4491,13 @@ class MediaPages(BasePage):
|
|||||||
|
|
||||||
# add footer section
|
# add footer section
|
||||||
# add clearline for proper styling
|
# add clearline for proper styling
|
||||||
footer = self.write_footer()
|
if ldatec == 0: ldatec = None
|
||||||
|
footer = self.write_footer(ldatec)
|
||||||
body += (fullclear, footer)
|
body += (fullclear, footer)
|
||||||
|
|
||||||
# send page out for processing
|
# send page out for processing
|
||||||
# and close the file
|
# and close the file
|
||||||
self.XHTMLWriter(medialistpage, of, sio)
|
self.XHTMLWriter(medialistpage, of, sio, ldatec)
|
||||||
|
|
||||||
def media_ref_link(self, handle, name, up = False):
|
def media_ref_link(self, handle, name, up = False):
|
||||||
|
|
||||||
@ -4497,6 +4530,7 @@ class MediaPages(BasePage):
|
|||||||
|
|
||||||
media = self.dbase_.get_object_from_handle(media_handle)
|
media = self.dbase_.get_object_from_handle(media_handle)
|
||||||
BasePage.__init__(self, report, title, media.gramps_id)
|
BasePage.__init__(self, report, title, media.gramps_id)
|
||||||
|
ldatec = media.get_change_time()
|
||||||
|
|
||||||
# get media rectangles
|
# get media rectangles
|
||||||
_region_items = self.media_ref_rect_regions(media_handle)
|
_region_items = self.media_ref_rect_regions(media_handle)
|
||||||
@ -4571,6 +4605,7 @@ class MediaPages(BasePage):
|
|||||||
# have to await a large download unnecessarily. Either way, set
|
# have to await a large download unnecessarily. Either way, set
|
||||||
# the display image size as requested.
|
# the display image size as requested.
|
||||||
orig_image_path = media_path_full(self.dbase_, media.get_path())
|
orig_image_path = media_path_full(self.dbase_, media.get_path())
|
||||||
|
mtime = os.stat(orig_image_path).st_mtime
|
||||||
(width, height) = image_size(orig_image_path)
|
(width, height) = image_size(orig_image_path)
|
||||||
max_width = self.report.options['maxinitialimagewidth']
|
max_width = self.report.options['maxinitialimagewidth']
|
||||||
max_height = self.report.options['maxinitialimageheight']
|
max_height = self.report.options['maxinitialimageheight']
|
||||||
@ -4596,12 +4631,15 @@ class MediaPages(BasePage):
|
|||||||
filed, dest = tempfile.mkstemp()
|
filed, dest = tempfile.mkstemp()
|
||||||
os.write(filed, initial_image_data)
|
os.write(filed, initial_image_data)
|
||||||
os.close(filed)
|
os.close(filed)
|
||||||
|
os.utime(dest, (mtime, mtime))
|
||||||
self.report.archive.add(dest, initial_image_path)
|
self.report.archive.add(dest, initial_image_path)
|
||||||
os.unlink(dest)
|
os.unlink(dest)
|
||||||
else:
|
else:
|
||||||
filed = open(os.path.join(self.html_dir, initial_image_path), 'wb')
|
file_path_init = os.path.join(self.html_dir, initial_image_path)
|
||||||
|
filed = open(file_path_init, 'wb')
|
||||||
filed.write(initial_image_data)
|
filed.write(initial_image_data)
|
||||||
filed.close()
|
filed.close()
|
||||||
|
os.utime(file_path_init, (mtime, mtime))
|
||||||
else:
|
else:
|
||||||
# not worth actually making a smaller image
|
# not worth actually making a smaller image
|
||||||
initial_image_path = newpath
|
initial_image_path = newpath
|
||||||
@ -4730,12 +4768,12 @@ class MediaPages(BasePage):
|
|||||||
|
|
||||||
# add clearline for proper styling
|
# add clearline for proper styling
|
||||||
# add footer section
|
# add footer section
|
||||||
footer = self.write_footer()
|
footer = self.write_footer(ldatec)
|
||||||
body += (fullclear, footer)
|
body += (fullclear, footer)
|
||||||
|
|
||||||
# send page out for processing
|
# send page out for processing
|
||||||
# and close the file
|
# and close the file
|
||||||
self.XHTMLWriter(mediapage, of, sio)
|
self.XHTMLWriter(mediapage, of, sio, ldatec)
|
||||||
|
|
||||||
def media_nav_link(self, handle, name, up = False):
|
def media_nav_link(self, handle, name, up = False):
|
||||||
"""
|
"""
|
||||||
@ -4765,14 +4803,16 @@ class MediaPages(BasePage):
|
|||||||
_WRONGMEDIAPATH.append([ photo.get_gramps_id(), fullpath])
|
_WRONGMEDIAPATH.append([ photo.get_gramps_id(), fullpath])
|
||||||
return None
|
return None
|
||||||
try:
|
try:
|
||||||
|
mtime = os.stat(fullpath).st_mtime
|
||||||
if self.report.archive:
|
if self.report.archive:
|
||||||
self.report.archive.add(fullpath, str(newpath))
|
self.report.archive.add(fullpath, str(newpath))
|
||||||
else:
|
else:
|
||||||
to_dir = os.path.join(self.html_dir, to_dir)
|
to_dir = os.path.join(self.html_dir, to_dir)
|
||||||
if not os.path.isdir(to_dir):
|
if not os.path.isdir(to_dir):
|
||||||
os.makedirs(to_dir)
|
os.makedirs(to_dir)
|
||||||
shutil.copyfile(fullpath,
|
new_file = os.path.join(self.html_dir, newpath)
|
||||||
os.path.join(self.html_dir, newpath))
|
shutil.copyfile(fullpath, new_file)
|
||||||
|
os.utime(new_file, (mtime, mtime))
|
||||||
return newpath
|
return newpath
|
||||||
except (IOError, OSError) as msg:
|
except (IOError, OSError) as msg:
|
||||||
error = _("Missing media object:") + \
|
error = _("Missing media object:") + \
|
||||||
@ -4925,12 +4965,12 @@ class ThumbnailPreviewPage(BasePage):
|
|||||||
|
|
||||||
# add footer section
|
# add footer section
|
||||||
# add clearline for proper styling
|
# add clearline for proper styling
|
||||||
footer = self.write_footer()
|
footer = self.write_footer(None)
|
||||||
body += (fullclear, footer)
|
body += (fullclear, footer)
|
||||||
|
|
||||||
# send page out for processing
|
# send page out for processing
|
||||||
# and close the file
|
# and close the file
|
||||||
self.XHTMLWriter(thumbnailpage, of, sio)
|
self.XHTMLWriter(thumbnailpage, of, sio, None)
|
||||||
|
|
||||||
def thumbnail_link(self, name, index):
|
def thumbnail_link(self, name, index):
|
||||||
"""
|
"""
|
||||||
@ -5075,12 +5115,12 @@ class DownloadPage(BasePage):
|
|||||||
|
|
||||||
# clear line for proper styling
|
# clear line for proper styling
|
||||||
# create footer section
|
# create footer section
|
||||||
footer = self.write_footer()
|
footer = self.write_footer(None)
|
||||||
body += (fullclear, footer)
|
body += (fullclear, footer)
|
||||||
|
|
||||||
# send page out for processing
|
# send page out for processing
|
||||||
# and close the file
|
# and close the file
|
||||||
self.XHTMLWriter(downloadpage, of, sio)
|
self.XHTMLWriter(downloadpage, of, sio, None)
|
||||||
|
|
||||||
class ContactPage(BasePage):
|
class ContactPage(BasePage):
|
||||||
def __init__(self, report, title):
|
def __init__(self, report, title):
|
||||||
@ -5141,12 +5181,12 @@ class ContactPage(BasePage):
|
|||||||
|
|
||||||
# add clearline for proper styling
|
# add clearline for proper styling
|
||||||
# add footer section
|
# add footer section
|
||||||
footer = self.write_footer()
|
footer = self.write_footer(None)
|
||||||
body += (fullclear, footer)
|
body += (fullclear, footer)
|
||||||
|
|
||||||
# send page out for porcessing
|
# send page out for porcessing
|
||||||
# and close the file
|
# and close the file
|
||||||
self.XHTMLWriter(contactpage, of, sio)
|
self.XHTMLWriter(contactpage, of, sio, None)
|
||||||
|
|
||||||
#################################################
|
#################################################
|
||||||
#
|
#
|
||||||
@ -5205,6 +5245,7 @@ class PersonPages(BasePage):
|
|||||||
|
|
||||||
of, sio = self.report.create_file("individuals")
|
of, sio = self.report.create_file("individuals")
|
||||||
indlistpage, head, body = self.write_header(_("Individuals"))
|
indlistpage, head, body = self.write_header(_("Individuals"))
|
||||||
|
date = 0
|
||||||
|
|
||||||
# begin Individuals division
|
# begin Individuals division
|
||||||
with Html("div", class_ = "content", id = "Individuals") as individuallist:
|
with Html("div", class_ = "content", id = "Individuals") as individuallist:
|
||||||
@ -5265,6 +5306,7 @@ class PersonPages(BasePage):
|
|||||||
first_surname = True
|
first_surname = True
|
||||||
for person_handle in handle_list:
|
for person_handle in 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()
|
||||||
|
|
||||||
# surname column
|
# surname column
|
||||||
trow = Html("tr")
|
trow = Html("tr")
|
||||||
@ -5388,12 +5430,13 @@ class PersonPages(BasePage):
|
|||||||
|
|
||||||
# create clear line for proper styling
|
# create clear line for proper styling
|
||||||
# create footer section
|
# create footer section
|
||||||
footer = self.write_footer()
|
if date == 0: date = None
|
||||||
|
footer = self.write_footer(date)
|
||||||
body += (fullclear, footer)
|
body += (fullclear, footer)
|
||||||
|
|
||||||
# send page out for processing
|
# send page out for processing
|
||||||
# and close the file
|
# and close the file
|
||||||
self.XHTMLWriter(indlistpage, of, sio)
|
self.XHTMLWriter(indlistpage, of, sio, date)
|
||||||
|
|
||||||
#################################################
|
#################################################
|
||||||
#
|
#
|
||||||
@ -5416,6 +5459,8 @@ class PersonPages(BasePage):
|
|||||||
self.sort_name = self.get_name(person)
|
self.sort_name = self.get_name(person)
|
||||||
self.name = self.get_name(person)
|
self.name = self.get_name(person)
|
||||||
|
|
||||||
|
date = self.person.get_change_time()
|
||||||
|
|
||||||
# to be used in the Family Map Pages...
|
# to be used in the Family Map Pages...
|
||||||
self.familymappages = self.report.options['familymappages']
|
self.familymappages = self.report.options['familymappages']
|
||||||
self.placemappages = self.report.options['placemappages']
|
self.placemappages = self.report.options['placemappages']
|
||||||
@ -5555,12 +5600,12 @@ class PersonPages(BasePage):
|
|||||||
|
|
||||||
# add clearline for proper styling
|
# add clearline for proper styling
|
||||||
# create footer section
|
# create footer section
|
||||||
footer = self.write_footer()
|
footer = self.write_footer(date)
|
||||||
body += (fullclear, footer)
|
body += (fullclear, footer)
|
||||||
|
|
||||||
# send page out for processing
|
# send page out for processing
|
||||||
# and close the file
|
# and close the file
|
||||||
self.XHTMLWriter(indivdetpage, of, sio)
|
self.XHTMLWriter(indivdetpage, of, sio, date)
|
||||||
|
|
||||||
def __create_family_map(self, person, place_lat_long):
|
def __create_family_map(self, person, place_lat_long):
|
||||||
"""
|
"""
|
||||||
@ -5819,12 +5864,12 @@ class PersonPages(BasePage):
|
|||||||
|
|
||||||
# add clearline for proper styling
|
# add clearline for proper styling
|
||||||
# add footer section
|
# add footer section
|
||||||
footer = self.write_footer()
|
footer = self.write_footer(None)
|
||||||
body += (fullclear, footer)
|
body += (fullclear, footer)
|
||||||
|
|
||||||
# send page out for processing
|
# send page out for processing
|
||||||
# and close the file
|
# and close the file
|
||||||
self.XHTMLWriter(familymappage, of, sio)
|
self.XHTMLWriter(familymappage, of, sio, None)
|
||||||
|
|
||||||
def __display_family_map(self, person, place_lat_long):
|
def __display_family_map(self, person, place_lat_long):
|
||||||
"""
|
"""
|
||||||
@ -6595,6 +6640,7 @@ class RepositoryPages(BasePage):
|
|||||||
of, sio = self.report.create_file("repositories")
|
of, sio = self.report.create_file("repositories")
|
||||||
repolistpage, head, body = self.write_header(_("Repositories"))
|
repolistpage, head, body = self.write_header(_("Repositories"))
|
||||||
|
|
||||||
|
ldatec = 0
|
||||||
# begin RepositoryList division
|
# begin RepositoryList division
|
||||||
with Html("div", class_ = "content", id = "RepositoryList") as repositorylist:
|
with Html("div", class_ = "content", id = "RepositoryList") as repositorylist:
|
||||||
body += repositorylist
|
body += repositorylist
|
||||||
@ -6641,22 +6687,25 @@ class RepositoryPages(BasePage):
|
|||||||
if repo.get_name():
|
if repo.get_name():
|
||||||
trow += Html("td", self.repository_link(handle, repo.get_name(),
|
trow += Html("td", self.repository_link(handle, repo.get_name(),
|
||||||
repo.get_gramps_id(), self.up), class_ = "ColumnName")
|
repo.get_gramps_id(), self.up), class_ = "ColumnName")
|
||||||
|
ldatec = repo.get_change_time()
|
||||||
else:
|
else:
|
||||||
trow += Html("td", "[ untitled ]", class_ = "ColumnName")
|
trow += Html("td", "[ untitled ]", class_ = "ColumnName")
|
||||||
|
|
||||||
# add clearline for proper styling
|
# add clearline for proper styling
|
||||||
# add footer section
|
# add footer section
|
||||||
footer = self.write_footer()
|
if ldatec == 0: ldatec = None
|
||||||
|
footer = self.write_footer(ldatec)
|
||||||
body += (fullclear, footer)
|
body += (fullclear, footer)
|
||||||
|
|
||||||
# send page out for processing
|
# send page out for processing
|
||||||
# and close the file
|
# and close the file
|
||||||
self.XHTMLWriter(repolistpage, of, sio)
|
self.XHTMLWriter(repolistpage, of, sio, ldatec)
|
||||||
|
|
||||||
def RepositoryPage(self, report, title, repo, handle):
|
def RepositoryPage(self, report, title, repo, handle):
|
||||||
gid = repo.get_gramps_id()
|
gid = repo.get_gramps_id()
|
||||||
BasePage.__init__(self, report, title, gid)
|
BasePage.__init__(self, report, title, gid)
|
||||||
self.dbase_ = report.database
|
self.dbase_ = report.database
|
||||||
|
ldatec = repo.get_change_time()
|
||||||
|
|
||||||
of, sio = self.report.create_file(handle, 'repo')
|
of, sio = self.report.create_file(handle, 'repo')
|
||||||
self.up = True
|
self.up = True
|
||||||
@ -6711,12 +6760,12 @@ class RepositoryPages(BasePage):
|
|||||||
|
|
||||||
# add clearline for proper styling
|
# add clearline for proper styling
|
||||||
# add footer section
|
# add footer section
|
||||||
footer = self.write_footer()
|
footer = self.write_footer(ldatec)
|
||||||
body += (fullclear, footer)
|
body += (fullclear, footer)
|
||||||
|
|
||||||
# send page out for processing
|
# send page out for processing
|
||||||
# and close the file
|
# and close the file
|
||||||
self.XHTMLWriter(repositorypage, of, sio)
|
self.XHTMLWriter(repositorypage, of, sio, ldatec)
|
||||||
|
|
||||||
class AddressBookListPage(BasePage):
|
class AddressBookListPage(BasePage):
|
||||||
def __init__(self, report, title, has_url_addr_res):
|
def __init__(self, report, title, has_url_addr_res):
|
||||||
@ -6803,12 +6852,12 @@ class AddressBookListPage(BasePage):
|
|||||||
index += 1
|
index += 1
|
||||||
|
|
||||||
# Add footer and clearline
|
# Add footer and clearline
|
||||||
footer = self.write_footer()
|
footer = self.write_footer(None)
|
||||||
body += (fullclear, footer)
|
body += (fullclear, footer)
|
||||||
|
|
||||||
# send the page out for processing
|
# send the page out for processing
|
||||||
# and close the file
|
# and close the file
|
||||||
self.XHTMLWriter(addressbooklistpage, of, sio)
|
self.XHTMLWriter(addressbooklistpage, of, sio, None)
|
||||||
|
|
||||||
class AddressBookPage(BasePage):
|
class AddressBookPage(BasePage):
|
||||||
def __init__(self, report, title, person_handle, has_add, has_res, has_url):
|
def __init__(self, report, title, person_handle, has_add, has_res, has_url):
|
||||||
@ -6847,12 +6896,12 @@ class AddressBookPage(BasePage):
|
|||||||
|
|
||||||
# add fullclear for proper styling
|
# add fullclear for proper styling
|
||||||
# and footer section to page
|
# and footer section to page
|
||||||
footer = self.write_footer()
|
footer = self.write_footer(None)
|
||||||
body += (fullclear, footer)
|
body += (fullclear, footer)
|
||||||
|
|
||||||
# send page out for processing
|
# send page out for processing
|
||||||
# and close the file
|
# and close the file
|
||||||
self.XHTMLWriter(addressbookpage, of, sio)
|
self.XHTMLWriter(addressbookpage, of, sio, None)
|
||||||
|
|
||||||
class NavWebReport(Report):
|
class NavWebReport(Report):
|
||||||
|
|
||||||
@ -7621,7 +7670,7 @@ class NavWebReport(Report):
|
|||||||
self.write_gendex(gendex_io, person)
|
self.write_gendex(gendex_io, person)
|
||||||
else:
|
else:
|
||||||
self.write_gendex(fp_gendex, person)
|
self.write_gendex(fp_gendex, person)
|
||||||
self.close_file(fp_gendex, gendex_io)
|
self.close_file(fp_gendex, gendex_io, date)
|
||||||
|
|
||||||
def write_gendex(self, fp, person):
|
def write_gendex(self, fp, person):
|
||||||
"""
|
"""
|
||||||
@ -7883,7 +7932,7 @@ class NavWebReport(Report):
|
|||||||
errors='xmlcharrefreplace')
|
errors='xmlcharrefreplace')
|
||||||
return (of, string_io)
|
return (of, string_io)
|
||||||
|
|
||||||
def close_file(self, of, string_io):
|
def close_file(self, of, string_io, date):
|
||||||
"""
|
"""
|
||||||
will close any file passed to it
|
will close any file passed to it
|
||||||
"""
|
"""
|
||||||
@ -7892,7 +7941,7 @@ class NavWebReport(Report):
|
|||||||
of.flush()
|
of.flush()
|
||||||
tarinfo = tarfile.TarInfo(self.cur_fname)
|
tarinfo = tarfile.TarInfo(self.cur_fname)
|
||||||
tarinfo.size = len(string_io.getvalue())
|
tarinfo.size = len(string_io.getvalue())
|
||||||
tarinfo.mtime = time.time()
|
tarinfo.mtime = date if date is not None else time.time()
|
||||||
if not win():
|
if not win():
|
||||||
tarinfo.uid = os.getuid()
|
tarinfo.uid = os.getuid()
|
||||||
tarinfo.gid = os.getgid()
|
tarinfo.gid = os.getgid()
|
||||||
@ -7901,6 +7950,8 @@ class NavWebReport(Report):
|
|||||||
of.close()
|
of.close()
|
||||||
else:
|
else:
|
||||||
of.close()
|
of.close()
|
||||||
|
if date is not None:
|
||||||
|
os.utime(of.name, (date, date))
|
||||||
|
|
||||||
def prepare_copy_media(self, photo):
|
def prepare_copy_media(self, photo):
|
||||||
"""
|
"""
|
||||||
@ -7925,8 +7976,10 @@ class NavWebReport(Report):
|
|||||||
be prepended before 'to_fname'.
|
be prepended before 'to_fname'.
|
||||||
"""
|
"""
|
||||||
# log.debug("copying '%s' to '%s/%s'" % (from_fname, to_dir, to_fname))
|
# log.debug("copying '%s' to '%s/%s'" % (from_fname, to_dir, to_fname))
|
||||||
|
mtime = os.stat(from_fname).st_mtime
|
||||||
if self.archive:
|
if self.archive:
|
||||||
dest = os.path.join(to_dir, to_fname)
|
dest = os.path.join(to_dir, to_fname)
|
||||||
|
os.utime(from_fname, (mtime, mtime))
|
||||||
self.archive.add(from_fname, dest)
|
self.archive.add(from_fname, dest)
|
||||||
else:
|
else:
|
||||||
dest = os.path.join(self.html_dir, to_dir, to_fname)
|
dest = os.path.join(self.html_dir, to_dir, to_fname)
|
||||||
@ -7938,6 +7991,7 @@ class NavWebReport(Report):
|
|||||||
if from_fname != dest:
|
if from_fname != dest:
|
||||||
try:
|
try:
|
||||||
shutil.copyfile(from_fname, dest)
|
shutil.copyfile(from_fname, dest)
|
||||||
|
os.utime(dest, (mtime, mtime))
|
||||||
except:
|
except:
|
||||||
print("Copying error: %s" % sys.exc_info()[1])
|
print("Copying error: %s" % sys.exc_info()[1])
|
||||||
print("Continuing...")
|
print("Continuing...")
|
||||||
|
Loading…
x
Reference in New Issue
Block a user