Fixed missing notes and sources in Event Section of Individual Pages. Reported by Alain Aupeix and Stephane Charette. No bug report generated. Thanks gentlemen.

svn: r14938
This commit is contained in:
Rob G. Healey 2010-03-26 23:52:57 +00:00
parent 4219566d11
commit 636ef25a7a

View File

@ -1,3 +1,5 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# #
# Gramps - a GTK+/GNOME based genealogy program # Gramps - a GTK+/GNOME based genealogy program
# #
@ -425,9 +427,14 @@ class BasePage(object):
# return unordered note list to its callers # return unordered note list to its callers
return ul return ul
def display_event_row(self, evt, evt_ref, showplc, showdescr, showsrc, subdirs, hyp): def display_event_row(self, evt, evt_ref, subdirs, hyp):
""" """
display the event row for IndividualPage display the event row for IndividualPage
@param: evt = Event
@param: evt_ref = event reference
@param: subdirs = add [".."] * 3 for subdirectories or not
@params: hyp = add a hyperlink or not
""" """
db = self.report.database db = self.report.database
@ -453,13 +460,20 @@ class BasePage(object):
""" """
for more information: see get_event_data() for more information: see get_event_data()
""" """
event_data = self.get_event_data(evt, evt_ref, showplc, showdescr, subdirs) event_data = self.get_event_data(evt, evt_ref, True, False, subdirs)
trow.extend( trow.extend(
Html("td", data or " ", class_ = "Column" + colclass, Html("td", data or " ", class_ = "Column" + colclass,
inline = (not data or colclass == "Date")) inline = (not data or colclass == "Date"))
for (label, colclass, data) in event_data) for (label, colclass, data) in event_data)
# get event notes
notelist = evt.get_note_list()
notelist.extend( evt_ref.get_note_list() )
if notelist:
notelist = self.dump_notes( notelist ) or " "
trow += Html("td", notelist, class_ = "ColumnNotes")
# get event source references # get event source references
srcrefs = self.get_citation_links( evt.get_source_references() ) or " " srcrefs = self.get_citation_links( evt.get_source_references() ) or " "
trow += Html("td", srcrefs, class_ = "ColumnSources") trow += Html("td", srcrefs, class_ = "ColumnSources")
@ -954,6 +968,12 @@ class BasePage(object):
Html("link", href = url3, type = "text/css", media = 'print', rel = "stylesheet") Html("link", href = url3, type = "text/css", media = 'print', rel = "stylesheet")
) )
if self.report.css in ["Web_Basic-Blue.css", "Web_Visually.css"]:
# Link to Navigation Menus stylesheet
fname = "/".join(["styles", "Web_Navigation-Menus.css"])
url = self.report.build_url_fname(fname, None, self.up)
links.extend( Html("link", href = url, type = "text/css", media = "screen", rel = "stylesheet") )
# add additional meta and link tags # add additional meta and link tags
head += meta head += meta
head += links head += links
@ -1429,21 +1449,21 @@ class BasePage(object):
if not uri.startswith("mailto:"): if not uri.startswith("mailto:"):
list += Html("a",descr, href = 'mailto: %s' % uri) list += Html("a",descr, href = 'mailto: %s' % uri)
else: else:
list += Html("a", descr, href = "%s" % uri) list += Html("a", descr, href = uri)
# Web Site address # Web Site address
elif _type == UrlType.WEB_HOME: elif _type == UrlType.WEB_HOME:
if not uri.startswith("http://"): if not uri.startswith("http://"):
list += Html("a", descr, href = 'http://%s' % uri) list += Html("a", descr, href = 'http://%s' % uri)
else: else:
list += Html("a", descr, href = "%s" % uri) list += Html("a", descr, href = uri)
# FTP server address # FTP server address
elif _type == UrlType.WEB_FTP: elif _type == UrlType.WEB_FTP:
if not uri.startswith("ftp://"): if not uri.startswith("ftp://"):
list += Html("a", descr, href = 'ftp://%s' % uri) list += Html("a", descr, href = 'ftp://%s' % uri)
else: else:
list += Html("a", descr, href = "%s" % uri) list += Html("a", descr, href = uri)
# custom type # custom type
else: else:
@ -3999,12 +4019,7 @@ class IndividualPage(BasePage):
thead = Html("thead") thead = Html("thead")
table += thead table += thead
""" thead += self.display_event_header()
@param: show place
@param: show description
@param: show source references
"""
thead += self.display_event_header(True, True, True)
tbody = Html("tbody") tbody = Html("tbody")
table += tbody table += tbody
@ -4016,13 +4031,10 @@ class IndividualPage(BasePage):
""" """
@param: event object @param: event object
@param: event_ref = event reference @param: event_ref = event reference
@param: show place or not?
@param: show description or not?
@param: show source references or not?
@param: subdirs = True or False @param: subdirs = True or False
@param: hyp = show hyperlinked evt type or not? @param: hyp = show hyperlinked evt type or not?
""" """
tbody += self.display_event_row(event, evt_ref, True, True, True, True, True) tbody += self.display_event_row(event, evt_ref, True, True)
# return section to its caller # return section to its caller
return section return section
@ -4507,34 +4519,22 @@ class IndividualPage(BasePage):
) )
return ped return ped
def display_event_header(self, showplc, showdescr, showsrc): def display_event_header(self):
""" """
will print the event header row for display_event_row() and will print the event header row for display_event_row() and
format_event() format_event()
@param: showplc = show place
@param: showdescr = show description
@param: showsrc = show source references
""" """
# position 0 = translatable label, position 1 = column class, and
# position 2 = data
event_header_row = [
(_EVENT, "Event"),
(DHEAD, "Date") ]
if showplc:
event_header_row.append((PHEAD, "Place"))
if showdescr:
event_header_row.append((DESCRHEAD, "Description"))
if showsrc:
event_header_row.append((SHEAD, "Sources"))
trow = Html("tr") trow = Html("tr")
trow.extend( trow.extend(
Html("th", label, class_ = "Column" + colclass, inline = True) Html("th", label, class_ = "Column" + colclass, inline = True)
for (label, colclass) in event_header_row) for (label, colclass) in [
(_EVENT, "Event"),
(DHEAD, "Date"),
(PHEAD, "Place"),
(NHEAD, "Notes"),
(SHEAD, "Sources") ]
)
# return header row to its callers # return header row to its callers
return trow return trow
@ -4551,12 +4551,7 @@ class IndividualPage(BasePage):
table += thead table += thead
# attach event header row # attach event header row
""" thead += self.display_event_header()
@param: show place
@param: show description
@param: show source references
"""
thead += self.display_event_header(True, True, True)
# begin table body # begin table body
tbody = Html("tbody") tbody = Html("tbody")
@ -4569,13 +4564,10 @@ class IndividualPage(BasePage):
""" """
@param: event object @param: event object
@param: event_ref = event reference @param: event_ref = event reference
@param: show place or not?
@param: show description or not?
@param: show source references or not?
@param: up = True or False: attach subdirs or not? @param: up = True or False: attach subdirs or not?
@param: hyp = show hyperlinked evt type or not? @param: hyp = show hyperlinked evt type or not?
""" """
tbody += self.display_event_row(event, event_ref, True, True, True, True, True) tbody += self.display_event_row(event, event_ref, True, True)
# return table to its callers # return table to its callers
return table return table
@ -4919,6 +4911,7 @@ class NavWebReport(Report):
self.target_path = self.options['target'] self.target_path = self.options['target']
self.ext = self.options['ext'] self.ext = self.options['ext']
self.css = self.options['css'] self.css = self.options['css']
self.navigation = self.options["navigation"]
self.title = self.options['title'] self.title = self.options['title']
self.inc_gallery = self.options['gallery'] self.inc_gallery = self.options['gallery']
@ -4928,7 +4921,7 @@ class NavWebReport(Report):
# name format option # name format option
self.name_format = self.options['name_format'] self.name_format = self.options['name_format']
# create event pages or not? # create an event pages or not?
self.inc_events = self.options['inc_events'] self.inc_events = self.options['inc_events']
# include repository page or not? # include repository page or not?
@ -5129,6 +5122,14 @@ class NavWebReport(Report):
fname = os.path.join(const.DATA_DIR, self.css) fname = os.path.join(const.DATA_DIR, self.css)
self.copy_file(fname, _NARRATIVESCREEN, "styles") self.copy_file(fname, _NARRATIVESCREEN, "styles")
# copy Navigation Menu Layout if Blue or Visually is being used
if self.css == "Web_Basic-Blue.css" or "Web_Visually.css":
if self.navigation == "Horizontal":
fname = os.path.join(const.DATA_DIR, "Web_Alphabet-Horizontal.css")
else:
fname = os.path.join(const.DATA_DIR, "Web_Alphabet-Vertical.css")
self.copy_file(fname, "Web_Navigation-Menus.css", "styles")
# copy printer stylesheet # copy printer stylesheet
fname = os.path.join(const.DATA_DIR, "Web_Print-Default.css") fname = os.path.join(const.DATA_DIR, "Web_Print-Default.css")
self.copy_file(fname, _NARRATIVEPRINT, "styles") self.copy_file(fname, _NARRATIVEPRINT, "styles")
@ -5662,11 +5663,24 @@ class NavWebOptions(MenuReportOptions):
cright.set_help( _("The copyright to be used for the web files")) cright.set_help( _("The copyright to be used for the web files"))
menu.add_option(category_name, "cright", cright) menu.add_option(category_name, "cright", cright)
css = EnumeratedListOption(_('StyleSheet'), CSS_FILES[0][1]) self.__css = EnumeratedListOption(_('StyleSheet'), CSS_FILES[0][1])
for style in CSS_FILES: for style in CSS_FILES:
css.add_item(style[1], style[0]) self.__css.add_item(style[1], style[0])
css.set_help( _('The stylesheet to be used for the web pages')) self.__css.set_help( _('The stylesheet to be used for the web pages'))
menu.add_option(category_name, "css", css) menu.add_option(category_name, "css", self.__css)
self.__css.connect("value-changed", self.__stylesheet_changed)
_NAVIGATION_OPTS = [
[_("Horizontal -- No Change"), "Horizontal"],
[_("Vertical"), "Vertical"]
]
self.__navigation = EnumeratedListOption(_("Navigation Layout"), _NAVIGATION_OPTS[0][1])
for layout in _NAVIGATION_OPTS:
self.__navigation.add_item(layout[1], layout[0])
self.__navigation.set_help(_("Choose which layout for the Navigation Menus."))
menu.add_option(category_name, "navigation", self.__navigation)
self.__stylesheet_changed()
self.__graph = BooleanOption(_("Include ancestor graph"), True) self.__graph = BooleanOption(_("Include ancestor graph"), True)
self.__graph.set_help(_('Whether to include an ancestor graph ' self.__graph.set_help(_('Whether to include an ancestor graph '
@ -5917,6 +5931,17 @@ class NavWebOptions(MenuReportOptions):
# The rest don't # The rest don't
self.__pid.set_available(False) self.__pid.set_available(False)
def __stylesheet_changed(self):
"""
Handles the changing nature of the stylesheet
"""
css_opts = self.__css.get_value()
if css_opts in ["Web_Basic-Blue.css", "Web_Visually.css"]:
self.__navigation.set_available(True)
else:
self.__navigation.set_available(False)
def __graph_changed(self): def __graph_changed(self):
""" """
Handle enabling or disabling the ancestor graph Handle enabling or disabling the ancestor graph