* src/Date.py: remove comment field

* src/DateParser.py: add parsing of Month Day1-Day2, Year
* src/RelLib.py: make date parsers/displayers global to resolve
pickle-ing problem
* src/EditPerson.py: update lists before committing to database


svn: r3559
This commit is contained in:
Don Allingham 2004-09-20 03:12:51 +00:00
parent f9fb4cd962
commit e5b8384463
6 changed files with 122 additions and 113 deletions

View File

@ -10,6 +10,11 @@
(event_edit, addr_edit): Remove button relief as in editPerson. (event_edit, addr_edit): Remove button relief as in editPerson.
2004-09-19 Don Allingham <dallingham@users.sourceforge.net> 2004-09-19 Don Allingham <dallingham@users.sourceforge.net>
* src/Date.py: remove comment field
* src/DateParser.py: add parsing of Month Day1-Day2, Year
* src/RelLib.py: make date parsers/displayers global to resolve
pickle-ing problem
* src/EditPerson.py: update lists before committing to database
* src/gramps.glade: remove button border for date editor button * src/gramps.glade: remove button border for date editor button
* src/DateDisplay.py: fix quality prefix display * src/DateDisplay.py: fix quality prefix display

View File

@ -110,7 +110,6 @@ class Date:
self.dateval = source.dateval self.dateval = source.dateval
self.text = source.text self.text = source.text
self.sortval = source.sortval self.sortval = source.sortval
self.comment = source.comment
else: else:
self.calendar = CAL_GREGORIAN self.calendar = CAL_GREGORIAN
self.modifier = MOD_TEXTONLY self.modifier = MOD_TEXTONLY
@ -118,7 +117,6 @@ class Date:
self.dateval = EMPTY self.dateval = EMPTY
self.text = u"" self.text = u""
self.sortval = 0 self.sortval = 0
self.comment = u""
def copy(self,source): def copy(self,source):
""" """
@ -131,7 +129,6 @@ class Date:
self.dateval = source.dateval self.dateval = source.dateval
self.text = source.text self.text = source.text
self.sortval = source.sortval self.sortval = source.sortval
self.comment = source.comment
def __cmp__(self,other): def __cmp__(self,other):
""" """
@ -147,16 +144,12 @@ class Date:
at the sorting value, and ignores the modifiers/comments. at the sorting value, and ignores the modifiers/comments.
""" """
if (self.calendar == other.calendar and return (self.calendar == other.calendar and
self.modifier == other.modifier and self.modifier == other.modifier and
self.quality == other.quality and self.quality == other.quality and
self.dateval == other.dateval and self.dateval == other.dateval and
self.text == other.text and self.text == other.text and
self.sortval == other.sortval and self.sortval == other.sortval)
self.comment == other.comment):
return 1
else:
return 0
def __str__(self): def __str__(self):
""" """
@ -219,18 +212,6 @@ class Date:
""" """
return self.modifier return self.modifier
def set_comment(self,comment):
"""
Sets the comment for the date.
"""
self.comment = comment
def get_comment(self):
"""
Returns the associated comment.
"""
return self.comment
def set_modifier(self,val): def set_modifier(self,val):
""" """
Sets the modifier for the date. Sets the modifier for the date.

View File

