From 40ca28cd6026aafe074bf69aa88c0465e83c229c Mon Sep 17 00:00:00 2001 From: Nick Hall Date: Thu, 31 May 2012 15:50:40 +0000 Subject: [PATCH] GEPS008: Re-structure Gramps locale files svn: r19727 --- configure.in | 2 +- po/POTFILES.in | 8 ++++---- po/POTFILES.skip | 17 +++++++++-------- src/Makefile.am | 1 - src/Utils.py | 2 +- src/gen/Makefile.am | 1 + src/gen/__init__.py | 4 ++-- src/gen/datehandler/_date_fr.py | 4 ++-- src/gen/datehandler/_datedisplay.py | 4 ++-- src/gen/datehandler/_dateparser.py | 6 +++--- src/{GrampsLocale => gen/locale}/Makefile.am | 10 +++++----- src/{GrampsLocale => gen/locale}/__init__.py | 2 +- .../locale/_grampslocale.py} | 0 src/gui/logger/Makefile.am | 2 +- src/plugins/drawreport/Calendar.py | 6 +++--- src/plugins/textreport/BirthdayReport.py | 4 ++-- src/plugins/webreport/WebCal.py | 8 ++++---- 17 files changed, 41 insertions(+), 40 deletions(-) rename src/{GrampsLocale => gen/locale}/Makefile.am (66%) rename src/{GrampsLocale => gen/locale}/__init__.py (96%) rename src/{GrampsLocale/_GrampsLocale.py => gen/locale/_grampslocale.py} (100%) diff --git a/configure.in b/configure.in index b583c59b1..2f28175e9 100644 --- a/configure.in +++ b/configure.in @@ -110,6 +110,7 @@ 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 @@ -135,7 +136,6 @@ src/gui/views/treemodels/Makefile src/gui/widgets/Makefile src/docgen/Makefile src/Simple/Makefile -src/GrampsLocale/Makefile src/plugins/Makefile src/plugins/docgen/Makefile src/plugins/drawreport/Makefile diff --git a/po/POTFILES.in b/po/POTFILES.in index 8b6f0e2d3..d79973c41 100644 --- a/po/POTFILES.in +++ b/po/POTFILES.in @@ -407,6 +407,10 @@ src/gui/filters/sidebar/_mediasidebarfilter.py src/gui/filters/sidebar/_reposidebarfilter.py src/gui/filters/sidebar/_notesidebarfilter.py +# gui.logger package +src/gui/logger/_errorreportassistant.py +src/gui/logger/_errorview.py + # gui.merge package src/gui/merge/mergecitation.py src/gui/merge/mergeevent.py @@ -477,10 +481,6 @@ src/config.py src/docgen/ODSTab.py src/docgen/TextBufDoc.py -# GrampsLogger package -src/GrampsLogger/_ErrorReportAssistant.py -src/GrampsLogger/_ErrorView.py - # plugins directory src/plugins/BookReport.py src/plugins/bookreport.gpr.py diff --git a/po/POTFILES.skip b/po/POTFILES.skip index 9363739e0..ee313d6af 100644 --- a/po/POTFILES.skip +++ b/po/POTFILES.skip @@ -162,6 +162,10 @@ 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 @@ -221,14 +225,6 @@ src/gen/utils/__init__.py src/gen/utils/callback.py src/gen/utils/callman.py -# GrampsLocale package -src/GrampsLocale/_GrampsLocale.py - -# GrampsLogger package -src/GrampsLogger/__init__.py -src/GrampsLogger/_GtkHandler.py -src/GrampsLogger/_RotateHandler.py - # gui - GUI code src/gui/__init__.py src/gui/dbguielement.py @@ -268,6 +264,11 @@ src/gui/filters/_filtercombobox.py src/gui/filters/_filtermenu.py src/gui/filters/__init__.py +# gui.logger package +src/gui/logger/__init__.py +src/gui/logger/_gtkhandler.py +src/gui/logger/_rotatehandler.py + # gui.merge package src/gui/merge/__init__.py diff --git a/src/Makefile.am b/src/Makefile.am index 7a91f92a6..d447875aa 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -6,7 +6,6 @@ SUBDIRS = \ data \ docgen \ gen \ - GrampsLocale \ gui \ images \ plugins \ diff --git a/src/Utils.py b/src/Utils.py index 7801c7198..28eaa154a 100644 --- a/src/Utils.py +++ b/src/Utils.py @@ -49,7 +49,7 @@ LOG = logging.getLogger(".") from gen.display.name import displayer as name_displayer import gen.lib import Errors -from GrampsLocale import codeset +from gen.locale import codeset from Date import Date import gen.datehandler diff --git a/src/gen/Makefile.am b/src/gen/Makefile.am index e7d5a6a91..9b3f80985 100644 --- a/src/gen/Makefile.am +++ b/src/gen/Makefile.am @@ -10,6 +10,7 @@ SUBDIRS = \ display \ filters \ lib \ + locale \ merge \ mime \ plug \ diff --git a/src/gen/__init__.py b/src/gen/__init__.py index 8d2991c12..8733b0ad7 100644 --- a/src/gen/__init__.py +++ b/src/gen/__init__.py @@ -26,5 +26,5 @@ The gen module provides packages that are common to all gramps interfaces (gui, cli and web). """ -__all__ = [ "datehandler", "db", "display", "filters", "lib", "merge", "mime", - "plug", "proxy", "utils" ] +__all__ = [ "datehandler", "db", "display", "filters", "lib", "locale", "merge", + "mime", "plug", "proxy", "utils" ] diff --git a/src/gen/datehandler/_date_fr.py b/src/gen/datehandler/_date_fr.py index 2a77acb20..6c128254a 100644 --- a/src/gen/datehandler/_date_fr.py +++ b/src/gen/datehandler/_date_fr.py @@ -270,8 +270,8 @@ class DateDisplayFR(DateDisplay): # Replace the previous "Numérique" by a string which # do have an explicit meaning: "System default (format)" - import GrampsLocale - _locale_tformat = GrampsLocale.tformat + import gen.locale + _locale_tformat = gen.locale.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 53a5e87a5..2c7c686f8 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 GrampsLocale +import gen.locale #------------------------------------------------------------------------- # @@ -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 = GrampsLocale.tformat + _tformat = gen.locale.tformat hebrew = ( "", "Tishri", "Heshvan", "Kislev", "Tevet", "Shevat", diff --git a/src/gen/datehandler/_dateparser.py b/src/gen/datehandler/_dateparser.py index 19b20b4db..06f4600d3 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 GrampsLocale +import gen.locale #------------------------------------------------------------------------- # @@ -140,7 +140,7 @@ class DateParser(object): 'Sep' : 9, 'Oct' : 10, 'Nov' : 11, 'Dec' : 12, } - month_to_int = GrampsLocale.month_to_int + month_to_int = gen.locale.month_to_int # modifiers before the date modifier_to_int = { @@ -272,7 +272,7 @@ class DateParser(object): Date.CAL_SWEDISH : self._parse_swedish, } - fmt = GrampsLocale.tformat + fmt = gen.locale.tformat match = self._fmt_parse.match(fmt.lower()) if match: self.dmy = (match.groups() == ('d', 'm', 'y') or \ diff --git a/src/GrampsLocale/Makefile.am b/src/gen/locale/Makefile.am similarity index 66% rename from src/GrampsLocale/Makefile.am rename to src/gen/locale/Makefile.am index f2b436a55..c28572d03 100644 --- a/src/GrampsLocale/Makefile.am +++ b/src/gen/locale/Makefile.am @@ -1,24 +1,24 @@ -# This is the src/GrampsLocale level Makefile for Gramps +# 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@/GrampsLocale +pkgpythondir = $(datadir)/@PACKAGE@/gen/locale pkgpython_PYTHON = \ - _GrampsLocale.py\ + _grampslocale.py\ __init__.py -pkgpyexecdir = @pkgpyexecdir@/GrampsLocale +pkgpyexecdir = @pkgpyexecdir@/gen/locale dist_pkgdata_DATA = # Clean up all the byte-compiled files MOSTLYCLEANFILES = *pyc *pyo -GRAMPS_PY_MODPATH = "../" +GRAMPS_PY_MODPATH = "../../" pycheck: (export PYTHONPATH=$(GRAMPS_PY_MODPATH); \ diff --git a/src/GrampsLocale/__init__.py b/src/gen/locale/__init__.py similarity index 96% rename from src/GrampsLocale/__init__.py rename to src/gen/locale/__init__.py index 4287025b0..9ed8799ef 100644 --- a/src/GrampsLocale/__init__.py +++ b/src/gen/locale/__init__.py @@ -20,4 +20,4 @@ # $Id$ -from _GrampsLocale import * +from _grampslocale import * diff --git a/src/GrampsLocale/_GrampsLocale.py b/src/gen/locale/_grampslocale.py similarity index 100% rename from src/GrampsLocale/_GrampsLocale.py rename to src/gen/locale/_grampslocale.py diff --git a/src/gui/logger/Makefile.am b/src/gui/logger/Makefile.am index 4d7884fc0..b17f9a9ed 100644 --- a/src/gui/logger/Makefile.am +++ b/src/gui/logger/Makefile.am @@ -1,4 +1,4 @@ -# This is the src/GrampsLogger level Makefile for Gramps +# This is the src/gui/logger level Makefile for Gramps # $Id$ # We could use GNU make's ':=' syntax for nice wildcard use, # but that is not necessarily portable. diff --git a/src/plugins/drawreport/Calendar.py b/src/plugins/drawreport/Calendar.py index a85700bfc..f675be09a 100644 --- a/src/plugins/drawreport/Calendar.py +++ b/src/plugins/drawreport/Calendar.py @@ -50,7 +50,7 @@ from gen.plug.report import utils as ReportUtils from gen.plug.report import MenuReportOptions from Utils import probably_alive from gen.datehandler import displayer as _dd -import GrampsLocale +import gen.locale import gen.lib import libholiday @@ -206,7 +206,7 @@ class Calendar(Report): for day_col in range(7): font_height = pt2cm(pdaynames.get_font().get_size()) self.doc.center_text("CAL-Daynames", - GrampsLocale.long_days[(day_col+ + gen.locale.long_days[(day_col+ g2iso(self.start_dow + 1)) % 7 + 1].capitalize(), day_col * cell_width + cell_width/2, @@ -447,7 +447,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, GrampsLocale.long_days[count].capitalize()) + start_dow.add_item((count+5) % 7 + 1, gen.locale.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 2c1558524..ff8db8f6f 100644 --- a/src/plugins/textreport/BirthdayReport.py +++ b/src/plugins/textreport/BirthdayReport.py @@ -50,7 +50,7 @@ from gen.plug.report import Report from gen.plug.report import utils as ReportUtils from gen.plug.report import MenuReportOptions from Utils import probably_alive -import GrampsLocale +import gen.locale from gen.datehandler import displayer as _dd import libholiday @@ -399,7 +399,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, GrampsLocale.long_days[count].capitalize()) + start_dow.add_item((count+5) % 7 + 1, gen.locale.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 72d40cdd1..5f0f8f148 100644 --- a/src/plugins/webreport/WebCal.py +++ b/src/plugins/webreport/WebCal.py @@ -58,7 +58,7 @@ from gen.plug.report import MenuReportOptions from gen.plug.menu import BooleanOption, NumberOption, StringOption, \ EnumeratedListOption, FilterOption, PersonOption, \ DestinationOption, NoteOption -import GrampsLocale +import gen.locale from Utils import probably_alive, xml_lang, get_researcher from gen.datehandler import displayer as _dd @@ -605,9 +605,9 @@ class WebCalReport(Report): day = col2day[col] return day_names[day] - # Note. GrampsLocale has sunday => 1, monday => 2, etc + # Note. gen.locale has sunday => 1, monday => 2, etc # We slice out the first empty element. - day_names = GrampsLocale.long_days + day_names = gen.locale.long_days def __get_previous_month_day(year, month, day_col): @@ -1417,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, GrampsLocale.long_days[count].capitalize()) + start_dow.add_item(count, gen.locale.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)