From c56f46b493f2308c2fc9b3de2a60745f56a4c6c3 Mon Sep 17 00:00:00 2001 From: "Rob G. Healey" Date: Mon, 16 Feb 2009 06:56:49 +0000 Subject: [PATCH] Added revision numbering symbol to all of plugins directory if it was missing in the file. svn: r12002 --- src/plugins/drawreport/Calendar.py | 4 +- src/plugins/export/ExportCd.py | 5 +- src/plugins/export/ExportSql.py | 4 +- src/plugins/gramplet/AgeStats.py | 3 + src/plugins/gramplet/AttributesGramplet.py | 3 + src/plugins/gramplet/GivenNameGramplet.py | 5 +- src/plugins/lib/libholiday.py | 770 +++++++++++---------- src/plugins/lib/libmapservice.py | 4 +- src/plugins/mapservices/googlemap.py | 3 +- src/plugins/mapservices/openstreetmap.py | 3 +- src/plugins/quickview/AgeOnDate.py | 5 +- src/plugins/quickview/AttributeMatch.py | 4 + src/plugins/quickview/FilterByName.py | 4 + src/plugins/quickview/OnThisDay.py | 3 + src/plugins/quickview/Query.py | 3 + src/plugins/quickview/References.py | 3 + src/plugins/quickview/Reporef.py | 3 + src/plugins/quickview/SameSurnames.py | 3 + src/plugins/quickview/all_events.py | 5 +- src/plugins/quickview/all_relations.py | 3 + src/plugins/quickview/siblings.py | 3 + src/plugins/textreport/BirthdayReport.py | 3 + 22 files changed, 452 insertions(+), 394 deletions(-) diff --git a/src/plugins/drawreport/Calendar.py b/src/plugins/drawreport/Calendar.py index 233516822..716b0e380 100644 --- a/src/plugins/drawreport/Calendar.py +++ b/src/plugins/drawreport/Calendar.py @@ -16,7 +16,9 @@ # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - +# +# $Id: $ +# #------------------------------------------------------------------------ # # python modules diff --git a/src/plugins/export/ExportCd.py b/src/plugins/export/ExportCd.py index 594c53af2..94756c15f 100644 --- a/src/plugins/export/ExportCd.py +++ b/src/plugins/export/ExportCd.py @@ -18,8 +18,9 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # - -# $Id:WriteCD.py 9912 2008-01-22 09:17:46Z acraphae $ +# +# $Id$ +# "Export to CD (nautilus)." diff --git a/src/plugins/export/ExportSql.py b/src/plugins/export/ExportSql.py index e4dd97684..1c1abee98 100644 --- a/src/plugins/export/ExportSql.py +++ b/src/plugins/export/ExportSql.py @@ -15,7 +15,9 @@ # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - +# +# $Id$ +# #------------------------------------------------------------------------ # # python modules diff --git a/src/plugins/gramplet/AgeStats.py b/src/plugins/gramplet/AgeStats.py index d65123770..1d046fcfe 100644 --- a/src/plugins/gramplet/AgeStats.py +++ b/src/plugins/gramplet/AgeStats.py @@ -16,6 +16,9 @@ # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# $Id$ +# """ This Gramplet shows textual distributions of age breakdowns of various types. diff --git a/src/plugins/gramplet/AttributesGramplet.py b/src/plugins/gramplet/AttributesGramplet.py index 95c189466..3ab63048e 100644 --- a/src/plugins/gramplet/AttributesGramplet.py +++ b/src/plugins/gramplet/AttributesGramplet.py @@ -15,6 +15,9 @@ # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# $Id: $ +# from DataViews import Gramplet, register from BasicUtils import name_displayer diff --git a/src/plugins/gramplet/GivenNameGramplet.py b/src/plugins/gramplet/GivenNameGramplet.py index 51bd42e81..0ef8141ef 100644 --- a/src/plugins/gramplet/GivenNameGramplet.py +++ b/src/plugins/gramplet/GivenNameGramplet.py @@ -16,7 +16,10 @@ # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - +# +# $Id$ +# +# from gettext import gettext as _ from DataViews import Gramplet, register diff --git a/src/plugins/lib/libholiday.py b/src/plugins/lib/libholiday.py index 53744b73b..a8ef3c4e9 100644 --- a/src/plugins/lib/libholiday.py +++ b/src/plugins/lib/libholiday.py @@ -1,390 +1,392 @@ -# Gramps - a GTK+/GNOME based genealogy program -# -# Copyright (C) 2000-2007 Donald N. Allingham +# Gramps - a GTK+/GNOME based genealogy program +# +# Copyright (C) 2000-2007 Donald N. Allingham # Copyright (C) 2008-2009 Brian G. Matherly -# Copyright (C) 2009 Rob G. Healey -# -# 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 -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -#------------------------------------------------------------------------ -# -# python modules -# -#------------------------------------------------------------------------ -from gettext import gettext as _ -from xml.parsers import expat -import datetime -import math -import const -import os - -#------------------------------------------------------------------------ -# -# GRAMPS modules -# -#------------------------------------------------------------------------ +# Copyright (C) 2009 Rob G. Healey +# +# 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 +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# $id: $ +# +#------------------------------------------------------------------------ +# +# python modules +# +#------------------------------------------------------------------------ +from gettext import gettext as _ +from xml.parsers import expat +import datetime +import math +import const +import os + +#------------------------------------------------------------------------ +# +# GRAMPS modules +# +#------------------------------------------------------------------------ from gen.plug import PluginManager, Plugin - -#------------------------------------------------------------------------ -# -# Support functions -# -#------------------------------------------------------------------------ -def g2iso(dow): - """ Converst GRAMPS day of week to ISO day of week """ - # GRAMPS: SUN = 1 - # ISO: MON = 1 - return (dow + 5) % 7 + 1 - -#------------------------------------------------------------------------ -# -# HolidayTable -# -#------------------------------------------------------------------------ -class HolidayTable: - """ - HolidayTable is a class which provides holidays for various - countries and years. - """ - __holiday_files = [] - __countries = [] - - def __init__(self): - """ - Find the holiday files and load the countries if it has not already - been done. - """ - if( not HolidayTable.__holiday_files ): - self.__find_holiday_files() - - if( not HolidayTable.__countries ): - self.__build_country_list() - - # Initialize the holiday table to be empty - self.__holidays = {} - self.__init_table() - - def __find_holiday_files(self): + +#------------------------------------------------------------------------ +# +# Support functions +# +#------------------------------------------------------------------------ +def g2iso(dow): + """ Converst GRAMPS day of week to ISO day of week """ + # GRAMPS: SUN = 1 + # ISO: MON = 1 + return (dow + 5) % 7 + 1 + +#------------------------------------------------------------------------ +# +# HolidayTable +# +#------------------------------------------------------------------------ +class HolidayTable: + """ + HolidayTable is a class which provides holidays for various + countries and years. + """ + __holiday_files = [] + __countries = [] + + def __init__(self): + """ + Find the holiday files and load the countries if it has not already + been done. + """ + if( not HolidayTable.__holiday_files ): + self.__find_holiday_files() + + if( not HolidayTable.__countries ): + self.__build_country_list() + + # Initialize the holiday table to be empty + self.__holidays = {} + self.__init_table() + + def __find_holiday_files(self): """ 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' - - # Look for holiday files in the user plugins directory and all - # subdirectories. - for (dirpath, dirnames, filenames) in os.walk(const.USER_PLUGINS): - holiday_full_path = os.path.join(dirpath, 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 - # subdirectories. - for (dirpath, dirnames, filenames) in os.walk(const.PLUGINS_DIR): - holiday_full_path = os.path.join(dirpath, holiday_file) - if os.path.exists(holiday_full_path): - HolidayTable.__holiday_files.append(holiday_full_path) - - def __build_country_list(self): - """ Generate the list of countries that have holiday information. """ - for holiday_file_path in HolidayTable.__holiday_files: - parser = _Xml2Obj() - root_element = parser.parse(holiday_file_path) - for country_element in root_element.get_children(): - if country_element.get_name() == "country": - country_name = country_element.get_attribute("name") - if country_name not in HolidayTable.__countries: - HolidayTable.__countries.append(country_name) - - def __init_table(self): - """ Initialize the holiday table structure. """ - for month in range(1, 13): - self.__holidays[month] = {} - for day in range(1, 32): - self.__holidays[month][day] = [] - - def get_countries(self): - """ - Get all the country names that holidays are available for. - - @return: nothing - """ - return HolidayTable.__countries - - def load_holidays(self, year, country): - """ - Load the holiday table for the specified year and country. - This must be called before get_holidays(). - - @param year: The year for which the holidays should be loaded. - Example: 2010 - @type year: int - @param country: The country for which the holidays should be loaded. - Example: "United States" - @type country: str - @return: nothing - """ - self.__init_table() - for holiday_file_path in HolidayTable.__holiday_files: - parser = _Xml2Obj() - element = parser.parse(holiday_file_path) - calendar = _Holidays(element, country) - date = datetime.date(year, 1, 1) - while date.year == year: - holidays = calendar.check_date(date) - for text in holidays: - self.__holidays[date.month][date.day].append(text) - date = date.fromordinal(date.toordinal() + 1) - - def get_holidays(self, month, day): - """ - Get the holidays for the given day of the year. - - @param month: The month for the requested holidays. - Example: 1 - @type month: int - @param month: The day for the requested holidays. - Example: 1 - @type month: int - @return: An array of strings with holiday names. - @return type: [str] - """ - return self.__holidays[month][day] - -#------------------------------------------------------------------------ -# -# _Element -# -#------------------------------------------------------------------------ -class _Element: - """ A parsed XML element """ - def __init__(self, name, attributes): - 'Element constructor' - # The element's tag name - self.__name = name - # The element's attribute dictionary - self.__attributes = attributes - # The element's child element list (sequence) - self.__children = [] - - def add_child(self, element): - 'Add a reference to a child element' - self.__children.append(element) - - def get_attribute(self, key): - 'Get an attribute value' - return self.__attributes.get(key) - - def get_attributes(self): - 'Get all the attributes' - return self.__attributes - - def get_name(self): - """ Get the name of this element. """ - return self.__name - - def get_children(self): - """ Get the children elements for this element. """ - return self.__children - -#------------------------------------------------------------------------ -# -# _Xml2Obj -# -#------------------------------------------------------------------------ -class _Xml2Obj: - """ XML to Object """ - def __init__(self): - self.root = None - self.nodeStack = [] - - def start_element(self, name, attributes): - 'SAX start element even handler' - # Instantiate an Element object - 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.add_child(element) - else: - self.root = element - self.nodeStack.append(element) - - def end_element(self, name): - 'SAX end element event handler' - self.nodeStack = self.nodeStack[:-1] - - def parse(self, filename): - 'Create a SAX parser and parse filename ' - parser = expat.ParserCreate() - # SAX event handlers - parser.StartElementHandler = self.start_element - parser.EndElementHandler = self.end_element - # Parse the XML File - parser.Parse(open(filename, 'r').read(), 1) - return self.root - -#------------------------------------------------------------------------ -# -# _Holidays -# -#------------------------------------------------------------------------ -class _Holidays: - """ Class used to read XML holidays to add to calendar. """ - def __init__(self, elements, country="US"): - self.debug = 0 - self.elements = elements - self.country = country - self.dates = [] - self.initialize() - - def set_country(self, country): - """ Set the contry of holidays to read """ - self.country = country - self.dates = [] - self.initialize() - - def initialize(self): - """ Parse the holiday date XML items """ - for country_set in self.elements.get_children(): - if country_set.get_name() == "country" and \ - country_set.get_attribute("name") == self.country: - for date in country_set.get_children(): - if date.get_name() == "date": - data = {"value" : "", - "name" : "", - "offset": "", - "type": "", - } # defaults - for attr in date.get_attributes(): - data[attr] = date.get_attribute(attr) - self.dates.append(data) - - def get_daynames(self, year, month, dayname): - """ Get the items for a particular year/month and day of week """ - if self.debug: - print "%s's in %d %d..." % (dayname, month, year) - - retval = [0] - dow = ['mon', 'tue', 'wed', 'thu', 'fri', 'sat', 'sun'].index(dayname) - for day in range(1, 32): - try: - date = datetime.date(year, month, day) - except ValueError: - continue - if date.weekday() == dow: - retval.append(day) - - if self.debug: - print "dow=", dow, "days=", retval - - return retval - - def check_date(self, date): - """ Return items that match rules """ - retval = [] - for rule in self.dates: - - 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(): - offset = int(rule["offset"]) - else: - # must be a dayname - offset = rule["offset"] - - if self.debug: - print "rule['value']:", rule["value"] - - if rule["value"].count("/") == 3: # year/num/day/month, "3rd wednesday in april" - y, num, dayname, mon = rule["value"].split("/") - if y == "*": - y = date.year - else: - y = int(y) - if mon.isdigit(): - m = int(mon) - elif mon == "*": - m = date.month - else: - 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 - - d = dates_of_dayname[int(num)] - - elif rule["value"].count("/") == 2: # year/month/day - y, m, d = rule["value"].split("/") - if y == "*": - y = date.year - else: - y = int(y) - if m == "*": - m = date.month - else: - m = int(m) - if d == "*": - d = date.day - else: - d = int(d) - ndate = datetime.date(y, m, d) - - 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): - direction = 1 - if offset[0] == "-": - direction = -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) - ordinal = ndate.toordinal() - while ndate.fromordinal(ordinal).weekday() != dow: - ordinal += direction - ndate = ndate.fromordinal(ordinal) - - if self.debug: - print "ndate:", ndate, "date:", date - - if ndate == date: - retval.append(rule["name"]) - return retval - -#------------------------------------------------------------------------ -# -# Register the plugins -# -#------------------------------------------------------------------------ -PluginManager.get_instance().register_plugin( -Plugin( - name = __name__, - description = _("Provides holiday information for different countries."), - module_name = __name__ - ) -) + holiday_file = 'holidays.xml' + + # Look for holiday files in the user plugins directory and all + # subdirectories. + for (dirpath, dirnames, filenames) in os.walk(const.USER_PLUGINS): + holiday_full_path = os.path.join(dirpath, 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 + # subdirectories. + for (dirpath, dirnames, filenames) in os.walk(const.PLUGINS_DIR): + holiday_full_path = os.path.join(dirpath, holiday_file) + if os.path.exists(holiday_full_path): + HolidayTable.__holiday_files.append(holiday_full_path) + + def __build_country_list(self): + """ Generate the list of countries that have holiday information. """ + for holiday_file_path in HolidayTable.__holiday_files: + parser = _Xml2Obj() + root_element = parser.parse(holiday_file_path) + for country_element in root_element.get_children(): + if country_element.get_name() == "country": + country_name = country_element.get_attribute("name") + if country_name not in HolidayTable.__countries: + HolidayTable.__countries.append(country_name) + + def __init_table(self): + """ Initialize the holiday table structure. """ + for month in range(1, 13): + self.__holidays[month] = {} + for day in range(1, 32): + self.__holidays[month][day] = [] + + def get_countries(self): + """ + Get all the country names that holidays are available for. + + @return: nothing + """ + return HolidayTable.__countries + + def load_holidays(self, year, country): + """ + Load the holiday table for the specified year and country. + This must be called before get_holidays(). + + @param year: The year for which the holidays should be loaded. + Example: 2010 + @type year: int + @param country: The country for which the holidays should be loaded. + Example: "United States" + @type country: str + @return: nothing + """ + self.__init_table() + for holiday_file_path in HolidayTable.__holiday_files: + parser = _Xml2Obj() + element = parser.parse(holiday_file_path) + calendar = _Holidays(element, country) + date = datetime.date(year, 1, 1) + while date.year == year: + holidays = calendar.check_date(date) + for text in holidays: + self.__holidays[date.month][date.day].append(text) + date = date.fromordinal(date.toordinal() + 1) + + def get_holidays(self, month, day): + """ + Get the holidays for the given day of the year. + + @param month: The month for the requested holidays. + Example: 1 + @type month: int + @param month: The day for the requested holidays. + Example: 1 + @type month: int + @return: An array of strings with holiday names. + @return type: [str] + """ + return self.__holidays[month][day] + +#------------------------------------------------------------------------ +# +# _Element +# +#------------------------------------------------------------------------ +class _Element: + """ A parsed XML element """ + def __init__(self, name, attributes): + 'Element constructor' + # The element's tag name + self.__name = name + # The element's attribute dictionary + self.__attributes = attributes + # The element's child element list (sequence) + self.__children = [] + + def add_child(self, element): + 'Add a reference to a child element' + self.__children.append(element) + + def get_attribute(self, key): + 'Get an attribute value' + return self.__attributes.get(key) + + def get_attributes(self): + 'Get all the attributes' + return self.__attributes + + def get_name(self): + """ Get the name of this element. """ + return self.__name + + def get_children(self): + """ Get the children elements for this element. """ + return self.__children + +#------------------------------------------------------------------------ +# +# _Xml2Obj +# +#------------------------------------------------------------------------ +class _Xml2Obj: + """ XML to Object """ + def __init__(self): + self.root = None + self.nodeStack = [] + + def start_element(self, name, attributes): + 'SAX start element even handler' + # Instantiate an Element object + 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.add_child(element) + else: + self.root = element + self.nodeStack.append(element) + + def end_element(self, name): + 'SAX end element event handler' + self.nodeStack = self.nodeStack[:-1] + + def parse(self, filename): + 'Create a SAX parser and parse filename ' + parser = expat.ParserCreate() + # SAX event handlers + parser.StartElementHandler = self.start_element + parser.EndElementHandler = self.end_element + # Parse the XML File + parser.Parse(open(filename, 'r').read(), 1) + return self.root + +#------------------------------------------------------------------------ +# +# _Holidays +# +#------------------------------------------------------------------------ +class _Holidays: + """ Class used to read XML holidays to add to calendar. """ + def __init__(self, elements, country="US"): + self.debug = 0 + self.elements = elements + self.country = country + self.dates = [] + self.initialize() + + def set_country(self, country): + """ Set the contry of holidays to read """ + self.country = country + self.dates = [] + self.initialize() + + def initialize(self): + """ Parse the holiday date XML items """ + for country_set in self.elements.get_children(): + if country_set.get_name() == "country" and \ + country_set.get_attribute("name") == self.country: + for date in country_set.get_children(): + if date.get_name() == "date": + data = {"value" : "", + "name" : "", + "offset": "", + "type": "", + } # defaults + for attr in date.get_attributes(): + data[attr] = date.get_attribute(attr) + self.dates.append(data) + + def get_daynames(self, year, month, dayname): + """ Get the items for a particular year/month and day of week """ + if self.debug: + print "%s's in %d %d..." % (dayname, month, year) + + retval = [0] + dow = ['mon', 'tue', 'wed', 'thu', 'fri', 'sat', 'sun'].index(dayname) + for day in range(1, 32): + try: + date = datetime.date(year, month, day) + except ValueError: + continue + if date.weekday() == dow: + retval.append(day) + + if self.debug: + print "dow=", dow, "days=", retval + + return retval + + def check_date(self, date): + """ Return items that match rules """ + retval = [] + for rule in self.dates: + + 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(): + offset = int(rule["offset"]) + else: + # must be a dayname + offset = rule["offset"] + + if self.debug: + print "rule['value']:", rule["value"] + + if rule["value"].count("/") == 3: # year/num/day/month, "3rd wednesday in april" + y, num, dayname, mon = rule["value"].split("/") + if y == "*": + y = date.year + else: + y = int(y) + if mon.isdigit(): + m = int(mon) + elif mon == "*": + m = date.month + else: + 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 + + d = dates_of_dayname[int(num)] + + elif rule["value"].count("/") == 2: # year/month/day + y, m, d = rule["value"].split("/") + if y == "*": + y = date.year + else: + y = int(y) + if m == "*": + m = date.month + else: + m = int(m) + if d == "*": + d = date.day + else: + d = int(d) + ndate = datetime.date(y, m, d) + + 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): + direction = 1 + if offset[0] == "-": + direction = -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) + ordinal = ndate.toordinal() + while ndate.fromordinal(ordinal).weekday() != dow: + ordinal += direction + ndate = ndate.fromordinal(ordinal) + + if self.debug: + print "ndate:", ndate, "date:", date + + if ndate == date: + retval.append(rule["name"]) + return retval + +#------------------------------------------------------------------------ +# +# Register the plugins +# +#------------------------------------------------------------------------ +PluginManager.get_instance().register_plugin( +Plugin( + name = __name__, + description = _("Provides holiday information for different countries."), + module_name = __name__ + ) +) diff --git a/src/plugins/lib/libmapservice.py b/src/plugins/lib/libmapservice.py index 774381aa2..3ec4982fd 100644 --- a/src/plugins/lib/libmapservice.py +++ b/src/plugins/lib/libmapservice.py @@ -17,7 +17,9 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # - +# +# $Id: $ +# """ Base class for map services. Example: open place in openstreetmap.org """ diff --git a/src/plugins/mapservices/googlemap.py b/src/plugins/mapservices/googlemap.py index 3b77dbe09..c284df988 100644 --- a/src/plugins/mapservices/googlemap.py +++ b/src/plugins/mapservices/googlemap.py @@ -17,7 +17,8 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # - +# $Id: $ +# """ Google Maps map service plugin. Open place in maps.google.com """ diff --git a/src/plugins/mapservices/openstreetmap.py b/src/plugins/mapservices/openstreetmap.py index da19891b5..9f043d952 100644 --- a/src/plugins/mapservices/openstreetmap.py +++ b/src/plugins/mapservices/openstreetmap.py @@ -17,7 +17,8 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # - +# $id: $ +# """ OpenStreetMap map service plugin. Open place in openstreetmap.org """ diff --git a/src/plugins/quickview/AgeOnDate.py b/src/plugins/quickview/AgeOnDate.py index c7282f11a..a35d7b509 100644 --- a/src/plugins/quickview/AgeOnDate.py +++ b/src/plugins/quickview/AgeOnDate.py @@ -19,7 +19,10 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # - +# +# $Id$ +# +# """ Display references for any object """ diff --git a/src/plugins/quickview/AttributeMatch.py b/src/plugins/quickview/AttributeMatch.py index 7401d96df..5994d3643 100644 --- a/src/plugins/quickview/AttributeMatch.py +++ b/src/plugins/quickview/AttributeMatch.py @@ -17,6 +17,10 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # +# +# $Id: $ +# +# from ReportBase import CATEGORY_QR_MISC from Simple import SimpleAccess, SimpleDoc, SimpleTable diff --git a/src/plugins/quickview/FilterByName.py b/src/plugins/quickview/FilterByName.py index 13c2f1052..2427b601a 100644 --- a/src/plugins/quickview/FilterByName.py +++ b/src/plugins/quickview/FilterByName.py @@ -18,6 +18,10 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # +# +# $Id: $ +# +# """ Display filtered data diff --git a/src/plugins/quickview/OnThisDay.py b/src/plugins/quickview/OnThisDay.py index 701743b20..5c915a844 100644 --- a/src/plugins/quickview/OnThisDay.py +++ b/src/plugins/quickview/OnThisDay.py @@ -18,6 +18,9 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # +# +# $Id$ +# """ Display all events on a particular day. diff --git a/src/plugins/quickview/Query.py b/src/plugins/quickview/Query.py index 94518ae8f..27bca9c09 100644 --- a/src/plugins/quickview/Query.py +++ b/src/plugins/quickview/Query.py @@ -18,6 +18,9 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # +# +# $Id$ +# """ Run a query on the tables diff --git a/src/plugins/quickview/References.py b/src/plugins/quickview/References.py index be67e92e7..e16b30828 100644 --- a/src/plugins/quickview/References.py +++ b/src/plugins/quickview/References.py @@ -18,6 +18,9 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # +# +# $Id$ +# """ Display references for any object diff --git a/src/plugins/quickview/Reporef.py b/src/plugins/quickview/Reporef.py index 7620784b4..d88ce1dce 100755 --- a/src/plugins/quickview/Reporef.py +++ b/src/plugins/quickview/Reporef.py @@ -20,6 +20,9 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # +# +# $Id$ +# # ------------------------------------------------------------------------- # diff --git a/src/plugins/quickview/SameSurnames.py b/src/plugins/quickview/SameSurnames.py index 815a20513..0eb3551d0 100644 --- a/src/plugins/quickview/SameSurnames.py +++ b/src/plugins/quickview/SameSurnames.py @@ -19,6 +19,9 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # +# +# $Id$ +# """ Display a people who have a person's same surname or given name diff --git a/src/plugins/quickview/all_events.py b/src/plugins/quickview/all_events.py index 67ec9ab93..be9573103 100644 --- a/src/plugins/quickview/all_events.py +++ b/src/plugins/quickview/all_events.py @@ -18,7 +18,10 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # - +# +# $Id$ +# +# """ Display a person's events, both personal and family """ diff --git a/src/plugins/quickview/all_relations.py b/src/plugins/quickview/all_relations.py index 082c5a147..56703319c 100644 --- a/src/plugins/quickview/all_relations.py +++ b/src/plugins/quickview/all_relations.py @@ -18,6 +18,9 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # +# +# $Id$ +# """ Display a person's relations to the home person diff --git a/src/plugins/quickview/siblings.py b/src/plugins/quickview/siblings.py index 17c9e47d4..f86bde02d 100644 --- a/src/plugins/quickview/siblings.py +++ b/src/plugins/quickview/siblings.py @@ -18,6 +18,9 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # +# +# $Id$ +# """ Display a person's siblings in a report window diff --git a/src/plugins/textreport/BirthdayReport.py b/src/plugins/textreport/BirthdayReport.py index cc69d2723..2c540d04d 100644 --- a/src/plugins/textreport/BirthdayReport.py +++ b/src/plugins/textreport/BirthdayReport.py @@ -16,6 +16,9 @@ # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# $Id: $ +# #------------------------------------------------------------------------ #