Various Feature Requests in Narrative Web (#468)

Issue #06772
This commit is contained in:
Serge Noiraud 2017-11-23 09:40:52 +01:00 committed by GitHub
parent 43ef686622
commit 4e0d562208
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 48 additions and 13 deletions

View File

@ -57,8 +57,9 @@ import logging
# Gramps module
#------------------------------------------------
from gramps.gen.const import GRAMPS_LOCALE as glocale
from gramps.gen.lib import (FamilyRelType, NoteType, NameType, Person, UrlType,
Name, PlaceType, EventRoleType, Family, Citation)
from gramps.gen.lib import (FamilyRelType, NoteType, NameType, Person,
UrlType, Date, Name, PlaceType, EventRoleType,
Family, Citation)
from gramps.gen.lib.date import Today
from gramps.gen.const import PROGRAM_NAME, URL_HOMEPAGE
from gramps.version import VERSION
@ -72,6 +73,7 @@ from gramps.gen.display.name import displayer as _nd
from gramps.gen.display.place import displayer as _pd
from gramps.plugins.lib.libhtmlconst import _CC
from gramps.gen.utils.db import get_birth_or_fallback, get_death_or_fallback
from gramps.gen.datehandler import parser as _dp
from gramps.plugins.lib.libhtml import Html, xml_lang
from gramps.plugins.lib.libhtmlbackend import HtmlBackend, process_spaces
from gramps.gen.utils.place import conv_lat_lon
@ -1491,8 +1493,8 @@ class BasePage: # pylint: disable=C1001
(self.report.surname_fname, self._("Surnames"), True),
('families', self._("Families"), self.report.inc_families),
('events', self._("Events"), self.report.inc_events),
('places', self._("Places"), True),
('sources', self._("Sources"), True),
('places', self._("Places"), self.report.inc_places),
('sources', self._("Sources"), self.report.inc_sources),
('repositories', self._("Repositories"), inc_repos),
('media', self._("Media"), _create_media_link),
('thumbnails', self._("Thumbnails"), self.create_media),
@ -2746,6 +2748,9 @@ class BasePage: # pylint: disable=C1001
role = "0"
elif obj[2] == "Family":
role = "1"
else:
if len(obj[2].split('-')) > 1:
role = obj[2] # date in ISO format
else:
role = "3"
return role
@ -2758,7 +2763,17 @@ class BasePage: # pylint: disable=C1001
name = self.report.obj_dict[bkref_class][bkref_handle][1]
gid = self.report.obj_dict[bkref_class][bkref_handle][2]
if role != "":
role = self._(" (%s) " % self._(role))
if len(role.split('-')) > 1:
# conver ISO date to Date for translation.
if len(role.split(' - ')) > 1:
(d1, d2) = role.split(' - ')
role = self._("between") + " " + d1 + " "
role += self._("and") + " " + d2
date = _dp.parse(role)
date = self.rlocale.get_date(date)
role = " (%s) " % date
else:
role = " (%s) " % self._(role)
ordered += list_html
if path == "":
list_html += name

View File

@ -175,6 +175,12 @@ class NavWebReport(Report):
# create an event pages or not?
self.inc_events = self.options['inc_events']
# create places pages or not?
self.inc_places = self.options['inc_places']
# create sources pages or not?
self.inc_sources = self.options['inc_sources']
# include repository page or not?
self.inc_repository = self.options['inc_repository']
@ -814,12 +820,16 @@ class NavWebReport(Report):
place_name = _pd.display_event(self._db, event)
else:
place_name = place.get_title()
if event:
role_or_date = str(event.get_date_object())
else:
role_or_date = ""
place_fname = self.build_url_fname(place_handle, "plc",
False) + self.ext
self.obj_dict[Place][place_handle] = (place_fname, place_name,
place.gramps_id, event)
self.bkref_dict[Place][place_handle].add((bkref_class, bkref_handle,
"" # no role for a place
role_or_date
))
############### Media section ##############
@ -1931,6 +1941,16 @@ class NavWebOptions(MenuReportOptions):
_('Add a complete events list and relevant pages or not'))
addopt("inc_events", inc_events)
inc_places = BooleanOption(_('Include places pages'), False)
inc_places.set_help(
_('Whether or not to include the places Pages.'))
addopt("inc_places", inc_places)
inc_sources = BooleanOption(_('Include sources pages'), False)
inc_sources.set_help(
_('Whether or not to include the sources Pages.'))
addopt("inc_sources", inc_sources)
inc_repository = BooleanOption(_('Include repository pages'), False)
inc_repository.set_help(
_('Whether or not to include the Repository Pages.'))

View File

@ -478,6 +478,12 @@ class PersonPages(BasePage):
individualdetail += thumbnail
individualdetail += (name, summary)
# display Narrative Notes
notelist = person.get_note_list()
sect8 = self.display_note_list(notelist)
if sect8 is not None:
individualdetail += sect8
# display a person's events
sect2 = self.display_ind_events(place_lat_long)
if sect2 is not None:
@ -538,12 +544,6 @@ class PersonPages(BasePage):
if sect7 is not None:
individualdetail += sect7
# display Narrative Notes
notelist = person.get_note_list()
sect8 = self.display_note_list(notelist)
if sect8 is not None:
individualdetail += sect8
# display attributes
attrlist = person.get_attribute_list()
if attrlist: