\n'
% (cs, url, title))
def calendar_build(self, of, cal, month):
@@ -443,7 +459,7 @@ class WebCalReport(Report):
This does the work of building the calendar
"""
- year = self.Year
+ year = self.year
# Begin calendar head
title = GrampsLocale.long_months[month]
@@ -529,7 +545,7 @@ class WebCalReport(Report):
of.write(' \n')
else: # day number
if cal == "by":
- of.write('
\n'
+ of.write('
\n'
% (day, dayclass))
of.write('
%d
\n' % day)
of.write('
\n')
@@ -537,23 +553,23 @@ class WebCalReport(Report):
of.write('
[])):
+ list_ = self.calendar.get(month, {}).get(thisday.day, {})
+ if ((thisday.day == day) and (list_ > [])):
specclass = "highlight " + dayclass
of.write('class="%s">\n' % specclass)
if cal == "yg": # Year at a Glance
lng_month = GrampsLocale.long_months[month]
shrt_month = GrampsLocale.short_months[month]
- of.write(' \n'
+ of.write(' \n'
% (lng_month, shrt_month, day, self.ext))
of.write('
\n' % self.Home_link)
+ ip.write('HOME\n' % self.home_link)
title = GrampsLocale.short_months[month]
self.display_nav_links(ip, title, "ip")
@@ -744,7 +767,7 @@ class WebCalReport(Report):
ip.write('
\n')
ip.write('
\n')
- ip.write('
%s %d, %d
\n'
+ ip.write('
%s %d, %d
\n'
% (lng_month, day_num, year))
# if arrow file exists in IMAGE_DIR, use it
@@ -753,7 +776,7 @@ class WebCalReport(Report):
ip.write('
\n')
else:
ip.write('
\n')
- for p in list:
+ for p in list_:
lines = p.count("\n") + 1 # lines in the text
for line in p.split("\n"):
ip.write('
')
@@ -766,7 +789,7 @@ class WebCalReport(Report):
def six_weeks(self, of, nweeks):
"""
- Will complete the calendar out to six weeks for
+ Will complete the calendar out to six weeks for
proper styling of css sheets
"""
@@ -774,7 +797,7 @@ class WebCalReport(Report):
for empty_weeks in range(1, 3):
of.write('
\n' % (nweeks + empty_weeks))
of.write('
\n')
- of.write('
\n')
+ of.write(' \n')
of.write('
\n')
elif nweeks == 5: # five weeks, add one week
of.write('
\n')
@@ -788,7 +811,7 @@ class WebCalReport(Report):
This method will create the Printable Full Year One Page Calendar...
"""
- year = self.Year
+ year = self.year
# if year dir doesn't exist, create it
new_dir = self.html_dir + "/%d" % year
if not os.path.isdir(new_dir):
@@ -814,6 +837,8 @@ class WebCalReport(Report):
"""
+ # TODO. See note in indiv_date()
+
# Add header to page
title = str(year) + "Blank Calendar"
(by, author) = self.write_header(by, title, "by", mystyle)
@@ -833,15 +858,15 @@ class WebCalReport(Report):
by.write('
\n')
by.write('
\n')
- if self.Home_link.strip() != '':
+ if self.home_link.strip() != '':
by.write('
\n')
-
+
# Create progress bar for it
self.progress.set_pass(_('Creating Printable Blank Full-Year Calendar Page'), 12)
@@ -864,7 +889,7 @@ class WebCalReport(Report):
This method will create the Full Year At A Glance Page...
"""
- year = self.Year
+ year = self.year
# if year dir doesn't exist, create it
new_dir = self.html_dir + "/%d/" % year
if not os.path.isdir(new_dir):
@@ -910,6 +935,8 @@ class WebCalReport(Report):
"""
+ # TODO. See note in indiv_date()
+
# Add header to page
title = "%d, At A Glance" % year
(yg, author) = self.write_header(yg, title, "yg", mystyle)
@@ -929,9 +956,9 @@ class WebCalReport(Report):
yg.write('
\n')
yg.write('
\n')
- if self.Home_link.strip() != '':
+ if self.home_link.strip() != '':
yg.write('
\n')
yg.write(' \n')
@@ -980,7 +1006,7 @@ class WebCalReport(Report):
parent_dir = os.path.dirname(self.html_dir)
if not os.path.isdir(parent_dir):
ErrorDialog(_("Neither %s nor %s are directories") % \
- (self.html_dir,parent_dir))
+ (self.html_dir, parent_dir))
return
else:
try:
@@ -993,24 +1019,24 @@ class WebCalReport(Report):
ErrorDialog(_("Could not create the directory: %s") % \
self.html_dir)
return
-
+
# initialize the dict to fill:
self.calendar = {}
- self.progress = Utils.ProgressMeter(_("Generate XHTML Calendars"),'')
+ self.progress = Utils.ProgressMeter(_("Generate XHTML Calendars"), '')
# Generate the CSS file
self.copy_css()
# get the information, first from holidays:
- if self.Country != 0: # Don't include holidays
- self.get_holidays(_COUNTRIES[self.Country]) # _country is currently global
- self.progress.set_pass(_("Getting information from holidays file"),'')
+ if self.country != 0: # Don't include holidays
+ self.get_holidays(_COUNTRIES[self.country]) # _country is currently global
+ self.progress.set_pass(_("Getting information from holidays file"), '')
# get data from database:
self.collect_data()
# generate the report:
- self.progress.set_pass(_("Creating Calendar pages"),12)
+ self.progress.set_pass(_("Creating Calendar pages"), 12)
for month in range(1, 13):
self.progress.step()
@@ -1025,31 +1051,12 @@ class WebCalReport(Report):
# Close the progress meter
self.progress.close()
- def subdirs(self, cal, dir, name):
- """
- his will add the number of subdirs to the filename depending on which
- calendar is being called
- "wc" = WebCal
- yg = Year At A Glance
- by = Printable Pocket Calendar
- ip = Indiv Pages
- """
-
- if cal == "wc":
- subdirs = '.././'
- elif ((cal == "yg") or (cal == "by")):
- subdirs = '.././'
- else:
- subdirs = '../.././'
- fname = subdirs + '%s%s' % (dir, name)
- return fname
-
def print_page(self, month):
"""
This method provides information and header/ footer to the calendar month
"""
- year = self.Year
+ year = self.year
# if year dir doesn't exist, create it
new_dir = self.html_dir + "/%d" % year
if not os.path.isdir(new_dir):
@@ -1070,8 +1077,10 @@ class WebCalReport(Report):
"""
+ # TODO. See note in indiv_date()
+
# Add Header to calendar
- (of, author) = self.write_header(of, self.Title_text, "of", mystyle)
+ of, author = self.write_header(of, self.title_text, "of", mystyle)
of.write('\n') # terminated in write_footer
@@ -1081,17 +1090,17 @@ class WebCalReport(Report):
of.write('
\n')
msg = 'Created for %s' % author
of.write(' %s
\n' % msg)
- of.write('
%s
\n' % self.Title_text)
+ of.write('
%s
\n' % self.title_text)
of.write('
%d
\n' % year)
of.write('
\n') # end header
# Create Navigation Menu
of.write('
\n')
- of.write('
\n')
+ of.write('
\n')
- if self.Home_link.strip() != '':
+ if self.home_link.strip() != '':
of.write('
\n')
of.write(' \n')
of.write(' \n\n')
@@ -1133,10 +1139,10 @@ class WebCalReport(Report):
This method runs through the data, and collects the relevant dates
and text.
"""
- self.progress.set_pass(_("Filtering"),'')
+ self.progress.set_pass(_("Filtering"), '')
people = self.filter.apply(self.database,
self.database.get_person_handles(sort_handles=False))
- self.progress.set_pass(_("Reading database"),len(people))
+ self.progress.set_pass(_("Reading database"), len(people))
for person_handle in people:
self.progress.step()
person = self.database.get_person_from_handle(person_handle)
@@ -1145,15 +1151,15 @@ class WebCalReport(Report):
if birth_ref:
birth_event = self.database.get_event_from_handle(birth_ref.ref)
birth_date = birth_event.get_date_object()
- living = probably_alive(person, self.database, make_date(self.Year, 1, 1), 0)
- if self.Birthday and birth_date != None and ((self.Alive and living) or not self.Alive):
+ living = probably_alive(person, self.database, make_date(self.year, 1, 1), 0)
+ if self.birthday and birth_date != None and ((self.alive and living) or not self.alive):
year = birth_date.get_year()
month = birth_date.get_month()
day = birth_date.get_day()
- age = self.Year - year
+ age = self.year - year
# add some things to handle maiden name:
father_lastname = None # husband, actually
- if self.Surname == 0: # get husband's last name:
+ if self.surname == 0: # get husband's last name:
if person.get_gender() == gen.lib.Person.FEMALE:
family_list = person.get_family_handle_list()
if len(family_list) > 0:
@@ -1168,13 +1174,14 @@ class WebCalReport(Report):
father_lastname = father.get_primary_name().get_surname()
short_name = self.get_short_name(person, father_lastname)
if age == 0: # person is 0 years old, display nothing
- text= ""
+ text = ""
elif age == 1: # person is 1, and therefore display it correctly
- text= '%s, %d year old' % (short_name, age)
+ # TODO. Make this translatable
+ text = '%s, %d year old' % (short_name, age)
else:
- text= '%s, %d years old' % (short_name, age)
+ text = '%s, %d years old' % (short_name, age)
self.add_day_item(text, year, month, day)
- if self.Anniv and ((self.Alive and living) or not self.Alive):
+ if self.anniv and ((self.alive and living) or not self.alive):
family_list = person.get_family_handle_list()
for fhandle in family_list:
fam = self.database.get_family_from_handle(fhandle)
@@ -1189,8 +1196,8 @@ class WebCalReport(Report):
if spouse:
spouse_name = self.get_short_name(spouse)
short_name = self.get_short_name(person)
- if self.Alive:
- if not probably_alive(spouse, self.database, make_date(self.Year, 1, 1), 0):
+ if self.alive:
+ if not probably_alive(spouse, self.database, make_date(self.year, 1, 1), 0):
continue
married = True
for event_ref in fam.get_event_ref_list():
@@ -1206,12 +1213,12 @@ class WebCalReport(Report):
year = event_obj.get_year()
month = event_obj.get_month()
day = event_obj.get_day()
- years = self.Year - year
+ years = self.year - year
if years == 0:
text = "" # zero year anniversary
- # display nothing
+ # display nothing
else:
- text = _('%(spouse)s and %(person)s, %(nyears)d year anniversary') % {
+ text = _('%(spouse)s and %(person)s, %(nyears)d year anniversary') % {
'spouse' : spouse_name,
'person' : short_name,
'nyears' : years,
@@ -1227,7 +1234,7 @@ class WebCalOptions(MenuReportOptions):
"""
Defines options and provides handling interface.
"""
-
+
def __init__(self, name, dbase):
self.__db = dbase
self.__pid = None
@@ -1241,34 +1248,34 @@ class WebCalOptions(MenuReportOptions):
self.__add_report_options(menu)
self.__add_content_options(menu)
self.__add_notes_options(menu)
-
+
def __add_report_options(self, menu):
"""
Options on the "Report Options" tab.
"""
category_name = _("Report Options")
-
- target = DestinationOption( _("Destination"),
- os.path.join(const.USER_HOME,"WEBCAL"))
+
+ target = DestinationOption( _("Destination"),
+ os.path.join(const.USER_HOME, "WEBCAL"))
target.set_help( _("The destination directory for the web files"))
target.set_directory_entry(True)
menu.add_option(category_name, "target", target)
-
- title = StringOption(_('Calendar Title'), _('My Family Calendar'))
+
+ title = StringOption(_('Calendar Title'), _('My Family Calendar'))
title.set_help(_("The title of the calendar"))
menu.add_option(category_name, "title", title)
-
+
self.__filter = FilterOption(_("Filter"), 0)
self.__filter.set_help(
_("Select filter to restrict people that appear on calendar"))
menu.add_option(category_name, "filter", self.__filter)
self.__filter.connect('value-changed', self.__filter_changed)
-
+
self.__pid = PersonOption(_("Filter Person"))
self.__pid.set_help(_("The center person for the filter"))
menu.add_option(category_name, "pid", self.__pid)
self.__pid.connect('value-changed', self.__update_filters)
-
+
self.__update_filters()
ext = EnumeratedListOption(_("File extension"), ".html" )
@@ -1276,7 +1283,7 @@ class WebCalOptions(MenuReportOptions):
ext.add_item(etype, etype)
ext.set_help( _("The extension to be used for the web files"))
menu.add_option(category_name, "ext", ext)
-
+
cright = EnumeratedListOption(_('Copyright'), 0 )
index = 0
for copt in _COPY_OPTIONS:
@@ -1284,8 +1291,8 @@ class WebCalOptions(MenuReportOptions):
index += 1
cright.set_help( _("The copyright to be used for the web files"))
menu.add_option(category_name, "cright", cright)
-
- encoding = EnumeratedListOption(_('Character set encoding'), 'utf-8' )
+
+ encoding = EnumeratedListOption(_('Character set encoding'), _CHARACTER_SETS[0][1])
for eopt in _CHARACTER_SETS:
encoding.add_item(eopt[1], eopt[0])
encoding.set_help( _("The encoding to be used for the web files"))
@@ -1296,14 +1303,14 @@ class WebCalOptions(MenuReportOptions):
css.add_item(style[1], style[0])
css.set_help( _("The Style Sheet to be used for the web page"))
menu.add_option(category_name, "css", css)
-
+
def __add_content_options(self, menu):
"""
Options on the "Content Options" tab.
"""
category_name = _("Content Options")
-
- year = NumberOption(_("Year of calendar"), time.localtime()[0],
+
+ year = NumberOption(_("Year of calendar"), time.localtime()[0],
1000, 3000)
year.set_help(_("Year of calendar"))
menu.add_option(category_name, "year", year)
@@ -1325,11 +1332,11 @@ class WebCalOptions(MenuReportOptions):
"country"))
menu.add_option(category_name, "country", country)
- home_link = StringOption(_('Home link'), '../index.html')
+ home_link = StringOption(_('Home link'), '../index.html')
home_link.set_help(_("The link to be included to direct the user to "
"the main page of the web site"))
menu.add_option(category_name, "home_link", home_link)
-
+
alive = BooleanOption(_("Include only living people"), True)
alive.set_help(_("Include only living people in the calendar"))
menu.add_option(category_name, "alive", alive)
@@ -1341,7 +1348,7 @@ class WebCalOptions(MenuReportOptions):
anniversaries = BooleanOption(_("Include anniversaries"), True)
anniversaries.set_help(_("Include anniversaries in the calendar"))
menu.add_option(category_name, "anniversaries", anniversaries)
-
+
surname = BooleanOption(_('Check for wives to use maiden name'), True)
surname.set_help(_("Attempt to use maiden names of women"))
menu.add_option(category_name, "surname", surname)
@@ -1352,53 +1359,53 @@ class WebCalOptions(MenuReportOptions):
"""
category_name = _("Jan - Jun Notes")
- note_jan = StringOption(_('Jan Note'), _('This prints in January'))
+ note_jan = StringOption(_('Jan Note'), _('This prints in January'))
note_jan.set_help(_("The note for the month of January"))
menu.add_option(category_name, "note_jan", note_jan)
-
- note_feb = StringOption(_('Feb Note'), _('This prints in February'))
+
+ note_feb = StringOption(_('Feb Note'), _('This prints in February'))
note_feb.set_help(_("The note for the month of February"))
menu.add_option(category_name, "note_feb", note_feb)
-
- note_mar = StringOption(_('Mar Note'), _('This prints in March'))
+
+ note_mar = StringOption(_('Mar Note'), _('This prints in March'))
note_mar.set_help(_("The note for the month of March"))
menu.add_option(category_name, "note_mar", note_mar)
-
- note_apr = StringOption(_('Apr Note'), _('This prints in April'))
+
+ note_apr = StringOption(_('Apr Note'), _('This prints in April'))
note_apr.set_help(_("The note for the month of April"))
menu.add_option(category_name, "note_apr", note_apr)
-
- note_may = StringOption(_('May Note'), _('This prints in May'))
+
+ note_may = StringOption(_('May Note'), _('This prints in May'))
note_may.set_help(_("The note for the month of May"))
menu.add_option(category_name, "note_may", note_may)
-
- note_jun = StringOption(_('Jun Note'), _('This prints in June'))
+
+ note_jun = StringOption(_('Jun Note'), _('This prints in June'))
note_jun.set_help(_("The note for the month of June"))
menu.add_option(category_name, "note_jun", note_jun)
-
+
category_name = _("Jul - Dec Notes")
- note_jul = StringOption(_('Jul Note'), _('This prints in July'))
+ note_jul = StringOption(_('Jul Note'), _('This prints in July'))
note_jul.set_help(_("The note for the month of July"))
menu.add_option(category_name, "note_jul", note_jul)
-
- note_aug = StringOption(_('Aug Note'), _('This prints in August'))
+
+ note_aug = StringOption(_('Aug Note'), _('This prints in August'))
note_aug.set_help(_("The note for the month of August"))
menu.add_option(category_name, "note_aug", note_aug)
-
- note_sep = StringOption(_('Sep Note'), _('This prints in September'))
+
+ note_sep = StringOption(_('Sep Note'), _('This prints in September'))
note_sep.set_help(_("The note for the month of September"))
menu.add_option(category_name, "note_sep", note_sep)
-
- note_oct = StringOption(_('Oct Note'), _('This prints in October'))
+
+ note_oct = StringOption(_('Oct Note'), _('This prints in October'))
note_oct.set_help(_("The note for the month of October"))
menu.add_option(category_name, "note_oct", note_oct)
-
- note_nov = StringOption(_('Nov Note'), _('This prints in November'))
+
+ note_nov = StringOption(_('Nov Note'), _('This prints in November'))
note_nov.set_help(_("The note for the month of November"))
menu.add_option(category_name, "note_nov", note_nov)
-
- note_dec = StringOption(_('Dec Note'), _('This prints in December'))
+
+ note_dec = StringOption(_('Dec Note'), _('This prints in December'))
note_dec.set_help(_("The note for the month of December"))
menu.add_option(category_name, "note_dec", note_dec)
@@ -1410,7 +1417,7 @@ class WebCalOptions(MenuReportOptions):
person = self.__db.get_person_from_gramps_id(gid)
filter_list = ReportUtils.get_person_filters(person, False)
self.__filter.set_filters(filter_list)
-
+
def __filter_changed(self):
"""
Handle filter change. If the filter is not specific to a person,
@@ -1426,12 +1433,12 @@ class WebCalOptions(MenuReportOptions):
#------------------------------------------------------------------------
#
-#
+#
#
#------------------------------------------------------------------------
class Element:
""" A parsed XML element """
- def __init__(self, name,attributes):
+ def __init__(self, name, attributes):
'Element constructor'
# The element's tag name
self.name = name
@@ -1442,11 +1449,11 @@ class Element:
# The element's child element list (sequence)
self.children = []
- def AddChild(self,element):
+ def addChild(self, element):
'Add a reference to a child element'
self.children.append(element)
- def getAttribute(self,key):
+ def getAttribute(self, key):
'Get an attribute value'
return self.attributes.get(key)
@@ -1488,14 +1495,14 @@ class Xml2Obj:
self.root = None
self.nodeStack = []
- def StartElement(self, name,attributes):
+ def StartElement(self, name, attributes):
'SAX start element even handler'
# Instantiate an Element object
- element = Element(name.encode(),attributes)
+ element = Element(name.encode(), attributes)
# Push element onto the stack and make it a child of parent
if len(self.nodeStack) > 0:
parent = self.nodeStack[-1]
- parent.AddChild(element)
+ parent.addChild(element)
else:
self.root = element
self.nodeStack.append(element)
@@ -1504,7 +1511,7 @@ class Xml2Obj:
'SAX end element event handler'
self.nodeStack = self.nodeStack[:-1]
- def CharacterData(self,data):
+ def CharacterData(self, data):
'SAX character data event handler'
if data.strip():
data = data.encode()
@@ -1512,7 +1519,7 @@ class Xml2Obj:
element.cdata += data
return
- def Parse(self,filename):
+ def Parse(self, filename):
# Create a SAX parser
Parser = expat.ParserCreate()
# SAX event handlers
@@ -1520,7 +1527,7 @@ class Xml2Obj:
Parser.EndElementHandler = self.EndElement
Parser.CharacterDataHandler = self.CharacterData
# Parse the XML File
- ParserStatus = Parser.Parse(open(filename,'r').read(), 1)
+ ParserStatus = Parser.Parse(open(filename, 'r').read(), 1)
return self.root
class Holidays:
@@ -1528,17 +1535,19 @@ class Holidays:
def __init__(self, elements, country="US"):
self.debug = 0
self.elements = elements
- self.Country = country
+ self.country = country
self.dates = []
self.initialize()
+
def set_country(self, country):
- self.Country = country
+ self.country = country
self.dates = []
self.initialize()
+
def initialize(self):
# parse the date objects
for country_set in self.elements.children:
- if country_set.name == "country" and country_set.attributes["name"] == self.Country:
+ if country_set.name == "country" and country_set.attributes["name"] == self.country:
for date in country_set.children:
if date.name == "date":
data = {"value" : "",
@@ -1550,8 +1559,10 @@ class Holidays:
for attr in date.attributes:
data[attr] = date.attributes[attr]
self.dates.append(data)
+
def get_daynames(self, y, m, dayname):
- if self.debug: print "%s's in %d %d..." % (dayname, m, y)
+ if self.debug:
+ print "%s's in %d %d..." % (dayname, m, y)
retval = [0]
dow = ['mon', 'tue', 'wed', 'thu', 'fri', 'sat', 'sun'].index(dayname)
for d in range(1, 32):
@@ -1561,17 +1572,20 @@ class Holidays:
continue
if date.weekday() == dow:
retval.append( d )
- if self.debug: print "dow=", dow, "days=", retval
+ if self.debug:
+ print "dow=", dow, "days=", retval
return retval
+
def check_date(self, date):
retval = []
for rule in self.dates:
- if self.debug: print "Checking ", rule["name"], "..."
+ if self.debug:
+ print "Checking ", rule["name"], "..."
offset = 0
if rule["offset"] != "":
if rule["offset"].isdigit():
offset = int(rule["offset"])
- elif rule["offset"][0] in ["-","+"] and rule["offset"][1:].isdigit():
+ elif rule["offset"][0] in ["-", "+"] and rule["offset"][1:].isdigit():
offset = int(rule["offset"])
else:
# must be a dayname
@@ -1590,7 +1604,8 @@ class Holidays:
m = ['jan', 'feb', 'mar', 'apr', 'may', 'jun',
'jul', 'aug', 'sep', 'oct', 'nov', 'dec'].index(mon) + 1
dates_of_dayname = self.get_daynames(y, m, dayname)
- if self.debug: print "num =", num
+ if self.debug:
+ print "num =", num
d = dates_of_dayname[int(num)]
elif rule["value"].count("/") == 2: # year/month/day
y, m, d = rule["value"].split("/")
@@ -1607,23 +1622,25 @@ class Holidays:
else:
d = int(d)
ndate = datetime.date(y, m, d)
- if self.debug: print ndate, offset, type(offset)
+ if self.debug:
+ print ndate, offset, type(offset)
if isinstance(offset, int):
if offset != 0:
ndate = ndate.fromordinal(ndate.toordinal() + offset)
elif isinstance(offset, basestring):
- dir = 1
+ dir_ = 1
if offset[0] == "-":
- dir = -1
+ dir_ = -1
offset = offset[1:]
if offset in ['mon', 'tue', 'wed', 'thu', 'fri', 'sat', 'sun']:
# next tuesday you come to, including this one
dow = ['mon', 'tue', 'wed', 'thu', 'fri', 'sat', 'sun'].index(offset)
- ord = ndate.toordinal()
- while ndate.fromordinal(ord).weekday() != dow:
- ord += dir
- ndate = ndate.fromordinal(ord)
- if self.debug: print "ndate:", ndate, "date:", date
+ ord_ = ndate.toordinal()
+ while ndate.fromordinal(ord_).weekday() != dow:
+ ord_ += dir_
+ ndate = ndate.fromordinal(ord_)
+ if self.debug:
+ print "ndate:", ndate, "date:", date
if ndate == date:
if rule["if"] != "":
if not eval(rule["if"]):
@@ -1631,6 +1648,32 @@ class Holidays:
retval.append(rule["name"])
return retval
+# TODO. Try to understand this function and then to replace it with
+# something more Pythonic, more understandable.
+# Questions to answer:
+# * are the file names URLs or native filesystem names?
+# (This matters if we must use os.path.join(), or build_url_fname())
+# * the logic path for "wc" and "yg" and "by" give same subdirs
+# * why the "./" trailer?
+def _subdirs(cal, dir_, name):
+ """
+ This will add the number of subdirs to the filename depending on which
+ calendar is being called:
+ wc = WebCal
+ yg = Year At A Glance
+ by = Printable Pocket Calendar
+ ip = Indiv Pages
+ """
+
+ if cal == "wc":
+ subdirs = '.././'
+ elif ((cal == "yg") or (cal == "by")):
+ subdirs = '.././'
+ else:
+ subdirs = '../.././'
+ fname = subdirs + '%s/%s' % (dir_, name)
+ return fname
+
def process_holiday_file(filename):
""" This will process a holiday file for country names """
parser = Xml2Obj()
@@ -1647,8 +1690,8 @@ def _get_countries():
locations = [const.PLUGINS_DIR, const.USER_PLUGINS]
holiday_file = 'holidays.xml'
country_list = []
- for dir in locations:
- holiday_full_path = os.path.join(dir, holiday_file)
+ for dir_ in locations:
+ holiday_full_path = os.path.join(dir_, holiday_file)
if os.path.exists(holiday_full_path):
cs = process_holiday_file(holiday_full_path)
for c in cs:
@@ -1658,7 +1701,7 @@ def _get_countries():
country_list.insert(0, _("Don't include holidays"))
return country_list
-# TODO: Only load this once the first time it is actually needed so Gramps
+# TODO: Only load this once the first time it is actually needed so Gramps
# doesn't take so long to start up.
_COUNTRIES = _get_countries()