@ -101,12 +101,13 @@ class DateParser:
) + ')' ) + ')'
_mon_str = '(' + '|'.join(month_to_int.keys()) + ')' _mon_str = '(' + '|'.join(month_to_int.keys()) + ')'
_qual = re.compile("%s\s+(.*)" % _qual_str,re.IGNORECASE) _qual = re.compile("%s\s+(.+)" % _qual_str,re.IGNORECASE)
_span = re.compile("from\s+(.*)\s+to\s+(.*)",re.IGNORECASE) _span = re.compile("from\s+(.+)\s+to\s+(.+)",re.IGNORECASE)
_range = re.compile("(bet.|between)\s+(.*)\s+and\s+(.*)",re.IGNORECASE) _range = re.compile("(bet.|between)\s+(.+)\s+and\s+(.+)",re.IGNORECASE)
_modifier = re.compile('%s\s+(.*)' % _mod_str,re.IGNORECASE) _modifier = re.compile('%s\s+(.*)' % _mod_str,re.IGNORECASE)
_text = re.compile('%s\s+(\d+)?\s*,?\s*((\d+)(/\d+)?)?' % _mon_str,re.IGNORECASE) _text = re.compile('%s\s+(\d+)?\s*,?\s*((\d+)(/\d+)?)?' % _mon_str,re.IGNORECASE)
_text2 = re.compile('(\d+)?\s+?%s\s*((\d+)(/\d+)?)?' % _mon_str,re.IGNORECASE) _text2 = re.compile('(\d+)?\s+?%s\s*((\d+)(/\d+)?)?' % _mon_str,re.IGNORECASE)
_range2 = re.compile('%s\s+(\d+)-(\d+)\s*,?\s*((\d+)(/\d+)?)?' % _mon_str,re.IGNORECASE)
_numeric = re.compile("((\d+)[/\.])?((\d+)[/\.])?(\d+)") _numeric = re.compile("((\d+)[/\.])?((\d+)[/\.])?(\d+)")
_iso = re.compile("(\d+)-(\d+)-(\d+)") _iso = re.compile("(\d+)-(\d+)-(\d+)")
@ -212,6 +213,24 @@ class DateParser:
stop = self._parse_subdate(grps[2]) stop = self._parse_subdate(grps[2])
date.set(qual,Date.MOD_RANGE,Date.CAL_GREGORIAN,start + stop) date.set(qual,Date.MOD_RANGE,Date.CAL_GREGORIAN,start + stop)
return return
match = self._range2.match(text)
if match:
grps = match.groups()
m = self.month_to_int[grps[0].lower()]
d0 = self._get_int(grps[1])
d1 = self._get_int(grps[2])
if grps[3] == None:
y = 0
s = None
else:
y = int(grps[3])
s = grps[4] != None
date.set(qual,Date.MOD_RANGE,Date.CAL_GREGORIAN,
(d0,m,y,s,d1,m,y,s))
return
match = self._modifier.match(text) match = self._modifier.match(text)
if match: if match:

View File

