diff --git a/configure.in b/configure.in index 1e56ea9df..279762057 100644 --- a/configure.in +++ b/configure.in @@ -110,7 +110,6 @@ src/gen/filters/rules/repository/Makefile src/gen/filters/rules/note/Makefile src/gen/filters/rules/citation/Makefile src/gen/lib/Makefile -src/gen/locale/Makefile src/gen/merge/Makefile src/gen/mime/Makefile src/gen/plug/Makefile diff --git a/po/POTFILES.skip b/po/POTFILES.skip index 61dd37897..d39209764 100644 --- a/po/POTFILES.skip +++ b/po/POTFILES.skip @@ -38,6 +38,7 @@ src/gen/datehandler/_date_ru.py src/gen/datehandler/_date_sk.py src/gen/datehandler/_date_sv.py src/gen/datehandler/_date_zh.py +src/gen/datehandler/_grampslocale.py src/gen/datehandler/__init__.py # gen db API @@ -151,10 +152,6 @@ src/gen/lib/url.py src/gen/lib/urlbase.py src/gen/lib/witness.py -# gen.locale package -src/gen/locale/__init__.py -src/gen/locale/_grampslocale.py - # gen.merge package src/gen/merge/__init__.py src/gen/merge/test/merge_ref_test.py diff --git a/src/Utils.py b/src/Utils.py index 1fa325ce4..62f4a05b2 100644 --- a/src/Utils.py +++ b/src/Utils.py @@ -49,8 +49,7 @@ LOG = logging.getLogger(".") from gen.display.name import displayer as name_displayer import gen.lib from gen.errors import DatabaseError -from gen.locale import codeset -import gen.datehandler +from gen.datehandler import displayer as date_displayer, codeset from gen.config import config from const import TEMP_DIR, USER_HOME, GRAMPS_UUID, IMAGE_DIR from gen.constfunc import mac, win @@ -987,7 +986,7 @@ def format_time(secs): """ t = time.localtime(secs) d = gen.lib.Date(t.tm_year, t.tm_mon, t.tm_mday) - return gen.datehandler.displayer.display(d) + time.strftime(' %X', t) + return date_displayer.display(d) + time.strftime(' %X', t) #------------------------------------------------------------------------- # diff --git a/src/gen/Makefile.am b/src/gen/Makefile.am index b9d35f552..a7217e0e2 100644 --- a/src/gen/Makefile.am +++ b/src/gen/Makefile.am @@ -10,7 +10,6 @@ SUBDIRS = \ display \ filters \ lib \ - locale \ merge \ mime \ plug \ diff --git a/src/gen/datehandler/Makefile.am b/src/gen/datehandler/Makefile.am index cbeeeb13a..709abc13e 100644 --- a/src/gen/datehandler/Makefile.am +++ b/src/gen/datehandler/Makefile.am @@ -29,6 +29,7 @@ pkgpython_PYTHON = \ _dateparser.py\ _datehandler.py\ _dateutils.py\ + _grampslocale.py\ __init__.py pkgpyexecdir = @pkgpyexecdir@/gen/datehandler diff --git a/src/gen/datehandler/__init__.py b/src/gen/datehandler/__init__.py index 8cafe45ae..84a362ddd 100644 --- a/src/gen/datehandler/__init__.py +++ b/src/gen/datehandler/__init__.py @@ -79,3 +79,5 @@ except: # Import utility functions from _dateutils import * +from _grampslocale import (codeset, month_to_int, long_months, short_months, + long_days, short_days, tformat) diff --git a/src/gen/datehandler/_date_fr.py b/src/gen/datehandler/_date_fr.py index 6c128254a..9ae425362 100644 --- a/src/gen/datehandler/_date_fr.py +++ b/src/gen/datehandler/_date_fr.py @@ -45,6 +45,7 @@ from gen.lib import Date from _dateparser import DateParser from _datedisplay import DateDisplay from _datehandler import register_datehandler +import _grampslocale #------------------------------------------------------------------------- # @@ -270,8 +271,7 @@ class DateDisplayFR(DateDisplay): # Replace the previous "Numérique" by a string which # do have an explicit meaning: "System default (format)" - import gen.locale - _locale_tformat = gen.locale.tformat + _locale_tformat = _grampslocale.tformat _locale_tformat = _locale_tformat.replace('%d', "J") _locale_tformat = _locale_tformat.replace('%m', "M") _locale_tformat = _locale_tformat.replace('%Y', "A") diff --git a/src/gen/datehandler/_datedisplay.py b/src/gen/datehandler/_datedisplay.py index 2c7c686f8..73cf5cb38 100644 --- a/src/gen/datehandler/_datedisplay.py +++ b/src/gen/datehandler/_datedisplay.py @@ -39,7 +39,7 @@ log = logging.getLogger(".DateDisplay") # #------------------------------------------------------------------------- from gen.lib import Date -import gen.locale +import _grampslocale #------------------------------------------------------------------------- # @@ -57,7 +57,7 @@ class DateDisplay(object): short_months = ( u"", u"Jan", u"Feb", u"Mar", u"Apr", u"May", u"Jun", u"Jul", u"Aug", u"Sep", u"Oct", u"Nov", u"Dec" ) - _tformat = gen.locale.tformat + _tformat = _grampslocale.tformat hebrew = ( "", "Tishri", "Heshvan", "Kislev", "Tevet", "Shevat", diff --git a/src/gen/datehandler/_dateparser.py b/src/gen/datehandler/_dateparser.py index 06f4600d3..00c4f3d40 100644 --- a/src/gen/datehandler/_dateparser.py +++ b/src/gen/datehandler/_dateparser.py @@ -49,7 +49,7 @@ log = logging.getLogger(".DateParser") # #------------------------------------------------------------------------- from gen.lib import Date, DateError -import gen.locale +import _grampslocale #------------------------------------------------------------------------- # @@ -140,7 +140,7 @@ class DateParser(object): 'Sep' : 9, 'Oct' : 10, 'Nov' : 11, 'Dec' : 12, } - month_to_int = gen.locale.month_to_int + month_to_int = _grampslocale.month_to_int # modifiers before the date modifier_to_int = { @@ -272,7 +272,7 @@ class DateParser(object): Date.CAL_SWEDISH : self._parse_swedish, } - fmt = gen.locale.tformat + fmt = _grampslocale.tformat match = self._fmt_parse.match(fmt.lower()) if match: self.dmy = (match.groups() == ('d', 'm', 'y') or \ diff --git a/src/gen/locale/_grampslocale.py b/src/gen/datehandler/_grampslocale.py similarity index 100% rename from src/gen/locale/_grampslocale.py rename to src/gen/datehandler/_grampslocale.py diff --git a/src/gen/locale/Makefile.am b/src/gen/locale/Makefile.am deleted file mode 100644 index c28572d03..000000000 --- a/src/gen/locale/Makefile.am +++ /dev/null @@ -1,25 +0,0 @@ -# This is the src/gen/locale level Makefile for Gramps -# $Id$ -# We could use GNU make's ':=' syntax for nice wildcard use, -# but that is not necessarily portable. -# If not using GNU make, then list all .py files individually - -pkgpythondir = $(datadir)/@PACKAGE@/gen/locale - -pkgpython_PYTHON = \ - _grampslocale.py\ - __init__.py - - -pkgpyexecdir = @pkgpyexecdir@/gen/locale - -dist_pkgdata_DATA = - -# Clean up all the byte-compiled files -MOSTLYCLEANFILES = *pyc *pyo - -GRAMPS_PY_MODPATH = "../../" - -pycheck: - (export PYTHONPATH=$(GRAMPS_PY_MODPATH); \ - pychecker $(pkgpython_PYTHON)); diff --git a/src/gen/locale/__init__.py b/src/gen/locale/__init__.py deleted file mode 100644 index 9ed8799ef..000000000 --- a/src/gen/locale/__init__.py +++ /dev/null @@ -1,23 +0,0 @@ -# -# Gramps - a GTK+/GNOME based genealogy program -# -# Copyright (C) 2004-2006 Donald N. Allingham -# -# 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$ - -from _grampslocale import * diff --git a/src/plugins/drawreport/Calendar.py b/src/plugins/drawreport/Calendar.py index 3eab332d4..065239771 100644 --- a/src/plugins/drawreport/Calendar.py +++ b/src/plugins/drawreport/Calendar.py @@ -49,8 +49,7 @@ from gen.plug.report import Report from gen.plug.report import utils as ReportUtils from gen.plug.report import MenuReportOptions from gen.utils.alive import probably_alive -from gen.datehandler import displayer as _dd -import gen.locale +from gen.datehandler import displayer as _dd, long_days import gen.lib import libholiday @@ -206,8 +205,7 @@ class Calendar(Report): for day_col in range(7): font_height = pt2cm(pdaynames.get_font().get_size()) self.doc.center_text("CAL-Daynames", - gen.locale.long_days[(day_col+ - g2iso(self.start_dow + 1)) + long_days[(day_col+ g2iso(self.start_dow + 1)) % 7 + 1].capitalize(), day_col * cell_width + cell_width/2, header - font_height * 1.5) @@ -447,7 +445,7 @@ class CalendarOptions(MenuReportOptions): start_dow = EnumeratedListOption(_("First day of week"), 1) for count in range(1, 8): # conversion between gramps numbering (sun=1) and iso numbering (mon=1) of weekdays below - start_dow.add_item((count+5) % 7 + 1, gen.locale.long_days[count].capitalize()) + start_dow.add_item((count+5) % 7 + 1, long_days[count].capitalize()) start_dow.set_help(_("Select the first day of the week for the calendar")) add_option("start_dow", start_dow) diff --git a/src/plugins/textreport/BirthdayReport.py b/src/plugins/textreport/BirthdayReport.py index d053219f3..d9bed5957 100644 --- a/src/plugins/textreport/BirthdayReport.py +++ b/src/plugins/textreport/BirthdayReport.py @@ -50,8 +50,7 @@ from gen.plug.report import Report from gen.plug.report import utils as ReportUtils from gen.plug.report import MenuReportOptions from gen.utils.alive import probably_alive -import gen.locale -from gen.datehandler import displayer as _dd +from gen.datehandler import displayer as _dd, long_days import libholiday @@ -399,7 +398,7 @@ class CalendarOptions(MenuReportOptions): start_dow = EnumeratedListOption(_("First day of week"), 1) for count in range(1, 8): # conversion between gramps numbering (sun=1) and iso numbering (mon=1) of weekdays below - start_dow.add_item((count+5) % 7 + 1, gen.locale.long_days[count].capitalize()) + start_dow.add_item((count+5) % 7 + 1, long_days[count].capitalize()) start_dow.set_help(_("Select the first day of the week for the calendar")) menu.add_option(category_name, "start_dow", start_dow) diff --git a/src/plugins/webreport/WebCal.py b/src/plugins/webreport/WebCal.py index 9fdbaf8cf..bc507e237 100644 --- a/src/plugins/webreport/WebCal.py +++ b/src/plugins/webreport/WebCal.py @@ -58,10 +58,9 @@ from gen.plug.report import MenuReportOptions from gen.plug.menu import BooleanOption, NumberOption, StringOption, \ EnumeratedListOption, FilterOption, PersonOption, \ DestinationOption, NoteOption -import gen.locale from Utils import xml_lang, get_researcher from gen.utils.alive import probably_alive -from gen.datehandler import displayer as _dd +from gen.datehandler import displayer as _dd, long_days from gen.display.name import displayer as _nd @@ -606,9 +605,9 @@ class WebCalReport(Report): day = col2day[col] return day_names[day] - # Note. gen.locale has sunday => 1, monday => 2, etc + # Note. gen.datehandler has sunday => 1, monday => 2, etc # We slice out the first empty element. - day_names = gen.locale.long_days + day_names = long_days def __get_previous_month_day(year, month, day_col): @@ -1418,7 +1417,7 @@ class WebCalOptions(MenuReportOptions): # Default selection ???? start_dow = EnumeratedListOption(_("First day of week"), 1) for count in range(1, 8): - start_dow.add_item(count, gen.locale.long_days[count].capitalize()) + start_dow.add_item(count, long_days[count].capitalize()) start_dow.set_help(_("Select the first day of the week for the calendar")) menu.add_option(category_name, "start_dow", start_dow)