From 7d93dd06022a85481887f373254430d512460de2 Mon Sep 17 00:00:00 2001 From: Brian Matherly Date: Sun, 21 May 2006 22:12:14 +0000 Subject: [PATCH] * src/plugins/Calendar.py: make calendar work in Windows * src/GrampsLocale.py: make calendar work in Windows svn: r6741 --- gramps2/ChangeLog | 2 ++ gramps2/src/GrampsLocale.py | 44 +++++++++++++++++++++++++++++++++ gramps2/src/plugins/Calendar.py | 15 ++--------- 3 files changed, 48 insertions(+), 13 deletions(-) diff --git a/gramps2/ChangeLog b/gramps2/ChangeLog index ab6b001a0..4bc68aa78 100644 --- a/gramps2/ChangeLog +++ b/gramps2/ChangeLog @@ -5,6 +5,8 @@ 2006-05-21 Brian Matherly * src/plugins/GraphViz.py.in: fix file open. + * src/plugins/Calendar.py: make calendar work in Windows + * src/GrampsLocale.py: make calendar work in Windows 2006-05-21 Alex Roitman * src/GrampsDb/_GrampsBSDDB.py: Do not import unused module. diff --git a/gramps2/src/GrampsLocale.py b/gramps2/src/GrampsLocale.py index aadb24401..3566c39e4 100644 --- a/gramps2/src/GrampsLocale.py +++ b/gramps2/src/GrampsLocale.py @@ -95,6 +95,28 @@ try: unicode(locale.nl_langinfo(locale.ABMON_12),codeset), ) + long_days = ( + "", + unicode(locale.nl_langinfo(locale.DAY_1),codeset), + unicode(locale.nl_langinfo(locale.DAY_2),codeset), + unicode(locale.nl_langinfo(locale.DAY_3),codeset), + unicode(locale.nl_langinfo(locale.DAY_4),codeset), + unicode(locale.nl_langinfo(locale.DAY_5),codeset), + unicode(locale.nl_langinfo(locale.DAY_6),codeset), + unicode(locale.nl_langinfo(locale.DAY_7),codeset), + ) + + short_days = ( + "", + unicode(locale.nl_langinfo(locale.ABDAY_1),codeset), + unicode(locale.nl_langinfo(locale.ABDAY_2),codeset), + unicode(locale.nl_langinfo(locale.ABDAY_3),codeset), + unicode(locale.nl_langinfo(locale.ABDAY_4),codeset), + unicode(locale.nl_langinfo(locale.ABDAY_5),codeset), + unicode(locale.nl_langinfo(locale.ABDAY_6),codeset), + unicode(locale.nl_langinfo(locale.ABDAY_7),codeset), + ) + tformat = locale.nl_langinfo(locale.D_FMT).replace('%y','%Y') except: @@ -160,6 +182,28 @@ except: unicode(time.strftime('%b',(0,11,1,1,1,1,1,1,1)),codeset), unicode(time.strftime('%b',(0,12,1,1,1,1,1,1,1)),codeset), ) + + long_days = ( + "", + unicode(time.strftime('%A',(0,1,1,1,1,1,1,1,1)),codeset), + unicode(time.strftime('%A',(0,1,1,1,1,1,2,1,1)),codeset), + unicode(time.strftime('%A',(0,1,1,1,1,1,3,1,1)),codeset), + unicode(time.strftime('%A',(0,1,1,1,1,1,4,1,1)),codeset), + unicode(time.strftime('%A',(0,1,1,1,1,1,5,1,1)),codeset), + unicode(time.strftime('%A',(0,1,1,1,1,1,6,1,1)),codeset), + unicode(time.strftime('%A',(0,1,1,1,1,1,7,1,1)),codeset), + ) + + short_days = ( + "", + unicode(time.strftime('%a',(0,1,1,1,1,1,1,1,1)),codeset), + unicode(time.strftime('%a',(0,1,1,1,1,1,2,1,1)),codeset), + unicode(time.strftime('%a',(0,1,1,1,1,1,3,1,1)),codeset), + unicode(time.strftime('%a',(0,1,1,1,1,1,4,1,1)),codeset), + unicode(time.strftime('%a',(0,1,1,1,1,1,5,1,1)),codeset), + unicode(time.strftime('%a',(0,1,1,1,1,1,6,1,1)),codeset), + unicode(time.strftime('%a',(0,1,1,1,1,1,7,1,1)),codeset), + ) if time.strftime('%x',(2005,1,2,1,1,1,1,1,1)) == '2/1/2005': tformat = '%d/%m/%y' diff --git a/gramps2/src/plugins/Calendar.py b/gramps2/src/plugins/Calendar.py index f8a3ab492..2695d1e63 100644 --- a/gramps2/src/plugins/Calendar.py +++ b/gramps2/src/plugins/Calendar.py @@ -43,18 +43,6 @@ from Filters import CustomFilters, GenericFilter, ParamFilter, Rules import GrampsLocale import RelLib -# _days could be added to DateDisplay: -_codeset = locale.nl_langinfo(locale.CODESET) -# slightly different from _months; this is zero based -_days = ( - unicode(locale.nl_langinfo(locale.DAY_1),_codeset), - unicode(locale.nl_langinfo(locale.DAY_2),_codeset), - unicode(locale.nl_langinfo(locale.DAY_3),_codeset), - unicode(locale.nl_langinfo(locale.DAY_4),_codeset), - unicode(locale.nl_langinfo(locale.DAY_5),_codeset), - unicode(locale.nl_langinfo(locale.DAY_6),_codeset), - unicode(locale.nl_langinfo(locale.DAY_7),_codeset), - ) _language, _country = "en", "US" (_language_country, _encoding) = locale.getlocale() if _language_country != None and _language_country.count("_") == 1: @@ -214,7 +202,8 @@ class Calendar(Report.Report): else: current_ord = current_date.toordinal() for day_col in range(7): - self.doc.center_text("daynames", _days[day_col], # global + self.doc.center_text("daynames", + GrampsLocale.long_days[day_col+1], # global day_col * cell_width + cell_width/2, header - font_height/3.0 + self["offset"]) # .35 for week_row in range(6):