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:
Serge Noiraud 2018-01-18 09:03:11 +01:00 committed by GitHub
parent 3c8cba0301
commit 3615e75d16
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
16 changed files with 258 additions and 171 deletions

View File

@ -288,10 +288,6 @@ table.infolist thead tr th {
table.infolist tr td { table.infolist tr td {
border-bottom: dashed 1px #000; border-bottom: dashed 1px #000;
vertical-align: middle; 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 { table.infolist tr.BeginLetter td, table.infolist tr.BeginSurname td {
border-top: solid 1px #000; border-top: solid 1px #000;
@ -351,15 +347,15 @@ div#Individuals {
margin: 0; margin: 0;
padding: 0; padding: 0;
} }
div#Individuals table.individuallist { div#Individuals table.IndividualList {
border-bottom: solid 1px #000; border-bottom: solid 1px #000;
} }
div#Individuals table.individuallist tbody tr td.ColumnSurname a:hover, 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:active {
cursor: default; cursor: default;
background: none; background: none;
} }
div#Individuals table.individuallist tbody tr td.ColumnName a { div#Individuals table.IndividualList tbody tr td.ColumnName a {
vertical-align: middle; vertical-align: middle;
} }
div#Individuals div table.infolist tr td p { div#Individuals div table.infolist tr td p {
@ -1129,9 +1125,10 @@ div.narrative {
} }
.narrative p { .narrative p {
font: normal .9em/1.4em sans-serif; font: normal .9em/1.4em sans-serif;
margin-top: .5em; margin: 0.1em 0 0.2em 0;
margin-bottom: 0; }
padding: 0 20px 1em 20px; i + div.grampsstylednote p {
margin: 0.1em 0 0.2em 0;
} }
/* Subsections : References /* Subsections : References

View File

@ -276,7 +276,6 @@ table.infolist tr th a:hover {
table.infolist tr td { table.infolist tr td {
font:normal 1.1em/1.4em serif; font:normal 1.1em/1.4em serif;
vertical-align:middle; vertical-align:middle;
padding:.1em 10px;
} }
table.infolist tr td a { table.infolist tr td a {
display:block; display:block;
@ -396,30 +395,30 @@ table.surname thead tr th.ColumnParents, table.surname tbody tr td.ColumnParents
/* Individuals /* Individuals
----------------------------------------------------- */ ----------------------------------------------------- */
#Individuals { } #Individuals { }
#Individuals table.individuallist { #Individuals table.IndividualList {
border-bottom:solid 1px #A97; border-bottom:solid 1px #A97;
} }
#Individuals table.individuallist tbody tr td { #Individuals table.IndividualList tbody tr td {
border-bottom:dashed 1px #C1B398; border-bottom:dashed 1px #C1B398;
} }
#Individuals table.individuallist tbody tr td a:hover { #Individuals table.IndividualList tbody tr td a:hover {
text-decoration:none; 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; cursor:default;
color:black; color:black;
background:none; background:none;
} }
table.individuallist tbody tr td.ColumnName { table.IndividualList tbody tr td.ColumnName {
padding:0; padding:0;
background-color:#FFF; background-color:#FFF;
} }
table.individuallist tbody tr td.ColumnName a { table.IndividualList tbody tr td.ColumnName a {
display:block; display:block;
padding:.6em 10px; padding:.1em .1em;
vertical-align:middle; vertical-align:middle;
} }
table.individuallist tbody tr td.ColumnName a:hover { table.IndividualList tbody tr td.ColumnName a:hover {
background-color:#C1B398; background-color:#C1B398;
} }
#Individuals div table.infolist tr td p { #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 { div.narrative {
padding-bottom:0; padding-bottom:0;
} }
i + div.grampsstylednote p {
margin: 0.1em 0 0.2em 0;
}
.narrative p { .narrative p {
margin: 0.1em 0 0.2em 0;
font:normal .9em/1.4em sans-serif; font:normal .9em/1.4em sans-serif;
margin-top:.5em;
margin-bottom:0;
padding:0 20px 1em 20px;
} }
/* Subsections : References /* Subsections : References

View File

@ -454,30 +454,30 @@ div#Individuals {
margin: 0; margin: 0;
padding: 0; padding: 0;
} }
div#Individuals table.individuallist { div#Individuals table.IndividualList {
border-bottom: solid 1px #5D835F; border-bottom: solid 1px #5D835F;
} }
div#Individuals table.individuallist tbody tr td { div#Individuals table.IndividualList tbody tr td {
border-bottom: dashed 1px #5D835F; border-bottom: dashed 1px #5D835F;
background-color: #D8F3D6; background-color: #D8F3D6;
} }
div#Individuals table.individuallist tbody tr td a { div#Individuals table.IndividualList tbody tr td a {
display: block; display: block;
padding: .6em 10px; padding: .6em 10px;
} }
div#Individuals table.individuallist tbody tr td.ColumnSurname a:hover, 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:active {
cursor:default; cursor:default;
color: #000; color: #000;
background:none; background:none;
} }
div#Individuals table.individuallist tbody tr td.ColumnName { div#Individuals table.IndividualList tbody tr td.ColumnName {
background-color: #FFF; background-color: #FFF;
} }
div#Individuals table.individuallist tbody tr td.ColumnName a { div#Individuals table.IndividualList tbody tr td.ColumnName a {
vertical-align:middle; vertical-align:middle;
} }
div#Individuals table.individuallist tbody tr td.ColumnPartner { div#Individuals table.IndividualList tbody tr td.ColumnPartner {
background-color: #FFF; background-color: #FFF;
} }
div#Individuals div table.infolist tr td p { div#Individuals div table.infolist tr td p {

View File

@ -33,7 +33,9 @@ body#FamilyMap {
border: solid 4px #000; border: solid 4px #000;
margin: 0px auto; margin: 0px auto;
width: 800px; width: 800px;
height: 800px; height: 400px;
max-width: 90%;
max-height: 90%;
} }
/* Place Maps /* Place Maps
@ -43,6 +45,8 @@ div#place_canvas {
border: solid 4px #000; border: solid 4px #000;
width: 500px; width: 500px;
height: 400px; height: 400px;
max-width: 90%;
max-height: 90%;
} }
button#drop { button#drop {
background-color: purple; background-color: purple;

View File

@ -612,17 +612,25 @@ class BasePage: # pylint: disable=C1001
""" """
creates the event header row for all events creates the event header row for all events
""" """
trow = Html("tr") trow = Html("tr", close=None)
trow.extend( trow.extend(
Html("th", trans, class_=colclass, inline=True) Html("th", trans, class_=colclass, inline=True)
for trans, colclass in [ for trans, colclass in [
(self._("Event"), "ColumnEvent"), (self._("Event"), "ColumnEvent"),
(self._("Date"), "ColumnDate"), (self._("Date"), "ColumnDate"),
(self._("Place"), "ColumnPlace"), (self._("Place"), "ColumnPlace"),
(self._("Description"), "ColumnDescription"), (self._("Description"), "ColumnDescription")]
(self._("Notes"), "ColumnNotes"),
(self._("Sources"), "ColumnSources")]
) )
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 return trow
def display_event_row(self, event, event_ref, place_lat_long, 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 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 # get event notes
notelist = event.get_note_list() notelist = event.get_note_list()
notelist.extend(event_ref.get_note_list()) notelist.extend(event_ref.get_note_list())
@ -693,12 +707,9 @@ class BasePage: # pylint: disable=C1001
if notelist: if notelist:
htmllist.extend(self.dump_notes(notelist)) htmllist.extend(self.dump_notes(notelist))
trow += Html("td", htmllist, class_="ColumnNotes") trow2 += Html("td", htmllist, class_="ColumnNotes", colspan=2)
# get event source references
srcrefs = self.get_citation_links(event.get_citation_list()) or " "
trow += Html("td", srcrefs, class_="ColumnSources")
trow += trow2
# return events table row to its callers # return events table row to its callers
return trow return trow
@ -1485,7 +1496,7 @@ class BasePage: # pylint: disable=C1001
("addressbook", self._("Address Book"), ("addressbook", self._("Address Book"),
self.report.inc_addressbook), self.report.inc_addressbook),
('contact', self._("Contact"), self.report.use_contact), ('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) (self.target_cal_uri, self._("Web Calendar"), self.usecal)
] ]

View File

@ -31,6 +31,7 @@ from unicodedata import normalize
from collections import defaultdict from collections import defaultdict
from hashlib import md5 from hashlib import md5
import re import re
import gc
import logging import logging
from xml.sax.saxutils import escape from xml.sax.saxutils import escape
@ -859,4 +860,3 @@ def html_escape(text):
text = text.replace("'", ''') text = text.replace("'", ''')
return text return text

View File

@ -110,17 +110,18 @@ class EventPages(BasePage):
for event_handle in event_handle_list: for event_handle in event_handle_list:
event = self.r_db.get_event_from_handle(event_handle) event = self.r_db.get_event_from_handle(event_handle)
event_types.append(self._(event.get_type().xml_str())) event_types.append(self._(event.get_type().xml_str()))
with self.r_user.progress(_("Narrated Web Site Report"), message = _("Creating event pages")
_("Creating event pages"), with self.r_user.progress(_("Narrated Web Site Report"), message,
len(event_handle_list) + 1 len(event_handle_list) + 1
) as step: ) as step:
self.eventlistpage(self.report, title, event_types, index = 1
event_handle_list)
for event_handle in event_handle_list: for event_handle in event_handle_list:
step() step()
index += 1
self.eventpage(self.report, title, event_handle) 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): def eventlistpage(self, report, title, event_types, event_handle_list):
""" """

View File

@ -103,16 +103,18 @@ class FamilyPages(BasePage):
for item in self.report.obj_dict[Family].items(): for item in self.report.obj_dict[Family].items():
LOG.debug(" %s", str(item)) LOG.debug(" %s", str(item))
with self.r_user.progress(_("Narrated Web Site Report"), message = _("Creating family pages...")
_("Creating family pages..."), index = 1
with self.r_user.progress(_("Narrated Web Site Report"), message,
len(self.report.obj_dict[Family]) + 1 len(self.report.obj_dict[Family]) + 1
) as step: ) as step:
self.familylistpage(self.report, title,
self.report.obj_dict[Family].keys())
for family_handle in self.report.obj_dict[Family]: for family_handle in self.report.obj_dict[Family]:
step() step()
index += 1
self.familypage(self.report, title, family_handle) 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): def familylistpage(self, report, title, fam_list):
""" """

View File

@ -94,6 +94,7 @@ class MediaPages(BasePage):
""" """
BasePage.__init__(self, report, title="") BasePage.__init__(self, report, title="")
self.media_dict = defaultdict(set) self.media_dict = defaultdict(set)
self.unused_media_handles = []
def display_pages(self, title): def display_pages(self, title):
""" """
@ -105,9 +106,13 @@ class MediaPages(BasePage):
LOG.debug("obj_dict[Media]") LOG.debug("obj_dict[Media]")
for item in self.report.obj_dict[Media].items(): for item in self.report.obj_dict[Media].items():
LOG.debug(" %s", str(item)) LOG.debug(" %s", str(item))
with self.r_user.progress(_("Narrated Web Site Report"), if self.create_unused_media:
_("Creating media pages"), media_count = len(self.r_db.get_media_handles())
len(self.report.obj_dict[Media]) + 1 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: ) as step:
# bug 8950 : it seems it's better to sort on desc + gid. # bug 8950 : it seems it's better to sort on desc + gid.
def sort_by_desc_and_gid(obj): def sort_by_desc_and_gid(obj):
@ -116,24 +121,62 @@ class MediaPages(BasePage):
""" """
return (obj.desc.lower(), obj.gramps_id) 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( sorted_media_handles = sorted(
self.report.obj_dict[Media].keys(), self.report.obj_dict[Media].keys(),
key=lambda x: sort_by_desc_and_gid( key=lambda x: sort_by_desc_and_gid(
self.r_db.get_media_from_handle(x))) self.r_db.get_media_from_handle(x)))
self.medialistpage(self.report, title, sorted_media_handles)
prev = None prev = None
total = len(sorted_media_handles) total = len(sorted_media_handles)
index = 1 index = 1
for handle in sorted_media_handles: for handle in sorted_media_handles:
gc.collect() # Reduce memory usage when there are many images. gc.collect() # Reduce memory usage when there are many images.
next_ = None if index == total else sorted_media_handles[index] if index == media_count:
step() 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, self.mediapage(self.report, title,
handle, (prev, next_, index, total)) handle, (prev, next_, index, media_count))
prev = handle prev = handle
step()
index += 1 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): def medialistpage(self, report, title, sorted_media_handles):
""" """
Generate and output the Media index page. Generate and output the Media index page.
@ -191,85 +234,84 @@ class MediaPages(BasePage):
table += tbody table += tbody
index = 1 index = 1
for media_handle in sorted_media_handles: if self.create_unused_media:
media = self.r_db.get_media_from_handle(media_handle) media_count = len(self.r_db.get_media_handles())
if media: else:
if media.get_change_time() > ldatec: media_count = len(self.report.obj_dict[Media])
ldatec = media.get_change_time() message = _("Creating list of media pages")
title = media.get_description() or "[untitled]" 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") trow = Html("tr")
tbody += trow tbody += trow
media_data_row = [ media_data_row = [
[index, "ColumnRowLabel"], [index, "ColumnRowLabel"],
[self.media_ref_link(media_handle, [self.media_ref_link(media_handle,
title), "ColumnName"], title), "ColumnName"],
[self.rlocale.get_date(media.get_date_object()), [self.rlocale.get_date(media.get_date_object()),
"ColumnDate"], "ColumnDate"],
[media.get_mime_type(), "ColumnMime"]] [media.get_mime_type(), "ColumnMime"]]
trow.extend( trow.extend(
Html("td", data, class_=colclass) Html("td", data, class_=colclass)
for data, colclass in media_data_row for data, colclass in media_data_row
) )
step()
index += 1 index += 1
def sort_by_desc_and_gid(obj): def sort_by_desc_and_gid(obj):
""" """
Sort by media description and gramps ID Sort by media description and gramps ID
""" """
return (obj.desc, obj.gramps_id) return (obj.desc, obj.gramps_id)
unused_media_handles = [] idx = 1
if self.create_unused_media: prev = None
# add unused media total = len(self.unused_media_handles)
media_list = self.r_db.get_media_handles() if total > 0:
for media_ref in media_list: trow += Html("tr")
if media_ref not in self.report.obj_dict[Media]: trow.extend(
unused_media_handles.append(media_ref) Html("td", Html("h4", " "), inline=True) +
unused_media_handles = sorted( Html("td",
unused_media_handles, Html("h4",
key=lambda x: sort_by_desc_and_gid( self._("Below unused media objects"),
self.r_db.get_media_from_handle(x))) inline=True),
class_="") +
idx = 1 Html("td", Html("h4", " "), inline=True) +
prev = None Html("td", Html("h4", " "), inline=True)
total = len(unused_media_handles) )
if total > 0: for media_handle in self.unused_media_handles:
trow += Html("tr") media = self.r_db.get_media_from_handle(media_handle)
trow.extend( gc.collect() # Reduce memory usage when many images.
Html("td", Html("h4", " "), inline=True) + if idx == total:
Html("td", next_ = None
Html("h4", else:
self._("Below unused media objects"), self.unused_media_handles[idx]
inline=True), trow += Html("tr")
class_="") + media_data_row = [
Html("td", Html("h4", " "), inline=True) + [index, "ColumnRowLabel"],
Html("td", Html("h4", " "), inline=True) [self.media_ref_link(media_handle,
) media.get_description()),
for media_handle in unused_media_handles: "ColumnName"],
media = self.r_db.get_media_from_handle(media_handle) [self.rlocale.get_date(media.get_date_object()),
gc.collect() # Reduce memory usage when many images. "ColumnDate"],
next_ = None if idx == total else unused_media_handles[idx] [media.get_mime_type(), "ColumnMime"]]
trow += Html("tr") trow.extend(
media_data_row = [ Html("td", data, class_=colclass)
[index, "ColumnRowLabel"], for data, colclass in media_data_row
[self.media_ref_link(media_handle, )
media.get_description()), prev = media_handle
"ColumnName"], step()
[self.rlocale.get_date(media.get_date_object()), index += 1
"ColumnDate"], idx += 1
[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
# add footer section # add footer section
# add clearline for proper styling # add clearline for proper styling

View File

@ -194,6 +194,8 @@ class NavWebReport(Report):
self.use_intro = self.options['intronote'] or self.options['introimg'] self.use_intro = self.options['intronote'] or self.options['introimg']
self.use_home = self.options['homenote'] or self.options['homeimg'] self.use_home = self.options['homenote'] or self.options['homeimg']
self.use_contact = self.opts['contactnote'] or self.opts['contactimg'] 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 ? # Do we need to include this in a cms ?
self.usecms = self.options['usecms'] self.usecms = self.options['usecms']
@ -429,7 +431,8 @@ class NavWebReport(Report):
self.tab["Source"].display_pages(self.title) self.tab["Source"].display_pages(self.title)
# build classes StatisticsPage # 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 # copy all of the neccessary files
self.copy_narrated_files() self.copy_narrated_files()
@ -446,6 +449,7 @@ class NavWebReport(Report):
if len(_WRONGMEDIAPATH) > 10: if len(_WRONGMEDIAPATH) > 10:
error += '\n ...' error += '\n ...'
self.user.warn(_("Missing media objects:"), error) self.user.warn(_("Missing media objects:"), error)
self.database.clear_cache()
def _build_obj_dict(self): def _build_obj_dict(self):
""" """
@ -476,12 +480,14 @@ class NavWebReport(Report):
ind_list = self._db.iter_person_handles() ind_list = self._db.iter_person_handles()
ind_list = self.filter.apply(self._db, ind_list, user=self.user) ind_list = self.filter.apply(self._db, ind_list, user=self.user)
with self.user.progress(_("Narrated Web Site Report"), message = _('Constructing list of other objects...')
_('Constructing list of other objects...'), with self.user.progress(_("Narrated Web Site Report"), message,
sum(1 for _ in ind_list)) as step: sum(1 for _ in ind_list)) as step:
index = 1
for handle in ind_list: for handle in ind_list:
step()
self._add_person(handle, "", "") self._add_person(handle, "", "")
step()
index += 1
LOG.debug("final object dictionary \n" + LOG.debug("final object dictionary \n" +
"".join(("%s: %s\n" % item) "".join(("%s: %s\n" % item)
@ -1041,13 +1047,15 @@ class NavWebReport(Report):
@param: ind_list -- The list of person to use @param: ind_list -- The list of person to use
""" """
if self.inc_gendex: if self.inc_gendex:
with self.user.progress(_("Narrated Web Site Report"), message = _('Creating GENDEX file')
_('Creating GENDEX file'), with self.user.progress(_("Narrated Web Site Report"), message,
len(ind_list)) as step: len(ind_list)) as step:
fp_gendex, gendex_io = self.create_file("gendex", ext=".txt") fp_gendex, gendex_io = self.create_file("gendex", ext=".txt")
date = 0 date = 0
index = 1
for person_handle in ind_list: for person_handle in ind_list:
step() step()
index += 1
person = self._db.get_person_from_handle(person_handle) person = self._db.get_person_from_handle(person_handle)
datex = person.get_change_time() datex = person.get_change_time()
if datex > date: if datex > date:
@ -1097,29 +1105,35 @@ class NavWebReport(Report):
""" """
local_list = sort_people(self._db, ind_list, self.rlocale) local_list = sort_people(self._db, ind_list, self.rlocale)
with self.user.progress(_("Narrated Web Site Report"), message = _("Creating surname pages")
_("Creating surname pages"), with self.user.progress(_("Narrated Web Site Report"), message,
len(local_list)) as step: len(local_list)) as step:
SurnameListPage(self, self.title, ind_list, SurnameListPage(self, self.title, ind_list,
SurnameListPage.ORDER_BY_NAME, SurnameListPage.ORDER_BY_NAME,
self.surname_fname) self.surname_fname)
SurnameListPage(self, self.title, ind_list, SurnameListPage(self, self.title, ind_list,
SurnameListPage.ORDER_BY_COUNT, SurnameListPage.ORDER_BY_COUNT,
"surnames_count") "surnames_count")
index = 1
for (surname, handle_list) in local_list: for (surname, handle_list) in local_list:
SurnamePage(self, self.title, surname, sorted(handle_list)) SurnamePage(self, self.title, surname, sorted(handle_list))
step() step()
index += 1
def thumbnail_preview_page(self): def thumbnail_preview_page(self):
""" """
creates the thumbnail preview page 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"), with self.user.progress(_("Narrated Web Site Report"),
_("Creating thumbnail preview page..."), _("Creating thumbnail preview page..."),
len(self.obj_dict[Media])) as step: media_count) as step:
ThumbnailPreviewPage(self, self.title, step) ThumbnailPreviewPage(self, self.title, step)
def statistics_preview_page(self, title): def statistics_preview_page(self, title):
@ -1128,7 +1142,7 @@ class NavWebReport(Report):
""" """
with self.user.progress(_("Narrated Web Site Report"), with self.user.progress(_("Narrated Web Site Report"),
_("Creating statistics page..."), _("Creating statistics page..."),
len(self.obj_dict[Media])) as step: 1) as step:
StatisticsPage(self, title, step) StatisticsPage(self, title, step)
def addressbook_pages(self, ind_list): def addressbook_pages(self, ind_list):
@ -1168,12 +1182,14 @@ class NavWebReport(Report):
# begin Address Book pages # begin Address Book pages
addr_size = len(url_addr_res) addr_size = len(url_addr_res)
with self.user.progress(_("Narrated Web Site Report"), message = _("Creating address book pages ...")
_("Creating address book pages ..."), with self.user.progress(_("Narrated Web Site Report"), message,
addr_size) as step: addr_size) as step:
index = 1
for (sort_name, person_handle, add, res, url) in url_addr_res: for (sort_name, person_handle, add, res, url) in url_addr_res:
AddressBookPage(self, self.title, person_handle, add, res, url) AddressBookPage(self, self.title, person_handle, add, res, url)
step() step()
index += 1
def base_pages(self): def base_pages(self):
""" """
@ -1911,6 +1927,10 @@ class NavWebOptions(MenuReportOptions):
"events.")) "events."))
addopt("inc_addressbook", inc_addressbook) 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): def __add_place_map_options(self, menu):
""" """
options for the Place Map tab. options for the Place Map tab.

View File

@ -130,16 +130,19 @@ class PersonPages(BasePage):
LOG.debug("obj_dict[Person]") LOG.debug("obj_dict[Person]")
for item in self.report.obj_dict[Person].items(): for item in self.report.obj_dict[Person].items():
LOG.debug(" %s", str(item)) LOG.debug(" %s", str(item))
with self.r_user.progress(_("Narrated Web Site Report"), message = _('Creating individual pages')
_('Creating individual pages'), with self.r_user.progress(_("Narrated Web Site Report"), message,
len(self.report.obj_dict[Person]) + 1 len(self.report.obj_dict[Person]) + 1
) as step: ) as step:
self.individuallistpage(self.report, title, index = 1
self.report.obj_dict[Person].keys())
for person_handle in sorted(self.report.obj_dict[Person]): for person_handle in sorted(self.report.obj_dict[Person]):
step() step()
index += 1
person = self.r_db.get_person_from_handle(person_handle) person = self.r_db.get_person_from_handle(person_handle)
self.individualpage(self.report, title, person) self.individualpage(self.report, title, person)
step()
self.individuallistpage(self.report, title,
self.report.obj_dict[Person].keys())
################################################# #################################################
# #

View File

@ -110,17 +110,18 @@ class PlacePages(BasePage):
LOG.debug("obj_dict[Place]") LOG.debug("obj_dict[Place]")
for item in self.report.obj_dict[Place].items(): for item in self.report.obj_dict[Place].items():
LOG.debug(" %s", str(item)) LOG.debug(" %s", str(item))
with self.r_user.progress(_("Narrated Web Site Report"), message = _("Creating place pages")
_("Creating place pages"), with self.r_user.progress(_("Narrated Web Site Report"), message,
len(self.report.obj_dict[Place]) + 1 len(self.report.obj_dict[Place]) + 1
) as step: ) as step:
index = 1
self.placelistpage(self.report, title,
self.report.obj_dict[Place].keys())
for place_handle in self.report.obj_dict[Place]: for place_handle in self.report.obj_dict[Place]:
step() step()
index += 1
self.placepage(self.report, title, place_handle) 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): def placelistpage(self, report, title, place_handles):
""" """

View File

@ -98,8 +98,8 @@ class RepositoryPages(BasePage):
LOG.debug(" %s", str(item)) LOG.debug(" %s", str(item))
# set progress bar pass for Repositories # set progress bar pass for Repositories
with self.r_user.progress(_("Narrated Web Site Report"), message = _('Creating repository pages')
_('Creating repository pages'), with self.r_user.progress(_("Narrated Web Site Report"), message,
len(self.report.obj_dict[Repository]) + 1 len(self.report.obj_dict[Repository]) + 1
) as step: ) as step:
# Sort the repositories # Sort the repositories
@ -114,10 +114,11 @@ class RepositoryPages(BasePage):
# RepositoryListPage Class # RepositoryListPage Class
self.repositorylistpage(self.report, title, repos_dict, keys) self.repositorylistpage(self.report, title, repos_dict, keys)
idx = 1
for index, key in enumerate(keys): for index, key in enumerate(keys):
(repo, handle) = repos_dict[key] (repo, handle) = repos_dict[key]
step() step()
idx += 1
self.repositorypage(self.report, title, repo, handle) self.repositorypage(self.report, title, repo, handle)
def repositorylistpage(self, report, title, repos_dict, keys): def repositorylistpage(self, report, title, repos_dict, keys):

View File

@ -99,15 +99,17 @@ class SourcePages(BasePage):
LOG.debug("obj_dict[Source]") LOG.debug("obj_dict[Source]")
for item in self.report.obj_dict[Source].items(): for item in self.report.obj_dict[Source].items():
LOG.debug(" %s", str(item)) LOG.debug(" %s", str(item))
with self.r_user.progress(_("Narrated Web Site Report"), message = _("Creating source pages")
_("Creating source pages"), with self.r_user.progress(_("Narrated Web Site Report"), message,
len(self.report.obj_dict[Source]) + 1 len(self.report.obj_dict[Source]) + 1
) as step: ) as step:
self.sourcelistpage(self.report, title, self.sourcelistpage(self.report, title,
self.report.obj_dict[Source].keys()) self.report.obj_dict[Source].keys())
index = 1
for source_handle in self.report.obj_dict[Source]: for source_handle in self.report.obj_dict[Source]:
step() step()
index += 1
self.sourcepage(self.report, title, source_handle) self.sourcepage(self.report, title, source_handle)
def sourcelistpage(self, report, title, source_handles): def sourcelistpage(self, report, title, source_handles):

View File

@ -86,6 +86,7 @@ class StatisticsPage(BasePage):
females, females,
unknown) = self.get_gender(report.database.iter_person_handles()) unknown) = self.get_gender(report.database.iter_person_handles())
step()
mobjects = report.database.get_number_of_media() mobjects = report.database.get_number_of_media()
npersons = report.database.get_number_of_people() npersons = report.database.get_number_of_people()
nfamilies = report.database.get_number_of_families() nfamilies = report.database.get_number_of_families()

View File

@ -122,7 +122,7 @@ class ThumbnailPreviewPage(BasePage):
"will take you to that image&#8217;s page.") "will take you to that image&#8217;s page.")
previewpage += Html("p", msg, id="description") previewpage += Html("p", msg, id="description")
with Html("table", class_="calendar") as table: with Html("table", class_="calendar thumbnails") as table:
previewpage += table previewpage += table
thead = Html("thead") thead = Html("thead")
@ -153,7 +153,7 @@ class ThumbnailPreviewPage(BasePage):
num_of_cols = 7 num_of_cols = 7
grid_row = 0 grid_row = 0
while grid_row < num_of_rows: 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 tbody += trow
cols = 0 cols = 0
@ -163,7 +163,7 @@ class ThumbnailPreviewPage(BasePage):
photo = media_list[indexpos][2] photo = media_list[indexpos][2]
# begin table cell and attach to table row(trow)... # begin table cell and attach to table row(trow)...
tcell = Html("td", class_="highlight weekend") tcell = Html("td", class_="highlight weekend thumbnail")
trow += tcell trow += tcell
# attach index number... # attach index number...
@ -203,6 +203,7 @@ class ThumbnailPreviewPage(BasePage):
for emptycols in range(cols, num_of_cols): for emptycols in range(cols, num_of_cols):
trow += Html("td", class_="emptyDays", inline=True) trow += Html("td", class_="emptyDays", inline=True)
message = _("Creating thumbnail preview page...")
# begin Thumbnail Reference section... # begin Thumbnail Reference section...
with Html("div", class_="subsection", id="references") as section: with Html("div", class_="subsection", id="references") as section:
body += section body += section
@ -225,11 +226,12 @@ class ThumbnailPreviewPage(BasePage):
tcell2 = Html("td", ptitle, class_="ColumnName") tcell2 = Html("td", ptitle, class_="ColumnName")
trow += (tcell1, tcell2) trow += (tcell1, tcell2)
# increase progress meter...
cb_progress()
# increase index for row number... # increase index for row number...
index += 1 index += 1
# increase progress meter...
cb_progress()
# add body id element # add body id element
body.attr = 'id ="ThumbnailPreview"' body.attr = 'id ="ThumbnailPreview"'