Narrative web: multiple problems. (#517)
* Narrative web: multiple problems. 1 - Added an option for the statistics page. 2 - We have problems with notes : pages are too large 3 - Difficult to see some page on a mobile phone when you have notes. 4 - Resizing of images on a mobile 5 - Maps are too bigs on a mobile 6 - Split the event line to have a narrower page 7 - The note is spanned on two columns (Place + Description) 7 - In media pages, the progress meter doesn't work well. 8 - Add a progress meter for the medialistpage Issues #10344 * Narrative Web: several modifications + css files * Stylesheet problems and reverse set_header * Removing memory cleanup.
This commit is contained in:
parent
3c8cba0301
commit
3615e75d16
@ -288,10 +288,6 @@ table.infolist thead tr th {
|
||||
table.infolist tr td {
|
||||
border-bottom: dashed 1px #000;
|
||||
vertical-align: middle;
|
||||
padding: 6px 0 6px 10px;
|
||||
}
|
||||
table.infolist tr td a {
|
||||
display: block;
|
||||
}
|
||||
table.infolist tr.BeginLetter td, table.infolist tr.BeginSurname td {
|
||||
border-top: solid 1px #000;
|
||||
@ -351,15 +347,15 @@ div#Individuals {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
div#Individuals table.individuallist {
|
||||
div#Individuals table.IndividualList {
|
||||
border-bottom: solid 1px #000;
|
||||
}
|
||||
div#Individuals table.individuallist tbody tr td.ColumnSurname a:hover,
|
||||
div#Individuals table.individuallist tbody tr td.ColumnSurname a:active {
|
||||
div#Individuals table.IndividualList tbody tr td.ColumnSurname a:hover,
|
||||
div#Individuals table.IndividualList tbody tr td.ColumnSurname a:active {
|
||||
cursor: default;
|
||||
background: none;
|
||||
}
|
||||
div#Individuals table.individuallist tbody tr td.ColumnName a {
|
||||
div#Individuals table.IndividualList tbody tr td.ColumnName a {
|
||||
vertical-align: middle;
|
||||
}
|
||||
div#Individuals div table.infolist tr td p {
|
||||
@ -1129,9 +1125,10 @@ div.narrative {
|
||||
}
|
||||
.narrative p {
|
||||
font: normal .9em/1.4em sans-serif;
|
||||
margin-top: .5em;
|
||||
margin-bottom: 0;
|
||||
padding: 0 20px 1em 20px;
|
||||
margin: 0.1em 0 0.2em 0;
|
||||
}
|
||||
i + div.grampsstylednote p {
|
||||
margin: 0.1em 0 0.2em 0;
|
||||
}
|
||||
|
||||
/* Subsections : References
|
||||
|
@ -276,7 +276,6 @@ table.infolist tr th a:hover {
|
||||
table.infolist tr td {
|
||||
font:normal 1.1em/1.4em serif;
|
||||
vertical-align:middle;
|
||||
padding:.1em 10px;
|
||||
}
|
||||
table.infolist tr td a {
|
||||
display:block;
|
||||
@ -396,30 +395,30 @@ table.surname thead tr th.ColumnParents, table.surname tbody tr td.ColumnParents
|
||||
/* Individuals
|
||||
----------------------------------------------------- */
|
||||
#Individuals { }
|
||||
#Individuals table.individuallist {
|
||||
#Individuals table.IndividualList {
|
||||
border-bottom:solid 1px #A97;
|
||||
}
|
||||
#Individuals table.individuallist tbody tr td {
|
||||
#Individuals table.IndividualList tbody tr td {
|
||||
border-bottom:dashed 1px #C1B398;
|
||||
}
|
||||
#Individuals table.individuallist tbody tr td a:hover {
|
||||
#Individuals table.IndividualList tbody tr td a:hover {
|
||||
text-decoration:none;
|
||||
}
|
||||
table.individuallist tbody tr td.ColumnSurname a:hover, table.individuallist tbody tr td.ColumnSurname a:active {
|
||||
table.IndividualList tbody tr td.ColumnSurname a:hover, table.IndividualList tbody tr td.ColumnSurname a:active {
|
||||
cursor:default;
|
||||
color:black;
|
||||
background:none;
|
||||
}
|
||||
table.individuallist tbody tr td.ColumnName {
|
||||
table.IndividualList tbody tr td.ColumnName {
|
||||
padding:0;
|
||||
background-color:#FFF;
|
||||
}
|
||||
table.individuallist tbody tr td.ColumnName a {
|
||||
table.IndividualList tbody tr td.ColumnName a {
|
||||
display:block;
|
||||
padding:.6em 10px;
|
||||
padding:.1em .1em;
|
||||
vertical-align:middle;
|
||||
}
|
||||
table.individuallist tbody tr td.ColumnName a:hover {
|
||||
table.IndividualList tbody tr td.ColumnName a:hover {
|
||||
background-color:#C1B398;
|
||||
}
|
||||
#Individuals div table.infolist tr td p {
|
||||
@ -960,11 +959,12 @@ div#Addresses table.infolist tr td a, div#Addresses table.infolist tr td p a {
|
||||
div.narrative {
|
||||
padding-bottom:0;
|
||||
}
|
||||
i + div.grampsstylednote p {
|
||||
margin: 0.1em 0 0.2em 0;
|
||||
}
|
||||
.narrative p {
|
||||
margin: 0.1em 0 0.2em 0;
|
||||
font:normal .9em/1.4em sans-serif;
|
||||
margin-top:.5em;
|
||||
margin-bottom:0;
|
||||
padding:0 20px 1em 20px;
|
||||
}
|
||||
|
||||
/* Subsections : References
|
||||
|
@ -454,30 +454,30 @@ div#Individuals {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
div#Individuals table.individuallist {
|
||||
div#Individuals table.IndividualList {
|
||||
border-bottom: solid 1px #5D835F;
|
||||
}
|
||||
div#Individuals table.individuallist tbody tr td {
|
||||
div#Individuals table.IndividualList tbody tr td {
|
||||
border-bottom: dashed 1px #5D835F;
|
||||
background-color: #D8F3D6;
|
||||
}
|
||||
div#Individuals table.individuallist tbody tr td a {
|
||||
div#Individuals table.IndividualList tbody tr td a {
|
||||
display: block;
|
||||
padding: .6em 10px;
|
||||
}
|
||||
div#Individuals table.individuallist tbody tr td.ColumnSurname a:hover,
|
||||
div#Individuals table.individuallist tbody tr td.ColumnSurname a:active {
|
||||
div#Individuals table.IndividualList tbody tr td.ColumnSurname a:hover,
|
||||
div#Individuals table.IndividualList tbody tr td.ColumnSurname a:active {
|
||||
cursor:default;
|
||||
color: #000;
|
||||
background:none;
|
||||
}
|
||||
div#Individuals table.individuallist tbody tr td.ColumnName {
|
||||
div#Individuals table.IndividualList tbody tr td.ColumnName {
|
||||
background-color: #FFF;
|
||||
}
|
||||
div#Individuals table.individuallist tbody tr td.ColumnName a {
|
||||
div#Individuals table.IndividualList tbody tr td.ColumnName a {
|
||||
vertical-align:middle;
|
||||
}
|
||||
div#Individuals table.individuallist tbody tr td.ColumnPartner {
|
||||
div#Individuals table.IndividualList tbody tr td.ColumnPartner {
|
||||
background-color: #FFF;
|
||||
}
|
||||
div#Individuals div table.infolist tr td p {
|
||||
|
@ -33,7 +33,9 @@ body#FamilyMap {
|
||||
border: solid 4px #000;
|
||||
margin: 0px auto;
|
||||
width: 800px;
|
||||
height: 800px;
|
||||
height: 400px;
|
||||
max-width: 90%;
|
||||
max-height: 90%;
|
||||
}
|
||||
|
||||
/* Place Maps
|
||||
@ -43,6 +45,8 @@ div#place_canvas {
|
||||
border: solid 4px #000;
|
||||
width: 500px;
|
||||
height: 400px;
|
||||
max-width: 90%;
|
||||
max-height: 90%;
|
||||
}
|
||||
button#drop {
|
||||
background-color: purple;
|
||||
|
@ -612,17 +612,25 @@ class BasePage: # pylint: disable=C1001
|
||||
"""
|
||||
creates the event header row for all events
|
||||
"""
|
||||
trow = Html("tr")
|
||||
trow = Html("tr", close=None)
|
||||
trow.extend(
|
||||
Html("th", trans, class_=colclass, inline=True)
|
||||
for trans, colclass in [
|
||||
(self._("Event"), "ColumnEvent"),
|
||||
(self._("Date"), "ColumnDate"),
|
||||
(self._("Place"), "ColumnPlace"),
|
||||
(self._("Description"), "ColumnDescription"),
|
||||
(self._("Notes"), "ColumnNotes"),
|
||||
(self._("Sources"), "ColumnSources")]
|
||||
(self._("Description"), "ColumnDescription")]
|
||||
)
|
||||
trow += Html("/tr", close=None)
|
||||
trow2 = Html("tr", indent=False)
|
||||
trow2.extend(
|
||||
Html("th", trans, class_=colclass, colspan=opt, inline=True)
|
||||
for trans, colclass, opt in [
|
||||
("", "ColumnEvent", 1),
|
||||
(self._("Sources"), "ColumnSources", 1),
|
||||
(self._("Notes"), "ColumnNotes", 2)]
|
||||
)
|
||||
trow.extend(trow2)
|
||||
return trow
|
||||
|
||||
def display_event_row(self, event, event_ref, place_lat_long,
|
||||
@ -672,6 +680,12 @@ class BasePage: # pylint: disable=C1001
|
||||
for (label, colclass, data) in event_data
|
||||
)
|
||||
|
||||
trow2 = Html("tr")
|
||||
trow2 += Html("td", "", class_="ColumnSources")
|
||||
# get event source references
|
||||
srcrefs = self.get_citation_links(event.get_citation_list()) or " "
|
||||
trow2 += Html("td", srcrefs, class_="ColumnSources")
|
||||
|
||||
# get event notes
|
||||
notelist = event.get_note_list()
|
||||
notelist.extend(event_ref.get_note_list())
|
||||
@ -693,12 +707,9 @@ class BasePage: # pylint: disable=C1001
|
||||
if notelist:
|
||||
htmllist.extend(self.dump_notes(notelist))
|
||||
|
||||
trow += Html("td", htmllist, class_="ColumnNotes")
|
||||
|
||||
# get event source references
|
||||
srcrefs = self.get_citation_links(event.get_citation_list()) or " "
|
||||
trow += Html("td", srcrefs, class_="ColumnSources")
|
||||
trow2 += Html("td", htmllist, class_="ColumnNotes", colspan=2)
|
||||
|
||||
trow += trow2
|
||||
# return events table row to its callers
|
||||
return trow
|
||||
|
||||
@ -1485,7 +1496,7 @@ class BasePage: # pylint: disable=C1001
|
||||
("addressbook", self._("Address Book"),
|
||||
self.report.inc_addressbook),
|
||||
('contact', self._("Contact"), self.report.use_contact),
|
||||
('statistics', self._("Statistics"), True),
|
||||
('statistics', self._("Statistics"), self.report.inc_stats),
|
||||
(self.target_cal_uri, self._("Web Calendar"), self.usecal)
|
||||
]
|
||||
|
||||
|
@ -31,6 +31,7 @@ from unicodedata import normalize
|
||||
from collections import defaultdict
|
||||
from hashlib import md5
|
||||
import re
|
||||
import gc
|
||||
import logging
|
||||
from xml.sax.saxutils import escape
|
||||
|
||||
@ -859,4 +860,3 @@ def html_escape(text):
|
||||
text = text.replace("'", ''')
|
||||
|
||||
return text
|
||||
|
||||
|
@ -110,17 +110,18 @@ class EventPages(BasePage):
|
||||
for event_handle in event_handle_list:
|
||||
event = self.r_db.get_event_from_handle(event_handle)
|
||||
event_types.append(self._(event.get_type().xml_str()))
|
||||
with self.r_user.progress(_("Narrated Web Site Report"),
|
||||
_("Creating event pages"),
|
||||
message = _("Creating event pages")
|
||||
with self.r_user.progress(_("Narrated Web Site Report"), message,
|
||||
len(event_handle_list) + 1
|
||||
) as step:
|
||||
self.eventlistpage(self.report, title, event_types,
|
||||
event_handle_list)
|
||||
|
||||
index = 1
|
||||
for event_handle in event_handle_list:
|
||||
step()
|
||||
index += 1
|
||||
self.eventpage(self.report, title, event_handle)
|
||||
|
||||
step()
|
||||
self.eventlistpage(self.report, title, event_types,
|
||||
event_handle_list)
|
||||
|
||||
def eventlistpage(self, report, title, event_types, event_handle_list):
|
||||
"""
|
||||
|
@ -103,16 +103,18 @@ class FamilyPages(BasePage):
|
||||
for item in self.report.obj_dict[Family].items():
|
||||
LOG.debug(" %s", str(item))
|
||||
|
||||
with self.r_user.progress(_("Narrated Web Site Report"),
|
||||
_("Creating family pages..."),
|
||||
message = _("Creating family pages...")
|
||||
index = 1
|
||||
with self.r_user.progress(_("Narrated Web Site Report"), message,
|
||||
len(self.report.obj_dict[Family]) + 1
|
||||
) as step:
|
||||
self.familylistpage(self.report, title,
|
||||
self.report.obj_dict[Family].keys())
|
||||
|
||||
for family_handle in self.report.obj_dict[Family]:
|
||||
step()
|
||||
index += 1
|
||||
self.familypage(self.report, title, family_handle)
|
||||
step()
|
||||
self.familylistpage(self.report, title,
|
||||
self.report.obj_dict[Family].keys())
|
||||
|
||||
def familylistpage(self, report, title, fam_list):
|
||||
"""
|
||||
|
@ -94,6 +94,7 @@ class MediaPages(BasePage):
|
||||
"""
|
||||
BasePage.__init__(self, report, title="")
|
||||
self.media_dict = defaultdict(set)
|
||||
self.unused_media_handles = []
|
||||
|
||||
def display_pages(self, title):
|
||||
"""
|
||||
@ -105,9 +106,13 @@ class MediaPages(BasePage):
|
||||
LOG.debug("obj_dict[Media]")
|
||||
for item in self.report.obj_dict[Media].items():
|
||||
LOG.debug(" %s", str(item))
|
||||
with self.r_user.progress(_("Narrated Web Site Report"),
|
||||
_("Creating media pages"),
|
||||
len(self.report.obj_dict[Media]) + 1
|
||||
if self.create_unused_media:
|
||||
media_count = len(self.r_db.get_media_handles())
|
||||
else:
|
||||
media_count = len(self.report.obj_dict[Media])
|
||||
message = _("Creating media pages")
|
||||
with self.r_user.progress(_("Narrated Web Site Report"), message,
|
||||
media_count + 1
|
||||
) as step:
|
||||
# bug 8950 : it seems it's better to sort on desc + gid.
|
||||
def sort_by_desc_and_gid(obj):
|
||||
@ -116,24 +121,62 @@ class MediaPages(BasePage):
|
||||
"""
|
||||
return (obj.desc.lower(), obj.gramps_id)
|
||||
|
||||
self.unused_media_handles = []
|
||||
if self.create_unused_media:
|
||||
# add unused media
|
||||
media_list = self.r_db.get_media_handles()
|
||||
for media_ref in media_list:
|
||||
if media_ref not in self.report.obj_dict[Media]:
|
||||
self.unused_media_handles.append(media_ref)
|
||||
self.unused_media_handles = sorted(
|
||||
self.unused_media_handles,
|
||||
key=lambda x: sort_by_desc_and_gid(
|
||||
self.r_db.get_media_from_handle(x)))
|
||||
|
||||
sorted_media_handles = sorted(
|
||||
self.report.obj_dict[Media].keys(),
|
||||
key=lambda x: sort_by_desc_and_gid(
|
||||
self.r_db.get_media_from_handle(x)))
|
||||
self.medialistpage(self.report, title, sorted_media_handles)
|
||||
|
||||
prev = None
|
||||
total = len(sorted_media_handles)
|
||||
index = 1
|
||||
for handle in sorted_media_handles:
|
||||
gc.collect() # Reduce memory usage when there are many images.
|
||||
next_ = None if index == total else sorted_media_handles[index]
|
||||
step()
|
||||
if index == media_count:
|
||||
next_ = None
|
||||
elif index < total:
|
||||
next_ = sorted_media_handles[index]
|
||||
elif len(self.unused_media_handles) > 0:
|
||||
next_ = self.unused_media_handles[0]
|
||||
else:
|
||||
next_ = None
|
||||
self.mediapage(self.report, title,
|
||||
handle, (prev, next_, index, total))
|
||||
handle, (prev, next_, index, media_count))
|
||||
prev = handle
|
||||
step()
|
||||
index += 1
|
||||
|
||||
total = len(self.unused_media_handles)
|
||||
idx = 1
|
||||
prev = sorted_media_handles[len(sorted_media_handles)-1]
|
||||
if total > 0:
|
||||
for media_handle in self.unused_media_handles:
|
||||
media = self.r_db.get_media_from_handle(media_handle)
|
||||
gc.collect() # Reduce memory usage when many images.
|
||||
if index == media_count:
|
||||
next_ = None
|
||||
else:
|
||||
next_ = self.unused_media_handles[idx]
|
||||
self.mediapage(self.report, title,
|
||||
media_handle,
|
||||
(prev, next_, index, media_count))
|
||||
prev = media_handle
|
||||
step()
|
||||
index += 1
|
||||
idx += 1
|
||||
|
||||
self.medialistpage(self.report, title, sorted_media_handles)
|
||||
|
||||
def medialistpage(self, report, title, sorted_media_handles):
|
||||
"""
|
||||
Generate and output the Media index page.
|
||||
@ -191,85 +234,84 @@ class MediaPages(BasePage):
|
||||
table += tbody
|
||||
|
||||
index = 1
|
||||
for media_handle in sorted_media_handles:
|
||||
media = self.r_db.get_media_from_handle(media_handle)
|
||||
if media:
|
||||
if media.get_change_time() > ldatec:
|
||||
ldatec = media.get_change_time()
|
||||
title = media.get_description() or "[untitled]"
|
||||
if self.create_unused_media:
|
||||
media_count = len(self.r_db.get_media_handles())
|
||||
else:
|
||||
media_count = len(self.report.obj_dict[Media])
|
||||
message = _("Creating list of media pages")
|
||||
with self.r_user.progress(_("Narrated Web Site Report"),
|
||||
message, media_count + 1
|
||||
) as step:
|
||||
for media_handle in sorted_media_handles:
|
||||
media = self.r_db.get_media_from_handle(media_handle)
|
||||
if media:
|
||||
if media.get_change_time() > ldatec:
|
||||
ldatec = media.get_change_time()
|
||||
title = media.get_description() or "[untitled]"
|
||||
|
||||
trow = Html("tr")
|
||||
tbody += trow
|
||||
trow = Html("tr")
|
||||
tbody += trow
|
||||
|
||||
media_data_row = [
|
||||
[index, "ColumnRowLabel"],
|
||||
[self.media_ref_link(media_handle,
|
||||
title), "ColumnName"],
|
||||
[self.rlocale.get_date(media.get_date_object()),
|
||||
"ColumnDate"],
|
||||
[media.get_mime_type(), "ColumnMime"]]
|
||||
media_data_row = [
|
||||
[index, "ColumnRowLabel"],
|
||||
[self.media_ref_link(media_handle,
|
||||
title), "ColumnName"],
|
||||
[self.rlocale.get_date(media.get_date_object()),
|
||||
"ColumnDate"],
|
||||
[media.get_mime_type(), "ColumnMime"]]
|
||||
|
||||
trow.extend(
|
||||
Html("td", data, class_=colclass)
|
||||
for data, colclass in media_data_row
|
||||
)
|
||||
trow.extend(
|
||||
Html("td", data, class_=colclass)
|
||||
for data, colclass in media_data_row
|
||||
)
|
||||
step()
|
||||
index += 1
|
||||
|
||||
def sort_by_desc_and_gid(obj):
|
||||
"""
|
||||
Sort by media description and gramps ID
|
||||
"""
|
||||
return (obj.desc, obj.gramps_id)
|
||||
def sort_by_desc_and_gid(obj):
|
||||
"""
|
||||
Sort by media description and gramps ID
|
||||
"""
|
||||
return (obj.desc, obj.gramps_id)
|
||||
|
||||
unused_media_handles = []
|
||||
if self.create_unused_media:
|
||||
# add unused media
|
||||
media_list = self.r_db.get_media_handles()
|
||||
for media_ref in media_list:
|
||||
if media_ref not in self.report.obj_dict[Media]:
|
||||
unused_media_handles.append(media_ref)
|
||||
unused_media_handles = sorted(
|
||||
unused_media_handles,
|
||||
key=lambda x: sort_by_desc_and_gid(
|
||||
self.r_db.get_media_from_handle(x)))
|
||||
|
||||
idx = 1
|
||||
prev = None
|
||||
total = len(unused_media_handles)
|
||||
if total > 0:
|
||||
trow += Html("tr")
|
||||
trow.extend(
|
||||
Html("td", Html("h4", " "), inline=True) +
|
||||
Html("td",
|
||||
Html("h4",
|
||||
self._("Below unused media objects"),
|
||||
inline=True),
|
||||
class_="") +
|
||||
Html("td", Html("h4", " "), inline=True) +
|
||||
Html("td", Html("h4", " "), inline=True)
|
||||
)
|
||||
for media_handle in unused_media_handles:
|
||||
media = self.r_db.get_media_from_handle(media_handle)
|
||||
gc.collect() # Reduce memory usage when many images.
|
||||
next_ = None if idx == total else unused_media_handles[idx]
|
||||
trow += Html("tr")
|
||||
media_data_row = [
|
||||
[index, "ColumnRowLabel"],
|
||||
[self.media_ref_link(media_handle,
|
||||
media.get_description()),
|
||||
"ColumnName"],
|
||||
[self.rlocale.get_date(media.get_date_object()),
|
||||
"ColumnDate"],
|
||||
[media.get_mime_type(), "ColumnMime"]]
|
||||
trow.extend(
|
||||
Html("td", data, class_=colclass)
|
||||
for data, colclass in media_data_row
|
||||
)
|
||||
self.mediapage(self.report, title,
|
||||
media_handle, (prev, next_, index, total))
|
||||
prev = media_handle
|
||||
index += 1
|
||||
idx += 1
|
||||
idx = 1
|
||||
prev = None
|
||||
total = len(self.unused_media_handles)
|
||||
if total > 0:
|
||||
trow += Html("tr")
|
||||
trow.extend(
|
||||
Html("td", Html("h4", " "), inline=True) +
|
||||
Html("td",
|
||||
Html("h4",
|
||||
self._("Below unused media objects"),
|
||||
inline=True),
|
||||
class_="") +
|
||||
Html("td", Html("h4", " "), inline=True) +
|
||||
Html("td", Html("h4", " "), inline=True)
|
||||
)
|
||||
for media_handle in self.unused_media_handles:
|
||||
media = self.r_db.get_media_from_handle(media_handle)
|
||||
gc.collect() # Reduce memory usage when many images.
|
||||
if idx == total:
|
||||
next_ = None
|
||||
else:
|
||||
self.unused_media_handles[idx]
|
||||
trow += Html("tr")
|
||||
media_data_row = [
|
||||
[index, "ColumnRowLabel"],
|
||||
[self.media_ref_link(media_handle,
|
||||
media.get_description()),
|
||||
"ColumnName"],
|
||||
[self.rlocale.get_date(media.get_date_object()),
|
||||
"ColumnDate"],
|
||||
[media.get_mime_type(), "ColumnMime"]]
|
||||
trow.extend(
|
||||
Html("td", data, class_=colclass)
|
||||
for data, colclass in media_data_row
|
||||
)
|
||||
prev = media_handle
|
||||
step()
|
||||
index += 1
|
||||
idx += 1
|
||||
|
||||
# add footer section
|
||||
# add clearline for proper styling
|
||||
|
@ -194,6 +194,8 @@ class NavWebReport(Report):
|
||||
self.use_intro = self.options['intronote'] or self.options['introimg']
|
||||
self.use_home = self.options['homenote'] or self.options['homeimg']
|
||||
self.use_contact = self.opts['contactnote'] or self.opts['contactimg']
|
||||
self.inc_stats = self.opts['inc_stats']
|
||||
self.create_unused_media = self.opts['unused']
|
||||
|
||||
# Do we need to include this in a cms ?
|
||||
self.usecms = self.options['usecms']
|
||||
@ -429,7 +431,8 @@ class NavWebReport(Report):
|
||||
self.tab["Source"].display_pages(self.title)
|
||||
|
||||
# build classes StatisticsPage
|
||||
self.statistics_preview_page(self.title)
|
||||
if self.inc_stats:
|
||||
self.statistics_preview_page(self.title)
|
||||
|
||||
# copy all of the neccessary files
|
||||
self.copy_narrated_files()
|
||||
@ -446,6 +449,7 @@ class NavWebReport(Report):
|
||||
if len(_WRONGMEDIAPATH) > 10:
|
||||
error += '\n ...'
|
||||
self.user.warn(_("Missing media objects:"), error)
|
||||
self.database.clear_cache()
|
||||
|
||||
def _build_obj_dict(self):
|
||||
"""
|
||||
@ -476,12 +480,14 @@ class NavWebReport(Report):
|
||||
ind_list = self._db.iter_person_handles()
|
||||
ind_list = self.filter.apply(self._db, ind_list, user=self.user)
|
||||
|
||||
with self.user.progress(_("Narrated Web Site Report"),
|
||||
_('Constructing list of other objects...'),
|
||||
message = _('Constructing list of other objects...')
|
||||
with self.user.progress(_("Narrated Web Site Report"), message,
|
||||
sum(1 for _ in ind_list)) as step:
|
||||
index = 1
|
||||
for handle in ind_list:
|
||||
step()
|
||||
self._add_person(handle, "", "")
|
||||
step()
|
||||
index += 1
|
||||
|
||||
LOG.debug("final object dictionary \n" +
|
||||
"".join(("%s: %s\n" % item)
|
||||
@ -1041,13 +1047,15 @@ class NavWebReport(Report):
|
||||
@param: ind_list -- The list of person to use
|
||||
"""
|
||||
if self.inc_gendex:
|
||||
with self.user.progress(_("Narrated Web Site Report"),
|
||||
_('Creating GENDEX file'),
|
||||
message = _('Creating GENDEX file')
|
||||
with self.user.progress(_("Narrated Web Site Report"), message,
|
||||
len(ind_list)) as step:
|
||||
fp_gendex, gendex_io = self.create_file("gendex", ext=".txt")
|
||||
date = 0
|
||||
index = 1
|
||||
for person_handle in ind_list:
|
||||
step()
|
||||
index += 1
|
||||
person = self._db.get_person_from_handle(person_handle)
|
||||
datex = person.get_change_time()
|
||||
if datex > date:
|
||||
@ -1097,29 +1105,35 @@ class NavWebReport(Report):
|
||||
"""
|
||||
local_list = sort_people(self._db, ind_list, self.rlocale)
|
||||
|
||||
with self.user.progress(_("Narrated Web Site Report"),
|
||||
_("Creating surname pages"),
|
||||
message = _("Creating surname pages")
|
||||
with self.user.progress(_("Narrated Web Site Report"), message,
|
||||
len(local_list)) as step:
|
||||
|
||||
SurnameListPage(self, self.title, ind_list,
|
||||
SurnameListPage.ORDER_BY_NAME,
|
||||
self.surname_fname)
|
||||
SurnameListPage.ORDER_BY_NAME,
|
||||
self.surname_fname)
|
||||
|
||||
SurnameListPage(self, self.title, ind_list,
|
||||
SurnameListPage.ORDER_BY_COUNT,
|
||||
"surnames_count")
|
||||
SurnameListPage.ORDER_BY_COUNT,
|
||||
"surnames_count")
|
||||
|
||||
index = 1
|
||||
for (surname, handle_list) in local_list:
|
||||
SurnamePage(self, self.title, surname, sorted(handle_list))
|
||||
step()
|
||||
index += 1
|
||||
|
||||
def thumbnail_preview_page(self):
|
||||
"""
|
||||
creates the thumbnail preview page
|
||||
"""
|
||||
if self.create_unused_media:
|
||||
media_count = len(self._db.get_media_handles())
|
||||
else:
|
||||
media_count = len(self.obj_dict[Media])
|
||||
with self.user.progress(_("Narrated Web Site Report"),
|
||||
_("Creating thumbnail preview page..."),
|
||||
len(self.obj_dict[Media])) as step:
|
||||
media_count) as step:
|
||||
ThumbnailPreviewPage(self, self.title, step)
|
||||
|
||||
def statistics_preview_page(self, title):
|
||||
@ -1128,7 +1142,7 @@ class NavWebReport(Report):
|
||||
"""
|
||||
with self.user.progress(_("Narrated Web Site Report"),
|
||||
_("Creating statistics page..."),
|
||||
len(self.obj_dict[Media])) as step:
|
||||
1) as step:
|
||||
StatisticsPage(self, title, step)
|
||||
|
||||
def addressbook_pages(self, ind_list):
|
||||
@ -1168,12 +1182,14 @@ class NavWebReport(Report):
|
||||
# begin Address Book pages
|
||||
addr_size = len(url_addr_res)
|
||||
|
||||
with self.user.progress(_("Narrated Web Site Report"),
|
||||
_("Creating address book pages ..."),
|
||||
message = _("Creating address book pages ...")
|
||||
with self.user.progress(_("Narrated Web Site Report"), message,
|
||||
addr_size) as step:
|
||||
index = 1
|
||||
for (sort_name, person_handle, add, res, url) in url_addr_res:
|
||||
AddressBookPage(self, self.title, person_handle, add, res, url)
|
||||
step()
|
||||
index += 1
|
||||
|
||||
def base_pages(self):
|
||||
"""
|
||||
@ -1911,6 +1927,10 @@ class NavWebOptions(MenuReportOptions):
|
||||
"events."))
|
||||
addopt("inc_addressbook", inc_addressbook)
|
||||
|
||||
inc_statistics = BooleanOption(_("Include the statistics page"), False)
|
||||
inc_statistics.set_help(_("Whether or not to add statistics page"))
|
||||
addopt("inc_stats", inc_statistics)
|
||||
|
||||
def __add_place_map_options(self, menu):
|
||||
"""
|
||||
options for the Place Map tab.
|
||||
|
@ -130,16 +130,19 @@ class PersonPages(BasePage):
|
||||
LOG.debug("obj_dict[Person]")
|
||||
for item in self.report.obj_dict[Person].items():
|
||||
LOG.debug(" %s", str(item))
|
||||
with self.r_user.progress(_("Narrated Web Site Report"),
|
||||
_('Creating individual pages'),
|
||||
message = _('Creating individual pages')
|
||||
with self.r_user.progress(_("Narrated Web Site Report"), message,
|
||||
len(self.report.obj_dict[Person]) + 1
|
||||
) as step:
|
||||
self.individuallistpage(self.report, title,
|
||||
self.report.obj_dict[Person].keys())
|
||||
index = 1
|
||||
for person_handle in sorted(self.report.obj_dict[Person]):
|
||||
step()
|
||||
index += 1
|
||||
person = self.r_db.get_person_from_handle(person_handle)
|
||||
self.individualpage(self.report, title, person)
|
||||
step()
|
||||
self.individuallistpage(self.report, title,
|
||||
self.report.obj_dict[Person].keys())
|
||||
|
||||
#################################################
|
||||
#
|
||||
|
@ -110,17 +110,18 @@ class PlacePages(BasePage):
|
||||
LOG.debug("obj_dict[Place]")
|
||||
for item in self.report.obj_dict[Place].items():
|
||||
LOG.debug(" %s", str(item))
|
||||
with self.r_user.progress(_("Narrated Web Site Report"),
|
||||
_("Creating place pages"),
|
||||
message = _("Creating place pages")
|
||||
with self.r_user.progress(_("Narrated Web Site Report"), message,
|
||||
len(self.report.obj_dict[Place]) + 1
|
||||
) as step:
|
||||
|
||||
self.placelistpage(self.report, title,
|
||||
self.report.obj_dict[Place].keys())
|
||||
|
||||
index = 1
|
||||
for place_handle in self.report.obj_dict[Place]:
|
||||
step()
|
||||
index += 1
|
||||
self.placepage(self.report, title, place_handle)
|
||||
step()
|
||||
self.placelistpage(self.report, title,
|
||||
self.report.obj_dict[Place].keys())
|
||||
|
||||
def placelistpage(self, report, title, place_handles):
|
||||
"""
|
||||
|
@ -98,8 +98,8 @@ class RepositoryPages(BasePage):
|
||||
LOG.debug(" %s", str(item))
|
||||
|
||||
# set progress bar pass for Repositories
|
||||
with self.r_user.progress(_("Narrated Web Site Report"),
|
||||
_('Creating repository pages'),
|
||||
message = _('Creating repository pages')
|
||||
with self.r_user.progress(_("Narrated Web Site Report"), message,
|
||||
len(self.report.obj_dict[Repository]) + 1
|
||||
) as step:
|
||||
# Sort the repositories
|
||||
@ -114,10 +114,11 @@ class RepositoryPages(BasePage):
|
||||
# RepositoryListPage Class
|
||||
self.repositorylistpage(self.report, title, repos_dict, keys)
|
||||
|
||||
idx = 1
|
||||
for index, key in enumerate(keys):
|
||||
(repo, handle) = repos_dict[key]
|
||||
|
||||
step()
|
||||
idx += 1
|
||||
self.repositorypage(self.report, title, repo, handle)
|
||||
|
||||
def repositorylistpage(self, report, title, repos_dict, keys):
|
||||
|
@ -99,15 +99,17 @@ class SourcePages(BasePage):
|
||||
LOG.debug("obj_dict[Source]")
|
||||
for item in self.report.obj_dict[Source].items():
|
||||
LOG.debug(" %s", str(item))
|
||||
with self.r_user.progress(_("Narrated Web Site Report"),
|
||||
_("Creating source pages"),
|
||||
message = _("Creating source pages")
|
||||
with self.r_user.progress(_("Narrated Web Site Report"), message,
|
||||
len(self.report.obj_dict[Source]) + 1
|
||||
) as step:
|
||||
self.sourcelistpage(self.report, title,
|
||||
self.report.obj_dict[Source].keys())
|
||||
|
||||
index = 1
|
||||
for source_handle in self.report.obj_dict[Source]:
|
||||
step()
|
||||
index += 1
|
||||
self.sourcepage(self.report, title, source_handle)
|
||||
|
||||
def sourcelistpage(self, report, title, source_handles):
|
||||
|
@ -86,6 +86,7 @@ class StatisticsPage(BasePage):
|
||||
females,
|
||||
unknown) = self.get_gender(report.database.iter_person_handles())
|
||||
|
||||
step()
|
||||
mobjects = report.database.get_number_of_media()
|
||||
npersons = report.database.get_number_of_people()
|
||||
nfamilies = report.database.get_number_of_families()
|
||||
|
@ -122,7 +122,7 @@ class ThumbnailPreviewPage(BasePage):
|
||||
"will take you to that image’s page.")
|
||||
previewpage += Html("p", msg, id="description")
|
||||
|
||||
with Html("table", class_="calendar") as table:
|
||||
with Html("table", class_="calendar thumbnails") as table:
|
||||
previewpage += table
|
||||
|
||||
thead = Html("thead")
|
||||
@ -153,7 +153,7 @@ class ThumbnailPreviewPage(BasePage):
|
||||
num_of_cols = 7
|
||||
grid_row = 0
|
||||
while grid_row < num_of_rows:
|
||||
trow = Html("tr", id="RowNumber: %08d" % grid_row)
|
||||
trow = Html("tr", class_="thumbnail", id="RowNumber: %08d" % grid_row)
|
||||
tbody += trow
|
||||
|
||||
cols = 0
|
||||
@ -163,7 +163,7 @@ class ThumbnailPreviewPage(BasePage):
|
||||
photo = media_list[indexpos][2]
|
||||
|
||||
# begin table cell and attach to table row(trow)...
|
||||
tcell = Html("td", class_="highlight weekend")
|
||||
tcell = Html("td", class_="highlight weekend thumbnail")
|
||||
trow += tcell
|
||||
|
||||
# attach index number...
|
||||
@ -203,6 +203,7 @@ class ThumbnailPreviewPage(BasePage):
|
||||
for emptycols in range(cols, num_of_cols):
|
||||
trow += Html("td", class_="emptyDays", inline=True)
|
||||
|
||||
message = _("Creating thumbnail preview page...")
|
||||
# begin Thumbnail Reference section...
|
||||
with Html("div", class_="subsection", id="references") as section:
|
||||
body += section
|
||||
@ -225,11 +226,12 @@ class ThumbnailPreviewPage(BasePage):
|
||||
tcell2 = Html("td", ptitle, class_="ColumnName")
|
||||
trow += (tcell1, tcell2)
|
||||
|
||||
# increase progress meter...
|
||||
cb_progress()
|
||||
|
||||
# increase index for row number...
|
||||
index += 1
|
||||
|
||||
# increase progress meter...
|
||||
cb_progress()
|
||||
|
||||
# add body id element
|
||||
body.attr = 'id ="ThumbnailPreview"'
|
||||
|
Loading…
Reference in New Issue
Block a user