Moved revision numbering tag to a better visual area; cleanup of calendar_build(), calendar_common(), get_day_list() in WebCal, removed alphabet_navigation from NarrativeWeb.py.

svn: r11814
This commit is contained in:
Rob G. Healey 2009-02-03 08:01:31 +00:00
parent 829d78b611
commit 2968250315
12 changed files with 322 additions and 247 deletions

View File

@ -6,7 +6,6 @@ GRAMPS Cascading Style Sheet
Style Name: Basic-Ash Stylesheet Style Name: Basic-Ash Stylesheet
Style Author: Jason M. Simanek (2008) Style Author: Jason M. Simanek (2008)
Note: Adapted from GRAMPS original Modern Style stylesheet Note: Adapted from GRAMPS original Modern Style stylesheet
$Id$
************************************************************************************************** **************************************************************************************************
This website was created with GRAMPS <http://www.gramps-project.org/> This website was created with GRAMPS <http://www.gramps-project.org/>
-------------------------------------------------------------------------------------------------- --------------------------------------------------------------------------------------------------
@ -20,7 +19,7 @@ Go to <http://gramps-project.org/> to learn more!
Copyright 2008 Jason M. Simanek Copyright 2008 Jason M. Simanek
This file is part of the GRAMPS program. This file is part of the GRAMPS program.
/*
GRAMPS is free software: you can redistribute it and/or modify it under the GRAMPS is free software: you can redistribute it and/or modify it under the
terms of the GNU General Public License as published by the Free Software terms of the GNU General Public License as published by the Free Software
Foundation, version 2 of the License. Foundation, version 2 of the License.
@ -41,13 +40,16 @@ gray #999
gray light #CCC gray light #CCC
gray very light #EEE gray very light #EEE
white #FFF white #FFF
NarrativeWeb Styles
------------------------------------------------------------------------------------------------
General Elements
-----------------------------------------------------
# $Id$
*/ */
/* NarrativeWeb Styles
-------------------------------------------------------------------------------------------- */
/* General Elements
----------------------------------------------------- */
body { body {
font-family:sans-serif; font-family:sans-serif;
color:#000; color:#000;

View File

@ -6,7 +6,6 @@ GRAMPS Cascading Style Sheet
Style Name: Basic - Cypress Style Name: Basic - Cypress
Style Author: Jason Simanek (2008) Style Author: Jason Simanek (2008)
Note: Adapted from GRAMPS original Modern Style stylesheet with colors from the original 'Tranquil' stylesheet Note: Adapted from GRAMPS original Modern Style stylesheet with colors from the original 'Tranquil' stylesheet
$Id$
************************************************************************************************** **************************************************************************************************
This website was created with GRAMPS <http://www.gramps-project.org/> This website was created with GRAMPS <http://www.gramps-project.org/>
-------------------------------------------------------------------------------------------------- --------------------------------------------------------------------------------------------------
@ -44,7 +43,11 @@ white #FFF
*/ */
/* General Elements /* General Elements
----------------------------------------------------- */ -----------------------------------------------------
# $Id$
*/
body { body {
font-family:sans-serif; font-family:sans-serif;
color:#000; color:#000;

View File

@ -6,7 +6,6 @@ GRAMPS Cascading Style Sheet
Style Name: Basic - Lilac Style Name: Basic - Lilac
Style Author: Jason M. Simanek (2008) Style Author: Jason M. Simanek (2008)
Note: Adapted from GRAMPS original Modern Style stylesheet with colors from the original 'Business' stylesheet Note: Adapted from GRAMPS original Modern Style stylesheet with colors from the original 'Business' stylesheet
$Id$
************************************************************************************************** **************************************************************************************************
This website was created with GRAMPS <http://www.gramps-project.org/> This website was created with GRAMPS <http://www.gramps-project.org/>
-------------------------------------------------------------------------------------------------- --------------------------------------------------------------------------------------------------
@ -20,7 +19,7 @@ Go to <http://gramps-project.org/> to learn more!
Copyright 2008 Jason M. Simanek Copyright 2008 Jason M. Simanek
This file is part of the GRAMPS program. This file is part of the GRAMPS program.
/*
GRAMPS is free software: you can redistribute it and/or modify it under the GRAMPS is free software: you can redistribute it and/or modify it under the
terms of the GNU General Public License as published by the Free Software terms of the GNU General Public License as published by the Free Software
Foundation, version 2 of the License. Foundation, version 2 of the License.
@ -47,7 +46,11 @@ white #FAFAFF
-------------------------------------------------------------------------------------------- */ -------------------------------------------------------------------------------------------- */
/* General Elements /* General Elements
----------------------------------------------------- */ -----------------------------------------------------
# $Id$
*/
body { body {
font-family:sans-serif; font-family:sans-serif;
color:#000; color:#000;

View File

@ -6,7 +6,7 @@ GRAMPS Cascading Style Sheet
Style Name: Basic-Peach Stylesheet Style Name: Basic-Peach Stylesheet
Style Author: Jason M. Simanek (2008) Style Author: Jason M. Simanek (2008)
Note: Adapted from GRAMPS original Modern Style stylesheet with a new orange color scheme. Note: Adapted from GRAMPS original Modern Style stylesheet with a new orange color scheme.
$Id$
************************************************************************************************** **************************************************************************************************
This website was created with GRAMPS <http://www.gramps-project.org/> This website was created with GRAMPS <http://www.gramps-project.org/>
-------------------------------------------------------------------------------------------------- --------------------------------------------------------------------------------------------------
@ -47,7 +47,11 @@ yellow light #FFFBE7
-------------------------------------------------------------------------------------------- */ -------------------------------------------------------------------------------------------- */
/* General Elements /* General Elements
----------------------------------------------------- */ -----------------------------------------------------
# $Id$
*/
body { body {
font-family:sans-serif; font-family:sans-serif;
color:#36220B; color:#36220B;

View File

@ -6,7 +6,7 @@ GRAMPS Cascading Style Sheet
Style Name: Basic-Spruce Stylesheet Style Name: Basic-Spruce Stylesheet
Style Author: Jason M. Simanek (2008) Style Author: Jason M. Simanek (2008)
Note: Adapted from GRAMPS original Modern Style stylesheet with a new blue color scheme. Note: Adapted from GRAMPS original Modern Style stylesheet with a new blue color scheme.
$Id$
************************************************************************************************** **************************************************************************************************
This website was created with GRAMPS <http://www.gramps-project.org/> This website was created with GRAMPS <http://www.gramps-project.org/>
-------------------------------------------------------------------------------------------------- --------------------------------------------------------------------------------------------------
@ -47,7 +47,11 @@ white #FFF
-------------------------------------------------------------------------------------------- */ -------------------------------------------------------------------------------------------- */
/* General Elements /* General Elements
----------------------------------------------------- */ -----------------------------------------------------
# $Id$
*/
body { body {
font-family:sans-serif; font-family:sans-serif;
color:#000; color:#000;

View File

@ -3,7 +3,7 @@
GRAMPS Cascading Style Sheet GRAMPS Cascading Style Sheet
Style Name: Mainz Style Name: Mainz
Style Author: Jason Simanek (2008) Style Author: Jason Simanek (2008)
$Id$
---------------------------------------------------------------------------- ----------------------------------------------------------------------------
This website was created with GRAMPS This website was created with GRAMPS
---------------------------------------------------------------------------- ----------------------------------------------------------------------------
@ -55,7 +55,11 @@ Middle Light images/Web_Mainz_MidLight.png
-------------------------------------------------------------------------------------------- */ -------------------------------------------------------------------------------------------- */
/* General Elements /* General Elements
----------------------------------------------------- */ -----------------------------------------------------
# $Id$
*/
body { body {
font-family:Georgia, serif; font-family:Georgia, serif;
color:#7D5925; color:#7D5925;

View File

@ -5,7 +5,7 @@ Copyright Holder and License
GRAMPS Cascading Style Sheet GRAMPS Cascading Style Sheet
Style Name: Nebraska Default Stylesheet Style Name: Nebraska Default Stylesheet
Style Author: Jason M. Simanek (2008) Style Author: Jason M. Simanek (2008)
$Id$
************************************************************************************************** **************************************************************************************************
This website was created with GRAMPS <http://www.gramps-project.org/> This website was created with GRAMPS <http://www.gramps-project.org/>
-------------------------------------------------------------------------------------------------- --------------------------------------------------------------------------------------------------
@ -47,7 +47,11 @@ green #5D835F
-------------------------------------------------------------------------------------------- */ -------------------------------------------------------------------------------------------- */
/* General Elements /* General Elements
----------------------------------------------------- */ -----------------------------------------------------
# $Id$
*/
body { body {
color:#000; color:#000;
margin:0; margin:0;

View File

@ -6,7 +6,7 @@ GRAMPS Cascading Style Sheet
Style Name: Print Style Sheet Style Name: Print Style Sheet
Style Author: Jason M. Simanek (2008) Style Author: Jason M. Simanek (2008)
Modified by Rob G. Healey, July 2008 Modified by Rob G. Healey, July 2008
$Id$
************************************************************************************************** **************************************************************************************************
This website was created with GRAMPS <http://www.gramps-project.org/> This website was created with GRAMPS <http://www.gramps-project.org/>
-------------------------------------------------------------------------------------------------- --------------------------------------------------------------------------------------------------
@ -45,7 +45,11 @@ white #FFF
-------------------------------------------------------------------------------------------- */ -------------------------------------------------------------------------------------------- */
/* General Elements /* General Elements
----------------------------------------------------- */ -----------------------------------------------------
# $Id$
*/
body { body {
color:#000; color:#000;
margin:0; margin:0;

View File

@ -5,7 +5,6 @@ Copyright Holder and License
GRAMPS Cascading Style Sheet GRAMPS Cascading Style Sheet
Style Name: Visually Impaired Stylesheet Style Name: Visually Impaired Stylesheet
Style Author: Jason M. Simanek (2008) Style Author: Jason M. Simanek (2008)
Modified by Rob G. Healey (C) 2008-2009
************************************************************************************************** **************************************************************************************************
This website was created with GRAMPS This website was created with GRAMPS
http://www.gramps-project.org http://www.gramps-project.org
@ -52,7 +51,11 @@ Females Web_Gender_Female.png
-------------------------------------------------------------------------------------------- */ -------------------------------------------------------------------------------------------- */
/* General Elements /* General Elements
----------------------------------------------------- */ -----------------------------------------------------
# $Id$
*/
body { body {
color:#000; color:#000;
margin:0; margin:0;

View File

@ -1,7 +1,8 @@
# Gramps - a GTK+/GNOME based genealogy program # Gramps - a GTK+/GNOME based genealogy program
# #
# Copyright (C) 2000-2007 Donald N. Allingham # Copyright (C) 2000-2007 Donald N. Allingham
# Copyright (C) 2008-2009 Brian G. Matherly # Copyright (C) 2008-2009 Brian G. Matherly
# Copyright (C) 2009 Rob G. Healey <robhealey1@gmail.com>
# #
# This program is free software; you can redistribute it and/or modify # This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU General Public License as published by
@ -114,9 +115,24 @@ class HolidayTable:
self.__init_table() self.__init_table()
def __find_holiday_files(self): def __find_holiday_files(self):
""" Looks in multiple places for holidays.xml files """ """ Looks in multiple places for holidays.xml files
It will search for the file in user;s plugin directories first,
then it will search in program's plugins directories. """
holiday_file = 'holidays.xml' holiday_file = 'holidays.xml'
# Look for holiday files in the user plugins directory and all
# subdirectories.
holiday_full_path = os.path.join(const.USER_PLUGINS, holiday_file)
if os.path.exists(holiday_full_path):
HolidayTable.__holiday_files.append(holiday_full_path)
for (dirpath, dirnames, filenames) in os.walk(const.USER_PLUGINS):
for directory in dirnames:
holiday_full_path = os.path.join(directory, holiday_file)
if os.path.exists(holiday_full_path):
HolidayTable.__holiday_files.append(holiday_full_path)
# Look for holiday files in the installation plugins directory and all # Look for holiday files in the installation plugins directory and all
# subdirectories. # subdirectories.
holiday_full_path = os.path.join(const.PLUGINS_DIR, holiday_file) holiday_full_path = os.path.join(const.PLUGINS_DIR, holiday_file)
@ -129,18 +145,6 @@ class HolidayTable:
if os.path.exists(holiday_full_path): if os.path.exists(holiday_full_path):
HolidayTable.__holiday_files.append(holiday_full_path) HolidayTable.__holiday_files.append(holiday_full_path)
# Look for holiday files in the user plugins directory and all
# subdirectories.
holiday_full_path = os.path.join(const.USER_PLUGINS, holiday_file)
if os.path.exists(holiday_full_path):
HolidayTable.__holiday_files.append(holiday_full_path)
for (dirpath, dirnames, filenames) in os.walk(const.USER_PLUGINS):
for directory in dirnames:
holiday_full_path = os.path.join(directory, holiday_file)
if os.path.exists(holiday_full_path):
HolidayTable.__holiday_files.append(holiday_full_path)
def __build_country_list(self): def __build_country_list(self):
""" Generate the list of countries that have holiday information. """ """ Generate the list of countries that have holiday information. """
for holiday_file_path in HolidayTable.__holiday_files: for holiday_file_path in HolidayTable.__holiday_files:

View File

@ -78,6 +78,7 @@ import gen.lib
import const import const
from GrampsCfg import get_researcher from GrampsCfg import get_researcher
import Sort import Sort
import GrampsLocale
from gen.plug import PluginManager from gen.plug import PluginManager
from gen.plug.menu import PersonOption, NumberOption, StringOption, \ from gen.plug.menu import PersonOption, NumberOption, StringOption, \
BooleanOption, EnumeratedListOption, FilterOption, \ BooleanOption, EnumeratedListOption, FilterOption, \
@ -101,6 +102,8 @@ from gen.lib.eventroletype import EventRoleType
# constants # constants
# #
#------------------------------------------------------------------------ #------------------------------------------------------------------------
_PERSON = 0
_PLACE = 1
_INCLUDE_LIVING_VALUE = 99 # Arbitrary number _INCLUDE_LIVING_VALUE = 99 # Arbitrary number
_NAME_COL = 3 _NAME_COL = 3
@ -236,7 +239,6 @@ def html_escape(text):
return text return text
def name_to_md5(text): def name_to_md5(text):
"""This creates an MD5 hex string to be used as filename.""" """This creates an MD5 hex string to be used as filename."""
return md5(text).hexdigest() return md5(text).hexdigest()
@ -245,7 +247,7 @@ class BasePage:
""" """
This is the base class to write certain HTML pages. This is the base class to write certain HTML pages.
""" """
def __init__(self, report, title, gid=None): def __init__(self, report, title, gid=None):
""" """
report - instance of NavWebReport report - instance of NavWebReport
@ -275,38 +277,6 @@ class BasePage:
self.linkhome = options['linkhome'] self.linkhome = options['linkhome']
self.use_gallery = options['gallery'] self.use_gallery = options['gallery']
def alphabet_navigation(self, of, ind_list):
"""
Will create the alphabetical navigation bar...
"""
def get_alpha_list(ind_list):
""" Will produce the active letters in the alphabet """
firstletter_list = []
for person_handle in ind_list:
person = self.report.database.get_person_from_handle(person_handle)
primary_name = person.get_primary_name()
alpha_name = primary_name.get_surname()
if alpha_name:
alpha_ltr = alpha_name[0]
if alpha_ltr not in firstletter_list:
firstletter_list.append(alpha_ltr)
firstletter_list.sort()
return firstletter_list
namedict = get_alpha_list(ind_list)
of.write('\t<div id="navigation">\n')
of.write('\t\t<ul>\n')
for ltr in namedict:
of.write('\t\t\t<li><a href="#%s">%s</a> |</li>' % (ltr, ltr))
of.write('\t\t</ul>\n')
of.write('\t</div>\n')
def write_footer(self, of): def write_footer(self, of):
of.write('</div>\n') # Terminate div_content of.write('</div>\n') # Terminate div_content
@ -355,7 +325,7 @@ class BasePage:
of.write('</body>\n') of.write('</body>\n')
of.write('</html>') of.write('</html>')
def write_header(self, of, title, content_divid=None): def write_header(self, of, title):
""" """
Note. 'title' is used as currentsection in the navigation links. Note. 'title' is used as currentsection in the navigation links.
""" """
@ -405,72 +375,82 @@ class BasePage:
of.write('</div>\n') of.write('</div>\n')
# Begin Navigation Menu # Begin Navigation Menu
of.write('<div id="navigation">\n')
of.write('\t<ul>\n')
self.display_nav_links(of, title) self.display_nav_links(of, title)
of.write('\t</ul>\n')
of.write('</div>\n') # End Navigation Menu
divid = ''
if content_divid:
divid = ' id="%s"' % content_divid
of.write('<div%s class="content">\n' % divid)
def display_nav_links(self, of, currentsection): def display_nav_links(self, of, currentsection):
"""
Creates the navigation menu
"""
# Determine if there will be a link to WebCal or not???
use_webcal = False
webcal_link = self.report.webcal_link
if webcal_link.strip() != '':
if not webcal_link.endswith(self.ext):
webcal_link += self.ext
if os.path.isfile(webcal_link):
use_webcal = True
navs = [ navs = [
(self.report.index_fname, _('Home'), self.report.use_home), (self.report.index_fname, _('Home'), self.report.use_home),
(self.report.intro_fname, _('Introduction'), self.report.use_intro), (self.report.intro_fname, _('Introduction'), self.report.use_intro),
(self.report.surname_fname, _('Surnames'), True), (self.report.surname_fname, _('Surnames'), True),
('individuals', _('Individuals'), True), ('individuals', _('Individuals'), True),
('places', _('Places'), True), ('places', _('Places'), True),
('gallery', _('Gallery'), self.use_gallery), ('gallery', _('Gallery'), self.use_gallery),
('download', _('Download'), self.report.inc_download), ('download', _('Download'), self.report.inc_download),
('contact', _('Contact'), self.report.use_contact), ('contact', _('Contact'), self.report.use_contact),
('sources', _('Sources'), True), ('sources', _('Sources'), True),
(webcal_link, _('Web Calendar'), use_webcal),
] ]
of.write('\t<div id="navigation">\n')
of.write('\t\t<ul>\n')
for url_fname, nav_text, cond in navs: for url_fname, nav_text, cond in navs:
if cond: if cond:
url = url_fname + self.ext
if not url_fname.endswith(self.ext):
url_fname += self.ext
if self.up: if self.up:
# TODO. Check if build_url_fname can be used. # TODO. Check if build_url_fname can be used.
url = '/'.join(['..']*3 + [url]) url_fname = '/'.join(['..']*3 + [url_fname])
self.display_nav_link(of, url, nav_text, currentsection)
# TODO. Move this logic to a higher level (caller of write_header). # TODO. Move this logic to a higher level (caller of write_header).
# Define 'currentsection' to correctly set navlink item CSS id # Define 'currentsection' to correctly set navlink item CSS id
# 'CurrentSection' for Navigation styling. # 'CurrentSection' for Navigation styling.
# Use 'self.report.cur_fname' to determine 'CurrentSection' for individual # Use 'self.report.cur_fname' to determine 'CurrentSection' for individual
# elements for Navigation styling. # elements for Navigation styling.
def display_nav_link(self, of, url, title, currentsection): # Figure out if we need <li id="CurrentSection"> of just plain <li>
# Figure out if we need <li id="CurrentSection"> of just plain <li> cs = False
cs = False if nav_text == currentsection:
if title == currentsection: cs = True
cs = True elif nav_text == _('Surnames'):
elif title == _('Surnames'): if "srn" in self.report.cur_fname:
if "srn" in self.report.cur_fname: cs = True
cs = True elif _('Surnames') in currentsection:
elif _('Surnames') in currentsection: cs = True
cs = True elif nav_text == _('Individuals'):
elif title == _('Individuals'): if "ppl" in self.report.cur_fname:
if "ppl" in self.report.cur_fname: cs = True
cs = True elif nav_text == _('Sources'):
elif title == _('Sources'): if "src" in self.report.cur_fname:
if "src" in self.report.cur_fname: cs = True
cs = True elif nav_text == _('Places'):
elif title == _('Places'): if "plc" in self.report.cur_fname:
if "plc" in self.report.cur_fname: cs = True
cs = True elif nav_text == _('Gallery'):
elif title == _('Gallery'): if "img" in self.report.cur_fname:
if "img" in self.report.cur_fname: cs = True
cs = True
cs = cs and ' id="CurrentSection"' or '' cs = cs and ' id="CurrentSection"' or ''
of.write('\t\t<li%s><a href="%s">%s</a></li>\n' % (cs, url, title)) of.write('\t\t\t<li%s><a href="%s">%s</a></li>\n' % (cs, url_fname, nav_text))
of.write('\t\t</ul>\n')
of.write('\t</div>\n') # End Navigation Menu
def display_first_image_as_thumbnail( self, of, photolist=None): def display_first_image_as_thumbnail( self, of, photolist=None):
if not photolist or not self.use_gallery: if not photolist or not self.use_gallery:
@ -750,7 +730,9 @@ class IndividualListPage(BasePage):
db = report.database db = report.database
of = self.report.create_file("individuals") of = self.report.create_file("individuals")
self.write_header(of, _('Individuals'), content_divid='Individuals') self.write_header(of, _('Individuals'))
of.write('<div id="Individuals" class="content">\n')
msg = _("This page contains an index of all the individuals in the " msg = _("This page contains an index of all the individuals in the "
"database, sorted by their last names. Selecting the person&#8217;s " "database, sorted by their last names. Selecting the person&#8217;s "
@ -761,9 +743,6 @@ class IndividualListPage(BasePage):
showspouse = report.options['showspouse'] showspouse = report.options['showspouse']
showparents = report.options['showparents'] showparents = report.options['showparents']
# begin alphabetical navigation
self.alphabet_navigation(of, person_handle_list)
of.write('\t<h2>%s</h2>\n' % _('Individuals')) of.write('\t<h2>%s</h2>\n' % _('Individuals'))
of.write('\t<p id="description">%s</p>\n' % msg) of.write('\t<p id="description">%s</p>\n' % msg)
of.write('\t<table class="infolist individuallist">\n') of.write('\t<table class="infolist individuallist">\n')
@ -799,11 +778,10 @@ class IndividualListPage(BasePage):
if first: if first:
of.write('\t\t<tr class="BeginSurname">\n') of.write('\t\t<tr class="BeginSurname">\n')
if surname: if surname:
of.write('\t\t\t<td class="ColumnSurname"><a name="%s">%s</a>' of.write('\t\t\t<td class="ColumnSurname"><a name="%s">%s</a>\n'
% (surname[0].upper(), surname))
else:
of.write('\t\t\t<td class="ColumnSurname"><a name="%s">%s</a>'
% (name_to_md5(surname), surname)) % (name_to_md5(surname), surname))
else:
of.write('\t\t\t<td class="ColumnSurname">&nbsp;\n')
else: else:
of.write('\t\t<tr>\n') of.write('\t\t<tr>\n')
of.write('\t\t\t<td class="ColumnSurname">&nbsp;') of.write('\t\t\t<td class="ColumnSurname">&nbsp;')
@ -904,7 +882,9 @@ class SurnamePage(BasePage):
db = report.database db = report.database
of = self.report.create_file(name_to_md5(surname), 'srn') of = self.report.create_file(name_to_md5(surname), 'srn')
self.up = True self.up = True
self.write_header(of, "%s - %s" % (_('Surname'), surname), content_divid='SurnameDetail') self.write_header(of, "%s - %s" % (_('Surname'), surname))
of.write('<div id="SurnameDetail" class="content">\n')
msg = _("This page contains an index of all the individuals in the " msg = _("This page contains an index of all the individuals in the "
"database with the surname of %s. Selecting the person&#8217;s name " "database with the surname of %s. Selecting the person&#8217;s name "
@ -1031,7 +1011,9 @@ class PlaceListPage(BasePage):
db = report.database db = report.database
of = self.report.create_file("places") of = self.report.create_file("places")
self.write_header(of, _('Places'), content_divid='Places') self.write_header(of, _('Places'))
of.write('<div id="Places" class="content">\n')
msg = _("This page contains an index of all the places in the " msg = _("This page contains an index of all the places in the "
"database, sorted by their title. Clicking on a place&#8217;s " "database, sorted by their title. Clicking on a place&#8217;s "
@ -1096,7 +1078,9 @@ class PlacePage(BasePage):
of = self.report.create_file(place.get_handle(), 'plc') of = self.report.create_file(place.get_handle(), 'plc')
self.up = True self.up = True
self.page_title = ReportUtils.place_name(db, place_handle) self.page_title = ReportUtils.place_name(db, place_handle)
self.write_header(of, "%s - %s" % (_('Places'), self.page_title), content_divid='PlaceDetail') self.write_header(of, "%s - %s" % (_('Places'), self.page_title))
of.write('<div id="PlaceDetail" class="content">\n')
media_list = place.get_media_list() media_list = place.get_media_list()
self.display_first_image_as_thumbnail(of, media_list) self.display_first_image_as_thumbnail(of, media_list)
@ -1178,7 +1162,9 @@ class MediaPage(BasePage):
self.copy_thumbnail(handle, photo) self.copy_thumbnail(handle, photo)
self.page_title = photo.get_description() self.page_title = photo.get_description()
self.write_header(of, "%s - %s" % (_('Gallery'), self.page_title), content_divid='GalleryDetail') self.write_header(of, "%s - %s" % (_('Gallery'), self.page_title))
of.write('<div id="GalleryDetail" class="content">\n')
of.write('\t<h2>%s:</h2>\n' % _('Gallery')) of.write('\t<h2>%s:</h2>\n' % _('Gallery'))
@ -1370,16 +1356,15 @@ class SurnameListPage(BasePage):
db = report.database db = report.database
if order_by == self.ORDER_BY_NAME: if order_by == self.ORDER_BY_NAME:
of = self.report.create_file(filename) of = self.report.create_file(filename)
self.write_header(of, _('Surnames'), content_divid='Surnames') self.write_header(of, _('Surnames'))
of.write('<div id="Surnames" class="content">\n')
of.write('\t<h2>%s</h2>\n' % _('Surnames')) of.write('\t<h2>%s</h2>\n' % _('Surnames'))
else: else:
of = self.report.create_file("surnames_count") of = self.report.create_file("surnames_count")
self.write_header(of, _('Surnames by person count'), content_divid='Surnames') self.write_header(of, _('Surnames by person count'))
of.write('<div id="Surnames" class="content">\n')
of.write('\t<h2>%s</h2>\n' % _('Surnames by person count')) of.write('\t<h2>%s</h2>\n' % _('Surnames by person count'))
# beginning of Alphabetical Navigation
self.alphabet_navigation(of, person_handle_list)
of.write('\t<p id="description">%s</p>\n' % _( of.write('\t<p id="description">%s</p>\n' % _(
'This page contains an index of all the ' 'This page contains an index of all the '
'surnames in the database. Selecting a link ' 'surnames in the database. Selecting a link '
@ -1430,8 +1415,7 @@ class SurnameListPage(BasePage):
if letter is not last_letter: if letter is not last_letter:
last_letter = letter last_letter = letter
of.write('\t\t<tr class="BeginLetter">\n') of.write('\t\t<tr class="BeginLetter">\n')
of.write('\t\t\t<td class="ColumnLetter">') of.write('\t\t\t<td class="ColumnLetter">%s</td?\n' % last_letter)
of.write('<a name="%s">%s</a></td>\n' % (last_letter, last_letter))
of.write('\t\t\t<td class="ColumnSurname">') of.write('\t\t\t<td class="ColumnSurname">')
self.surname_link(of, name_to_md5(surname), surname) self.surname_link(of, name_to_md5(surname), surname)
of.write('</td>\n') of.write('</td>\n')
@ -1466,7 +1450,9 @@ class IntroductionPage(BasePage):
db = report.database db = report.database
of = self.report.create_file(report.intro_fname) of = self.report.create_file(report.intro_fname)
# Note. In old NarrativeWeb.py the content_divid depended on filename. # Note. In old NarrativeWeb.py the content_divid depended on filename.
self.write_header(of, _('Introduction'), content_divid='Introduction') self.write_header(of, _('Introduction'))
of.write('<div id="Introduction" class="content">\n')
of.write('\t<h2>%s</h2>\n' % _('Introduction')) of.write('\t<h2>%s</h2>\n' % _('Introduction'))
@ -1491,7 +1477,9 @@ class HomePage(BasePage):
db = report.database db = report.database
of = self.report.create_file("index") of = self.report.create_file("index")
self.write_header(of, _('Home'), content_divid='Home') self.write_header(of, _('Home'))
of.write('<div id="Home" class="content">\n')
of.write('\t<h2>%s</h2>\n' % _('Home')) of.write('\t<h2>%s</h2>\n' % _('Home'))
@ -1516,7 +1504,9 @@ class SourcesPage(BasePage):
db = report.database db = report.database
of = self.report.create_file("sources") of = self.report.create_file("sources")
self.write_header(of, _('Sources'), content_divid='Sources') self.write_header(of, _('Sources'))
of.write('<div id="Sources" class="content">\n')
handle_list = list(handle_set) handle_list = list(handle_set)
source_dict = {} source_dict = {}
@ -1572,7 +1562,9 @@ class SourcePage(BasePage):
of = self.report.create_file(source.get_handle(), 'src') of = self.report.create_file(source.get_handle(), 'src')
self.up = True self.up = True
self.page_title = source.get_title() self.page_title = source.get_title()
self.write_header(of, "%s - %s" % (_('Sources'), self.page_title), content_divid='SourceDetail') self.write_header(of, "%s - %s" % (_('Sources'), self.page_title))
of.write('<div id="SourceDetail" class="content">\n')
media_list = source.get_media_list() media_list = source.get_media_list()
self.display_first_image_as_thumbnail(of, media_list) self.display_first_image_as_thumbnail(of, media_list)
@ -1613,7 +1605,9 @@ class GalleryPage(BasePage):
db = report.database db = report.database
of = self.report.create_file("gallery") of = self.report.create_file("gallery")
self.write_header(of, _('Gallery'), content_divid='Gallery') self.write_header(of, _('Gallery'))
of.write('<div id="Gallery" class="content">\n')
of.write('\t<h2>%s</h2>\n\n' % _('Gallery')) of.write('\t<h2>%s</h2>\n\n' % _('Gallery'))
of.write('\t<p id="description">') of.write('\t<p id="description">')
@ -1671,7 +1665,9 @@ class DownloadPage(BasePage):
BasePage.__init__(self, report, title) BasePage.__init__(self, report, title)
of = self.report.create_file("download") of = self.report.create_file("download")
self.write_header(of, _('Download'), content_divid='Download') self.write_header(of, _('Download'))
of.write('<div id="Download" class="content">\n')
of.write('\t<h2>%s</h2>\n\n' % _('Download')) of.write('\t<h2>%s</h2>\n\n' % _('Download'))
@ -1685,7 +1681,9 @@ class ContactPage(BasePage):
db = report.database db = report.database
of = self.report.create_file("contact") of = self.report.create_file("contact")
self.write_header(of, _('Contact'), content_divid='Contact') self.write_header(of, _('Contact'))
of.write('<div id="Contact" class="content">\n')
of.write('\t<h2>%s</h2>\n\n' % _('Contact')) of.write('\t<h2>%s</h2>\n\n' % _('Contact'))
of.write('\t<div id="summaryarea">\n') of.write('\t<div id="summaryarea">\n')
@ -1750,7 +1748,9 @@ class IndividualPage(BasePage):
db = report.database db = report.database
of = self.report.create_file(person.handle, 'ppl') of = self.report.create_file(person.handle, 'ppl')
self.up = True self.up = True
self.write_header(of, self.sort_name, content_divid='IndividualDetail') self.write_header(of, self.sort_name)
of.write('<div id="IndividualDetail" class="content">\n')
self.display_ind_general(of) self.display_ind_general(of)
self.display_ind_events(of) self.display_ind_events(of)
@ -2697,8 +2697,11 @@ class NavWebReport(Report):
self.options['homeimg'] self.options['homeimg']
self.use_contact = self.options['contactnote'] or \ self.use_contact = self.options['contactnote'] or \
self.options['contactimg'] self.options['contactimg']
self.graph = self.options['graph'] self.graph = self.options['graph']
self.webcal_link = self.options['webcal_link']
if self.use_home: if self.use_home:
self.index_fname = "index" self.index_fname = "index"
self.surname_fname = "surnames" self.surname_fname = "surnames"
@ -2713,7 +2716,8 @@ class NavWebReport(Report):
self.intro_fname = None self.intro_fname = None
self.archive = None self.archive = None
self.cur_fname = None # Internal use. The name of the output file, to be used for the tar archive. self.cur_fname = None # Internal use. The name of the output file,
# to be used for the tar archive.
self.string_io = None self.string_io = None
if self.use_archive: if self.use_archive:
self.html_dir = None self.html_dir = None
@ -3266,6 +3270,13 @@ class NavWebOptions(MenuReportOptions):
nogid.set_help(_('Whether to include the Gramps ID of objects')) nogid.set_help(_('Whether to include the Gramps ID of objects'))
menu.add_option(category_name, 'nogid', nogid) menu.add_option(category_name, 'nogid', nogid)
today = time.localtime()
lng_month = GrampsLocale.long_months[today[1]]
fpath = '/'.join([const.USER_HOME] + ['WEBCAL'] + [str(today[0])] + [lng_month])
webcal_link = StringOption(_('Link to Web Calendar'), fpath)
webcal_link.set_help(_('Choose your link to Web Calendars if you want?'))
menu.add_option(category_name, 'webcal_link', webcal_link)
def __add_privacy_options(self, menu): def __add_privacy_options(self, menu):
""" """
Options on the "Privacy" tab. Options on the "Privacy" tab.
@ -3434,6 +3445,18 @@ def _get_prefix_suffix_name(sex, name):
first = first + ", " + suffix first = first + ", " + suffix
return first return first
def get_people(db):
for handle in db.get_handles():
yield db.get_person_from_handle(handle)
def get_place(db, handle):
""" ... """
place = db.get_place_from_handle(handle)
return place
# *****************************************
# Register Plugin
# *****************************************
pmgr = PluginManager.get_instance() pmgr = PluginManager.get_instance()
pmgr.register_report( pmgr.register_report(
name = 'navwebpage', name = 'navwebpage',

View File

@ -3,7 +3,7 @@
# #
# Copyright (C) 2007 Thom Sturgill # Copyright (C) 2007 Thom Sturgill
# Copyright (C) 2007-2009 Brian G. Matherly # Copyright (C) 2007-2009 Brian G. Matherly
# Copyright (C) 2008 Rob G. Healey <robhealey1@gmail.com> # Copyright (C) 2008-2009 Rob G. Healey <robhealey1@gmail.com>
# Copyright (C) 2008 Jason Simanek # Copyright (C) 2008 Jason Simanek
# Copyright (C) 2008 Kees Bakker # Copyright (C) 2008 Kees Bakker
# #
@ -29,10 +29,8 @@ Web Calendar generator.
Refactoring. This is an ongoing job until this plugin is in a better shape. Refactoring. This is an ongoing job until this plugin is in a better shape.
TODO list: TODO list:
- change filename for one_day pages to yyyy/mm/dd.html (just numbers)
- progress bar, rethink its usage - progress bar, rethink its usage
- in year navigation, use month in link, or 'fullyear' - in year navigation, use month in link, or 'fullyear'
- untangle calendar_build, it's too complex the way it is
- use standard Gramps method to display surname, see _get_regular_surname - use standard Gramps method to display surname, see _get_regular_surname
- daylight saving not just for USA and Europe - daylight saving not just for USA and Europe
- move the close_file() from one_day() to caller - move the close_file() from one_day() to caller
@ -178,6 +176,38 @@ def _make_date(year, month, day):
retval.set_yr_mon_day(year, month, day) retval.set_yr_mon_day(year, month, day)
return retval return retval
# Compute the first day to display for this month.
# It can also be a day in the previous month.
def get_first_day(year, month):
current_date = datetime.date(year, month, 1) # first day of the month
# monthinfo is filled using standard Python library
# calendar.monthcalendar. It fills a list of 7-day-lists. The first day
# of the 7-day-list is determined by calendar.firstweekday.
monthinfo = calendar.monthcalendar(year, month)
current_ord = current_date.toordinal() - monthinfo[0].count(0)
return current_date, current_ord, monthinfo
# get last month's last week for previous days in the month
def get_previous_day(year, month, day_col):
if month == 1:
prevmonth = calendar.monthcalendar(year - 1, 12)
else:
prevmonth = calendar.monthcalendar(year, month-1)
num_weeks = len(prevmonth)
lastweek_prevmonth = prevmonth[num_weeks - 1]
return lastweek_prevmonth[day_col]
# get next month's first week for next days in the month
def get_next_day(year, month, day_col):
if month == 12:
nextmonth = calendar.monthcalendar(year + 1, 1)
else:
nextmonth = calendar.monthcalendar(year, month + 1)
firstweek_nextmonth = nextmonth[0]
return firstweek_nextmonth[day_col]
#------------------------------------------------------------------------ #------------------------------------------------------------------------
# #
# WebCalReport # WebCalReport
@ -460,17 +490,11 @@ class WebCalReport(Report):
of.write('\t</ul>\n') of.write('\t</ul>\n')
of.write('</div>\n\n') of.write('</div>\n\n')
def calendar_common(self, of, nr_up, year, currsec1, title, body_id, def calendar_common(self, of, nr_up, year, currsec1, title, use_home=False):
use_home=False, add_print=True):
""" """
Will create the common information for each calendar being created Will create the common information for each calendar being created
""" """
# Add Header
self.write_header(of, nr_up, title, add_print)
of.write('<body id="%s">\n' % body_id)
# Header Title # Header Title
of.write('<div id="header">\n') of.write('<div id="header">\n')
of.write('\t<h1 id="SiteTitle">%s</h1>\n' % title) of.write('\t<h1 id="SiteTitle">%s</h1>\n' % title)
@ -517,10 +541,6 @@ class WebCalReport(Report):
start_dow = self.start_dow start_dow = self.start_dow
col2day = [(x-1)%7+1 for x in range(start_dow, start_dow + 7)] col2day = [(x-1)%7+1 for x in range(start_dow, start_dow + 7)]
# Note. GrampsLocale has sunday => 1, monday => 2, etc
# We slice out the first empty element.
day_names = GrampsLocale.long_days
# Translate a Gramps day number into a HTMLclass # Translate a Gramps day number into a HTMLclass
def get_class_for_daycol(col): def get_class_for_daycol(col):
day = col2day[col] day = col2day[col]
@ -534,10 +554,9 @@ class WebCalReport(Report):
day = col2day[col] day = col2day[col]
return day_names[day] return day_names[day]
# monthinfo is filled using standard Python library # Note. GrampsLocale has sunday => 1, monday => 2, etc
# calendar.monthcalendar. It fills a list of 7-day-lists. The first day # We slice out the first empty element.
# of the 7-day-list is determined by calendar.firstweekday. day_names = GrampsLocale.long_days
monthinfo = calendar.monthcalendar(year, month)
# Begin calendar head. We'll use the capitalized name, because here it # Begin calendar head. We'll use the capitalized name, because here it
# seems appropriate for most countries. # seems appropriate for most countries.
@ -558,33 +577,15 @@ class WebCalReport(Report):
for day_col in range(7): for day_col in range(7):
dayclass = get_class_for_daycol(day_col) dayclass = get_class_for_daycol(day_col)
dayname = get_name_for_daycol(day_col) dayname = get_name_for_daycol(day_col)
#of.write('\t\t\t<th class="%s">%s</th>\n' % (dayclass, get_name_for_daycol(day_col))) of.write('\t\t\t<th class="%s"><abbr title="%s">\n' % (dayclass, dayname))
of.write('\t\t\t<th class="%s"><abbr title="%s">%s</abbr></th>\n' % (dayclass, dayname, dayname[0])) of.write('\t\t\t\t%s</abbr></th>\n' % dayname[0])
of.write('\t\t</tr>\n') of.write('\t\t</tr>\n')
of.write('\t</thead>\n') of.write('\t</thead>\n')
# begin table body # begin table body
of.write('\t<tbody>\n') of.write('\t<tbody>\n')
# Compute the first day to display for this month. current_date, current_ord, monthinfo = get_first_day(year, month)
# It can also be a day in the previous month.
current_date = datetime.date(year, month, 1) # first day of the month
current_ord = current_date.toordinal() - monthinfo[0].count(0)
# get last month's last week for previous days in the month
if month == 1:
prevmonth = calendar.monthcalendar(year - 1, 12)
else:
prevmonth = calendar.monthcalendar(year, month-1)
num_weeks = len(prevmonth)
lastweek_prevmonth = prevmonth[num_weeks - 1]
# get next month's first week for next days in the month
if month == 12:
nextmonth = calendar.monthcalendar(year + 1, 1)
else:
nextmonth = calendar.monthcalendar(year, month + 1)
firstweek_nextmonth = nextmonth[0]
nweeks = len(monthinfo) nweeks = len(monthinfo)
for week_row in range(0, nweeks): for week_row in range(0, nweeks):
@ -598,10 +599,10 @@ class WebCalReport(Report):
day = week[day_col] day = week[day_col]
if day == 0: # a day in the previous or next month if day == 0: # a day in the previous or next month
if week_row == 0: # a day in the previous month if week_row == 0: # a day in the previous month
specday = lastweek_prevmonth[day_col] specday = get_previous_day(year, month, day_col)
specclass = "previous " + dayclass specclass = "previous " + dayclass
elif week_row == nweeks-1: # a day in the next month elif week_row == nweeks-1: # a day in the next month
specday = firstweek_nextmonth[day_col] specday = get_next_day(year, month, day_col)
specclass = "next " + dayclass specclass = "next " + dayclass
of.write('\t\t\t<td class="%s">\n' % specclass) of.write('\t\t\t<td class="%s">\n' % specclass)
@ -621,31 +622,34 @@ class WebCalReport(Report):
# specify day class for this day # specify day class for this day
of.write('class="%s">\n' % hilightday) of.write('class="%s">\n' % hilightday)
# Year at a Glance
if cal == "yg":
# create yyyymmdd date string for
# "One Day" calendar pages filename
two_digit_month = '%02d' % month
two_digit_day = '%02d' % day
fname_date = str(year) + str(two_digit_month) + str(two_digit_day)
# create web link to corresponding "One Day" page...
# The HREF is relative to the year path.
fname_date = '/'.join([lng_month, fname_date])
fname_date += self.ext
of.write('\t\t\t\t<a href="%s" title="%s%d">\n'
% (fname_date, shrt_month, day))
of.write('\t\t\t\t\t<div class="date">%d</div>\n' % day)
of.write('\t\t\t\t</a>\n')
one_day_cal = "OneDay"
# WebCal
else:
one_day_cal = "WebCal"
of.write('\t\t\t\t<div class="date">%d</div>\n' % day)
evt_dte = _make_date(thisday.year, thisday.month, thisday.day) evt_dte = _make_date(thisday.year, thisday.month, thisday.day)
self.one_day(of, evt_dte, one_day_cal, holiday_list, bday_anniv_list) day_list = get_day_list(evt_dte, holiday_list, bday_anniv_list)
if day_list:
# Year at a Glance
if cal == "yg":
# create yyyymmdd date string for
# "One Day" calendar page filename
two_digit_month = '%02d' % month
two_digit_day = '%02d' % day
fname_date = str(year) + str(two_digit_month) + str(two_digit_day)
# create web link to corresponding "One Day" page...
# The HREF is relative to the year path.
fname_date = '/'.join([lng_month, fname_date])
fname_date += self.ext
of.write('\t\t\t\t<a href="%s" title="%s%d">\n'
% (fname_date, shrt_month, day))
of.write('\t\t\t\t\t<div class="date">%d</div></a>\n' % day)
one_day_cal = "OneDay"
# WebCal
else:
one_day_cal = "WebCal"
of.write('\t\t\t\t<div class="date">%d</div>\n' % day)
# both WebCal and Year_Glance needs day_list displayed
self.one_day(of, evt_dte, one_day_cal, day_list)
# no holiday/ bday/ anniversary this day # no holiday/ bday/ anniversary this day
else: else:
@ -684,7 +688,7 @@ class WebCalReport(Report):
""" """
of.write('<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"\n') of.write('<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"\n')
of.write(' "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">\n') of.write('\t"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">\n')
xmllang = Utils.xml_lang() xmllang = Utils.xml_lang()
of.write('<html xmlns="http://www.w3.org/1999/xhtml" ' of.write('<html xmlns="http://www.w3.org/1999/xhtml" '
'xml:lang="%s" lang="%s">\n' % (xmllang, xmllang)) 'xml:lang="%s" lang="%s">\n' % (xmllang, xmllang))
@ -698,18 +702,21 @@ class WebCalReport(Report):
subdirs = ['..'] * nr_up subdirs = ['..'] * nr_up
# link to stylesheet # link to screen stylesheet
fname = '/'.join(subdirs + ['styles'] + [self.css]) fname = '/'.join(subdirs + ['styles'] + [self.css])
of.write('\t<link rel="stylesheet" href="%s" type="text/css" media="screen" />\n' % fname) of.write('\t<link rel="stylesheet" href="%s"\n' % fname)
of.write('\t\ttype="text/css" media="screen">\n')
# link to _CALENDARPRINT stylesheet # link to print stylesheet
if add_print: if add_print:
fname = '/'.join(subdirs + ['styles'] + ["Web_Print-Default.css"]) fname = '/'.join(subdirs + ['styles'] + ["Web_Print-Default.css"])
of.write('\t<link rel="stylesheet" href="%s" type="text/css" media="print" />\n' % fname) of.write('\t<link rel="stylesheet" href="%s"\n' % fname)
of.write('\t\ttype="text/css" media="print">\n')
# link to GRAMPS favicon # link to GRAMPS favicon
fname = '/'.join(subdirs + ['images'] + ['favicon.ico']) fname = '/'.join(subdirs + ['images'] + ['favicon.ico'])
of.write('\t<link rel="shortcut icon" href="%s" type="image/icon" />\n' % fname) of.write('\t<link rel="shortcut icon" href="%s" \n' % fname)
of.write('\t\ttype="image/icon" />\n')
of.write('</head>\n\n') of.write('</head>\n\n')
@ -772,24 +779,15 @@ class WebCalReport(Report):
def close_file(self, of): def close_file(self, of):
of.close() of.close()
def one_day(self, of, evt_dte, one_day_cal, holiday_list, bday_anniv_list): def one_day(self, of, evt_dte, one_day_cal, day_list):
""" """
This method creates the One Day page for "Year At A Glance" This method creates the One Day page for "Year At A Glance"
'holiday_list' - list of holidays to display on this day
'bday_anniv_list' - list of birthdays and anniversaries to display on this day
'day_list' - a combination of both dictionaries to be able to create one day 'day_list' - a combination of both dictionaries to be able to create one day
nyears, date, text, event --- are necessary for figuring the age or years married nyears, date, text, event --- are necessary for figuring the age or years married
for each year being created... for each year being created...
""" """
# initialize day_list
day_list = []
# call day_list to fill
day_list = fill_day_list(evt_dte, holiday_list, bday_anniv_list)
# This is one_day in the year-at-a-glance calendar # This is one_day in the year-at-a-glance calendar
if one_day_cal == "OneDay": if one_day_cal == "OneDay":
@ -816,7 +814,15 @@ class WebCalReport(Report):
# set date display as in user prevferences # set date display as in user prevferences
pg_date = _dd.display(evt_dte) pg_date = _dd.display(evt_dte)
self.calendar_common(of, nr_up, year, lng_month, _('One Day Within A Year'), pg_date) # page title
title = _('One Day Within A Year')
# Add Header
self.write_header(of, nr_up, title, False)
of.write('<body id="%s">\n' % pg_date)
self.calendar_common(of, nr_up, year, lng_month, title)
of.write('\t<h3 id="OneDay">%s</h3>\n' % pg_date) of.write('\t<h3 id="OneDay">%s</h3>\n' % pg_date)
@ -845,7 +851,12 @@ class WebCalReport(Report):
# page title # page title
title = _("%(year)d, At A Glance") % {'year' : year} title = _("%(year)d, At A Glance") % {'year' : year}
self.calendar_common(of, nr_up, year, 'fullyear', title, 'fullyearlinked') # Add Header
self.write_header(of, nr_up, title, False)
of.write('<body id="fullyearlinked">\n')
self.calendar_common(of, nr_up, year, 'fullyear', title)
# page description # page description
of.write('<div class="content">\n') of.write('<div class="content">\n')
@ -993,7 +1004,12 @@ class WebCalReport(Report):
cal_fname = _get_long_month_name(month) cal_fname = _get_long_month_name(month)
of = self.create_file(cal_fname, str(year)) of = self.create_file(cal_fname, str(year))
self.calendar_common(of, nr_up, year, cal_fname, self.title_text, 'WebCal', use_home=True) # Add Header
self.write_header(of, nr_up, self.title_text, True)
of.write('<body id="Web Calendar">\n')
self.calendar_common(of, nr_up, year, cal_fname, self.title_text, True)
# build the calendar # build the calendar
self.calendar_build(of, "wc", year, month) self.calendar_build(of, "wc", year, month)
@ -1454,9 +1470,9 @@ def _get_long_month_name(month):
def _get_short_month_name(month): def _get_short_month_name(month):
return _shrt_month[month] return _shrt_month[month]
def fill_day_list(evt_dte, holiday_list, bday_anniv_list): def get_day_list(evt_dte, holiday_list, bday_anniv_list):
""" """
Will fill day_list and return it to its caller one_day() Will fill day_list and return it to its caller: calendar_build()
holiday_list, or bday_anniv_list -- will always have something in it... holiday_list, or bday_anniv_list -- will always have something in it...
@ -1464,7 +1480,7 @@ def fill_day_list(evt_dte, holiday_list, bday_anniv_list):
'day_list' - a combination of both dictionaries to be able to create one day 'day_list' - a combination of both dictionaries to be able to create one day
nyears, date, text, event --- are necessary for figuring the age or years married nyears, date, text, event --- are necessary for figuring the age or years married
for each year being created... for each day being created...
""" """
# initialize day_list # initialize day_list
@ -1521,12 +1537,10 @@ def fill_day_list(evt_dte, holiday_list, bday_anniv_list):
if txt_str is not None: if txt_str is not None:
day_list.append((nyears, date, txt_str, event)) day_list.append((nyears, date, txt_str, event))
# if there is more than one event on any given date, sort them based on years # sort them based on number of years
# for birthdays and anniversaries. # holidays will always be on top of day
# holidays will always appear first in the list. day_list.sort()
if len(day_list) > 1:
day_list.sort()
return day_list return day_list
def get_marrital_status(family, db): def get_marrital_status(family, db):
@ -1548,6 +1562,9 @@ def get_marrital_status(family, db):
are_married = None are_married = None
return are_married return are_married
def gen_key(event):
return ((event.get_year(), event.get_month(), event.get_day()))
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
# #
# #