Fixed unicode problem with dates

svn: r590
This commit is contained in:
Don Allingham 2001-11-27 20:36:39 +00:00
parent 0fcaa80f36
commit 63848c4c70
5 changed files with 632 additions and 708 deletions

View File

@ -155,6 +155,8 @@ class Date:
return self.start.getYear() return self.start.getYear()
def getMonth(self): def getMonth(self):
if self.start.month == UNDEF:
return UNDEF
return self.start.month+1 return self.start.month+1
def getDay(self): def getDay(self):
@ -407,6 +409,8 @@ class SingleDate:
self.year = UNDEF self.year = UNDEF
def getMonth(self): def getMonth(self):
if self.month == UNDEF:
return UNDEF
return self.month + 1 return self.month + 1
def setDay(self,val): def setDay(self,val):

View File

@ -413,7 +413,7 @@ class GrampsParser:
else: else:
d = self.event.getDateObj() d = self.event.getDateObj()
d.set(attrs['val']) d.set(u2l(attrs['val']))
def start_created(self,attrs): def start_created(self,attrs):
self.entries = int(attrs["people"]) + int(attrs["families"]) self.entries = int(attrs["people"]) + int(attrs["families"])

View File

@ -1284,8 +1284,8 @@ def redisplay_person_list(person):
gender,bday.getQuoteDate(), gender,bday.getQuoteDate(),
dday.getQuoteDate(), dday.getQuoteDate(),
sort.build_sort_name(name), sort.build_sort_name(name),
sort.build_sort_birth(bday), sort.build_sort_event(bday),
sort.build_sort_death(dday)]) sort.build_sort_event(dday)])
person_list.set_row_data(0,pos) person_list.set_row_data(0,pos)
@ -1297,8 +1297,8 @@ def redisplay_person_list(person):
gender,bday.getQuoteDate(), gender,bday.getQuoteDate(),
dday.getQuoteDate(), dday.getQuoteDate(),
sort.build_sort_name(name), sort.build_sort_name(name),
sort.build_sort_birth(bday), sort.build_sort_event(bday),
sort.build_sort_death(dday)]) sort.build_sort_event(dday)])
person_list.set_row_data(0,pos2) person_list.set_row_data(0,pos2)
@ -1715,16 +1715,17 @@ def apply_filter():
bday = person.getBirth().getDateObj() bday = person.getBirth().getDateObj()
dday = person.getDeath().getDateObj() dday = person.getDeath().getDateObj()
sort_bday = sort.build_sort_birth(bday) sort_bday = sort.build_sort_event(bday)
sort_dday = sort.build_sort_death(dday) sort_dday = sort.build_sort_event(dday)
qbday = bday.getQuoteDate() qbday = bday.getQuoteDate()
qdday = dday.getQuoteDate() qdday = dday.getQuoteDate()
pid = person.getId() pid = person.getId()
bsn = sort.build_sort_name bsn = sort.build_sort_name
name = person.getPrimaryName() name = person.getPrimaryName()
person_list.insert(0,[gname(name,0), pid, gender, qbday, qdday, values = [gname(name,0), pid, gender, qbday, qdday,
bsn(name), sort_bday, sort_dday]) bsn(name), sort_bday, sort_dday ]
person_list.insert(0,values)
person_list.set_row_data(0,pos) person_list.set_row_data(0,pos)
if Config.hide_altnames: if Config.hide_altnames:
@ -1734,8 +1735,9 @@ def apply_filter():
pos = (person,1) pos = (person,1)
new_alt2col[person].append(pos) new_alt2col[person].append(pos)
person_list.insert(0,[gname(name,1), pid, gender, qbday, qdday, values = [gname(name,1), pid, gender, qbday, qdday,
bsn(name), sort_bday, sort_dday]) bsn(name), sort_bday, sort_dday]
person_list.insert(0,values)
person_list.set_row_data(0,pos) person_list.set_row_data(0,pos)
else: else:

File diff suppressed because it is too large Load Diff

View File

@ -19,7 +19,7 @@
# #
import string import string
from Date import compare_dates from Date import compare_dates, UNDEF
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
# #
@ -35,7 +35,7 @@ def build_sort_name(n):
# #
# #
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
def build_sort_birth(n): def build_sort_event(n):
y = n.start.year y = n.start.year
if y < 0: if y < 0:
y = 9999 y = 9999
@ -47,23 +47,6 @@ def build_sort_birth(n):
d = 99 d = 99
return "%04d%02d%02d" % (y,m,d) return "%04d%02d%02d" % (y,m,d)
#-------------------------------------------------------------------------
#
#
#
#-------------------------------------------------------------------------
def build_sort_death(n):
y = n.start.year
if y == -1:
y = 9999
m = n.start.month
if m == -1:
m = 99
d = n.start.day
if d == -1:
d = 99
return "%04d%02d%02d" % (y,m,d)
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
# #
# #