* src/DateParser.py: dynamically detect numerical parsing based
off locale. Do not depend on strptime. * src/Utils.py: remove last remains of SingleDate * src/PeopleModel.py: display "error" instead of a blank string on an error * src/EventEdit.py: removed unused parameter * src/Exporter.py: remove unused gnome.ui import * src/plugins/FanChart.py: remove old Calendar reference * src/plugins/Verify.py: remove old Calendar reference svn: r3620
This commit is contained in:
parent
d0a04be93f
commit
45504a5025
@ -1,3 +1,14 @@
|
|||||||
|
2004-10-11 Don Allingham <dallingham@users.sourceforge.net>
|
||||||
|
* src/DateParser.py: dynamically detect numerical parsing based
|
||||||
|
off locale. Do not depend on strptime.
|
||||||
|
* src/Utils.py: remove last remains of SingleDate
|
||||||
|
* src/PeopleModel.py: display "error" instead of a blank string
|
||||||
|
on an error
|
||||||
|
* src/EventEdit.py: removed unused parameter
|
||||||
|
* src/Exporter.py: remove unused gnome.ui import
|
||||||
|
* src/plugins/FanChart.py: remove old Calendar reference
|
||||||
|
* src/plugins/Verify.py: remove old Calendar reference
|
||||||
|
|
||||||
2004-10-11 Alex Roitman <shura@alex.neuro.umn.edu>
|
2004-10-11 Alex Roitman <shura@alex.neuro.umn.edu>
|
||||||
* src/DateDisplay.py (_display_gregorian): Prepend month and
|
* src/DateDisplay.py (_display_gregorian): Prepend month and
|
||||||
day with zeros if needed for the ISO format.
|
day with zeros if needed for the ISO format.
|
||||||
|
@ -58,6 +58,7 @@ class DateParser:
|
|||||||
|
|
||||||
# determine the code set returned by nl_langinfo
|
# determine the code set returned by nl_langinfo
|
||||||
_codeset = locale.nl_langinfo(locale.CODESET)
|
_codeset = locale.nl_langinfo(locale.CODESET)
|
||||||
|
_fmt_parse = re.compile(".*%(\S).*%(\S).*%(\S).*")
|
||||||
|
|
||||||
# RFC-2822 only uses capitalized English abbreviated names, no locales.
|
# RFC-2822 only uses capitalized English abbreviated names, no locales.
|
||||||
_rfc_days = ('Sun','Mon','Tue','Wed','Thu','Fri','Sat')
|
_rfc_days = ('Sun','Mon','Tue','Wed','Thu','Fri','Sat')
|
||||||
@ -245,6 +246,13 @@ class DateParser:
|
|||||||
Date.CAL_HEBREW : self._parse_hebrew,
|
Date.CAL_HEBREW : self._parse_hebrew,
|
||||||
Date.CAL_ISLAMIC : self._parse_islamic,
|
Date.CAL_ISLAMIC : self._parse_islamic,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fmt = locale.nl_langinfo(locale.D_FMT)
|
||||||
|
match = self._fmt_parse.match(fmt.lower())
|
||||||
|
if match:
|
||||||
|
self.dmy = (match.groups() == ('d','m','y'))
|
||||||
|
else:
|
||||||
|
self.dmy = True
|
||||||
|
|
||||||
def _get_int(self,val):
|
def _get_int(self,val):
|
||||||
"""
|
"""
|
||||||
@ -321,12 +329,6 @@ class DateParser:
|
|||||||
if subparser == None:
|
if subparser == None:
|
||||||
subparser = self._parse_greg_julian
|
subparser = self._parse_greg_julian
|
||||||
|
|
||||||
try:
|
|
||||||
value = time.strptime(text)
|
|
||||||
return (value[2],value[1],value[0],False)
|
|
||||||
except ValueError:
|
|
||||||
pass
|
|
||||||
|
|
||||||
value = subparser(text)
|
value = subparser(text)
|
||||||
if value != Date.EMPTY:
|
if value != Date.EMPTY:
|
||||||
return value
|
return value
|
||||||
@ -356,8 +358,12 @@ class DateParser:
|
|||||||
match = self._numeric.match(text)
|
match = self._numeric.match(text)
|
||||||
if match:
|
if match:
|
||||||
groups = match.groups()
|
groups = match.groups()
|
||||||
m = self._get_int(groups[1])
|
if self.dmy:
|
||||||
d = self._get_int(groups[3])
|
m = self._get_int(groups[3])
|
||||||
|
d = self._get_int(groups[1])
|
||||||
|
else:
|
||||||
|
m = self._get_int(groups[1])
|
||||||
|
d = self._get_int(groups[3])
|
||||||
y = self._get_int(groups[4])
|
y = self._get_int(groups[4])
|
||||||
if gregorian_valid((d,m)):
|
if gregorian_valid((d,m)):
|
||||||
return (d,m,y,False)
|
return (d,m,y,False)
|
||||||
|
@ -272,7 +272,7 @@ class EventEditor:
|
|||||||
"""Display the relevant portion of GRAMPS manual"""
|
"""Display the relevant portion of GRAMPS manual"""
|
||||||
gnome.help_display('gramps-manual','gramps-edit-complete')
|
gnome.help_display('gramps-manual','gramps-edit-complete')
|
||||||
|
|
||||||
def get_place(self,field,trans):
|
def get_place(self,field):
|
||||||
text = strip(unicode(field.get_text()))
|
text = strip(unicode(field.get_text()))
|
||||||
if text:
|
if text:
|
||||||
if self.pmap.has_key(text):
|
if self.pmap.has_key(text):
|
||||||
@ -289,7 +289,7 @@ class EventEditor:
|
|||||||
ename = unicode(self.event_menu.child.get_text())
|
ename = unicode(self.event_menu.child.get_text())
|
||||||
#self.date = self.dp.parse(unicode(self.date_field.get_text()))
|
#self.date = self.dp.parse(unicode(self.date_field.get_text()))
|
||||||
ecause = unicode(self.cause_field.get_text())
|
ecause = unicode(self.cause_field.get_text())
|
||||||
eplace_obj = self.get_place(self.place_field,trans)
|
eplace_obj = self.get_place(self.place_field)
|
||||||
buf = self.note_field.get_buffer()
|
buf = self.note_field.get_buffer()
|
||||||
|
|
||||||
enote = unicode(buf.get_text(buf.get_start_iter(),buf.get_end_iter(),gtk.FALSE))
|
enote = unicode(buf.get_text(buf.get_start_iter(),buf.get_end_iter(),gtk.FALSE))
|
||||||
|
@ -40,6 +40,7 @@ from gettext import gettext as _
|
|||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
import gtk
|
import gtk
|
||||||
import gnome
|
import gnome
|
||||||
|
import gnome.ui
|
||||||
|
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
|
@ -178,8 +178,7 @@ class PeopleModel(gtk.GenericTreeModel):
|
|||||||
try:
|
try:
|
||||||
return COLUMN_DEFS[col][COLUMN_DEF_LIST](self,self.db.person_map[str(node)],node)
|
return COLUMN_DEFS[col][COLUMN_DEF_LIST](self,self.db.person_map[str(node)],node)
|
||||||
except:
|
except:
|
||||||
print "except"
|
return u'error'
|
||||||
return u''
|
|
||||||
|
|
||||||
def reset_visible(self):
|
def reset_visible(self):
|
||||||
self.visible = {}
|
self.visible = {}
|
||||||
|
@ -647,16 +647,16 @@ def probably_alive(person,db):
|
|||||||
sp_death_handle = spouse.get_death_handle()
|
sp_death_handle = spouse.get_death_handle()
|
||||||
if sp_birth_handle:
|
if sp_birth_handle:
|
||||||
spouse_birth = db.get_event_from_handle(sp_birth_handle)
|
spouse_birth = db.get_event_from_handle(sp_birth_handle)
|
||||||
if spouse_birth.get_date() != "":
|
if not spouse_birth.get_date().is_empty():
|
||||||
d = SingleDate (spouse_birth.get_date_object().get_start_date())
|
d = Date(spouse_birth.get_date_object())
|
||||||
d.set_year (d.get_year() + max_age_difference)
|
d.set_year(d.get_year() + max_age_difference)
|
||||||
if not not_too_old (d):
|
if not not_too_old (d):
|
||||||
return False
|
return False
|
||||||
|
|
||||||
if sp_death_handle:
|
if sp_death_handle:
|
||||||
spouse_death = db.get_event_from_handle(sp_death_handle)
|
spouse_death = db.get_event_from_handle(sp_death_handle)
|
||||||
if spouse_death.get_date() != "":
|
if spouse_death.get_date() != "":
|
||||||
d = SingleDate (spouse_death.get_date_object().get_start_date())
|
d = Date(spouse_death.get_date_object())
|
||||||
d.set_year (d.get_year() - min_generation)
|
d.set_year (d.get_year() - min_generation)
|
||||||
if not not_too_old (d):
|
if not not_too_old (d):
|
||||||
return False
|
return False
|
||||||
|
@ -35,7 +35,7 @@ import gtk
|
|||||||
import BaseDoc
|
import BaseDoc
|
||||||
import Report
|
import Report
|
||||||
import Errors
|
import Errors
|
||||||
import Calendar
|
import Date
|
||||||
|
|
||||||
from QuestionDialog import ErrorDialog
|
from QuestionDialog import ErrorDialog
|
||||||
from SubstKeywords import SubstKeywords
|
from SubstKeywords import SubstKeywords
|
||||||
@ -206,7 +206,7 @@ class FanChart:
|
|||||||
birth_handle = person.get_birth_handle()
|
birth_handle = person.get_birth_handle()
|
||||||
if birth_handle:
|
if birth_handle:
|
||||||
b = self.database.get_event_from_handle(birth_handle).get_date_object().get_year()
|
b = self.database.get_event_from_handle(birth_handle).get_date_object().get_year()
|
||||||
if b == Calendar.UNDEF:
|
if b == 0:
|
||||||
b = ""
|
b = ""
|
||||||
else:
|
else:
|
||||||
b = ""
|
b = ""
|
||||||
@ -214,7 +214,7 @@ class FanChart:
|
|||||||
death_handle = person.get_death_handle()
|
death_handle = person.get_death_handle()
|
||||||
if death_handle:
|
if death_handle:
|
||||||
d = self.database.get_event_from_handle(death_handle).get_date_object().get_year()
|
d = self.database.get_event_from_handle(death_handle).get_date_object().get_year()
|
||||||
if d == Calendar.UNDEF:
|
if d == 0:
|
||||||
d = ""
|
d = ""
|
||||||
else:
|
else:
|
||||||
d = ""
|
d = ""
|
||||||
|
@ -50,7 +50,6 @@ import gtk.glade
|
|||||||
#------------------------------------------------------------------------
|
#------------------------------------------------------------------------
|
||||||
import RelLib
|
import RelLib
|
||||||
import Utils
|
import Utils
|
||||||
import Gregorian
|
|
||||||
|
|
||||||
from gettext import gettext as _
|
from gettext import gettext as _
|
||||||
|
|
||||||
@ -117,8 +116,8 @@ class Verify:
|
|||||||
event = self.db.get_event_from_handle(event_handle)
|
event = self.db.get_event_from_handle(event_handle)
|
||||||
dateObj = event.get_date_object()
|
dateObj = event.get_date_object()
|
||||||
if dateObj:
|
if dateObj:
|
||||||
if dateObj.get_calendar().NAME != Gregorian.Gregorian.NAME:
|
if dateObj.get_calendar() != Date.CAL_GREGORIAN:
|
||||||
dateObj.set_calendar(Gregorian.Gregorian)
|
dateObj.set_calendar(Date.CAL_GREGORIAN)
|
||||||
year = dateObj.get_year()
|
year = dateObj.get_year()
|
||||||
return year
|
return year
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user