* src/plugins/Calendar.py: make calendar work in Windows

* src/GrampsLocale.py: make calendar work in Windows

svn: r6741
This commit is contained in:
Brian Matherly 2006-05-21 22:12:14 +00:00
parent 1766750f8e
commit 2b1459deac
3 changed files with 48 additions and 13 deletions

View File

@ -5,6 +5,8 @@
2006-05-21 Brian Matherly <brian@gramps-project.org> 2006-05-21 Brian Matherly <brian@gramps-project.org>
* src/plugins/GraphViz.py.in: fix file open. * 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 <shura@gramps-project.org> 2006-05-21 Alex Roitman <shura@gramps-project.org>
* src/GrampsDb/_GrampsBSDDB.py: Do not import unused module. * src/GrampsDb/_GrampsBSDDB.py: Do not import unused module.

View File

@ -95,6 +95,28 @@ try:
unicode(locale.nl_langinfo(locale.ABMON_12),codeset), 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') tformat = locale.nl_langinfo(locale.D_FMT).replace('%y','%Y')
except: 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,11,1,1,1,1,1,1,1)),codeset),
unicode(time.strftime('%b',(0,12,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': if time.strftime('%x',(2005,1,2,1,1,1,1,1,1)) == '2/1/2005':
tformat = '%d/%m/%y' tformat = '%d/%m/%y'

View File

@ -43,18 +43,6 @@ from Filters import CustomFilters, GenericFilter, ParamFilter, Rules
import GrampsLocale import GrampsLocale
import RelLib 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 = "en", "US"
(_language_country, _encoding) = locale.getlocale() (_language_country, _encoding) = locale.getlocale()
if _language_country != None and _language_country.count("_") == 1: if _language_country != None and _language_country.count("_") == 1:
@ -214,7 +202,8 @@ class Calendar(Report.Report):
else: else:
current_ord = current_date.toordinal() current_ord = current_date.toordinal()
for day_col in range(7): 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, day_col * cell_width + cell_width/2,
header - font_height/3.0 + self["offset"]) # .35 header - font_height/3.0 + self["offset"]) # .35
for week_row in range(6): for week_row in range(6):