@ -103,11 +103,11 @@ class EditPerson:
self.callback = callback self.callback = callback
self.child_windows = {} self.child_windows = {}
self.path = db.get_save_path() self.path = db.get_save_path()
self.not_loaded = 1 self.not_loaded = True
self.lds_not_loaded = 1 self.lds_not_loaded = True
self.lists_changed = 0 self.lists_changed = False
self.update_birth = 0 self.update_birth = False
self.update_death = 0 self.update_death = False
self.pdmap = {} self.pdmap = {}
self.add_places = [] self.add_places = []
self.should_guess_gender = (person.get_gramps_id() == '' and self.should_guess_gender = (person.get_gramps_id() == '' and
@ -607,7 +607,7 @@ class EditPerson:
self.build_endow_menu() self.build_endow_menu()
def on_gender_activate (self, button): def on_gender_activate (self, button):
self.should_guess_gender = 0 self.should_guess_gender = False
def on_givenName_focus_out_event (self, entry, event): def on_givenName_focus_out_event (self, entry, event):
if not self.should_guess_gender: if not self.should_guess_gender:
@ -615,11 +615,11 @@ class EditPerson:
gender = self.db.genderStats.guess_gender(unicode(entry.get_text ())) gender = self.db.genderStats.guess_gender(unicode(entry.get_text ()))
if gender == RelLib.Person.unknown: if gender == RelLib.Person.unknown:
self.is_unknown.set_active (1) self.is_unknown.set_active(True)
elif gender == RelLib.Person.male: elif gender == RelLib.Person.male:
self.is_male.set_active (1) self.is_male.set_active(True)
else: else:
self.is_female.set_active (1) self.is_female.set_active(True)
def build_menu(self,list,task,opt_menu,type): def build_menu(self,list,task,opt_menu,type):
menu = gtk.Menu() menu = gtk.Menu()
@ -677,7 +677,7 @@ class EditPerson:
foo.set_place_handle(place.get_handle()) foo.set_place_handle(place.get_handle())
self.elist.insert(row,foo) self.elist.insert(row,foo)
self.lists_changed = 1 self.lists_changed = True
self.redraw_event_list() self.redraw_event_list()
def move_element(self,list,src,dest): def move_element(self,list,src,dest):
@ -718,7 +718,7 @@ class EditPerson:
else: else:
foo = pickle.loads(data[2]); foo = pickle.loads(data[2]);
self.ulist.append(foo) self.ulist.append(foo)
self.lists_changed = 1 self.lists_changed = True
self.redraw_url_list() self.redraw_url_list()
def url_drag_begin(self, context, a): def url_drag_begin(self, context, a):
@ -751,7 +751,7 @@ class EditPerson:
newbase = self.db.get_source_from_handle(base_handle) newbase = self.db.get_source_from_handle(base_handle)
src.set_base_handle(newbase) src.set_base_handle(newbase)
self.alist.append(foo) self.alist.append(foo)
self.lists_changed = 1 self.lists_changed = True
self.redraw_attr_list() self.redraw_attr_list()
def at_drag_begin(self, context, a): def at_drag_begin(self, context, a):
@ -785,7 +785,7 @@ class EditPerson:
src.set_base_handle(newbase) src.set_base_handle(newbase)
self.plist.insert(row,foo) self.plist.insert(row,foo)
self.lists_changed = 1 self.lists_changed = True
self.redraw_addr_list() self.redraw_addr_list()
def ad_drag_data_get(self,widget, context, sel_data, info, time): def ad_drag_data_get(self,widget, context, sel_data, info, time):
@ -830,11 +830,11 @@ class EditPerson:
self.wmap[str(url)] = node self.wmap[str(url)] = node
if len(self.ulist) > 0: if len(self.ulist) > 0:
self.web_go.set_sensitive(0) self.web_go.set_sensitive(False)
self.wtree.select_row(0) self.wtree.select_row(0)
Utils.bold_label(self.inet_label) Utils.bold_label(self.inet_label)
else: else:
self.web_go.set_sensitive(0) self.web_go.set_sensitive(False)
self.web_url.set_text("") self.web_url.set_text("")
self.web_description.set_text("") self.web_description.set_text("")
Utils.unbold_label(self.inet_label) Utils.unbold_label(self.inet_label)
@ -923,13 +923,13 @@ class EditPerson:
# Update birth with new values, make sure death values don't change # Update birth with new values, make sure death values don't change
if self.update_birth: if self.update_birth:
self.update_birth = 0 self.update_birth = False
self.update_birth_info() self.update_birth_info()
self.dplace.set_text(prev_dtext) self.dplace.set_text(prev_dtext)
# Update death with new values, make sure birth values don't change # Update death with new values, make sure birth values don't change
if self.update_death: if self.update_death:
self.update_death = 0 self.update_death = False
self.update_death_info() self.update_death_info()
self.bplace.set_text(prev_btext) self.bplace.set_text(prev_btext)
@ -982,7 +982,7 @@ class EditPerson:
name cannot be changed""" name cannot be changed"""
import EventEdit import EventEdit
self.update_birth = 1 self.update_birth = True
pname = self.person.get_primary_name().get_name() pname = self.person.get_primary_name().get_name()
event = self.birth event = self.birth
event.set_date_object(Date.Date(self.birth_date_object)) event.set_date_object(Date.Date(self.birth_date_object))
@ -1000,7 +1000,7 @@ class EditPerson:
name cannot be changed""" name cannot be changed"""
import EventEdit import EventEdit
self.update_death = 1 self.update_death = True
pname = self.person.get_primary_name().get_name() pname = self.person.get_primary_name().get_name()
event = self.death event = self.death
event.set_date_object(Date.Date(self.death_date_object)) event.set_date_object(Date.Date(self.death_date_object))
@ -1018,7 +1018,7 @@ class EditPerson:
store,node = self.ntree.get_selected() store,node = self.ntree.get_selected()
if node: if node:
self.nlist.remove(self.ntree.get_object(node)) self.nlist.remove(self.ntree.get_object(node))
self.lists_changed = 1 self.lists_changed = True
self.redraw_name_list() self.redraw_name_list()
def on_delete_url_clicked(self,obj): def on_delete_url_clicked(self,obj):
@ -1026,7 +1026,7 @@ class EditPerson:
store,node = self.wtree.get_selected() store,node = self.wtree.get_selected()
if node: if node:
self.ulist.remove(self.wtree.get_object(node)) self.ulist.remove(self.wtree.get_object(node))
self.lists_changed = 1 self.lists_changed = True
self.redraw_url_list() self.redraw_url_list()
def on_delete_attr_clicked(self,obj): def on_delete_attr_clicked(self,obj):
@ -1034,7 +1034,7 @@ class EditPerson:
store,node = self.atree.get_selected() store,node = self.atree.get_selected()
if node: if node:
self.alist.remove(self.atree.get_object(node)) self.alist.remove(self.atree.get_object(node))
self.lists_changed = 1 self.lists_changed = True
self.redraw_attr_list() self.redraw_attr_list()
def on_delete_addr_clicked(self,obj): def on_delete_addr_clicked(self,obj):
@ -1042,7 +1042,7 @@ class EditPerson:
store,node = self.ptree.get_selected() store,node = self.ptree.get_selected()
if node: if node:
self.plist.remove(self.ptree.get_object(node)) self.plist.remove(self.ptree.get_object(node))
self.lists_changed = 1 self.lists_changed = True
self.redraw_addr_list() self.redraw_addr_list()
def on_web_go_clicked(self,obj): def on_web_go_clicked(self,obj):
@ -1077,10 +1077,10 @@ class EditPerson:
'have made will be lost'), 'have made will be lost'),
self.cancel_callback, self.cancel_callback,
self.save) self.save)
return 1 return True
else: else:
self.close() self.close()
return 0 return False
def cancel_callback(self): def cancel_callback(self):
"""If the user answered yes to abandoning changes, close the window""" """If the user answered yes to abandoning changes, close the window"""
@ -1110,32 +1110,32 @@ class EditPerson:
if idval == "": if idval == "":
idval = None idval = None
changed = 0 changed = False
name = self.person.get_primary_name() name = self.person.get_primary_name()
if self.complete.get_active() != self.person.get_complete_flag(): if self.complete.get_active() != self.person.get_complete_flag():
changed = 1 changed = True
if self.person.get_gramps_id() != idval: if self.person.get_gramps_id() != idval:
changed = 1 changed = True
if suffix != name.get_suffix(): if suffix != name.get_suffix():
changed = 1 changed = True
if prefix != name.get_surname_prefix(): if prefix != name.get_surname_prefix():
changed = 1 changed = True
if surname.upper() != name.get_surname().upper(): if surname.upper() != name.get_surname().upper():
changed = 1 changed = True
if ntype != const.NameTypesMap.find_value(name.get_type()): if ntype != const.NameTypesMap.find_value(name.get_type()):
changed = 1 changed = True
if given != name.get_first_name(): if given != name.get_first_name():
changed = 1 changed = True
if nick != self.person.get_nick_name(): if nick != self.person.get_nick_name():
changed = 1 changed = True
if title != name.get_title(): if title != name.get_title():
changed = 1 changed = True
if self.pname.get_note() != name.get_note(): if self.pname.get_note() != name.get_note():
changed = 1 changed = True
if self.lds_not_loaded == 0 and self.check_lds(): if self.lds_not_loaded == False and self.check_lds():
changed = 1 changed = True
bplace = unicode(self.bplace.get_text().strip()) bplace = unicode(self.bplace.get_text().strip())
dplace = unicode(self.dplace.get_text().strip()) dplace = unicode(self.dplace.get_text().strip())
@ -1145,7 +1145,7 @@ class EditPerson:
else: else:
p1 = None p1 = None
if bplace != "": if bplace != "":
changed = 1 changed = True
self.birth.set_place_handle('') self.birth.set_place_handle('')
if self.pdmap.has_key(dplace): if self.pdmap.has_key(dplace):
@ -1153,33 +1153,33 @@ class EditPerson:
else: else:
p1 = None p1 = None
if dplace != "": if dplace != "":
changed = 1 changed = True
self.death.set_place_handle('') self.death.set_place_handle('')
if not self.birth.are_equal(self.orig_birth): if not self.birth.are_equal(self.orig_birth):
changed = 1 changed = True
if not self.death.are_equal(self.orig_death): if not self.death.are_equal(self.orig_death):
changed = 1 changed = True
if male and self.person.get_gender() != RelLib.Person.male: if male and self.person.get_gender() != RelLib.Person.male:
changed = 1 changed = True
elif female and self.person.get_gender() != RelLib.Person.female: elif female and self.person.get_gender() != RelLib.Person.female:
changed = 1 changed = True
elif unknown and self.person.get_gender() != RelLib.Person.unknown: elif unknown and self.person.get_gender() != RelLib.Person.unknown:
changed = 1 changed = True
if text != self.person.get_note() or self.lists_changed: if text != self.person.get_note():
changed = 1 changed = True
if format != self.person.get_note_format(): if format != self.person.get_note_format():
changed = 1 changed = True
if self.lds_not_loaded == 0: if self.lds_not_loaded == False:
if not self.lds_baptism.are_equal(self.person.get_lds_baptism()): if not self.lds_baptism.are_equal(self.person.get_lds_baptism()):
changed= 1 changed= True
if not self.lds_endowment.are_equal(self.person.get_lds_endowment()): if not self.lds_endowment.are_equal(self.person.get_lds_endowment()):
changed = 1 changed = True
if not self.lds_sealing.are_equal(self.person.get_lds_sealing()): if not self.lds_sealing.are_equal(self.person.get_lds_sealing()):
changed = 1 changed = True
return changed return changed
@ -1212,7 +1212,7 @@ class EditPerson:
def on_event_delete_clicked(self,obj): def on_event_delete_clicked(self,obj):
"""Delete the selected event""" """Delete the selected event"""
if Utils.delete_selected(obj,self.elist): if Utils.delete_selected(obj,self.elist):
self.lists_changed = 1 self.lists_changed = True
self.redraw_event_list() self.redraw_event_list()
def update_birth_death(self): def update_birth_death(self):
@ -1452,7 +1452,7 @@ class EditPerson:
def on_apply_person_clicked(self,obj): def on_apply_person_clicked(self,obj):
trans = self.db.transaction_begin() trans = self.db.transaction_begin()
surname = unicode(self.surname.get_text()) surname = unicode(self.surname.get_text())
suffix = unicode(self.suffix.get_text()) suffix = unicode(self.suffix.get_text())
prefix = unicode(self.prefix.get_text()) prefix = unicode(self.prefix.get_text())
@ -1546,13 +1546,13 @@ class EditPerson:
male = self.is_male.get_active() male = self.is_male.get_active()
female = self.is_female.get_active() female = self.is_female.get_active()
unknown = self.is_unknown.get_active() unknown = self.is_unknown.get_active()
error = 0 error = False
if male and self.person.get_gender() != RelLib.Person.male: if male and self.person.get_gender() != RelLib.Person.male:
self.person.set_gender(RelLib.Person.male) self.person.set_gender(RelLib.Person.male)
for temp_family in self.person.get_family_handle_list(): for temp_family in self.person.get_family_handle_list():
if self.person == temp_family.get_mother_handle(): if self.person == temp_family.get_mother_handle():
if temp_family.get_father_handle() != None: if temp_family.get_father_handle() != None:
error = 1 error = True
else: else:
temp_family.set_mother_handle(None) temp_family.set_mother_handle(None)
temp_family.set_father_handle(self.person) temp_family.set_father_handle(self.person)
@ -1561,7 +1561,7 @@ class EditPerson:
for temp_family in self.person.get_family_handle_list(): for temp_family in self.person.get_family_handle_list():
if self.person == temp_family.get_father_handle(): if self.person == temp_family.get_father_handle():
if temp_family.get_mother_handle() != None: if temp_family.get_mother_handle() != None:
error = 1 error = True
else: else:
temp_family.set_father_handle(None) temp_family.set_father_handle(None)
temp_family.set_mother_handle(self.person) temp_family.set_mother_handle(self.person)
@ -1570,18 +1570,18 @@ class EditPerson:
for temp_family in self.person.get_family_handle_list(): for temp_family in self.person.get_family_handle_list():
if self.person == temp_family.get_father_handle(): if self.person == temp_family.get_father_handle():
if temp_family.get_mother_handle() != None: if temp_family.get_mother_handle() != None:
error = 1 error = True
else: else:
temp_family.set_father_handle(None) temp_family.set_father_handle(None)
temp_family.set_mother_handle(self.person) temp_family.set_mother_handle(self.person)
if self.person == temp_family.get_mother_handle(): if self.person == temp_family.get_mother_handle():
if temp_family.get_father_handle() != None: if temp_family.get_father_handle() != None:
error = 1 error = True
else: else:
temp_family.set_mother_handle(None) temp_family.set_mother_handle(None)
temp_family.set_father_handle(self.person) temp_family.set_father_handle(self.person)
if error == 1: if error == True:
msg2 = _("Problem changing the gender") msg2 = _("Problem changing the gender")
msg = _("Changing the gender caused problems " msg = _("Changing the gender caused problems "
"with marriage information.\nPlease check " "with marriage information.\nPlease check "
@ -1601,7 +1601,7 @@ class EditPerson:
if self.complete.get_active() != self.person.get_complete_flag(): if self.complete.get_active() != self.person.get_complete_flag():
self.person.set_complete_flag(self.complete.get_active()) self.person.set_complete_flag(self.complete.get_active())
if self.lds_not_loaded == 0: if self.lds_not_loaded == False:
self.check_lds() self.check_lds()
lds_ord = RelLib.LdsOrd(self.person.get_lds_baptism()) lds_ord = RelLib.LdsOrd(self.person.get_lds_baptism())
if not self.lds_baptism.are_equal(lds_ord): if not self.lds_baptism.are_equal(lds_ord):
@ -1617,6 +1617,7 @@ class EditPerson:
if self.lists_changed: if self.lists_changed:
self.person.set_source_reference_list(self.srcreflist) self.person.set_source_reference_list(self.srcreflist)
self.update_lists()
if self.person.get_handle() == None: if self.person.get_handle() == None:
self.db.add_person(self.person, trans) self.db.add_person(self.person, trans)
@ -1624,7 +1625,6 @@ class EditPerson:
self.db.commit_person(self.person, trans) self.db.commit_person(self.person, trans)
n = self.person.get_primary_name().get_regular_name() n = self.person.get_primary_name().get_regular_name()
self.db.transaction_commit(trans,_("Edit Person (%s)") % n) self.db.transaction_commit(trans,_("Edit Person (%s)") % n)
self.update_lists()
if self.callback: if self.callback:
self.callback(self,1) self.callback(self,1)
self.close() self.close()
@ -1654,7 +1654,7 @@ class EditPerson:
def update_primary_name(self,list): def update_primary_name(self,list):
self.pname.set_source_reference_list(list) self.pname.set_source_reference_list(list)
self.lists_changed = 1 self.lists_changed = True
def on_name_note_clicked(self,obj): def on_name_note_clicked(self,obj):
import NoteEdit import NoteEdit
@ -1666,7 +1666,7 @@ class EditPerson:
def update_ldsbap_list(self,list): def update_ldsbap_list(self,list):
self.lds_baptism.set_source_reference_list(list) self.lds_baptism.set_source_reference_list(list)
self.lists_changed = 1 self.lists_changed = True
def on_ldsbap_note_clicked(self,obj): def on_ldsbap_note_clicked(self,obj):
import NoteEdit import NoteEdit
@ -1678,7 +1678,7 @@ class EditPerson:
def set_ldsendow_list(self,list): def set_ldsendow_list(self,list):
self.lds_endowment.set_source_reference_list(list) self.lds_endowment.set_source_reference_list(list)
self.lists_changed = 1 self.lists_changed = True
def on_ldsendow_note_clicked(self,obj): def on_ldsendow_note_clicked(self,obj):
import NoteEdit import NoteEdit
@ -1690,7 +1690,7 @@ class EditPerson:
def lds_seal_list(self,list): def lds_seal_list(self,list):
self.lds_sealing.set_source_reference_list(list) self.lds_sealing.set_source_reference_list(list)
self.lists_changed = 1 self.lists_changed = True
def on_ldsseal_note_clicked(self,obj): def on_ldsseal_note_clicked(self,obj):
import NoteEdit import NoteEdit
@ -1726,9 +1726,9 @@ class EditPerson:
elif page == 2: elif page == 2:
self.redraw_event_list() self.redraw_event_list()
elif page == 7 and self.not_loaded: elif page == 7 and self.not_loaded:
self.not_loaded = 0 self.not_loaded = False
elif page == 9 and self.lds_not_loaded: elif page == 9 and self.lds_not_loaded:
self.lds_not_loaded = 0 self.lds_not_loaded = False
self.draw_lds() self.draw_lds()
note_buf = self.notes_buffer note_buf = self.notes_buffer
text = unicode(note_buf.get_text(note_buf.get_start_iter(), text = unicode(note_buf.get_text(note_buf.get_start_iter(),
@ -1738,7 +1738,7 @@ class EditPerson:
else: else:
Utils.unbold_label(self.notes_label) Utils.unbold_label(self.notes_label)
if self.lds_not_loaded == 0: if self.lds_not_loaded == False:
self.check_lds() self.check_lds()
if self.lds_baptism.is_empty() \ if self.lds_baptism.is_empty() \
and self.lds_endowment.is_empty() \ and self.lds_endowment.is_empty() \
@ -1756,7 +1756,7 @@ class EditPerson:
self.nlist.append(old) self.nlist.append(old)
self.redraw_name_list() self.redraw_name_list()
self.pname = RelLib.Name(new) self.pname = RelLib.Name(new)
self.lists_changed = 1 self.lists_changed = True
self.write_primary_name() self.write_primary_name()
def write_primary_name(self): def write_primary_name(self):
@ -1776,7 +1776,7 @@ class EditPerson:
def birth_dates_in_order(self,list): def birth_dates_in_order(self,list):
"""Check any *valid* birthdates in the list to insure that they are in """Check any *valid* birthdates in the list to insure that they are in
numerically increasing order.""" numerically increasing order."""
inorder = 1 inorder = True
prev_date = "00000000" prev_date = "00000000"
for i in range(len(list)): for i in range(len(list)):
child_handle = list[i] child_handle = list[i]
@ -1790,7 +1790,7 @@ class EditPerson:
if (prev_date <= child_date): # <= allows for twins if (prev_date <= child_date): # <= allows for twins
prev_date = child_date prev_date = child_date
else: else:
inorder = 0 inorder = False
return inorder return inorder
def reorder_child_list(self, person, list): def reorder_child_list(self, person, list):

View File

@ -141,6 +141,7 @@ class GrampsDbBase:
if transaction != None: if transaction != None:
old_data = self.person_map.get(handle) old_data = self.person_map.get(handle)
transaction.add(PERSON_KEY,handle,old_data) transaction.add(PERSON_KEY,handle,old_data)
self.person_map[handle] = person.serialize() self.person_map[handle] = person.serialize()
def commit_media_object(self,obj,transaction,change_time=None): def commit_media_object(self,obj,transaction,change_time=None):

View File

@ -61,6 +61,15 @@ CONF_NORMAL = 2
CONF_LOW = 1 CONF_LOW = 1
CONF_VERY_LOW = 0 CONF_VERY_LOW = 0
#-------------------------------------------------------------------------
#
# Class definitions
#
#-------------------------------------------------------------------------
_display = DateHandler.create_display()
_parser = DateHandler.create_parser()
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
# #
# Class definitions # Class definitions
@ -817,8 +826,6 @@ class Event(PrimaryObject,DataObj):
PrimaryObject.__init__(self,source) PrimaryObject.__init__(self,source)
DataObj.__init__(self,source) DataObj.__init__(self,source)
self.dd = DateHandler.create_display()
self.dp = DateHandler.create_parser()
if source: if source:
self.place = source.place self.place = source.place
self.date = Date.Date(source.date) self.date = Date.Date(source.date)
@ -984,12 +991,12 @@ class Event(PrimaryObject,DataObj):
def set_date(self, date) : def set_date(self, date) :
"""attempts to sets the date of the Event instance""" """attempts to sets the date of the Event instance"""
self.date = self.dp.parse(date) self.date = _parser.parse(date)
def get_date(self) : def get_date(self) :
"""returns a string representation of the date of the Event instance""" """returns a string representation of the date of the Event instance"""
if self.date: if self.date:
return self.dd.display(self.date) return _display.display(self.date)
return u"" return u""
def get_preferred_date(self) : def get_preferred_date(self) :
@ -1000,7 +1007,7 @@ class Event(PrimaryObject,DataObj):
"""returns a string representation of the date of the Event instance, """returns a string representation of the date of the Event instance,
enclosing the results in quotes if it is not a valid date""" enclosing the results in quotes if it is not a valid date"""
if self.date: if self.date:
return self.dd.quote_display(self.date) return _display.quote_display(self.date)
return u"" return u""
def get_date_object(self): def get_date_object(self):
@ -1357,8 +1364,6 @@ class LdsOrd(SourceNote):
def __init__(self,source=None): def __init__(self,source=None):
"""Creates a LDS Ordinance instance""" """Creates a LDS Ordinance instance"""
SourceNote.__init__(self,source) SourceNote.__init__(self,source)
self.dp = DateHandler.create_parser()
self.dd = DateHandler.create_display()
if source: if source:
self.famc = source.famc self.famc = source.famc
@ -1403,12 +1408,12 @@ class LdsOrd(SourceNote):
"""attempts to sets the date of the ordinance""" """attempts to sets the date of the ordinance"""
if not self.date: if not self.date:
self.date = Date.Date() self.date = Date.Date()
self.dp.set_date(self.date,date) _parser.set_date(self.date,date)
def get_date(self) : def get_date(self) :
"""returns a string representation of the date of the ordinance""" """returns a string representation of the date of the ordinance"""
if self.date: if self.date:
return self.dd.display(self.date) return _display.display(self.date)
return u"" return u""
def get_date_object(self): def get_date_object(self):
@ -1723,8 +1728,6 @@ class Address(DataObj):
if provided""" if provided"""
DataObj.__init__(self,source) DataObj.__init__(self,source)
self.dd = DateHandler.create_display()
self.dp = DateHandler.create_parser()
if source: if source:
self.street = source.street self.street = source.street
self.city = source.city self.city = source.city
@ -1745,13 +1748,13 @@ class Address(DataObj):
def set_date(self,text): def set_date(self,text):
"""attempts to sets the date that the person lived at the address """attempts to sets the date that the person lived at the address
from the passed string""" from the passed string"""
self.date = self.dp.parse(text) self.date = _parser.parse(text)
def get_date(self): def get_date(self):
"""returns a string representation of the date that the person """returns a string representation of the date that the person
lived at the address""" lived at the address"""
if self.date: if self.date:
return self.dd.display(self.date) return _display.display(self.date)
return u"" return u""
def get_preferred_date(self): def get_preferred_date(self):