Spotty cleanup of NarrativeWeb. Huge cleanup of WebCal-- saves a lot of space in web page files.
svn: r12389
This commit is contained in:
parent
444770b2bd
commit
3fa8f51025
@ -109,12 +109,6 @@ _NARRATIVEPRINT = 'narrative-print.css'
|
|||||||
_PERSON = 0
|
_PERSON = 0
|
||||||
_PLACE = 1
|
_PLACE = 1
|
||||||
|
|
||||||
# graphics for Maiz stylesheet
|
|
||||||
_WEBBKGD = 'Web_Mainz_Bkgd.png'
|
|
||||||
_WEBHEADER = 'Web_Mainz_Header.png'
|
|
||||||
_WEBMID = 'Web_Mainz_Mid.png'
|
|
||||||
_WEBMIDLIGHT = 'Web_Mainz_MidLight.png'
|
|
||||||
|
|
||||||
# Web page filename extensions
|
# Web page filename extensions
|
||||||
_WEB_EXT = ['.html', '.htm', '.shtml', '.php', '.php3', '.cgi']
|
_WEB_EXT = ['.html', '.htm', '.shtml', '.php', '.php3', '.cgi']
|
||||||
|
|
||||||
@ -367,7 +361,7 @@ class BasePage:
|
|||||||
text = '© %(year)d %(person)s' % {
|
text = '© %(year)d %(person)s' % {
|
||||||
'person' : self.author,
|
'person' : self.author,
|
||||||
'year' : year}
|
'year' : year}
|
||||||
elif 0 < copy_nr < len(_CC):
|
elif 0 < copy_nr <= len(_CC):
|
||||||
# Note. This is a URL
|
# Note. This is a URL
|
||||||
fname = '/'.join(["images", "somerights20.gif"])
|
fname = '/'.join(["images", "somerights20.gif"])
|
||||||
fname = self.report.build_url_fname(fname, None, self.up)
|
fname = self.report.build_url_fname(fname, None, self.up)
|
||||||
@ -2204,7 +2198,7 @@ class IndividualPage(BasePage):
|
|||||||
birth_event = self.report.database.get_event_from_handle(birth_ref.ref)
|
birth_event = self.report.database.get_event_from_handle(birth_ref.ref)
|
||||||
birth_date = birth_event.get_date_object()
|
birth_date = birth_event.get_date_object()
|
||||||
|
|
||||||
if (birth_date is not None and birth_date.get_valid()):
|
if (birth_date is not None and birth_date.is_valid()):
|
||||||
alive = probably_alive(self.person, self.report.database, gen.lib.date.Today())
|
alive = probably_alive(self.person, self.report.database, gen.lib.date.Today())
|
||||||
death_ref = self.person.get_death_ref()
|
death_ref = self.person.get_death_ref()
|
||||||
death_date = None
|
death_date = None
|
||||||
@ -2991,9 +2985,14 @@ class NavWebReport(Report):
|
|||||||
|
|
||||||
imgs = []
|
imgs = []
|
||||||
|
|
||||||
|
# Mainz stylesheet graphics
|
||||||
|
# will only be used if Mainz is slected as the stylesheet
|
||||||
|
Mainz_images = ["Web_Mainz_Bkgd.png", "Web_Mainz_Header.png",
|
||||||
|
"Web_Mainz_Mid.png", "Web_Mainz_MidLight.png"]
|
||||||
|
|
||||||
# Copy Mainz Style Images
|
# Copy Mainz Style Images
|
||||||
if self.css == "Web_Mainz.css":
|
if self.css == "Web_Mainz.css":
|
||||||
imgs += [_WEBBKGD, _WEBHEADER, _WEBMID, _WEBMIDLIGHT]
|
imgs += Mainz_images
|
||||||
|
|
||||||
# Copy the Creative Commons icon if the Creative Commons
|
# Copy the Creative Commons icon if the Creative Commons
|
||||||
# license is requested???
|
# license is requested???
|
||||||
|
@ -82,13 +82,6 @@ _WEB_EXT = ['.html', '.htm', '.shtml', '.php', '.php3', '.cgi']
|
|||||||
_CALENDARSCREEN = 'calendar-screen.css'
|
_CALENDARSCREEN = 'calendar-screen.css'
|
||||||
_CALENDARPRINT = 'calendar-print.css'
|
_CALENDARPRINT = 'calendar-print.css'
|
||||||
|
|
||||||
# Mainz stylesheet graphics
|
|
||||||
# will only be used if Mainz is slected as the stylesheet
|
|
||||||
_WEBBKGD = "Web_Mainz_Bkgd.png"
|
|
||||||
_WEBHEADER = "Web_Mainz_Header.png"
|
|
||||||
_WEBMID = "Web_Mainz_Mid.png"
|
|
||||||
_WEBMIDLIGHT = "Web_Mainz_MidLight.png"
|
|
||||||
|
|
||||||
# This information defines the list of styles in the Web calendar
|
# This information defines the list of styles in the Web calendar
|
||||||
# options dialog as well as the location of the corresponding
|
# options dialog as well as the location of the corresponding
|
||||||
# stylesheets.
|
# stylesheets.
|
||||||
@ -229,8 +222,7 @@ class WebCalReport(Report):
|
|||||||
self.email = researcher.email
|
self.email = researcher.email
|
||||||
|
|
||||||
# set to today's date
|
# set to today's date
|
||||||
today = time.localtime()
|
self.today = gen.lib.date.Today()
|
||||||
self.today = gen.lib.Date(today[0], today[1], today[2])
|
|
||||||
|
|
||||||
self.warn_dir = True # Only give warning once.
|
self.warn_dir = True # Only give warning once.
|
||||||
|
|
||||||
@ -283,12 +275,16 @@ class WebCalReport(Report):
|
|||||||
# Adds Birthdays and Anniversaries
|
# Adds Birthdays and Anniversaries
|
||||||
#
|
#
|
||||||
# ---------------------------------------------------------------------------------------
|
# ---------------------------------------------------------------------------------------
|
||||||
|
|
||||||
def add_day_item(self, text, year, month, day, event):
|
def add_day_item(self, text, year, month, day, event):
|
||||||
if day == 0:
|
if day == 0:
|
||||||
# This may happen for certain "about" dates.
|
# This may happen for certain "about" dates.
|
||||||
day = 1 # Use first day of the month
|
day = 1 # Use first day of the month
|
||||||
month_dict = self.calendar.get(month, {})
|
|
||||||
|
# determine which dictionary to use???
|
||||||
|
if event in ['Birthday', 'Anniversary']:
|
||||||
|
month_dict = self.calendar.get(month, {})
|
||||||
|
else:
|
||||||
|
month_dict = self.holidays.get(month, {})
|
||||||
day_list = month_dict.get(day, [])
|
day_list = month_dict.get(day, [])
|
||||||
|
|
||||||
if month > 0:
|
if month > 0:
|
||||||
@ -302,14 +298,19 @@ class WebCalReport(Report):
|
|||||||
|
|
||||||
day_list.append((text, event, event_date))
|
day_list.append((text, event, event_date))
|
||||||
month_dict[day] = day_list
|
month_dict[day] = day_list
|
||||||
self.calendar[month] = month_dict
|
|
||||||
|
# determine which dictionary to add it to???
|
||||||
|
if event in ['Birthday', 'Anniversary']:
|
||||||
|
self.calendar[month] = month_dict
|
||||||
|
else:
|
||||||
|
self.holidays[month] = month_dict
|
||||||
|
|
||||||
# ---------------------------------------------------------------------------------------
|
# ---------------------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
# Retrieves Holidays from the Holiday file, src/plugins/lib/holidays.xml
|
# Retrieves Holidays from the Holiday file,
|
||||||
|
# src/plugins/lib/holidays.xml
|
||||||
#
|
#
|
||||||
# ---------------------------------------------------------------------------------------
|
# ---------------------------------------------------------------------------------------
|
||||||
|
|
||||||
def __get_holidays(self, year):
|
def __get_holidays(self, year):
|
||||||
|
|
||||||
self.progress.set_pass(_('Calculating Holidays for year %d' % year), 365)
|
self.progress.set_pass(_('Calculating Holidays for year %d' % year), 365)
|
||||||
@ -322,42 +323,16 @@ class WebCalReport(Report):
|
|||||||
for day in range(1, 32):
|
for day in range(1, 32):
|
||||||
holiday_names = holiday_table.get_holidays(month, day)
|
holiday_names = holiday_table.get_holidays(month, day)
|
||||||
for holiday_name in holiday_names:
|
for holiday_name in holiday_names:
|
||||||
self.add_holiday_item(holiday_name, month, day)
|
self.add_day_item(holiday_name, year, month, day, 'Holiday')
|
||||||
|
|
||||||
# increment progress bar
|
# increment progress bar
|
||||||
self.progress.step()
|
self.progress.step()
|
||||||
|
|
||||||
# ---------------------------------------------------------------------------------------
|
|
||||||
#
|
|
||||||
# Adds Holiday events
|
|
||||||
#
|
|
||||||
# ---------------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
def add_holiday_item(self, text, month, day):
|
|
||||||
"""
|
|
||||||
add holiday to its dictionary
|
|
||||||
|
|
||||||
text -- holiday title
|
|
||||||
month -- month of holiday
|
|
||||||
day -- day of holiday
|
|
||||||
"""
|
|
||||||
|
|
||||||
if day == 0:
|
|
||||||
# This may happen for certain "about" dates.
|
|
||||||
day = 1 # Use first day of the month
|
|
||||||
month_dict = self.holidays.get(month, {})
|
|
||||||
day_list = month_dict.get(day, [])
|
|
||||||
|
|
||||||
day_list.append(text)
|
|
||||||
month_dict[day] = day_list
|
|
||||||
self.holidays[month] = month_dict
|
|
||||||
|
|
||||||
# ---------------------------------------------------------------------------------------
|
# ---------------------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
# Copies all of the calendar files for all calendars
|
# Copies all of the calendar files for all calendars
|
||||||
#
|
#
|
||||||
# ---------------------------------------------------------------------------------------
|
# ---------------------------------------------------------------------------------------
|
||||||
|
|
||||||
def copy_calendar_files(self):
|
def copy_calendar_files(self):
|
||||||
"""
|
"""
|
||||||
Copies all the necessary stylesheets and images for these calendars
|
Copies all the necessary stylesheets and images for these calendars
|
||||||
@ -374,9 +349,14 @@ class WebCalReport(Report):
|
|||||||
# set imgs to empty
|
# set imgs to empty
|
||||||
imgs = []
|
imgs = []
|
||||||
|
|
||||||
|
# Mainz stylesheet graphics
|
||||||
|
# will only be used if Mainz is slected as the stylesheet
|
||||||
|
Mainz_images = ["Web_Mainz_Bkgd.png", "Web_Mainz_Header.png",
|
||||||
|
"Web_Mainz_Mid.png", "Web_Mainz_MidLight.png"]
|
||||||
|
|
||||||
if self.css == "Web_Mainz.css":
|
if self.css == "Web_Mainz.css":
|
||||||
# Copy Mainz Style Images
|
# Copy Mainz Style Images
|
||||||
imgs += [_WEBBKGD, _WEBHEADER, _WEBMID, _WEBMIDLIGHT]
|
imgs += Mainz_images
|
||||||
|
|
||||||
# Copy GRAMPS favicon
|
# Copy GRAMPS favicon
|
||||||
imgs += ['favicon.ico']
|
imgs += ['favicon.ico']
|
||||||
@ -465,9 +445,6 @@ class WebCalReport(Report):
|
|||||||
Html('meta', attr = _META2)
|
Html('meta', attr = _META2)
|
||||||
)
|
)
|
||||||
|
|
||||||
# add meta tags to head section
|
|
||||||
head += meta
|
|
||||||
|
|
||||||
# links for GRAMPS favicon and stylesheets
|
# links for GRAMPS favicon and stylesheets
|
||||||
links = Html('link',rel='shortcut icon', href=fname1,type='image/x-icon',indent=True) + (
|
links = Html('link',rel='shortcut icon', href=fname1,type='image/x-icon',indent=True) + (
|
||||||
Html('link',rel='stylesheet', href=fname2,type='text/css',media='screen')
|
Html('link',rel='stylesheet', href=fname2,type='text/css',media='screen')
|
||||||
@ -478,8 +455,8 @@ class WebCalReport(Report):
|
|||||||
fname = '/'.join([subdirs] + ['styles'] + [_CALENDARPRINT])
|
fname = '/'.join([subdirs] + ['styles'] + [_CALENDARPRINT])
|
||||||
links += Html('link',rel='stylesheet', href=fname,type='text/css',media='print')
|
links += Html('link',rel='stylesheet', href=fname,type='text/css',media='print')
|
||||||
|
|
||||||
# add stylesheet links to head section
|
# add additional meta tags and stylesheet links to head section
|
||||||
head += links
|
head += (meta, links)
|
||||||
|
|
||||||
# begin page body
|
# begin page body
|
||||||
new_body = Html('body', id = body_id)
|
new_body = Html('body', id = body_id)
|
||||||
@ -507,8 +484,7 @@ class WebCalReport(Report):
|
|||||||
# add header division to body
|
# add header division to body
|
||||||
new_body += headerdiv
|
new_body += headerdiv
|
||||||
|
|
||||||
# return to its caller
|
# return to its caller; either webcalendar(), year_glance(), or one_day()
|
||||||
# either webcalendar(), year_glance(), or one_day()
|
|
||||||
return page, new_body
|
return page, new_body
|
||||||
|
|
||||||
# ---------------------------------------------------------------------------------------
|
# ---------------------------------------------------------------------------------------
|
||||||
@ -561,10 +537,10 @@ class WebCalReport(Report):
|
|||||||
|
|
||||||
# Figure out if we need <li class="CurrentSection"> or just plain <li>
|
# Figure out if we need <li class="CurrentSection"> or just plain <li>
|
||||||
cs = str(cal_year) == currentsection and 'class="CurrentSection"' or ''
|
cs = str(cal_year) == currentsection and 'class="CurrentSection"' or ''
|
||||||
ul += Html('li',attr=cs , indent=True, inline=True) + (
|
ul += Html('li', attr=cs , indent=True, inline=True) + (
|
||||||
|
|
||||||
# create hyperlink
|
# create hyperlink
|
||||||
Html('a', str(cal_year), href = url, inline=True)
|
Html('a', str(cal_year), href = url, indent=True, inline=True)
|
||||||
)
|
)
|
||||||
|
|
||||||
# increase columns
|
# increase columns
|
||||||
@ -643,7 +619,7 @@ class WebCalReport(Report):
|
|||||||
ul += Html('li', attr = cs, indent=True, inline=True) + (
|
ul += Html('li', attr = cs, indent=True, inline=True) + (
|
||||||
|
|
||||||
# create hyperlink
|
# create hyperlink
|
||||||
Html('a', nav_text, href = url)
|
Html('a', nav_text, href = url,indent=True,inline=True)
|
||||||
)
|
)
|
||||||
|
|
||||||
# add ul to monthnav
|
# add ul to monthnav
|
||||||
@ -717,11 +693,11 @@ 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)
|
||||||
th = Html('th', class_ =dayclass, indent=True, inline=True)
|
th = Html('th', class_ =dayclass, indent=True, inline=True) + (
|
||||||
abbr = Html('abbr', dayname[0], title=dayname)
|
Html('abbr', dayname[0], title=dayname)
|
||||||
|
)
|
||||||
|
|
||||||
# now add it all together
|
# now add it all together
|
||||||
th += abbr
|
|
||||||
weekday_names += th
|
weekday_names += th
|
||||||
|
|
||||||
# add weekdays names to table body
|
# add weekdays names to table body
|
||||||
@ -736,13 +712,15 @@ class WebCalReport(Report):
|
|||||||
# get first of the month and month information
|
# get first of the month and month information
|
||||||
current_date, current_ord, monthinfo = get_first_day_of_month(year, month)
|
current_date, current_ord, monthinfo = get_first_day_of_month(year, month)
|
||||||
|
|
||||||
|
# begin calendar table rows, starting week0
|
||||||
nweeks = len(monthinfo)
|
nweeks = len(monthinfo)
|
||||||
for week_row in range(0, nweeks):
|
for week_row in range(0, nweeks):
|
||||||
week = monthinfo[week_row]
|
week = monthinfo[week_row]
|
||||||
|
|
||||||
# if you look this up in wikipedia, the first week is called week0
|
# if you look this up in wikipedia, the first week is called week0
|
||||||
tr = Html('tr', class_ = 'week%02d' % week_row, indent=True)
|
tr = Html('tr', class_ = 'week%d' % week_row, indent=True)
|
||||||
|
|
||||||
|
# begin calendar day column
|
||||||
for day_col in range(0, 7):
|
for day_col in range(0, 7):
|
||||||
dayclass = get_class_for_daycol(day_col)
|
dayclass = get_class_for_daycol(day_col)
|
||||||
|
|
||||||
@ -755,30 +733,35 @@ class WebCalReport(Report):
|
|||||||
# adds date for all pieces of this calendar building
|
# adds date for all pieces of this calendar building
|
||||||
datediv = Html('div', day, class_ ='date',indent=True,inline=True)
|
datediv = Html('div', day, class_ ='date',indent=True,inline=True)
|
||||||
|
|
||||||
if day == 0: # a day in the previous or next month
|
# a day in the previous or next month
|
||||||
if week_row == 0: # a day in the previous month
|
if day == 0:
|
||||||
|
|
||||||
|
# day in previous month
|
||||||
|
if week_row == 0:
|
||||||
specday = get_previous_day(year, month, 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
|
|
||||||
|
# a day in the next month
|
||||||
|
elif week_row == (nweeks-1):
|
||||||
specday = get_next_day(year, month, day_col)
|
specday = get_next_day(year, month, day_col)
|
||||||
specclass = "next " + dayclass
|
specclass = "next " + dayclass
|
||||||
|
|
||||||
# continue table cell, <td>
|
# continue table cell, <td>, without id tag
|
||||||
td = Html('td', class_ = specclass, indent=True,inline=True)
|
td = Html('td', class_ = specclass, indent=True,inline=True) + (
|
||||||
|
|
||||||
# adds date for all pieces of this calendar building
|
# adds date for previous and next month days
|
||||||
datediv = Html('div', specday, class_ = 'date',indent=True,inline=True)
|
Html('div', specday, class_ = 'date',indent=True,inline=True)
|
||||||
|
)
|
||||||
# add date to table cell, <td>
|
|
||||||
td += datediv
|
|
||||||
|
|
||||||
# add table cell, <td>, to table row, <tr>
|
# add table cell, <td>, to table row, <tr>
|
||||||
tr += td
|
tr += td
|
||||||
|
|
||||||
else: # normal day number in current month
|
# normal day number in current month
|
||||||
|
else:
|
||||||
thisday = datetime.date.fromordinal(current_ord)
|
thisday = datetime.date.fromordinal(current_ord)
|
||||||
|
|
||||||
if thisday.month == month: # Something this month
|
# Something this month
|
||||||
|
if thisday.month == month:
|
||||||
holiday_list = self.holidays.get(month, {}).get(thisday.day, [])
|
holiday_list = self.holidays.get(month, {}).get(thisday.day, [])
|
||||||
bday_anniv_list = self.calendar.get(month, {}).get(thisday.day, [])
|
bday_anniv_list = self.calendar.get(month, {}).get(thisday.day, [])
|
||||||
|
|
||||||
@ -818,9 +801,12 @@ class WebCalReport(Report):
|
|||||||
# just year_glance(), but no one_day() pages
|
# just year_glance(), but no one_day() pages
|
||||||
else:
|
else:
|
||||||
|
|
||||||
# date division section
|
# continue table cell, <td>, without id tag
|
||||||
# show hilighted date, but no hyperlink
|
td = Html('td', class_ = hilightday, indent=True,inline=True) + (
|
||||||
td += datediv
|
|
||||||
|
# adds date division
|
||||||
|
Html('div', day, class_ = 'date',indent=True,inline=True)
|
||||||
|
)
|
||||||
|
|
||||||
# WebCal
|
# WebCal
|
||||||
else:
|
else:
|
||||||
@ -841,17 +827,19 @@ class WebCalReport(Report):
|
|||||||
else:
|
else:
|
||||||
|
|
||||||
# create empty day with date
|
# create empty day with date
|
||||||
td = Html('td', id=tdid, class_ = dayclass, indent=True)
|
td = Html('td', class_ = dayclass, indent=True, inline=True) + (
|
||||||
|
|
||||||
# add date to table cell, <td>
|
# adds date division
|
||||||
td += datediv
|
Html('div', day, class_ = 'date',indent=True,inline=True)
|
||||||
|
)
|
||||||
|
|
||||||
# nothing for this month
|
# nothing for this month
|
||||||
else:
|
else:
|
||||||
td = Html('td', id=tdid, class_ = dayclass, indent=True)
|
td = Html('td', class_ = dayclass, indent=True) + (
|
||||||
|
|
||||||
# add date to table cell, <td>
|
# adds date division
|
||||||
td += datediv
|
Html('div', day, class_ = 'date',indent=True,inline=True)
|
||||||
|
)
|
||||||
|
|
||||||
# add table cell, <td>, to table row, <tr>
|
# add table cell, <td>, to table row, <tr>
|
||||||
# close the day column
|
# close the day column
|
||||||
@ -867,13 +855,11 @@ class WebCalReport(Report):
|
|||||||
if cal == "yg":
|
if cal == "yg":
|
||||||
# Fill up till we have 6 rows, so that the months align properly
|
# Fill up till we have 6 rows, so that the months align properly
|
||||||
for i in range(nweeks, 6):
|
for i in range(nweeks, 6):
|
||||||
six_weeks = Html('tr', class_ = 'week%02d' % (i + 1), indent=True)
|
six_weeks = Html('tr', class_ = 'week%d' % (i + 1), indent=True) + (
|
||||||
|
|
||||||
# create table cell, <td>
|
# create table cell, <td>
|
||||||
td = Html('td', colspan=7, indent=True)
|
Html('td', colspan=7, indent=True,inline=True)
|
||||||
|
)
|
||||||
# add table cell, <td>, to six weeks
|
|
||||||
six_weeks += td
|
|
||||||
|
|
||||||
# add extra weeks to tbody if needed
|
# add extra weeks to tbody if needed
|
||||||
tbody += six_weeks
|
tbody += six_weeks
|
||||||
@ -1399,29 +1385,23 @@ class WebCalOptions(MenuReportOptions):
|
|||||||
category_name = _("Content Options")
|
category_name = _("Content Options")
|
||||||
|
|
||||||
# set to today's date for use in menu, etc.
|
# set to today's date for use in menu, etc.
|
||||||
# 0 = year, 1 = month, 2 = day
|
today = gen.lib.date.Today()
|
||||||
today = time.localtime()
|
|
||||||
today = datetime.date(today[0], today[1], today[2])
|
|
||||||
|
|
||||||
self.__multiyear = BooleanOption(_('Create multiple year '
|
self.__multiyear = BooleanOption(_('Create multiple year calendars'), False)
|
||||||
'calendars'), False)
|
self.__multiyear.set_help(_('Whether to create Multiple year calendars or not.'))
|
||||||
self.__multiyear.set_help(_('Whether to create Multiple year '
|
|
||||||
'calendars or not.'))
|
|
||||||
menu.add_option(category_name, 'multiyear', self.__multiyear)
|
menu.add_option(category_name, 'multiyear', self.__multiyear)
|
||||||
self.__multiyear.connect('value-changed', self.__multiyear_changed)
|
self.__multiyear.connect('value-changed', self.__multiyear_changed)
|
||||||
|
|
||||||
self.__start_year = NumberOption(_('Start Year for the '
|
self.__start_year = NumberOption(_('Start Year for the Calendar(s)'), today.get_year(),
|
||||||
'Calendar(s)'), today.year, 1900, 3000)
|
1900, 3000)
|
||||||
self.__start_year.set_help(_('Enter the starting year for the calendars '
|
self.__start_year.set_help(_('Enter the starting year for the calendars '
|
||||||
'between 1900 - 3000'))
|
'between 1900 - 3000'))
|
||||||
menu.add_option(category_name, 'start_year', self.__start_year)
|
menu.add_option(category_name, 'start_year', self.__start_year)
|
||||||
|
|
||||||
self.__end_year = NumberOption(_('End Year for the '
|
self.__end_year = NumberOption(_('End Year for the Calendar(s)'), today.get_year(),
|
||||||
'Calendar(s)'), today.year, 1900, 3000)
|
1900, 3000)
|
||||||
self.__end_year.set_help(_('Enter the ending year for the calendars '
|
self.__end_year.set_help(_('Enter the ending year for the calendars '
|
||||||
'between 1900 - 3000. if multiple years '
|
'between 1900 - 3000.'))
|
||||||
'is selected, then only twenty years at any '
|
|
||||||
'given time'))
|
|
||||||
menu.add_option(category_name, 'end_year', self.__end_year)
|
menu.add_option(category_name, 'end_year', self.__end_year)
|
||||||
|
|
||||||
self.__multiyear_changed()
|
self.__multiyear_changed()
|
||||||
@ -1792,11 +1772,9 @@ def get_day_list(event_date, holiday_list, bday_anniv_list):
|
|||||||
|
|
||||||
##################################################################
|
##################################################################
|
||||||
# holiday on this day
|
# holiday on this day
|
||||||
# The 0 will force holidays to be first in the list
|
# '...' signifies an incomplete date for an event. See add_day_item()
|
||||||
for event_name in holiday_list:
|
holiday_list = [(t, e, d) for t, e, d in holiday_list
|
||||||
for line in event_name.splitlines():
|
if d != '...']
|
||||||
day_list.append((0, event_date, line, 'Holiday'))
|
|
||||||
##################################################################
|
|
||||||
|
|
||||||
##################################################################
|
##################################################################
|
||||||
# birthday/ anniversary on this day
|
# birthday/ anniversary on this day
|
||||||
@ -1810,9 +1788,8 @@ def get_day_list(event_date, holiday_list, bday_anniv_list):
|
|||||||
for text, event, date in bday_anniv_list:
|
for text, event, date in bday_anniv_list:
|
||||||
|
|
||||||
# number of years married, ex: 10
|
# number of years married, ex: 10
|
||||||
nyears = event_date.get_year() - date.get_year()
|
# zero will force holidays to be first in list
|
||||||
|
nyears = (event_date.get_year() - date.get_year())
|
||||||
txt_str = None
|
|
||||||
|
|
||||||
# number of years for birthday, ex: 10 years
|
# number of years for birthday, ex: 10 years
|
||||||
age_str = event_date - date
|
age_str = event_date - date
|
||||||
@ -1839,13 +1816,16 @@ def get_day_list(event_date, holiday_list, bday_anniv_list):
|
|||||||
% {'couple' : text, 'years' : nyears})
|
% {'couple' : text, 'years' : nyears})
|
||||||
txt_str = Html('span', txt_str, class_ = 'yearsmarried')
|
txt_str = Html('span', txt_str, class_ = 'yearsmarried')
|
||||||
|
|
||||||
if txt_str is not None:
|
day_list.append((nyears, date, txt_str, event))
|
||||||
day_list.append((nyears, date, txt_str, event))
|
|
||||||
|
# a holiday
|
||||||
|
for text, event, date in holiday_list:
|
||||||
|
day_list.append((0, date, text, 'Holiday'))
|
||||||
|
|
||||||
# sort them based on number of years
|
# sort them based on number of years
|
||||||
# holidays will always be on top of day
|
|
||||||
day_list.sort()
|
day_list.sort()
|
||||||
|
|
||||||
|
# return to its caller calendar_build()
|
||||||
return day_list
|
return day_list
|
||||||
|
|
||||||
# ---------------------------------------------------------------------------------------
|
# ---------------------------------------------------------------------------------------
|
||||||
|
Loading…
x
Reference in New Issue
Block a user