Fixed the problem with the FamilyPage content not showing in the page. Added a conditional to MediaListPage to catch possible failure.
svn: r18080
This commit is contained in:
parent
bcbe23ebbb
commit
a9dc79c730
@ -34,9 +34,9 @@
|
|||||||
"""
|
"""
|
||||||
Narrative Web Page generator.
|
Narrative Web Page generator.
|
||||||
"""
|
"""
|
||||||
#------------------------------------------------------------------------
|
#------------------------------------------------
|
||||||
# python modules
|
# python modules
|
||||||
#------------------------------------------------------------------------
|
#------------------------------------------------
|
||||||
|
|
||||||
from __future__ import print_function
|
from __future__ import print_function
|
||||||
from functools import partial
|
from functools import partial
|
||||||
@ -66,15 +66,15 @@ import operator
|
|||||||
from decimal import Decimal, getcontext
|
from decimal import Decimal, getcontext
|
||||||
getcontext().prec = 8
|
getcontext().prec = 8
|
||||||
|
|
||||||
#------------------------------------------------------------------------
|
#------------------------------------------------
|
||||||
# Set up logging
|
# Set up logging
|
||||||
#------------------------------------------------------------------------
|
#------------------------------------------------
|
||||||
import logging
|
import logging
|
||||||
log = logging.getLogger(".NarrativeWeb")
|
log = logging.getLogger(".NarrativeWeb")
|
||||||
|
|
||||||
#------------------------------------------------------------------------
|
#------------------------------------------------
|
||||||
# GRAMPS module
|
# GRAMPS module
|
||||||
#------------------------------------------------------------------------
|
#------------------------------------------------
|
||||||
from gen.ggettext import sgettext as _
|
from gen.ggettext import sgettext as _
|
||||||
import gen.lib
|
import gen.lib
|
||||||
from gen.lib import UrlType, date, FamilyRelType, NoteType, EventRoleType
|
from gen.lib import UrlType, date, FamilyRelType, NoteType, EventRoleType
|
||||||
@ -114,9 +114,9 @@ from libgedcom import make_gedcom_date
|
|||||||
from PlaceUtils import conv_lat_lon
|
from PlaceUtils import conv_lat_lon
|
||||||
from gui.pluginmanager import GuiPluginManager
|
from gui.pluginmanager import GuiPluginManager
|
||||||
|
|
||||||
#------------------------------------------------------------------------
|
#------------------------------------------------
|
||||||
# constants
|
# constants
|
||||||
#------------------------------------------------------------------------
|
#------------------------------------------------
|
||||||
# Translatable strings for variables within this plugin
|
# Translatable strings for variables within this plugin
|
||||||
# gettext carries a huge footprint with it.
|
# gettext carries a huge footprint with it.
|
||||||
AHEAD = _("Attributes")
|
AHEAD = _("Attributes")
|
||||||
@ -350,6 +350,7 @@ class BasePage(object):
|
|||||||
self.noid = report.options['nogid']
|
self.noid = report.options['nogid']
|
||||||
self.linkhome = report.options['linkhome']
|
self.linkhome = report.options['linkhome']
|
||||||
self.create_media = report.options['gallery']
|
self.create_media = report.options['gallery']
|
||||||
|
self.thumbpreview = report.options['thumbpreview']
|
||||||
self.inc_events = report.options['inc_events']
|
self.inc_events = report.options['inc_events']
|
||||||
|
|
||||||
def complete_people(self, tcell, first_person, handle_list, ppl_hnd_list, up =True):
|
def complete_people(self, tcell, first_person, handle_list, ppl_hnd_list, up =True):
|
||||||
@ -2573,7 +2574,7 @@ class SurnamePage(BasePage):
|
|||||||
if mother:
|
if mother:
|
||||||
mother_name = self.get_name(mother)
|
mother_name = self.get_name(mother)
|
||||||
if mother and father:
|
if mother and father:
|
||||||
tcell = ( Html("span", father_name, class_ = "father fatherNmother") +
|
tcell = Html("span", father_name, class_ = "father fatherNmother") + (
|
||||||
Html("span", mother_name, class_ = "mother")
|
Html("span", mother_name, class_ = "mother")
|
||||||
)
|
)
|
||||||
elif mother:
|
elif mother:
|
||||||
@ -2763,15 +2764,18 @@ class FamilyListPage(BasePage):
|
|||||||
|
|
||||||
class FamilyPage(BasePage):
|
class FamilyPage(BasePage):
|
||||||
def __init__(self, report, title, person, family, ppl_hnd_list):
|
def __init__(self, report, title, person, family, ppl_hnd_list):
|
||||||
|
if (not person or not family):
|
||||||
|
return
|
||||||
|
|
||||||
db = report.database
|
db = report.database
|
||||||
BasePage.__init__(self, report, title, family.get_gramps_id())
|
BasePage.__init__(self, report, title, family.get_gramps_id())
|
||||||
|
|
||||||
self.bibli = Bibliography()
|
self.bibli = Bibliography()
|
||||||
self.person = person
|
self.person = person
|
||||||
person_name = self.get_name(person)
|
self.up = True
|
||||||
|
birthorder = self.report.options["birthorder"]
|
||||||
|
|
||||||
of = self.report.create_file(family.get_handle(), "fam")
|
of = self.report.create_file(family.get_handle(), "fam")
|
||||||
self.up = True
|
|
||||||
familydetailpage, head, body = self.write_header(_("Family/ Relationship"))
|
familydetailpage, head, body = self.write_header(_("Family/ Relationship"))
|
||||||
|
|
||||||
partner = False
|
partner = False
|
||||||
@ -2783,7 +2787,7 @@ class FamilyPage(BasePage):
|
|||||||
with Html("div", class_ ="content", id ="RelationshipDetail") as familydetail:
|
with Html("div", class_ ="content", id ="RelationshipDetail") as familydetail:
|
||||||
body += familydetail
|
body += familydetail
|
||||||
|
|
||||||
# family media list
|
# family media list initial thumbnail
|
||||||
if self.create_media:
|
if self.create_media:
|
||||||
family_media_list = family.get_media_list()
|
family_media_list = family.get_media_list()
|
||||||
thumbnail = self.display_first_image_as_thumbnail(family_media_list, family)
|
thumbnail = self.display_first_image_as_thumbnail(family_media_list, family)
|
||||||
@ -2808,20 +2812,17 @@ class FamilyPage(BasePage):
|
|||||||
self.page_title = _("Family for %s" % person_link)
|
self.page_title = _("Family for %s" % person_link)
|
||||||
elif partner:
|
elif partner:
|
||||||
self.page_title = _("Family for %s" % partner_link)
|
self.page_title = _("Family for %s" % partner_link)
|
||||||
familydetail += Html("h3", self.page_title, inline =True)
|
familydetail += Html("h2", self.page_title, inline =True)
|
||||||
|
|
||||||
family_hnd_list = [family.get_handle()]
|
|
||||||
birthorder = self.report.options["birthorder"]
|
|
||||||
|
|
||||||
# begin families division and section title
|
# begin families division and section title
|
||||||
with Html("div", class_ = "subsection", id = "families") as section:
|
with Html("div", class_ = "subsection", id = "families") as section:
|
||||||
familydetail += Html("h4", _("Family"), inline =True)
|
familydetail += section
|
||||||
|
section += Html("h4", _("Family"), inline =True)
|
||||||
|
|
||||||
# begin families table
|
# begin families table
|
||||||
with Html("table", class_ ="infolist") as table:
|
with Html("table", class_ ="infolist") as table:
|
||||||
section += table
|
section += table
|
||||||
|
|
||||||
if family:
|
|
||||||
gender = self.person.get_gender()
|
gender = self.person.get_gender()
|
||||||
reltype = family.get_relationship()
|
reltype = family.get_relationship()
|
||||||
|
|
||||||
@ -2877,8 +2878,6 @@ class FamilyPage(BasePage):
|
|||||||
tcell = Html("td", class_ ="ColumnValue")
|
tcell = Html("td", class_ ="ColumnValue")
|
||||||
trow += tcell
|
trow += tcell
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
childlist = family.get_child_ref_list()
|
childlist = family.get_child_ref_list()
|
||||||
if childlist:
|
if childlist:
|
||||||
trow = Html("tr") + (
|
trow = Html("tr") + (
|
||||||
@ -4131,7 +4130,6 @@ class SourcePage(BasePage):
|
|||||||
self.XHTMLWriter(sourcepage, of)
|
self.XHTMLWriter(sourcepage, of)
|
||||||
|
|
||||||
class MediaListPage(BasePage):
|
class MediaListPage(BasePage):
|
||||||
|
|
||||||
def __init__(self, report, title):
|
def __init__(self, report, title):
|
||||||
BasePage.__init__(self, report, title)
|
BasePage.__init__(self, report, title)
|
||||||
db = report.database
|
db = report.database
|
||||||
@ -4160,15 +4158,14 @@ class MediaListPage(BasePage):
|
|||||||
|
|
||||||
trow = Html("tr")
|
trow = Html("tr")
|
||||||
thead += trow
|
thead += trow
|
||||||
media_header_row = [
|
|
||||||
[" ", "RowLabel"],
|
|
||||||
[_("Media | Name"), "Name"],
|
|
||||||
[DHEAD, "Date"],
|
|
||||||
[_("Mime Type"), "Mime"]
|
|
||||||
]
|
|
||||||
trow.extend(
|
trow.extend(
|
||||||
Html("th", label, class_ = "Column" + colclass, inline = True)
|
Html("th", trans, class_ =colclass, inline =True)
|
||||||
for (label, colclass) in media_header_row
|
for trans, colclass in [
|
||||||
|
[" ", "ColumnRowLabel"],
|
||||||
|
[_("Media | Name"), "ColumnName"],
|
||||||
|
[_("Date"), "ColumnDate"],
|
||||||
|
[_("Mime Type"), "ColumnMime"] ]
|
||||||
)
|
)
|
||||||
|
|
||||||
# begin table body
|
# begin table body
|
||||||
@ -4181,6 +4178,7 @@ class MediaListPage(BasePage):
|
|||||||
|
|
||||||
for handle in mlist:
|
for handle in mlist:
|
||||||
media = db.get_object_from_handle(handle)
|
media = db.get_object_from_handle(handle)
|
||||||
|
if media:
|
||||||
title = media.get_description() or "[untitled]"
|
title = media.get_description() or "[untitled]"
|
||||||
|
|
||||||
trow = Html("tr")
|
trow = Html("tr")
|
||||||
@ -4190,14 +4188,12 @@ class MediaListPage(BasePage):
|
|||||||
[index, "RowLabel"],
|
[index, "RowLabel"],
|
||||||
[self.media_ref_link(handle, title), "Name"],
|
[self.media_ref_link(handle, title), "Name"],
|
||||||
[_dd.display(media.get_date_object() ), "Date"],
|
[_dd.display(media.get_date_object() ), "Date"],
|
||||||
[media.get_mime_type(), "Mime"]
|
[media.get_mime_type(), "Mime"] ]
|
||||||
]
|
|
||||||
|
|
||||||
trow.extend(
|
trow.extend(
|
||||||
Html("td", data, class_ = "Column" + colclass)
|
Html("td", data, class_ =colclass)
|
||||||
for (data, colclass) in media_data_row
|
for data, colclass in media_data_row
|
||||||
)
|
)
|
||||||
|
|
||||||
index += 1
|
index += 1
|
||||||
|
|
||||||
# add footer section
|
# add footer section
|
||||||
@ -6057,13 +6053,16 @@ class NavWebReport(Report):
|
|||||||
|
|
||||||
self.title = self.options['title']
|
self.title = self.options['title']
|
||||||
self.inc_gallery = self.options['gallery']
|
self.inc_gallery = self.options['gallery']
|
||||||
|
self.thumbpreview = self.options['thumbpreview']
|
||||||
|
|
||||||
self.inc_contact = self.options['contactnote'] or \
|
self.inc_contact = self.options['contactnote'] or \
|
||||||
self.options['contactimg']
|
self.options['contactimg']
|
||||||
|
|
||||||
# name format options
|
# name format options
|
||||||
self.name_format = self.options['name_format']
|
self.name_format = self.options['name_format']
|
||||||
|
|
||||||
# create family pages or not?
|
# create a media thumbnail preview page or not?
|
||||||
|
self.thumbpreview = self.options['thumbpreview']
|
||||||
|
|
||||||
# create an event pages or not?
|
# create an event pages or not?
|
||||||
self.inc_events = self.options['inc_events']
|
self.inc_events = self.options['inc_events']
|
||||||
@ -7015,6 +7014,11 @@ class NavWebOptions(MenuReportOptions):
|
|||||||
addopt( "gallery", self.__gallery )
|
addopt( "gallery", self.__gallery )
|
||||||
self.__gallery.connect('value-changed', self.__gallery_changed)
|
self.__gallery.connect('value-changed', self.__gallery_changed)
|
||||||
|
|
||||||
|
self.__thumbpreview = BooleanOption(_("Create a media thumbnails preview page"), False)
|
||||||
|
self.__thumbpreview.set_help(_("Whether to create a thumbnail's preview page? "
|
||||||
|
"This will be hyper- linked to the Media List Page only!"))
|
||||||
|
addopt("thumbpreview", self.__thumbpreview)
|
||||||
|
|
||||||
self.__maxinitialimagewidth = NumberOption(_("Max width of initial image"),
|
self.__maxinitialimagewidth = NumberOption(_("Max width of initial image"),
|
||||||
_DEFAULT_MAX_IMG_WIDTH, 0, 2000)
|
_DEFAULT_MAX_IMG_WIDTH, 0, 2000)
|
||||||
self.__maxinitialimagewidth.set_help(_("This allows you to set the maximum width "
|
self.__maxinitialimagewidth.set_help(_("This allows you to set the maximum width "
|
||||||
@ -7264,10 +7268,15 @@ class NavWebOptions(MenuReportOptions):
|
|||||||
Handles the changing nature of gallery
|
Handles the changing nature of gallery
|
||||||
"""
|
"""
|
||||||
|
|
||||||
if self.__gallery.get_value() == False:
|
if not self.__gallery.get_value():
|
||||||
|
self.__thumbpreview.set_available(False)
|
||||||
|
|
||||||
|
|
||||||
self.__maxinitialimagewidth.set_available(False)
|
self.__maxinitialimagewidth.set_available(False)
|
||||||
self.__maxinitialimageheight.set_available(False)
|
self.__maxinitialimageheight.set_available(False)
|
||||||
else:
|
else:
|
||||||
|
self.__thumbpreview.set_available(True)
|
||||||
|
|
||||||
self.__maxinitialimagewidth.set_available(True)
|
self.__maxinitialimagewidth.set_available(True)
|
||||||
self.__maxinitialimageheight.set_available(True)
|
self.__maxinitialimageheight.set_available(True)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user