diff --git a/ChangeLog b/ChangeLog index 59e1e4f27..02a6b2298 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,6 @@ +2004-02-13 Don Allingham + * src/RelLib.py, etc.: move away from references to ids + 2004-02-10 Alex Roitman * doc/gramps.1.in, doc/gramps.1: Typo. New date. * doc/gramps-manual/fr/getstart.xml: Comment out old ZODB section. @@ -119,8 +122,15 @@ * doc/gramps-manual/fr/figures/*.png: Update figures. 2004-01-31 Don Allingham +<<<<<<< ChangeLog +<<<<<<< ChangeLog + * src/PeopleView.py (PeopleView.add_to_person_list): don't attempt to sort the + model unless it has be assigned. +======= +======= * src/SourceView.py: handle column sorting properly * src/PlaceView.py: handle column sorting properly +>>>>>>> 1.658 * src/gramps_main.py: better error messages on database write failure * src/WriteXML.py: better error messages on database write failure * src/GrampsXML.py: better error messages on database write failure @@ -144,9 +154,10 @@ 2004-01-31 Don Allingham * src/PeopleView.py (PeopleView.add_to_person_list): don't attempt to sort the model unless it has be assigned. +>>>>>>> 1.655 * src/TransTable.py: make sure returned valued is in unicode format * src/plugins/Ancestors.py: fix InverseNameTypesMap problem - * src/plugins/IndivComplete.py: fix InverseNameTypesMap problem + * src/plugins/IndivComplete.py: fix InverseNameTypesMap problem. 2004-01-30 Alex Roitman * src/plugins/AncestorChart2.py (write_book_item): diff --git a/src/AddMedia.py b/src/AddMedia.py index 8efddf3d2..76fe4d51e 100644 --- a/src/AddMedia.py +++ b/src/AddMedia.py @@ -119,17 +119,17 @@ class AddMediaObject: description = os.path.basename(filename) mobj = RelLib.Photo() - mobj.setDescription(description) - mobj.setMimeType(type) - self.db.addObject(mobj) + mobj.set_description(description) + mobj.set_mime_type(type) + self.db.add_object(mobj) if external.get_active() == 0: - path = self.db.getSavePath() - name = RelImage.import_media_object(filename,path,mobj.getId()) - mobj.setLocal(1) + path = self.db.get_save_path() + name = RelImage.import_media_object(filename,path,mobj.get_id()) + mobj.set_local(1) else: name = filename - mobj.setPath(name) + mobj.set_path(name) Utils.modified() if self.update: diff --git a/src/AddSpouse.py b/src/AddSpouse.py index 7dad57ec3..e9052c555 100644 --- a/src/AddSpouse.py +++ b/src/AddSpouse.py @@ -141,17 +141,17 @@ class AddSpouse: relation = const.save_frel(unicode(self.relation_type.get_text())) if relation == "Partners": - if self.person.getGender() == RelLib.Person.male: + if self.person.get_gender() == RelLib.Person.male: gen = RelLib.Person.male else: gen = RelLib.Person.female - elif self.person.getGender() == RelLib.Person.male: + elif self.person.get_gender() == RelLib.Person.male: gen = RelLib.Person.female else: gen = RelLib.Person.male person = RelLib.Person() - person.setGender(gen) + person.set_gender(gen) EditPerson.EditPerson(person,self.db,self.update_list) def update_list(self,epo): @@ -161,13 +161,13 @@ class AddSpouse: been closed. """ person = epo.person - if person.getId() == "": - self.db.addPerson(person) + if person.get_id() == "": + self.db.add_person(person) else: - self.db.addPersonNoMap(person,person.getId()) - self.db.buildPersonDisplay(person.getId()) + self.db.add_person_no_map(person,person.get_id()) + self.db.build_person_display(person.get_id()) self.addperson(person) - self.update_data(person.getId()) + self.update_data(person.get_id()) self.slist.center_selected() def select_spouse_clicked(self,obj): @@ -181,28 +181,29 @@ class AddSpouse: return id = self.slist.get_object(iter) - spouse = self.db.getPerson(id) + spouse = self.db.get_person(id) # don't do anything if the marriage already exists - for f in self.person.getFamilyList(): - if spouse == f.getMother() or spouse == f.getFather(): + for f in self.person.get_family_id_list(): + fam = self.db.find_family_from_id(f) + if spouse.get_id() == fam.get_mother_id() or spouse.get_id() == fam.get_father_id(): Utils.destroy_passed_object(obj) return Utils.modified() if not self.active_family: - self.active_family = self.db.newFamily() - self.person.addFamily(self.active_family) - spouse.addFamily(self.active_family) + self.active_family = self.db.new_family() + self.person.add_family_id(self.active_family.get_id()) + spouse.add_family_id(self.active_family.get_id()) - if self.person.getGender() == RelLib.Person.male: - self.active_family.setMother(spouse) - self.active_family.setFather(self.person) + if self.person.get_gender() == RelLib.Person.male: + self.active_family.set_mother_id(spouse.get_id()) + self.active_family.set_father_id(self.person.get_id()) else: - self.active_family.setFather(spouse) - self.active_family.setMother(self.person) + self.active_family.set_father_id(spouse.get_id()) + self.active_family.set_mother_id(self.person.get_id()) - self.active_family.setRelationship(const.save_frel(unicode(self.relation_type.get_text()))) + self.active_family.set_relationship(const.save_frel(unicode(self.relation_type.get_text()))) Utils.destroy_passed_object(obj) self.update(self.active_family) @@ -221,9 +222,9 @@ class AddSpouse: # determine the gender of the people to be loaded into # the potential spouse list. If Partners is selected, use # the same gender as the current person. - gender = self.person.getGender() - bday = self.person.getBirth().getDateObj() - dday = self.person.getDeath().getDateObj() + gender = self.person.get_gender() + bday = self.person.get_birth().get_date_object() + dday = self.person.get_death().get_date_object() if text == _("Partners"): if gender == RelLib.Person.male: @@ -239,14 +240,14 @@ class AddSpouse: self.entries = [] self.slist.clear() self.slist.new_model() - for key in self.db.sortPersonKeys(): - data = self.db.getPersonDisplay(key) + for key in self.db.sort_person_keys(): + data = self.db.get_person_display(key) if data[2] == sgender: continue if not self.showall.get_active(): - pdday = self.db.getPerson(key).getDeath().getDateObj() - pbday = self.db.getPerson(key).getBirth().getDateObj() + pdday = self.db.get_person(key).get_death().get_date_object() + pbday = self.db.get_person(key).get_birth().get_date_object() if bday.getYearValid(): if pbday.getYearValid(): diff --git a/src/AddrEdit.py b/src/AddrEdit.py index 968153765..9cf23bb96 100644 --- a/src/AddrEdit.py +++ b/src/AddrEdit.py @@ -85,7 +85,7 @@ class AddressEditor: self.db = self.parent.db self.addr = addr self.callback = callback - name = parent.person.getPrimaryName().getName() + name = parent.person.get_primary_name().get_name() if name == ", ": text = _("Address Editor") else: @@ -97,19 +97,19 @@ class AddressEditor: text,_('Address Editor')) if self.addr: - self.srcreflist = self.addr.getSourceRefList() - self.addr_start.set_text(self.addr.getDate()) - self.street.set_text(self.addr.getStreet()) - self.city.set_text(self.addr.getCity()) - self.state.set_text(self.addr.getState()) - self.country.set_text(self.addr.getCountry()) - self.postal.set_text(self.addr.getPostal()) - self.phone.set_text(self.addr.getPhone()) - self.priv.set_active(self.addr.getPrivacy()) - if self.addr.getNote(): - self.note_field.get_buffer().set_text(self.addr.getNote()) + self.srcreflist = self.addr.get_source_references() + self.addr_start.set_text(self.addr.get_date()) + self.street.set_text(self.addr.get_street()) + self.city.set_text(self.addr.get_city()) + self.state.set_text(self.addr.get_state()) + self.country.set_text(self.addr.get_country()) + self.postal.set_text(self.addr.get_postal_code()) + self.phone.set_text(self.addr.get_phone()) + self.priv.set_active(self.addr.get_privacy()) + if self.addr.get_note(): + self.note_field.get_buffer().set_text(self.addr.get_note()) Utils.bold_label(self.notes_label) - if addr.getNoteFormat() == 1: + if addr.get_note_format() == 1: self.preform.set_active(1) else: self.flowed.set_active(1) @@ -162,7 +162,7 @@ class AddressEditor: if self.addr == None: self.addr = RelLib.Address() self.parent.plist.append(self.addr) - self.addr.setSourceRefList(self.srcreflist) + self.addr.set_source_reference_list(self.srcreflist) self.update(date,street,city,state,country,postal,phone,note,format,priv) self.callback(self.addr) @@ -179,19 +179,19 @@ class AddressEditor: d = Date.Date() d.set(date) - if self.addr.getDate() != d.getDate(): - self.addr.setDate(date) + if self.addr.get_date() != d.get_date(): + self.addr.set_date(date) self.parent.lists_changed = 1 - self.check(self.addr.getStreet,self.addr.setStreet,street) - self.check(self.addr.getCountry,self.addr.setCountry,country) - self.check(self.addr.getCity,self.addr.setCity,city) - self.check(self.addr.getState,self.addr.setState,state) - self.check(self.addr.getPostal,self.addr.setPostal,postal) - self.check(self.addr.getPhone,self.addr.setPhone,phone) - self.check(self.addr.getNote,self.addr.setNote,note) - self.check(self.addr.getNoteFormat,self.addr.setNoteFormat,format) - self.check(self.addr.getPrivacy,self.addr.setPrivacy,priv) + self.check(self.addr.get_street,self.addr.set_street,street) + self.check(self.addr.get_country,self.addr.setCountry,country) + self.check(self.addr.get_city,self.addr.set_city,city) + self.check(self.addr.get_state,self.addr.set_state,state) + self.check(self.addr.get_postal_code,self.addr.set_postal_code,postal) + self.check(self.addr.get_phone,self.addr.set_phone,phone) + self.check(self.addr.get_note,self.addr.set_note,note) + self.check(self.addr.get_note_format,self.addr.set_note_format,format) + self.check(self.addr.get_privacy,self.addr.set_privacy,priv) def on_switch_page(self,obj,a,page): buf = self.note_field.get_buffer() diff --git a/src/ArgHandler.py b/src/ArgHandler.py index 538810c99..e82d02e82 100644 --- a/src/ArgHandler.py +++ b/src/ArgHandler.py @@ -144,7 +144,7 @@ class ArgHandler: if os.path.isfile(os.path.join(self.impdir_path,fn)): os.remove(os.path.join(self.impdir_path,fn)) self.parent.clear_database() - self.parent.db.setSavePath(self.impdir_path) + self.parent.db.set_save_path(self.impdir_path) for imp in imports: print "Importing: file %s, format %s." % (imp[0],imp[1]) self.cl_import(imp[0],imp[1]) @@ -270,9 +270,9 @@ class ArgHandler: try: # Write media files first, since the database may be modified # during the process (i.e. when removing object) - ObjectMap = self.parent.db.getObjectMap() + ObjectMap = self.parent.db.get_object_map() for ObjectId in ObjectMap.keys(): - oldfile = ObjectMap[ObjectId].getPath() + oldfile = ObjectMap[ObjectId].get_path() base = os.path.basename(oldfile) if os.path.isfile(oldfile): g = open(oldfile,"rb") diff --git a/src/AttrEdit.py b/src/AttrEdit.py index 047bd7341..0b2430800 100644 --- a/src/AttrEdit.py +++ b/src/AttrEdit.py @@ -90,7 +90,7 @@ class AttributeEditor: self.window = self.top.get_widget("attr_edit") if attrib: - self.srcreflist = self.attrib.getSourceRefList() + self.srcreflist = self.attrib.get_source_references() else: self.srcreflist = [] @@ -110,14 +110,14 @@ class AttributeEditor: AutoComp.AutoCombo(self.attrib_menu,list) if attrib != None: - self.type_field.set_text(attrib.getType()) - self.value_field.set_text(attrib.getValue()) - self.priv.set_active(attrib.getPrivacy()) + self.type_field.set_text(attrib.get_type()) + self.value_field.set_text(attrib.get_value()) + self.priv.set_active(attrib.get_privacy()) - if attrib.getNote(): - self.note_field.get_buffer().set_text(attrib.getNote()) + if attrib.get_note(): + self.note_field.get_buffer().set_text(attrib.get_note()) Utils.bold_label(self.notes_label) - if attrib.getNoteFormat() == 1: + if attrib.get_note_format() == 1: self.preform.set_active(1) else: self.flowed.set_active(1) @@ -171,7 +171,7 @@ class AttributeEditor: self.attrib = RelLib.Attribute() self.parent.alist.append(self.attrib) - self.attrib.setSourceRefList(self.srcreflist) + self.attrib.set_source_reference_list(self.srcreflist) self.update(type,value,note,format,priv) self.callback(self.attrib) @@ -185,11 +185,11 @@ class AttributeEditor: def update(self,type,value,note,format,priv): """Compares the data items, and updates if necessary""" ntype = const.save_pattr(type) - self.check(self.attrib.getType,self.attrib.setType,ntype) - self.check(self.attrib.getValue,self.attrib.setValue,value) - self.check(self.attrib.getNote,self.attrib.setNote,note) - self.check(self.attrib.getNoteFormat,self.attrib.setNoteFormat,format) - self.check(self.attrib.getPrivacy,self.attrib.setPrivacy,priv) + self.check(self.attrib.get_type,self.attrib.set_type,ntype) + self.check(self.attrib.get_value,self.attrib.set_value,value) + self.check(self.attrib.get_note,self.attrib.set_note,note) + self.check(self.attrib.get_note_format,self.attrib.set_note_format,format) + self.check(self.attrib.get_privacy,self.attrib.set_privacy,priv) def on_switch_page(self,obj,a,page): buf = self.note_field.get_buffer() diff --git a/src/Bookmarks.py b/src/Bookmarks.py index 52ecb37d8..eb2fd6eb5 100644 --- a/src/Bookmarks.py +++ b/src/Bookmarks.py @@ -83,7 +83,7 @@ class Bookmarks : def add_to_menu(self,person): """adds a person's name to the drop down menu""" - item = gtk.MenuItem(person.getPrimaryName().getName()) + item = gtk.MenuItem(person.get_primary_name().get_name()) item.connect("activate", self.callback, person) item.show() self.myMenu.append(item) @@ -141,7 +141,7 @@ class Bookmarks : self.draw_window() index = 0 for person in self.bookmarks: - self.namelist.append([person.getPrimaryName().getName()]) + self.namelist.append([person.get_primary_name().get_name()]) self.namelist.set_row_data(index,person) index = index + 1 diff --git a/src/ChooseParents.py b/src/ChooseParents.py index 44d2c9f30..a21eaa74a 100644 --- a/src/ChooseParents.py +++ b/src/ChooseParents.py @@ -85,11 +85,11 @@ class ChooseParents: self.type = "" self.parent_selected = 0 - self.date = person.getBirth().getDateObj() + self.date = person.get_birth().get_date_object() if self.family: - self.father = self.family.getFather() - self.mother = self.family.getMother() + self.father = self.family.get_father_id() + self.mother = self.family.get_mother_id() else: self.mother = None self.father = None @@ -120,7 +120,7 @@ class ChooseParents: self.mmodel = ListModel.ListModel(self.mother_list, _titles, self.mother_list_select_row) - for (f,mr,fr) in self.person.getParentList(): + for (f,mr,fr) in self.person.get_parent_family_id_list(): if f == self.family: self.mother_rel.set_text(_(mr)) self.father_rel.set_text(_(fr)) @@ -130,7 +130,7 @@ class ChooseParents: self.father_rel.set_text(_("Birth")) if self.family: - self.type = self.family.getRelationship() + self.type = self.family.get_relationship() else: self.type = "Married" @@ -159,29 +159,29 @@ class ChooseParents: self.fmodel.clear() self.fmodel.new_model() - pkey = self.person.getId() + pkey = self.person.get_id() if self.father: - fid = self.father.getId() + fid = self.father.get_id() else: fid = None - bday = self.person.getBirth().getDateObj() - dday = self.person.getDeath().getDateObj() + bday = self.person.get_birth().get_date_object() + dday = self.person.get_death().get_date_object() person_list = [] - for key in self.db.sortPersonKeys(): + for key in self.db.sort_person_keys(): if pkey == key: continue - person = self.db.getPerson(key) - if person.getGender() != person.male: + person = self.db.get_person(key) + if person.get_gender() != person.male: continue if not self.showallf.get_active(): - pdday = person.getDeath().getDateObj() - pbday = person.getBirth().getDateObj() + pdday = person.get_death().get_date_object() + pbday = person.get_birth().get_date_object() if bday.getYearValid(): if pbday.getYearValid(): @@ -209,10 +209,10 @@ class ChooseParents: if pdday.getHighYear() + 150 < dday.getLowYear(): continue - person_list.append(person.getId()) + person_list.append(person.get_id()) for idval in person_list: - d = self.db.getPersonDisplay(idval) + d = self.db.get_person_display(idval) info = [d[0],d[1],d[3],d[5],d[6]] if self.type == "Partners": self.fmodel.add(info,d[1],fid==d[1]) @@ -233,31 +233,31 @@ class ChooseParents: self.mmodel.clear() self.mmodel.new_model() - pkey = self.person.getId() + pkey = self.person.get_id() if self.mother: - mid = self.mother.getId() + mid = self.mother.get_id() else: mid = None - bday = self.person.getBirth().getDateObj() - dday = self.person.getDeath().getDateObj() + bday = self.person.get_birth().get_date_object() + dday = self.person.get_death().get_date_object() person_list = [] - for key in self.db.sortPersonKeys(): + for key in self.db.sort_person_keys(): if pkey == key: continue - person = self.db.getPerson(key) - if person.getGender() != person.female: + person = self.db.get_person(key) + if person.get_gender() != person.female: continue - person = self.db.getPerson(key) + person = self.db.get_person(key) if not self.showallm.get_active(): - pdday = person.getDeath().getDateObj() - pbday = person.getBirth().getDateObj() + pdday = person.get_death().get_date_object() + pbday = person.get_birth().get_date_object() if bday.getYearValid(): if pbday.getYearValid(): @@ -285,10 +285,10 @@ class ChooseParents: if pdday.getHighYear() + 150 < dday.getLowYear(): continue - person_list.append(person.getId()) + person_list.append(person.get_id()) for idval in person_list: - d = self.db.getPersonDisplay(idval) + d = self.db.get_person_display(idval) info = [d[0],d[1],d[3],d[5],d[6]] if self.type == "Partners": self.mmodel.add(info,d[1],mid==d[1]) @@ -323,22 +323,22 @@ class ChooseParents: if not father and not mother: return None - families = self.db.getFamilyMap().values() + families = self.db.get_family_id_map().values() for family in families: - if family.getFather() == father and family.getMother() == mother: + if family.get_father_id() == father and family.get_mother_id() == mother: return family - elif family.getFather() == mother and family.getMother() == father: + elif family.get_father_id() == mother and family.get_mother_id() == father: return family - family = self.db.newFamily() - family.setFather(father) - family.setMother(mother) - family.addChild(self.person) + family = self.db.new_family() + family.set_father_id(father) + family.set_mother_id(mother) + family.add_child_id(self.person) if father: - father.addFamily(family) + father.add_family_id(family.get_id()) if mother: - mother.addFamily(family) + mother.add_family_id(family.get_id()) return family def mother_list_select_row(self,obj): @@ -348,16 +348,16 @@ class ChooseParents: model, iter = self.mmodel.get_selected() if iter: id = model.get_value(iter,1) - self.mother = self.db.getPerson(id) + self.mother = self.db.get_person(id) else: self.mother = None if not self.parent_selected and self.mother: self.parent_selected = 1 - list = self.mother.getFamilyList() + list = self.mother.get_family_id_list() if len(list) >= 1: - father = list[0].getFather() - self.fmodel.find(father.getId()) + father = list[0].get_father_id() + self.fmodel.find(father.get_id()) self.fmodel.center_selected() def father_list_select_row(self,obj): @@ -366,16 +366,16 @@ class ChooseParents: model, iter = self.fmodel.get_selected() if iter: id = model.get_value(iter,1) - self.father = self.db.getPerson(id) + self.father = self.db.get_person(id) else: self.father = None if not self.parent_selected and self.father: self.parent_selected = 1 - list = self.father.getFamilyList() + list = self.father.get_family_id_list() if len(list) >= 1: - mother = list[0].getMother() - self.mmodel.find(mother.getId()) + mother = list[0].get_mother_id() + self.mmodel.find(mother.get_id()) self.mmodel.center_selected() def save_parents_clicked(self,obj): @@ -384,30 +384,30 @@ class ChooseParents: of the main perosn. """ try: - mother_rel = const.childRelations[unicode(self.mother_rel.get_text())] + mother_rel = const.child_relations(self.mother_rel.get_text()) except KeyError: - mother_rel = const.childRelations["Birth"] + mother_rel = const.child_relations("Birth") try: - father_rel = const.childRelations[unicode(self.father_rel.get_text())] + father_rel = const.child_relations(self.father_rel.get_text()) except KeyError: - father_rel = const.childRelations["Birth"] + father_rel = const.childRelations("Birth") if self.father or self.mother: if self.mother and not self.father: - if self.mother.getGender() == RelLib.Person.male: + if self.mother.get_gender() == RelLib.Person.male: self.father = self.mother self.mother = None self.family = self.find_family(self.father,self.mother) elif self.father and not self.mother: - if self.father.getGender() == RelLib.Person.female: + if self.father.get_gender() == RelLib.Person.female: self.mother = self.father self.father = None self.family = self.find_family(self.father,self.mother) - elif self.mother.getGender() != self.father.getGender(): + elif self.mother.get_gender() != self.father.get_gender(): if self.type == "Partners": self.type = "Unknown" - if self.father.getGender() == RelLib.Person.female: + if self.father.get_gender() == RelLib.Person.female: x = self.father self.father = self.mother self.mother = x @@ -420,7 +420,7 @@ class ChooseParents: Utils.destroy_passed_object(obj) if self.family: - self.family.setRelationship(self.type) + self.family.set_relationship(self.type) self.change_family_type(self.family,mother_rel,father_rel) self.family_update(None) @@ -429,21 +429,21 @@ class ChooseParents: depending on the gender of the person.""" person = epo.person - id = person.getId() + id = person.get_id() if id == "": - id = self.db.addPerson(person) + id = self.db.add_person(person) else: - self.db.addPersonNoMap(person,id) - self.db.buildPersonDisplay(id) + self.db.add_person_no_map(person,id) + self.db.build_person_display(id) self.type = const.save_frel(unicode(self.prel.get_text())) - dinfo = self.db.getPersonDisplay(id) + dinfo = self.db.get_person_display(id) rdata = [dinfo[0],dinfo[1],dinfo[3],dinfo[5],dinfo[6]] if self.type == "Partners": self.parent_relation_changed(self.prel) - elif person.getGender() == RelLib.Person.male: + elif person.get_gender() == RelLib.Person.male: self.fmodel.add(rdata,None,1) self.fmodel.center_selected() else: @@ -456,7 +456,7 @@ class ChooseParents: class to create a new person.""" person = RelLib.Person() - person.setGender(RelLib.Person.male) + person.set_gender(RelLib.Person.male) try: import EditPerson @@ -470,18 +470,18 @@ class ChooseParents: Changes the family type of the specified family. If the family is None, the the relationship type shoud be deleted. """ - if self.person not in family.getChildList(): - family.addChild(self.person) - for fam in self.person.getParentList(): + if self.person not in family.get_child_id_list(): + family.add_child_id(self.person) + for fam in self.person.get_parent_family_id_list(): if family == fam[0]: if mother_rel == fam[1] and father_rel == fam[2]: return if mother_rel != fam[1] or father_rel != fam[2]: - self.person.removeAltFamily(family) - self.person.addAltFamily(family,mother_rel,father_rel) + self.person.remove_parent_family_id(family.get_id()) + self.person.add_parent_family_id(family.get_id(),mother_rel,father_rel) break else: - self.person.addAltFamily(family,mother_rel,father_rel) + self.person.add_parent_family_id(family.get_id(),mother_rel,father_rel) Utils.modified() @@ -502,8 +502,8 @@ class ModifyParents: self.family_update = family_update self.full_update = full_update - self.father = self.family.getFather() - self.mother = self.family.getMother() + self.father = self.family.get_father_id() + self.mother = self.family.get_mother_id() self.glade = gtk.glade.XML(const.gladeFile,"modparents","gramps") self.top = self.glade.get_widget("modparents") @@ -519,7 +519,7 @@ class ModifyParents: self.orig_mrel = _("Birth") self.orig_frel = _("Birth") - for (f,mr,fr) in self.person.getParentList(): + for (f,mr,fr) in self.person.get_parent_family_id_list(): if f == self.family: self.orig_mrel = _(mr) self.orig_frel = _(fr) @@ -533,7 +533,7 @@ class ModifyParents: self.title.set_use_markup(gtk.TRUE) - if self.family.getRelationship() == "Partners": + if self.family.get_relationship() == "Partners": self.mlabel.set_label('%s' % _("Parent")) self.flabel.set_label('%s' % _("Parent")) else: @@ -542,22 +542,22 @@ class ModifyParents: if self.father: - fname = self.father.getPrimaryName().getName() + fname = self.father.get_primary_name().get_name() self.glade.get_widget("fname").set_text(fname) else: self.father_rel.set_sensitive(0) if self.mother: - mname = self.mother.getPrimaryName().getName() + mname = self.mother.get_primary_name().get_name() self.glade.get_widget("mname").set_text(mname) else: self.mother_rel.set_sensitive(0) self.pref = self.glade.get_widget('preferred') - if len(self.person.getParentList()) > 1: + if len(self.person.get_parent_family_id_list()) > 1: self.glade.get_widget('pref_label').show() self.pref.show() - if family == self.person.getParentList()[0]: + if family == self.person.get_parent_family_id_list()[0]: self.pref.set_active(1) else: self.pref.set_active(0) @@ -580,28 +580,28 @@ class ModifyParents: Called with the OK button nis pressed. Saves the selected people as parents of the main perosn. """ - mother_rel = const.childRelations[unicode(self.mother_rel.get_text())] - father_rel = const.childRelations[unicode(self.father_rel.get_text())] + mother_rel = const.childRelations(self.mother_rel.get_text()) + father_rel = const.childRelations(self.father_rel.get_text()) mod = 0 if mother_rel != self.orig_mrel or father_rel != self.orig_frel: - self.person.removeAltFamily(self.family) - self.person.addAltFamily(self.family,mother_rel,father_rel) + self.person.remove_parent_family_id(self.family) + self.person.add_parent_family_id(self.family,mother_rel,father_rel) mod = 1 Utils.modified() - if len(self.person.getParentList()): + if len(self.person.get_parent_family_id_list()): make_pref = self.pref.get_active() - plist = self.person.getParentList() + plist = self.person.get_parent_family_id_list() if make_pref: if self.family != plist[0]: - self.person.setMainParents(self.family) + self.person.set_main_parent_family_id(self.family) Utils.modified() mod = 1 else: if self.family == plist[0]: - self.person.setMainParents(plist[0]) + self.person.set_main_parent_family_id(plist[0]) Utils.modified() mod = 1 diff --git a/src/Date.py b/src/Date.py index 460951654..bc1d0efc2 100644 --- a/src/Date.py +++ b/src/Date.py @@ -181,7 +181,7 @@ class Date: self.stop.calendar = self.calendar return self.stop.day - def getText(self): + def get_text(self): return self.text def greater_than(self,other): @@ -241,19 +241,19 @@ class Date: def set_range(self,val): self.range = val - def getDate(self): + def get_date(self): if self.range == 0: - return self.start.getDate() + return self.start.get_date() elif self.range == -1: return self.text else: return _("from %(start_date)s to %(stop_date)s") % { - 'start_date' : self.start.getDate(), - 'stop_date' : self.stop.getDate() } + 'start_date' : self.start.get_date(), + 'stop_date' : self.stop.get_date() } - def getQuoteDate(self): + def get_quote_date(self): if self.range == 0: - return self.start.getQuoteDate() + return self.start.get_quote_date() elif self.range == -1: if self.text: return '"%s"' % self.text @@ -261,10 +261,10 @@ class Date: return '' else: return _("from %(start_date)s to %(stop_date)s") % { - 'start_date' : self.start.getQuoteDate(), - 'stop_date' : self.stop.getQuoteDate() } + 'start_date' : self.start.get_quote_date(), + 'stop_date' : self.stop.get_quote_date() } - def isEmpty(self): + def is_empty(self): s = self.start return s.year==UNDEF and s.month==UNDEF and s.day==UNDEF and not self.text @@ -376,10 +376,10 @@ class SingleDate: return "%s%s%s" % (y,m,d) - def getDate(self): + def get_date(self): return self.calendar.display(self.year, self.month, self.day, self.mode) - def getQuoteDate(self): + def get_quote_date(self): if self.year == UNDEF and self.month == UNDEF and self.day == UNDEF: return "" else: diff --git a/src/EditPerson.py b/src/EditPerson.py index 69c092cc7..e64e1f971 100644 --- a/src/EditPerson.py +++ b/src/EditPerson.py @@ -77,11 +77,12 @@ class EditPerson: def __init__(self,person,db,callback=None): """Creates an edit window. Associates a person with the window.""" + self.person = person - self.original_id = person.getId() + self.original_id = person.get_id() self.db = db self.callback = callback - self.path = db.getSavePath() + self.path = db.get_save_path() self.not_loaded = 1 self.lds_not_loaded = 1 self.lists_changed = 0 @@ -90,11 +91,11 @@ class EditPerson: self.pdmap = {} self.add_places = [] self.should_guess_gender = (self.original_id == '' and - person.getGender () == + person.get_gender () == RelLib.Person.unknown) - for key in db.getPlaceKeys(): - p = db.getPlaceDisplay(key) + for key in db.get_place_id_keys(): + p = db.get_place_display(key) self.pdmap[p[0]] = key self.load_obj = None @@ -195,18 +196,18 @@ class EditPerson: self.gallery_label = self.get_widget("gallery_label") self.lds_tab = self.get_widget("lds_tab") - self.death = RelLib.Event(person.getDeath()) - self.birth = RelLib.Event(person.getBirth()) - self.pname = RelLib.Name(person.getPrimaryName()) + self.death = RelLib.Event(person.get_death()) + self.birth = RelLib.Event(person.get_birth()) + self.pname = RelLib.Name(person.get_primary_name()) - self.elist = person.getEventList()[:] - self.nlist = person.getAlternateNames()[:] - self.alist = person.getAttributeList()[:] - self.ulist = person.getUrlList()[:] - self.plist = person.getAddressList()[:] + self.elist = person.get_event_list()[:] + self.nlist = person.get_alternate_names()[:] + self.alist = person.get_attribute_list()[:] + self.ulist = person.get_url_list()[:] + self.plist = person.get_address_list()[:] if person: - self.srcreflist = person.getSourceRefList() + self.srcreflist = person.get_source_references() else: self.srcreflist = [] @@ -223,7 +224,7 @@ class EditPerson: Utils.bold_label(self.inet_label) if self.plist: Utils.bold_label(self.addr_label) - if self.person.getPhotoList(): + if self.person.get_photo_list(): Utils.bold_label(self.gallery_label) # event display @@ -262,24 +263,24 @@ class EditPerson: place_list.sort() self.autoplace = AutoComp.AutoCombo(self.bpcombo, place_list) self.autodeath = AutoComp.AutoCombo(self.dpcombo, place_list, self.autoplace) - self.comp = AutoComp.AutoCombo(self.sncombo,self.db.getSurnames()) + self.comp = AutoComp.AutoCombo(self.sncombo,self.db.get_surnames()) - self.gid.set_text(person.getId()) + self.gid.set_text(person.get_id()) self.gid.set_editable(GrampsCfg.id_edit) - self.lds_baptism = RelLib.LdsOrd(self.person.getLdsBaptism()) - self.lds_endowment = RelLib.LdsOrd(self.person.getLdsEndowment()) - self.lds_sealing = RelLib.LdsOrd(self.person.getLdsSeal()) + self.lds_baptism = RelLib.LdsOrd(self.person.get_lds_baptism()) + self.lds_endowment = RelLib.LdsOrd(self.person.get_lds_endowment()) + self.lds_sealing = RelLib.LdsOrd(self.person.get_lds_sealing()) if GrampsCfg.uselds \ - or (not self.lds_baptism.isEmpty()) \ - or (not self.lds_endowment.isEmpty()) \ - or (not self.lds_sealing.isEmpty()): + or (not self.lds_baptism.is_empty()) \ + or (not self.lds_endowment.is_empty()) \ + or (not self.lds_sealing.is_empty()): self.get_widget("lds_tab").show() self.get_widget("lds_page").show() - if (not self.lds_baptism.isEmpty()) \ - or (not self.lds_endowment.isEmpty()) \ - or (not self.lds_sealing.isEmpty()): + if (not self.lds_baptism.is_empty()) \ + or (not self.lds_endowment.is_empty()) \ + or (not self.lds_sealing.is_empty()): Utils.bold_label(self.lds_tab) types = const.NameTypesMap.get_values() @@ -287,21 +288,21 @@ class EditPerson: self.autotype = AutoComp.AutoCombo(self.ntype_field,types) self.write_primary_name() - if person.getGender() == RelLib.Person.male: + if person.get_gender() == RelLib.Person.male: self.is_male.set_active(1) - elif person.getGender() == RelLib.Person.female: + elif person.get_gender() == RelLib.Person.female: self.is_female.set_active(1) else: self.is_unknown.set_active(1) - self.nick.set_text(person.getNickName()) + self.nick.set_text(person.get_nick_name()) self.load_person_image() # set notes data self.notes_buffer = self.notes_field.get_buffer() - if person.getNote(): - self.notes_buffer.set_text(person.getNote()) - if person.getNoteObj().getFormat() == 1: + if person.get_note(): + self.notes_buffer.set_text(person.get_note()) + if person.get_note_object().get_format() == 1: self.preform.set_active(1) else: self.flowed.set_active(1) @@ -333,11 +334,11 @@ class EditPerson: self.bdate_check = DateEdit.DateEdit(self.bdate, self.get_widget("birth_stat")) - self.bdate_check.set_calendar(self.birth.getDateObj().get_calendar()) + self.bdate_check.set_calendar(self.birth.get_date_object().get_calendar()) self.ddate_check = DateEdit.DateEdit(self.ddate, self.get_widget("death_stat")) - self.ddate_check.set_calendar(self.death.getDateObj().get_calendar()) + self.ddate_check.set_calendar(self.death.get_date_object().get_calendar()) self.top.signal_autoconnect({ "destroy_passed_object" : self.on_cancel_edit, @@ -390,7 +391,7 @@ class EditPerson: self.top.get_widget('edit_src'), self.top.get_widget('del_src')) - if self.person.getComplete(): + if self.person.get_complete(): self.complete.set_active(1) self.redraw_event_list() @@ -417,11 +418,11 @@ class EditPerson: def lds_field(self,ord,combo,date,place): combo.set_popdown_strings(_temple_names) - if not ord.isEmpty(): - stat = ord.getStatus() - date.set_text(ord.getDate()) - if ord.getTemple() != "": - name = const.lds_temple_to_abrev[ord.getTemple()] + if not ord.is_empty(): + stat = ord.get_status() + date.set_text(ord.get_date()) + if ord.get_temple() != "": + name = const.lds_temple_to_abrev[ord.get_temple()] else: name = "" combo.entry.set_text(name) @@ -430,8 +431,9 @@ class EditPerson: combo.entry.set_text("") AutoComp.AutoEntry(place,None,self.autoplace) - if ord and ord.getPlace(): - place.set_text(ord.getPlace().get_title()) + if ord and ord.get_place_id(): + ord_place = self.db.find_place_from_id(ord.get_place_id()) + place.set_text(ord_place.get_title()) return stat def draw_lds(self): @@ -467,7 +469,7 @@ class EditPerson: self.ldsseal_date, self.ldssealplace) if self.lds_sealing: - self.ldsfam = self.lds_sealing.getFamily() + self.ldsfam = self.lds_sealing.get_family_id() else: self.ldsfam = None @@ -480,14 +482,14 @@ class EditPerson: index = 0 hist = 0 - flist = [self.person.getMainParents()] - for (fam,mrel,frel) in self.person.getParentList(): + flist = [self.person.get_main_parents_family_id()] + for (fam,mrel,frel) in self.person.get_parent_family_id_list(): flist.append(fam) for fam in flist: if fam == None: continue - f = fam.getFather() - m = fam.getMother() + f = fam.get_father_id() + m = fam.get_mother_id() if f and m: name = _("%(father)s and %(mother)s") % { 'father' : GrampsCfg.nameof(f), @@ -554,13 +556,13 @@ class EditPerson: self.seal_stat) def set_lds_bap(self,obj): - self.lds_baptism.setStatus(obj.get_data("val")) + self.lds_baptism.set_status(obj.get_data("val")) def set_lds_endow(self,obj): - self.lds_endowment.setStatus(obj.get_data("val")) + self.lds_endowment.set_status(obj.get_data("val")) def set_lds_seal(self,obj): - self.lds_sealing.setStatus(obj.get_data("val")) + self.lds_sealing.set_status(obj.get_data("val")) def ev_drag_data_received(self,widget,context,x,y,sel_data,info,time): row = self.etree.get_row_at(x,y) @@ -571,17 +573,17 @@ class EditPerson: exec 'person = "%s"' % data[1] if mytype != 'pevent': return - elif person == self.person.getId(): + elif person == self.person.get_id(): self.move_element(self.elist,self.etree.get_selected_row(),row) else: foo = pickle.loads(data[2]); - for src in foo.getSourceRefList(): - base = src.getBase() - newbase = self.db.findSourceNoMap(base.getId()) - src.setBase(newbase) - place = foo.getPlace() + for src in foo.get_source_references(): + base_id = src.get_base_id() + newbase = self.db.find_source_from_id(base_id) + src.set_base_id(newbase) + place = foo.get_place_id() if place: - foo.setPlace(self.db.findPlaceNoMap(place.getId())) + foo.set_place_id(place.get_id()) self.elist.insert(row,foo) self.lists_changed = 1 @@ -599,7 +601,7 @@ class EditPerson: bits_per = 8; # we're going to pass a string pickled = pickle.dumps(ev[0]); - data = str(('pevent',self.person.getId(),pickled)); + data = str(('pevent',self.person.get_id(),pickled)); sel_data.set(sel_data.target, bits_per, data) def ev_drag_begin(self, context, a): @@ -620,7 +622,7 @@ class EditPerson: exec 'person = "%s"' % data[1] if mytype != "url": return - elif person == self.person.getId(): + elif person == self.person.get_id(): self.move_element(self.ulist,self.wtree.get_selected_row(),row) else: foo = pickle.loads(data[2]); @@ -637,7 +639,7 @@ class EditPerson: if len(ev): bits_per = 8; # we're going to pass a string pickled = pickle.dumps(ev[0]); - data = str(('url',self.person.getId(),pickled)); + data = str(('url',self.person.get_id(),pickled)); sel_data.set(sel_data.target, bits_per, data) def at_drag_data_received(self,widget,context,x,y,sel_data,info,time): @@ -649,14 +651,14 @@ class EditPerson: exec 'person = "%s"' % data[1] if mytype != 'pattr': return - elif person == self.person.getId(): + elif person == self.person.get_id(): self.move_element(self.alist,self.atree.get_selected_row(),row) else: foo = pickle.loads(data[2]); - for src in foo.getSourceRefList(): - base = src.getBase() - newbase = self.db.findSourceNoMap(base.getId()) - src.setBase(newbase) + for src in foo.get_source_references(): + base_id = src.get_base_id() + newbase = self.db.find_source_from_id(base_id) + src.set_base_id(newbase) self.alist.append(foo) self.lists_changed = 1 self.redraw_attr_list() @@ -670,7 +672,7 @@ class EditPerson: if len(ev): bits_per = 8; # we're going to pass a string pickled = pickle.dumps(ev[0]); - data = str(('pattr',self.person.getId(),pickled)); + data = str(('pattr',self.person.get_id(),pickled)); sel_data.set(sel_data.target, bits_per, data) def ad_drag_data_received(self,widget,context,x,y,sel_data,info,time): @@ -682,14 +684,14 @@ class EditPerson: exec 'person = "%s"' % data[1] if mytype != 'paddr': return - elif person == self.person.getId(): + elif person == self.person.get_id(): self.move_element(self.plist,self.ptree.get_selected_row(),row) else: foo = pickle.loads(data[2]); - for src in foo.getSourceRefList(): - base = src.getBase() - newbase = self.db.findSourceNoMap(base.getId()) - src.setBase(newbase) + for src in foo.get_source_references(): + base_id = src.get_base_id() + newbase = self.db.find_source_from_id(base_id) + src.set_base_id(newbase) self.plist.insert(row,foo) self.lists_changed = 1 @@ -701,7 +703,7 @@ class EditPerson: if len(ev): bits_per = 8; # we're going to pass a string pickled = pickle.dumps(ev[0]); - data = str(('paddr',self.person.getId(),pickled)); + data = str(('paddr',self.person.get_id(),pickled)); sel_data.set(sel_data.target, bits_per, data) def ad_drag_begin(self, context, a): @@ -719,7 +721,7 @@ class EditPerson: self.ntree.clear() self.nmap = {} for name in self.nlist: - iter = self.ntree.add([name.getName(),_(name.getType())],name) + iter = self.ntree.add([name.get_name(),_(name.get_type())],name) self.nmap[str(name)] = iter if self.nlist: self.ntree.select_row(0) @@ -751,9 +753,9 @@ class EditPerson: self.ptree.clear() self.pmap = {} for addr in self.plist: - location = "%s %s %s %s" % (addr.getStreet(),addr.getCity(), - addr.getState(),addr.getCountry()) - iter = self.ptree.add([addr.getDate(),location],addr) + location = "%s %s %s %s" % (addr.get_street(),addr.get_city(), + addr.get_state(),addr.get_country()) + iter = self.ptree.add([addr.get_date(),location],addr) self.pmap[str(addr)] = iter if self.plist: self.ptree.select_row(0) @@ -766,7 +768,7 @@ class EditPerson: self.atree.clear() self.amap = {} for attr in self.alist: - iter = self.atree.add([const.display_pattr(attr.getType()),attr.getValue()],attr) + iter = self.atree.add([const.display_pattr(attr.get_type()),attr.get_value()],attr) self.amap[str(attr)] = iter if self.alist: self.atree.select_row(0) @@ -809,8 +811,9 @@ class EditPerson: self.etree.clear() self.emap = {} for event in self.elist: - iter = self.etree.add([const.display_pevent(event.getName()),event.getDescription(), - event.getQuoteDate(),event.getPlaceName()],event) + pname = place_title(self.db,event) + iter = self.etree.add([const.display_pevent(event.get_name()),event.get_description(), + event.get_quote_date(),pname],event) self.emap[str(event)] = iter if self.elist: self.etree.select_row(0) @@ -851,13 +854,13 @@ class EditPerson: def on_add_url_clicked(self,obj): """Invokes the url editor to add a new name""" import UrlEdit - pname = self.person.getPrimaryName().getName() + pname = self.person.get_primary_name().get_name() UrlEdit.UrlEditor(self,pname,None,self.url_edit_callback,self.window) def on_add_attr_clicked(self,obj): """Brings up the AttributeEditor for a new attribute""" import AttrEdit - pname = self.person.getPrimaryName().getName() + pname = self.person.get_primary_name().get_name() AttrEdit.AttributeEditor(self,None,pname,const.personalAttributes, self.attr_edit_callback,self.window) @@ -878,7 +881,7 @@ class EditPerson: def on_event_add_clicked(self,obj): """Brings up the EventEditor for a new event""" import EventEdit - pname = self.person.getPrimaryName().getName() + pname = self.person.get_primary_name().get_name() EventEdit.EventEditor(self,pname,const.personalEvents, const.save_event,None,None,0,self.event_edit_callback) @@ -888,14 +891,14 @@ class EditPerson: import EventEdit self.update_birth = 1 - pname = self.person.getPrimaryName().getName() + pname = self.person.get_primary_name().get_name() event = self.birth - event.setDate(unicode(self.bdate.get_text())) + event.set_date(unicode(self.bdate.get_text())) def_placename = unicode(self.bplace.get_text()) p = self.get_place(self.bplace) if p: - event.setPlace(p) + event.set_place_id(p) EventEdit.EventEditor(self,pname,const.personalEvents, const.save_event,event,def_placename,1, self.event_edit_callback) @@ -906,14 +909,14 @@ class EditPerson: import EventEdit self.update_death = 1 - pname = self.person.getPrimaryName().getName() + pname = self.person.get_primary_name().get_name() event = self.death - event.setDate(unicode(self.ddate.get_text())) + event.set_date(unicode(self.ddate.get_text())) def_placename = unicode(self.dplace.get_text()) p = self.get_place(self.dplace) if p: - event.setPlace(p) + event.set_place_id(p) EventEdit.EventEditor(self,pname,const.personalEvents, const.save_event,event,def_placename,1, self.event_edit_callback) @@ -960,7 +963,7 @@ class EditPerson: """If the data has changed, give the user a chance to cancel the close window""" if self.did_data_change(): - n = "%s" % self.person.getPrimaryName().getRegularName() + n = "%s" % self.person.get_primary_name().get_regular_name() SaveDialog(_('Save changes to %s?') % n, _('If you close without saving, the changes you ' 'have made will be lost'), @@ -977,7 +980,7 @@ class EditPerson: """If the data has changed, give the user a chance to cancel the close window""" if self.did_data_change(): - n = "%s" % self.person.getPrimaryName().getRegularName() + n = "%s" % self.person.get_primary_name().get_regular_name() SaveDialog(_('Save Changes to %s?') % n, _('If you close without saving, the changes you ' 'have made will be lost'), @@ -999,8 +1002,8 @@ class EditPerson: original record""" surname = unicode(self.surname_field.get_text()) - self.birth.setDate(unicode(self.bdate.get_text())) - self.death.setDate(unicode(self.ddate.get_text())) + self.birth.set_date(unicode(self.bdate.get_text())) + self.death.set_date(unicode(self.ddate.get_text())) ntype = unicode(self.ntype_field.entry.get_text()) suffix = unicode(self.suffix.get_text()) @@ -1017,28 +1020,28 @@ class EditPerson: idval = unicode(self.gid.get_text()) changed = 0 - name = self.person.getPrimaryName() + name = self.person.get_primary_name() - if self.complete.get_active() != self.person.getComplete(): + if self.complete.get_active() != self.person.get_complete(): changed = 1 - if self.person.getId() != idval: + if self.person.get_id() != idval: changed = 1 - if suffix != name.getSuffix(): + if suffix != name.get_suffix(): changed = 1 - if prefix != name.getSurnamePrefix(): + if prefix != name.get_surname_prefix(): changed = 1 - if surname.upper() != name.getSurname().upper(): + if surname.upper() != name.get_surname().upper(): changed = 1 - if ntype != const.NameTypesMap.find_value(name.getType()): + if ntype != const.NameTypesMap.find_value(name.get_type()): changed = 1 - if given != name.getFirstName(): + if given != name.get_first_name(): changed = 1 - if nick != self.person.getNickName(): + if nick != self.person.get_nick_name(): changed = 1 - if title != name.getTitle(): + if title != name.get_title(): changed = 1 - if self.pname.getNote() != name.getNote(): + if self.pname.get_note() != name.get_note(): changed = 1 if self.lds_not_loaded == 0 and self.check_lds(): changed = 1 @@ -1047,73 +1050,73 @@ class EditPerson: dplace = unicode(string.strip(self.dplace.get_text())) if self.pdmap.has_key(bplace): - p1 = self.db.getPlaceMap()[self.pdmap[bplace]] + self.birth.set_place_id(self.pdmap[bplace]) else: p1 = None if bplace != "": changed = 1 - self.birth.setPlace(p1) + self.birth.set_place_id('') if self.pdmap.has_key(dplace): - p1 = self.db.getPlaceMap()[self.pdmap[dplace]] + self.death.set_place_id(self.pdmap[dplace]) else: p1 = None if dplace != "": changed = 1 - self.death.setPlace(p1) + self.death.set_place_id('') - if not self.birth.are_equal(self.person.getBirth()): + if not self.birth.are_equal(self.person.get_birth()): changed = 1 - if not self.death.are_equal(self.person.getDeath()): + if not self.death.are_equal(self.person.get_death()): changed = 1 - if male and self.person.getGender() != RelLib.Person.male: + if male and self.person.get_gender() != RelLib.Person.male: changed = 1 - elif female and self.person.getGender() != RelLib.Person.female: + elif female and self.person.get_gender() != RelLib.Person.female: changed = 1 - elif unknown and self.person.getGender() != RelLib.Person.unknown: + elif unknown and self.person.get_gender() != RelLib.Person.unknown: changed = 1 - if text != self.person.getNote() or self.lists_changed: + if text != self.person.get_note() or self.lists_changed: changed = 1 - if format != self.person.getNoteFormat(): + if format != self.person.get_note_format(): changed = 1 if self.lds_not_loaded == 0: - if not self.lds_baptism.are_equal(self.person.getLdsBaptism()): + if not self.lds_baptism.are_equal(self.person.get_lds_baptism()): changed= 1 - if not self.lds_endowment.are_equal(self.person.getLdsEndowment()): + if not self.lds_endowment.are_equal(self.person.get_lds_endowment()): changed = 1 - if not self.lds_sealing.are_equal(self.person.getLdsSeal()): + if not self.lds_sealing.are_equal(self.person.get_lds_sealing()): changed = 1 return changed def check_lds(self): - self.lds_baptism.setDate(unicode(self.ldsbap_date.get_text())) + self.lds_baptism.set_date(unicode(self.ldsbap_date.get_text())) temple = unicode(self.ldsbap_temple.entry.get_text()) if const.lds_temple_codes.has_key(temple): - self.lds_baptism.setTemple(const.lds_temple_codes[temple]) + self.lds_baptism.set_temple(const.lds_temple_codes[temple]) else: - self.lds_baptism.setTemple("") - self.lds_baptism.setPlace(self.get_place(self.ldsbapplace,1)) + self.lds_baptism.set_temple("") + self.lds_baptism.set_place_id(self.get_place(self.ldsbapplace,1)) - self.lds_endowment.setDate(unicode(self.ldsend_date.get_text())) + self.lds_endowment.set_date(unicode(self.ldsend_date.get_text())) temple = unicode(self.ldsend_temple.entry.get_text()) if const.lds_temple_codes.has_key(temple): - self.lds_endowment.setTemple(const.lds_temple_codes[temple]) + self.lds_endowment.set_temple(const.lds_temple_codes[temple]) else: - self.lds_endowment.setTemple("") - self.lds_endowment.setPlace(self.get_place(self.ldsendowplace,1)) + self.lds_endowment.set_temple("") + self.lds_endowment.set_place_id(self.get_place(self.ldsendowplace,1)) - self.lds_sealing.setDate(unicode(self.ldsseal_date.get_text())) + self.lds_sealing.set_date(unicode(self.ldsseal_date.get_text())) temple = unicode(self.ldsseal_temple.entry.get_text()) if const.lds_temple_codes.has_key(temple): - self.lds_sealing.setTemple(const.lds_temple_codes[temple]) + self.lds_sealing.set_temple(const.lds_temple_codes[temple]) else: - self.lds_sealing.setTemple("") - self.lds_sealing.setFamily(self.ldsfam) - self.lds_sealing.setPlace(self.get_place(self.ldssealplace,1)) + self.lds_sealing.set_temple("") + self.lds_sealing.set_family_id(self.ldsfam) + self.lds_sealing.set_place_id(self.get_place(self.ldssealplace,1)) def on_event_delete_clicked(self,obj): """Delete the selected event""" @@ -1122,20 +1125,22 @@ class EditPerson: self.redraw_event_list() def update_birth_death(self): - self.bdate.set_text(self.birth.getDate()) - self.bplace.set_text(self.birth.getPlaceName()) - self.bdate_check.set_calendar(self.birth.getDateObj().get_calendar()) - self.ddate.set_text(self.death.getDate()) - self.ddate_check.set_calendar(self.death.getDateObj().get_calendar()) - self.dplace.set_text(self.death.getPlaceName()) - self.dplace.set_text(self.death.getPlaceName()) + self.bdate.set_text(self.birth.get_date()) + + self.bplace.set_text(place_title(self.db,self.birth)) + self.dplace.set_text(place_title(self.db,self.death)) + + self.bdate.set_text(self.birth.get_date()) + self.bdate_check.set_calendar(self.birth.get_date_object().get_calendar()) + self.ddate.set_text(self.death.get_date()) + self.ddate_check.set_calendar(self.death.get_date_object().get_calendar()) def on_update_attr_clicked(self,obj): import AttrEdit store,iter = self.atree.get_selected() if iter: attr = self.atree.get_object(iter) - pname = self.person.getPrimaryName().getName() + pname = self.person.get_primary_name().get_name() AttrEdit.AttributeEditor(self,attr,pname,const.personalAttributes, self.attr_edit_callback,self.window) @@ -1150,7 +1155,7 @@ class EditPerson: import UrlEdit store,iter = self.wtree.get_selected() if iter: - pname = self.person.getPrimaryName().getName() + pname = self.person.get_primary_name().get_name() url = self.wtree.get_object(iter) UrlEdit.UrlEditor(self,pname,url,self.url_edit_callback,self.window) @@ -1160,7 +1165,7 @@ class EditPerson: store,iter = self.etree.get_selected() if not iter: return - pname = self.person.getPrimaryName().getName() + pname = self.person.get_primary_name().get_name() event = self.etree.get_object(iter) EventEdit.EventEditor(self,pname,const.personalEvents, const.save_event,event,None,0, @@ -1171,15 +1176,16 @@ class EditPerson: if iter: row = store.get_path(iter) event = self.elist[row[0]] - self.event_date_field.set_text(event.getDate()) - self.event_place_field.set_text(event.getPlaceName()) - self.event_name_field.set_text(const.display_pevent(event.getName())) - self.event_cause_field.set_text(event.getCause()) - self.event_descr_field.set_text(short(event.getDescription())) - if len(event.getSourceRefList()) > 0: - psrc = event.getSourceRefList()[0] - self.event_src_field.set_text(short(psrc.getBase().getTitle())) - self.event_conf_field.set_text(const.confidence[psrc.getConfidence()]) + self.event_date_field.set_text(event.get_date()) + self.event_place_field.set_text(place_title(self.db,event)) + self.event_name_field.set_text(const.display_pevent(event.get_name())) + self.event_cause_field.set_text(event.get_cause()) + self.event_descr_field.set_text(short(event.get_description())) + if len(event.get_source_references()) > 0: + psrc_id = event.get_source_references()[0].get_base_id() + psrc = self.db.find_source_from_id(psrc_id) + self.event_src_field.set_text(short(psrc.get_base_id().get_title())) + self.event_conf_field.set_text(const.confidence[psrc.get_confidence_level()]) else: self.event_src_field.set_text('') self.event_conf_field.set_text('') @@ -1200,17 +1206,18 @@ class EditPerson: store,iter = self.ptree.get_selected() if iter: addr = self.ptree.get_object(iter) - self.addr_start.set_text(addr.getDate()) - self.addr_street.set_text(addr.getStreet()) - self.addr_city.set_text(addr.getCity()) - self.addr_state.set_text(addr.getState()) - self.addr_country.set_text(addr.getCountry()) - self.addr_postal.set_text(addr.getPostal()) - self.addr_phone.set_text(addr.getPhone()) - if len(addr.getSourceRefList()) > 0: - psrc = addr.getSourceRefList()[0] - self.addr_conf_field.set_text(const.confidence[psrc.getConfidence()]) - self.addr_src_field.set_text(short(psrc.getBase().getTitle())) + self.addr_start.set_text(addr.get_date()) + self.addr_street.set_text(addr.get_street()) + self.addr_city.set_text(addr.get_city()) + self.addr_state.set_text(addr.get_state()) + self.addr_country.set_text(addr.get_country()) + self.addr_postal.set_text(addr.get_postal_code()) + self.addr_phone.set_text(addr.get_phone()) + if len(addr.get_source_references()) > 0: + psrc_id = addr.get_source_references()[0].get_base_id() + psrc = self.db.find_source_from_id(psrc_id) + self.addr_conf_field.set_text(const.confidence[psrc.get_confidence_level()]) + self.addr_src_field.set_text(short(psrc.get_base_id().get_title())) else: self.addr_src_field.set_text('') self.addr_conf_field.set_text('') @@ -1233,16 +1240,17 @@ class EditPerson: store,iter = self.ntree.get_selected() if iter: name = self.ntree.get_object(iter) - self.alt_given_field.set_text(name.getFirstName()) - self.alt_title_field.set_text(name.getTitle()) - self.alt_last_field.set_text(name.getSurname()) - self.alt_suffix_field.set_text(name.getSuffix()) - self.alt_prefix_field.set_text(name.getSurnamePrefix()) - self.name_type_field.set_text(const.NameTypesMap.find_value(name.getType())) - if len(name.getSourceRefList()) > 0: - psrc = name.getSourceRefList()[0] - self.name_src_field.set_text(short(psrc.getBase().getTitle())) - self.name_conf_field.set_text(const.confidence[psrc.getConfidence()]) + self.alt_given_field.set_text(name.get_first_name()) + self.alt_title_field.set_text(name.get_title()) + self.alt_last_field.set_text(name.get_surname()) + self.alt_suffix_field.set_text(name.get_suffix()) + self.alt_prefix_field.set_text(name.get_surname_prefix()) + self.name_type_field.set_text(const.NameTypesMap.find_value(name.get_type())) + if len(name.get_source_references()) > 0: + psrc_id = name.get_source_references()[0].get_base_id() + psrc = self.db.find_source_from_id(psrc_id) + self.name_src_field.set_text(short(psrc.get_base_id().get_title())) + self.name_conf_field.set_text(const.confidence[psrc.get_confidence_level()]) else: self.name_src_field.set_text('') self.name_conf_field.set_text('') @@ -1282,12 +1290,13 @@ class EditPerson: store,iter = self.atree.get_selected() if iter: attr = self.atree.get_object(iter) - self.attr_type.set_text(const.display_pattr(attr.getType())) - self.attr_value.set_text(short(attr.getValue())) - if len(attr.getSourceRefList()) > 0: - psrc = attr.getSourceRefList()[0] - self.attr_src_field.set_text(short(psrc.getBase().getTitle())) - self.attr_conf_field.set_text(const.confidence[psrc.getConfidence()]) + self.attr_type.set_text(const.display_pattr(attr.get_type())) + self.attr_value.set_text(short(attr.get_value())) + if len(attr.get_source_references()) > 0: + psrc_id = attr.get_source_references()[0].get_base_id() + psrc = self.db.find_source_from_id(psrc_id) + self.attr_src_field.set_text(short(psrc.get_base_id().get_title())) + self.attr_conf_field.set_text(const.confidence[psrc.get_confidence_level()]) else: self.attr_src_field.set_text('') self.attr_conf_field.set_text('') @@ -1340,13 +1349,13 @@ class EditPerson: def update_lists(self): """Updates the person's lists if anything has changed""" if self.lists_changed: - self.person.setEventList(self.elist) - self.person.setAlternateNames(self.nlist) - self.person.setUrlList(self.ulist) - self.person.setAttributeList(self.alist) - self.person.setAddressList(self.plist) - self.person.setBirth(self.birth) - self.person.setDeath(self.death) + self.person.set_event_list(self.elist) + self.person.set_alternate_names(self.nlist) + self.person.set_url_list(self.ulist) + self.person.set_attribute_list(self.alist) + self.person.set_address_list(self.plist) + self.person.set_birth(self.birth) + self.person.set_death(self.death) Utils.modified() def on_apply_person_clicked(self,obj): @@ -1361,16 +1370,16 @@ class EditPerson: name = self.pname - self.birth.setDate(unicode(self.bdate.get_text())) - self.birth.setPlace(self.get_place(self.bplace,1)) + self.birth.set_date(unicode(self.bdate.get_text())) + self.birth.set_place_id(self.get_place(self.bplace,1)) - if idval != self.person.getId(): - m = self.db.getPersonMap() + if idval != self.person.get_id(): + m = self.db.get_person_id_map() if not m.has_key(idval): - if m.has_key(self.person.getId()): - del m[self.person.getId()] + if m.has_key(self.person.get_id()): + del m[self.person.get_id()] m[idval] = self.person - self.person.setId(idval) + self.person.set_id(idval) Utils.modified() else: n = GrampsCfg.nameof(m[idval]) @@ -1381,105 +1390,107 @@ class EditPerson: 'person' : n } WarningDialog(msg1,msg2) - if suffix != name.getSuffix(): - name.setSuffix(suffix) + if suffix != name.get_suffix(): + name.set_suffix(suffix) - if prefix != name.getSurnamePrefix(): - name.setSurnamePrefix(prefix) + if prefix != name.get_surname_prefix(): + name.set_surname_prefix(prefix) if const.NameTypesMap.has_value(ntype): ntype = const.NameTypesMap.find_key(ntype) else: ntype = "Birth Name" - if ntype != name.getType(): - name.setType(ntype) + if ntype != name.get_type(): + name.set_type(ntype) - if surname != name.getSurname(): - name.setSurname(surname) - self.db.addSurname(surname) + if surname != name.get_surname(): + name.set_surname(surname) + self.db.add_surname(surname) - if given != name.getFirstName(): - name.setFirstName(given) + if given != name.get_first_name(): + name.set_first_name(given) - if title != name.getTitle(): - name.setTitle(title) + if title != name.get_title(): + name.set_title(title) - name.setSourceRefList(self.pname.getSourceRefList()) + name.set_source_reference_list(self.pname.get_source_references()) - if not name.are_equal(self.person.getPrimaryName()): - self.person.setPrimaryName(name) + if not name.are_equal(self.person.get_primary_name()): + self.person.set_primary_name(name) Utils.modified() - if nick != self.person.getNickName(): - self.person.setNickName(nick) + if nick != self.person.get_nick_name(): + self.person.set_nick_name(nick) Utils.modified() self.pdmap.clear() - for key in self.db.getPlaceKeys(): - p = self.db.getPlaceDisplay(key) + for key in self.db.get_place_id_keys(): + p = self.db.get_place_display(key) self.pdmap[p[0]] = key - if not self.person.getBirth().are_equal(self.birth): - self.person.setBirth(self.birth) + if not self.person.get_birth().are_equal(self.birth): + self.person.set_birth(self.birth) Utils.modified() # Update each of the families child lists to reflect any # change in ordering due to the new birth date - family = self.person.getMainParents() + family = self.person.get_main_parents_family_id() if (family): - new_order = reorder_child_list(self.person,family.getChildList()) - family.setChildList(new_order) - for (family, rel1, rel2) in self.person.getParentList(): - new_order = reorder_child_list(self.person,family.getChildList()) - family.setChildList(new_order) + f = self.db.find_family_no_map(family) + new_order = reorder_child_list(self.person,f.get_child_id_list()) + f.set_child_id_list(new_order) + for (family, rel1, rel2) in self.person.get_parent_family_id_list(): + f = self.db.find_family_no_map(family) + new_order = reorder_child_list(self.person,f.get_child_id_list()) + f.set_child_id_list(new_order) - self.death.setDate(unicode(self.ddate.get_text())) - self.death.setPlace(self.get_place(self.dplace,1)) + self.death.set_date(unicode(self.ddate.get_text())) + self.death.set_place_id(self.get_place(self.dplace,1)) - if not self.person.getDeath().are_equal(self.death): - self.person.setDeath(self.death) + if not self.person.get_death().are_equal(self.death): + self.person.set_death(self.death) Utils.modified() male = self.is_male.get_active() female = self.is_female.get_active() unknown = self.is_unknown.get_active() error = 0 - if male and self.person.getGender() != RelLib.Person.male: - self.person.setGender(RelLib.Person.male) - for temp_family in self.person.getFamilyList(): - if self.person == temp_family.getMother(): - if temp_family.getFather() != None: + if male and self.person.get_gender() != RelLib.Person.male: + self.person.set_gender(RelLib.Person.male) + for temp_family in self.person.get_family_id_list(): + if self.person == temp_family.get_mother_id(): + if temp_family.get_father_id() != None: error = 1 else: - temp_family.setMother(None) - temp_family.setFather(self.person) + temp_family.set_mother_id(None) + temp_family.set_father_id(self.person) Utils.modified() - elif female and self.person.getGender() != RelLib.Person.female: - self.person.setGender(RelLib.Person.female) - for temp_family in self.person.getFamilyList(): - if self.person == temp_family.getFather(): - if temp_family.getMother() != None: + elif female and self.person.get_gender() != RelLib.Person.female: + self.person.set_gender(RelLib.Person.female) + for temp_family in self.person.get_family_id_list(): + if self.person == temp_family.get_father_id(): + if temp_family.get_mother_id() != None: error = 1 else: - temp_family.setFather(None) - temp_family.setMother(self.person) + temp_family.set_father_id(None) + temp_family.set_mother_id(self.person) Utils.modified() - elif unknown and self.person.getGender() != RelLib.Person.unknown: - self.person.setGender(RelLib.Person.unknown) - for temp_family in self.person.getFamilyList(): - if self.person == temp_family.getFather(): - if temp_family.getMother() != None: + elif unknown and self.person.get_gender() != RelLib.Person.unknown: + self.person.set_gender(RelLib.Person.unknown) + for temp_family in self.person.get_family_id_list(): + if self.person == temp_family.get_father_id(): + if temp_family.get_mother_id() != None: error = 1 else: - temp_family.setFather(None) - temp_family.setMother(self.person) - if self.person == temp_family.getMother(): - if temp_family.getFather() != None: + temp_family.set_father_id(None) + temp_family.set_mother_id(self.person) + if self.person == temp_family.get_mother_id(): + if temp_family.get_father_id() != None: error = 1 else: - temp_family.setMother(None) - temp_family.setFather(self.person) + temp_family.set_mother_id(None) + temp_family.set_father_id(self.person) Utils.modified() if error == 1: @@ -1492,38 +1503,38 @@ class EditPerson: text = unicode(self.notes_buffer.get_text(self.notes_buffer.get_start_iter(), self.notes_buffer.get_end_iter(),gtk.FALSE)) - if text != self.person.getNote(): - self.person.setNote(text) + if text != self.person.get_note(): + self.person.set_note(text) Utils.modified() format = self.preform.get_active() - if format != self.person.getNoteFormat(): - self.person.setNoteFormat(format) + if format != self.person.get_note_format(): + self.person.set_note_format(format) Utils.modified() - if self.complete.get_active() != self.person.getComplete(): - self.person.setComplete(self.complete.get_active()) + if self.complete.get_active() != self.person.get_complete(): + self.person.set_complete(self.complete.get_active()) Utils.modified() if self.lds_not_loaded == 0: self.check_lds() - ord = RelLib.LdsOrd(self.person.getLdsBaptism()) + ord = RelLib.LdsOrd(self.person.get_lds_baptism()) if not self.lds_baptism.are_equal(ord): - self.person.setLdsBaptism(self.lds_baptism) + self.person.set_lds_baptism(self.lds_baptism) Utils.modified() - ord = RelLib.LdsOrd(self.person.getLdsEndowment()) + ord = RelLib.LdsOrd(self.person.get_lds_endowment()) if not self.lds_endowment.are_equal(ord): - self.person.setLdsEndowment(self.lds_endowment) + self.person.set_lds_endowment(self.lds_endowment) Utils.modified() - ord = RelLib.LdsOrd(self.person.getLdsSeal()) + ord = RelLib.LdsOrd(self.person.get_lds_sealing()) if not self.lds_sealing.are_equal(ord): - self.person.setLdsSeal(self.lds_sealing) + self.person.set_lds_sealing(self.lds_sealing) Utils.modified() if self.lists_changed: - self.person.setSourceRefList(self.srcreflist) + self.person.set_source_reference_list(self.srcreflist) Utils.modified() self.update_lists() @@ -1537,26 +1548,26 @@ class EditPerson: text = unicode(string.strip(field.get_text())) if text: if self.pdmap.has_key(text): - return self.db.getPlaceMap()[self.pdmap[text]] + return self.pdmap[text] elif makenew: place = RelLib.Place() place.set_title(text) - self.db.addPlace(place) - self.pdmap[text] = place.getId() + self.db.add_place(place) + self.pdmap[text] = place.get_id() self.add_places.append(place) Utils.modified() - return place + return place.get_id() else: - return None + return '' else: - return None + return '' def on_primary_name_source_clicked(self,obj): - Sources.SourceSelector(self.pname.getSourceRefList(),self, + Sources.SourceSelector(self.pname.get_source_references(),self, self.update_primary_name) def update_primary_name(self,list): - self.pname.setSourceRefList(list) + self.pname.set_source_reference_list(list) self.lists_changed = 1 def on_name_note_clicked(self,obj): @@ -1564,11 +1575,11 @@ class EditPerson: NoteEdit.NoteEditor(self.pname,self.window) def on_ldsbap_source_clicked(self,obj): - Sources.SourceSelector(self.lds_baptism.getSourceRefList(), + Sources.SourceSelector(self.lds_baptism.get_source_references(), self,self.update_ldsbap_list) def update_ldsbap_list(self,list): - self.lds_baptism.setSourceRefList(list) + self.lds_baptism.set_source_reference_list(list) self.lists_changed = 1 def on_ldsbap_note_clicked(self,obj): @@ -1576,11 +1587,11 @@ class EditPerson: NoteEdit.NoteEditor(self.lds_baptism,self.window) def on_ldsendow_source_clicked(self,obj): - Sources.SourceSelector(self.lds_endowment.getSourceRefList(), + Sources.SourceSelector(self.lds_endowment.get_source_references(), self,self.set_ldsendow_list) def set_ldsendow_list(self,list): - self.lds_endowment.setSourceRefList(list) + self.lds_endowment.set_source_reference_list(list) self.lists_changed = 1 def on_ldsendow_note_clicked(self,obj): @@ -1588,11 +1599,11 @@ class EditPerson: NoteEdit.NoteEditor(self.lds_endowment,self.window) def on_ldsseal_source_clicked(self,obj): - Sources.SourceSelector(self.lds_sealing.getSourceRefList(), + Sources.SourceSelector(self.lds_sealing.get_source_references(), self,self.lds_seal_list) def lds_seal_list(self,list): - self.lds_sealing.setSourceRefList(list) + self.lds_sealing.set_source_reference_list(list) self.lists_changed = 1 def on_ldsseal_note_clicked(self,obj): @@ -1600,25 +1611,25 @@ class EditPerson: NoteEdit.NoteEditor(self.lds_sealing,self.window) def load_person_image(self): - photo_list = self.person.getPhotoList() + photo_list = self.person.get_photo_list() if photo_list: ph = photo_list[0] - object = ph.getReference() - if self.load_obj != object.getPath(): - if object.getMimeType()[0:5] == "image": - self.load_photo(object.getPath()) + object = ph.get_reference() + if self.load_obj != object.get_path(): + if object.get_mime_type()[0:5] == "image": + self.load_photo(object.get_path()) else: self.load_photo(None) else: self.load_photo(None) def update_birth_info(self): - self.bdate.set_text(self.birth.getDate()) - self.bplace.set_text(self.birth.getPlaceName()) + self.bdate.set_text(self.birth.get_date()) + self.bplace.set_text(place_title(self.db,self.birth)) def update_death_info(self): - self.ddate.set_text(self.death.getDate()) - self.dplace.set_text(self.death.getPlaceName()) + self.ddate.set_text(self.death.get_date()) + self.dplace.set_text(place_title(self.db,self.death)) def on_switch_page(self,obj,a,page): if page == 0: @@ -1639,9 +1650,9 @@ class EditPerson: if self.lds_not_loaded == 0: self.check_lds() - if self.lds_baptism.isEmpty() \ - and self.lds_endowment.isEmpty() \ - and self.lds_sealing.isEmpty(): + if self.lds_baptism.is_empty() \ + and self.lds_endowment.is_empty() \ + and self.lds_sealing.is_empty(): Utils.unbold_label(self.lds_tab) else: Utils.bold_label(self.lds_tab) @@ -1663,14 +1674,14 @@ class EditPerson: name = '%s' % GrampsCfg.nameof(self.person) self.get_widget("activepersonTitle").set_text(name) self.get_widget("activepersonTitle").set_use_markup(gtk.TRUE) - self.suffix.set_text(self.pname.getSuffix()) - self.prefix.set_text(self.pname.getSurnamePrefix()) + self.suffix.set_text(self.pname.get_suffix()) + self.prefix.set_text(self.pname.get_surname_prefix()) - self.surname_field.set_text(self.pname.getSurname()) - self.given.set_text(self.pname.getFirstName()) + self.surname_field.set_text(self.pname.get_surname()) + self.given.set_text(self.pname.get_first_name()) - self.ntype_field.entry.set_text(_(self.pname.getType())) - self.title.set_text(self.pname.getTitle()) + self.ntype_field.entry.set_text(_(self.pname.get_type())) + self.title.set_text(self.pname.get_title()) #------------------------------------------------------------------------- # @@ -1685,7 +1696,7 @@ def birth_dates_in_order(list): prev_date = "00000000" for i in range(len(list)): child = list[i] - bday = child.getBirth().getDateObj() + bday = child.get_birth().get_date_object() child_date = sort.build_sort_date(bday) if (child_date == "99999999"): continue @@ -1710,13 +1721,13 @@ def reorder_child_list(person, list): return(list) # Build the person's date string once - person_bday = sort.build_sort_date(person.getBirth().getDateObj()) + person_bday = sort.build_sort_date(person.get_birth().get_date_object()) # First, see if the person needs to be moved forward in the list index = list.index(person) target = index for i in range(index-1, -1, -1): - other_bday = sort.build_sort_date(list[i].getBirth().getDateObj()) + other_bday = sort.build_sort_date(list[i].get_birth().get_date_object()) if (other_bday == "99999999"): continue; if (person_bday < other_bday): @@ -1725,7 +1736,7 @@ def reorder_child_list(person, list): # Now try moving to a later position in the list if (target == index): for i in range(index, len(list)): - other_bday = sort.build_sort_date(list[i].getBirth().getDateObj()) + other_bday = sort.build_sort_date(list[i].get_birth().get_date_object()) if (other_bday == "99999999"): continue; if (person_bday > other_bday): @@ -1743,3 +1754,10 @@ def short(val,size=60): return "%s..." % val[0:size] else: return val + +def place_title(db,event): + pid = event.get_place_id() + if pid: + return db.find_place_from_id(pid).get_title() + else: + return u'' diff --git a/src/EditPlace.py b/src/EditPlace.py index 804896110..13cd05dc6 100644 --- a/src/EditPlace.py +++ b/src/EditPlace.py @@ -69,13 +69,13 @@ class EditPlace: self.db = parent.db self.parent = parent self.callback = func - self.path = parent.db.getSavePath() + self.path = parent.db.get_save_path() self.not_loaded = 1 self.ref_not_loaded = 1 self.lists_changed = 0 self.gallery_ok = 0 if place: - self.srcreflist = place.getSourceRefList() + self.srcreflist = place.get_source_references() else: self.srcreflist = [] @@ -121,7 +121,7 @@ class EditPlace: self.loc_parish = self.top_window.get_widget("loc_parish") self.loc_country = self.top_window.get_widget("loc_country") - self.ulist = place.getUrlList()[:] + self.ulist = place.get_url_list()[:] self.llist = place.get_alternate_locations()[:] self.loc_model = gtk.ListStore(gobject.TYPE_STRING,gobject.TYPE_STRING, @@ -155,15 +155,15 @@ class EditPlace: self.preform = self.top_window.get_widget("place_preform") self.note_buffer = self.note.get_buffer() - if place.getNote(): - self.note_buffer.set_text(place.getNote()) + if place.get_note(): + self.note_buffer.set_text(place.get_note()) Utils.bold_label(self.notes_label) - if place.getNoteFormat() == 1: + if place.get_note_format() == 1: self.preform.set_active(1) else: self.flowed.set_active(1) - if self.place.getPhotoList(): + if self.place.get_photo_list(): Utils.bold_label(self.gallery_label) self.top_window.signal_autoconnect({ @@ -189,7 +189,7 @@ class EditPlace: self.top_window.get_widget('edit_src'), self.top_window.get_widget('del_src')) - if self.place.getId() == "": + if self.place.get_id() == "": self.top_window.get_widget("add_photo").set_sensitive(0) self.top_window.get_widget("delete_photo").set_sensitive(0) @@ -232,7 +232,7 @@ class EditPlace: exec 'data = %s' % sel_data.data exec 'mytype = "%s"' % data[0] exec 'place = "%s"' % data[1] - if place == self.place.getId() or mytype != 'url': + if place == self.place.get_id() or mytype != 'url': return foo = pickle.loads(data[2]); self.ulist.append(foo) @@ -244,11 +244,11 @@ class EditPlace: ev = self.web_model.get_selected_objects()[0] bits_per = 8; # we're going to pass a string pickled = pickle.dumps(ev); - data = str(('url',self.place.getId(),pickled)); + data = str(('url',self.place.get_id(),pickled)); sel_data.set(sel_data.target, bits_per, data) def update_lists(self): - self.place.setUrlList(self.ulist) + self.place.set_url_list(self.ulist) self.place.set_alternate_locations(self.llist) if self.lists_changed: Utils.modified() @@ -308,16 +308,16 @@ class EditPlace: self.set(self.latitude,self.place.get_latitude, self.place.set_latitude) - if self.lists_changed: - self.place.setSourceRefList(self.srcreflist) + if self.lists_changed: + self.place.set_source_reference_list(self.srcreflist) Utils.modified() - if note != self.place.getNote(): - self.place.setNote(note) + if note != self.place.get_note(): + self.place.set_note(note) Utils.modified() - if format != self.place.getNoteFormat(): - self.place.setNoteFormat(format) + if format != self.place.get_note_format(): + self.place.set_note_format(format) Utils.modified() self.gallery_ok = 1 @@ -426,14 +426,14 @@ class EditPlace: pevent = [] fevent = [] msg = "" - for key in self.db.getPersonKeys(): - p = self.db.getPerson(key) - for event in [p.getBirth(), p.getDeath()] + p.getEventList(): - if event.getPlace() == self.place: + for key in self.db.get_person_keys(): + p = self.db.get_person(key) + for event in [p.get_birth(), p.get_death()] + p.get_event_list(): + if event.get_place_id() == self.place: pevent.append((p,event)) - for f in self.db.getFamilyMap().values(): - for event in f.getEventList(): - if event.getPlace() == self.place: + for f in self.db.get_family_id_map().values(): + for event in f.get_event_list(): + if event.get_place_id() == self.place: fevent.append((f,event)) any = 0 @@ -444,7 +444,7 @@ class EditPlace: t = _("%s [%s]: event %s\n") for e in pevent: - msg = msg + ( t % (GrampsCfg.nameof(e[0]),e[0].getId(),_(e[1].getName()))) + msg = msg + ( t % (GrampsCfg.nameof(e[0]),e[0].get_id(),_(e[1].get_name()))) if len(fevent) > 0: any = 1 @@ -453,8 +453,8 @@ class EditPlace: t = _("%s [%s]: event %s\n") for e in fevent: - father = e[0].getFather() - mother = e[0].getMother() + father = e[0].get_father_id() + mother = e[0].get_mother_id() if father and mother: fname = _("%(father)s and %(mother)s") % { "father" : GrampsCfg.nameof(father), @@ -464,7 +464,7 @@ class EditPlace: else: fname = "%s" % GrampsCfg.nameof(mother) - msg = msg + ( t % (fname,e[0].getId(),_(e[1].getName()))) + msg = msg + ( t % (fname,e[0].get_id(),_(e[1].get_name()))) self.refinfo.get_buffer().set_text(msg) if any: @@ -501,17 +501,17 @@ class DeletePlaceQuery: self.update = update def query_response(self): - self.db.removePlace(self.place.getId()) + self.db.remove_place(self.place.get_id()) Utils.modified() - for key in self.db.getPersonKeys(): - p = self.db.getPerson(key) - for event in [p.getBirth(), p.getDeath()] + p.getEventList(): - if event.getPlace() == self.place: - event.setPlace(None) - for f in self.db.getFamilyMap().values(): - for event in f.getEventList(): - if event.getPlace() == self.place: - event.setPlace(None) + for key in self.db.get_person_keys(): + p = self.db.get_person(key) + for event in [p.get_birth(), p.get_death()] + p.get_event_list(): + if event.get_place_id() == self.place: + event.set_place_id(None) + for f in self.db.get_family_id_map().values(): + for event in f.get_event_list(): + if event.get_place_id() == self.place: + event.set_place_id(None) self.update(None) diff --git a/src/EditSource.py b/src/EditSource.py index b9d537078..caf3d4197 100644 --- a/src/EditSource.py +++ b/src/EditSource.py @@ -53,7 +53,7 @@ class EditSource: self.source = source self.db = db self.callback = func - self.path = db.getSavePath() + self.path = db.get_save_path() self.not_loaded = 1 self.ref_not_loaded = 1 self.lists_changed = 0 @@ -81,20 +81,20 @@ class EditSource: self.refinfo = self.top_window.get_widget("refinfo") self.title = self.top_window.get_widget("source_title") - self.title.set_text(source.getTitle()) - self.author.set_text(source.getAuthor()) - self.pubinfo.set_text(source.getPubInfo()) - self.abbrev.set_text(source.getAbbrev()) + self.title.set_text(source.get_title()) + self.author.set_text(source.get_author()) + self.pubinfo.set_text(source.get_publication_info()) + self.abbrev.set_text(source.get_abbreviation()) - if source.getNote(): - self.notes_buffer.set_text(source.getNote()) + if source.get_note(): + self.notes_buffer.set_text(source.get_note()) Utils.bold_label(self.notes_label) - if source.getNoteFormat() == 1: + if source.get_note_format() == 1: self.preform.set_active(1) else: self.flowed.set_active(1) - if self.source.getPhotoList(): + if self.source.get_photo_list(): Utils.bold_label(self.gallery_label) self.top_window.signal_autoconnect({ @@ -107,7 +107,7 @@ class EditSource: "on_sourceEditor_help_clicked" : self.on_help_clicked, }) - if self.source.getId() == "": + if self.source.get_id() == "": self.top_window.get_widget("edit_photo").set_sensitive(0) self.top_window.get_widget("delete_photo").set_sensitive(0) @@ -139,39 +139,39 @@ class EditSource: f_event_list = [] f_attr_list = [] p_list = [] - for key in self.db.getPlaceKeys(): - p = self.db.getPlace(key) + for key in self.db.get_place_id_keys(): + p = self.db.get_place_id(key) name = p.get_title() - for sref in p.getSourceRefList(): - if sref.getBase() == self.source: + for sref in p.get_source_references(): + if sref.get_base_id() == self.source.get_id(): p_list.append(name) - for key in self.db.getPersonKeys(): - p = self.db.getPerson(key) + for key in self.db.get_person_keys(): + p = self.db.get_person(key) name = GrampsCfg.nameof(p) - for v in p.getEventList() + [p.getBirth(), p.getDeath()]: - for sref in v.getSourceRefList(): - if sref.getBase() == self.source: - p_event_list.append((name,v.getName())) - for v in p.getAttributeList(): - for sref in v.getSourceRefList(): - if sref.getBase() == self.source: - p_attr_list.append((name,v.getType())) - for v in p.getAlternateNames() + [p.getPrimaryName()]: - for sref in v.getSourceRefList(): - if sref.getBase() == self.source: - p_name_list.append((name,v.getName())) - for v in p.getAddressList(): - for sref in v.getSourceRefList(): - if sref.getBase() == self.source: - p_addr_list.append((name,v.getStreet())) - for p in self.db.getObjectMap().values(): - name = p.getDescription() - for sref in p.getSourceRefList(): - if sref.getBase() == self.source: + for v in p.get_event_list() + [p.get_birth(), p.get_death()]: + for sref in v.get_source_references(): + if sref.get_base_id() == self.source.get_id(): + p_event_list.append((name,v.get_name())) + for v in p.get_attribute_list(): + for sref in v.get_source_references(): + if sref.get_base_id() == self.source.get_id(): + p_attr_list.append((name,v.get_type())) + for v in p.get_alternate_names() + [p.get_primary_name()]: + for sref in v.get_source_references(): + if sref.get_base_id() == self.source.get_id(): + p_name_list.append((name,v.get_name())) + for v in p.get_address_list(): + for sref in v.get_source_references(): + if sref.get_base_id() == self.source.get_id(): + p_addr_list.append((name,v.get_street())) + for p in self.db.get_object_map().values(): + name = p.get_description() + for sref in p.get_source_references(): + if sref.get_base_id() == self.source.get_id(): m_list.append(name) - for p in self.db.getFamilyMap().values(): - f = p.getFather() - m = p.getMother() + for p in self.db.get_family_id_map().values(): + f = p.get_father_id() + m = p.get_mother_id() if f and m: name = _("%(father)s and %(mother)s") % { "father" : GrampsCfg.nameof(f), @@ -180,14 +180,14 @@ class EditSource: name = GrampsCfg.nameof(f) else: name = GrampsCfg.nameof(m) - for v in p.getEventList(): - for sref in v.getSourceRefList(): - if sref.getBase() == self.source: - f_event_list.append((name,v.getName())) - for v in p.getAttributeList(): - for sref in v.getSourceRefList(): - if sref.getBase() == self.source: - f_attr_list.append((name,v.getType())) + for v in p.get_event_list(): + for sref in v.get_source_references(): + if sref.get_base_id() == self.source.get_id(): + f_event_list.append((name,v.get_name())) + for v in p.get_attribute_list(): + for sref in v.get_source_references(): + if sref.get_base_id() == self.source.get_id(): + f_attr_list.append((name,v.get_type())) slist = self.top_window.get_widget('slist') @@ -245,28 +245,28 @@ class EditSource: self.notes_buffer.get_end_iter(),gtk.FALSE)) format = self.preform.get_active() - if author != self.source.getAuthor(): - self.source.setAuthor(author) + if author != self.source.get_author(): + self.source.set_author(author) Utils.modified() - if title != self.source.getTitle(): - self.source.setTitle(title) + if title != self.source.get_title(): + self.source.set_title(title) Utils.modified() - if pubinfo != self.source.getPubInfo(): - self.source.setPubInfo(pubinfo) + if pubinfo != self.source.get_publication_info(): + self.source.set_publication_info(pubinfo) Utils.modified() - if abbrev != self.source.getAbbrev(): - self.source.setAbbrev(abbrev) + if abbrev != self.source.get_abbreviation(): + self.source.set_abbreviation(abbrev) Utils.modified() - if note != self.source.getNote(): - self.source.setNote(note) + if note != self.source.get_note(): + self.source.set_note(note) Utils.modified() - if format != self.source.getNoteFormat(): - self.source.setNoteFormat(format) + if format != self.source.get_note_format(): + self.source.set_note_format(format) Utils.modified() if self.lists_changed: @@ -302,43 +302,43 @@ class DelSrcQuery: def delete_source(self,object): m = 0 l = [] - for sref in object.getSourceRefList(): - if sref.getBase() != self.source: + for sref in object.get_source_references(): + if sref.get_base_id() != self.source.get_id(): l.append(sref) else: m = 1 if m: - object.setSourceRefList(l) + object.set_source_reference_list(l) def query_response(self): - self.db.removeSource(self.source.getId()) + self.db.remove_source_id(self.source.get_id()) Utils.modified() - for key in self.db.getPersonKeys(): - p = self.db.getPerson(key) - for v in p.getEventList() + [p.getBirth(), p.getDeath()]: + for key in self.db.get_person_keys(): + p = self.db.get_person(key) + for v in p.get_event_list() + [p.get_birth(), p.get_death()]: self.delete_source(v) - for v in p.getAttributeList(): + for v in p.get_attribute_list(): self.delete_source(v) - for v in p.getAlternateNames() + [p.getPrimaryName()]: + for v in p.get_alternate_names() + [p.get_primary_name()]: self.delete_source(v) - for v in p.getAddressList(): + for v in p.get_address_list(): self.delete_source(v) - for p in self.db.getFamilyMap().values(): - for v in p.getEventList(): + for p in self.db.get_family_id_map().values(): + for v in p.get_event_list(): self.delete_source(v) - for v in p.getAttributeList(): + for v in p.get_attribute_list(): self.delete_source(v) - for p in self.db.getObjectMap().values(): + for p in self.db.get_object_map().values(): self.delete_source(p) - for key in self.db.getPlaceKeys(): - self.delete_source(self.db.getPlace(key)) + for key in self.db.get_place_id_keys(): + self.delete_source(self.db.get_place_id(key)) self.update(0) diff --git a/src/EventEdit.py b/src/EventEdit.py index 30c558bc0..cee953ff9 100644 --- a/src/EventEdit.py +++ b/src/EventEdit.py @@ -68,17 +68,17 @@ class EventEditor: self.pmap = {} self.elist = list - for key in self.parent.db.getPlaceKeys(): - p = self.parent.db.getPlaceDisplay(key) + for key in self.parent.db.get_place_id_keys(): + p = self.parent.db.get_place_display(key) self.pmap[p[0]] = key if event: - self.srcreflist = self.event.getSourceRefList() + self.srcreflist = self.event.get_source_references() self.witnesslist = self.event.get_witness_list() if not self.witnesslist: self.witnesslist = [] - self.date = Date.Date(self.event.getDateObj()) - transname = const.display_event(event.getName()) + self.date = Date.Date(self.event.get_date_object()) + transname = const.display_event(event.get_name()) # add the name to the list if it is not already there. This tends to occur # in translated languages with the 'Death' event, which is a partial match # to other events @@ -150,18 +150,18 @@ class EventEditor: if (def_placename): self.place_field.set_text(def_placename) else: - self.place_field.set_text(event.getPlaceName()) + self.place_field.set_text(event.get_place_name()) - self.date_field.set_text(self.date.getDate()) - self.cause_field.set_text(event.getCause()) - self.descr_field.set_text(event.getDescription()) - self.priv.set_active(event.getPrivacy()) + self.date_field.set_text(self.date.get_date()) + self.cause_field.set_text(event.get_cause()) + self.descr_field.set_text(event.get_description()) + self.priv.set_active(event.get_privacy()) - self.note_field.get_buffer().set_text(event.getNote()) - if event.getNote(): - self.note_field.get_buffer().set_text(event.getNote()) + self.note_field.get_buffer().set_text(event.get_note()) + if event.get_note(): + self.note_field.get_buffer().set_text(event.get_note()) Utils.bold_label(self.notes_label) - if event.getNoteFormat() == 1: + if event.get_note_format() == 1: self.preform.set_active(1) else: self.flowed.set_active(1) @@ -214,19 +214,19 @@ class EventEditor: cobj = obj.get_data("d") self.date.set(unicode(self.date_field.get_text())) self.date.set_calendar(cobj) - self.date_field.set_text(self.date.getDate()) + self.date_field.set_text(self.date.get_date()) self.date_check.set_calendar(cobj()) def get_place(self,field,makenew=0): text = strip(unicode(field.get_text())) if text: if self.pmap.has_key(text): - return self.parent.db.getPlaceMap()[self.pmap[text]] + return self.parent.db.get_place_id_map()[self.pmap[text]] elif makenew: place = RelLib.Place() place.set_title(text) - self.parent.db.addPlace(place) - self.pmap[text] = place.getId() + self.parent.db.add_place(place) + self.pmap[text] = place.get_id() self.plist.append(place) Utils.modified() return place @@ -257,7 +257,7 @@ class EventEditor: if self.event == None: self.event = RelLib.Event() - self.event.setSourceRefList(self.srcreflist) + self.event.set_source_reference_list(self.srcreflist) self.event.set_witness_list(self.witnesslist) self.parent.elist.append(self.event) @@ -266,41 +266,41 @@ class EventEditor: self.callback(self.event) def update_event(self,name,date,place,desc,note,format,priv,cause): - if self.event.getPlace() != place: - self.event.setPlace(place) + if self.event.get_place_id() != place: + self.event.set_place_id(place) self.parent.lists_changed = 1 - if self.event.getName() != self.trans(name): - self.event.setName(self.trans(name)) + if self.event.get_name() != self.trans(name): + self.event.set_name(self.trans(name)) self.parent.lists_changed = 1 - if self.event.getDescription() != desc: - self.event.setDescription(desc) + if self.event.get_description() != desc: + self.event.set_description(desc) self.parent.lists_changed = 1 - if self.event.getNote() != note: - self.event.setNote(note) + if self.event.get_note() != note: + self.event.set_note(note) self.parent.lists_changed = 1 - if self.event.getNoteFormat() != format: - self.event.setNoteFormat(format) + if self.event.get_note_format() != format: + self.event.set_note_format(format) self.parent.lists_changed = 1 - dobj = self.event.getDateObj() + dobj = self.event.get_date_object() - self.event.setSourceRefList(self.srcreflist) + self.event.set_source_reference_list(self.srcreflist) self.event.set_witness_list(self.witnesslist) if Date.compare_dates(dobj,date) != 0: - self.event.setDateObj(date) + self.event.set_date_object(date) self.parent.lists_changed = 1 - if self.event.getCause() != cause: - self.event.setCause(cause) + if self.event.get_cause() != cause: + self.event.set_cause(cause) self.parent.lists_changed = 1 - if self.event.getPrivacy() != priv: - self.event.setPrivacy(priv) + if self.event.get_privacy() != priv: + self.event.set_privacy(priv) self.parent.lists_changed = 1 def on_switch_page(self,obj,a,page): diff --git a/src/FamilyView.py b/src/FamilyView.py index 286edacfa..ea3f6dfb2 100644 --- a/src/FamilyView.py +++ b/src/FamilyView.py @@ -465,18 +465,18 @@ class FamilyView: model, iter = self.child_selection.get_selected() if not iter: return - child = self.parent.db.getPerson(self.child_model.get_value(iter,2)) + child = self.parent.db.get_person(self.child_model.get_value(iter,2)) try: EditPerson.EditPerson(child, self.parent.db, self.spouse_after_edit) except: DisplayTrace.DisplayTrace() def child_rel(self,obj): - person = self.parent.db.getPerson(obj.get_data(Utils.OBJECT)) + person = self.parent.db.get_person(obj.get_data(Utils.OBJECT)) SelectChild.EditRel(person,self.family,self.load_family) def child_rel_by_id(self,id): - person = self.parent.db.getPerson(id) + person = self.parent.db.get_person(id) SelectChild.EditRel(person,self.family,self.load_family) def spouse_changed(self,obj): @@ -485,7 +485,9 @@ class FamilyView: self.display_marriage(None) else: row = model.get_path(iter) - self.display_marriage(self.person.getFamilyList()[row[0]]) + id = self.person.get_family_id_list()[row[0]] + fam = self.parent.db.find_family_from_id(id) + self.display_marriage(fam) def build_spouse_menu(self,event): @@ -528,7 +530,7 @@ class FamilyView: def set_preferred_spouse(self,obj): if self.selected_spouse: - self.person.setPreferred(self.family) + self.person.set_preferred_family_id(self.family) self.load_family() def edit_spouse_callback(self,obj): @@ -581,10 +583,10 @@ class FamilyView: def add_spouse(self,obj): person = RelLib.Person() - if self.person.getGender() == RelLib.Person.male: - person.setGender(RelLib.Person.female) + if self.person.get_gender() == RelLib.Person.male: + person.set_gender(RelLib.Person.female) else: - person.setGender(RelLib.Person.male) + person.set_gender(RelLib.Person.male) try: EditPerson.EditPerson(person, self.parent.db, self.new_spouse_after_edit) except: @@ -593,7 +595,7 @@ class FamilyView: def spouse_after_edit(self,epo): ap = self.parent.active_person if epo: - self.parent.db.buildPersonDisplay(epo.person.getId(),epo.original_id) + self.parent.db.build_person_display(epo.person.get_id(),epo.original_id) self.parent.people_view.remove_from_person_list(epo.person,epo.original_id) self.parent.people_view.redisplay_person_list(epo.person) @@ -601,23 +603,23 @@ class FamilyView: self.load_family(self.family) def new_spouse_after_edit(self,epo): - if epo.person.getId() == "": - self.parent.db.addPerson(epo.person) + if epo.person.get_id() == "": + self.parent.db.add_person(epo.person) else: - self.parent.db.addPersonNoMap(epo.person,epo.person.getId()) - self.parent.db.buildPersonDisplay(epo.person.getId()) + self.parent.db.add_person_no_map(epo.person,epo.person.get_id()) + self.parent.db.build_person_display(epo.person.get_id()) self.parent.people_view.add_to_person_list(epo.person,0) - self.family = self.parent.db.newFamily() - self.person.addFamily(self.family) - epo.person.addFamily(self.family) + self.family = self.parent.db.new_family() + self.person.add_family_id(self.family.get_id()) + epo.person.add_family_id(self.family.get_id()) - if self.person.getGender() == RelLib.Person.male: - self.family.setMother(epo.person) - self.family.setFather(self.person) + if self.person.get_gender() == RelLib.Person.male: + self.family.set_mother_id(epo.person) + self.family.set_father_id(self.person) else: - self.family.setFather(epo.person) - self.family.setMother(self.person) + self.family.set_father_id(epo.person) + self.family.set_mother_id(self.person) self.load_family(self.family) @@ -640,8 +642,8 @@ class FamilyView: name = self.icelandic(0) else: name = self.no_name(0) - person.getPrimaryName().setSurname(name[1]) - person.getPrimaryName().setSurnamePrefix(name[0]) + person.get_primary_name().set_surname(name[1]) + person.get_primary_name().set_surname_prefix(name[0]) try: EditPerson.EditPerson(person, self.parent.db, self.new_child_after_edit) @@ -650,38 +652,38 @@ class FamilyView: def update_person_list(self,person): if not self.family: - self.family = self.parent.db.newFamily() - person.addFamily(self.family) - if person.getGender() == RelLib.Person.male: - self.family.setFather(person) + self.family = self.parent.db.new_family() + person.add_family_id(self.family.get_id()) + if person.get_gender() == RelLib.Person.male: + self.family.set_father_id(person) else: - self.family.setMother(person) + self.family.set_mother_id(person) - self.family.addChild(person) - person.addAltFamily(self.family,"Birth","Birth") + self.family.add_child_id(person) + person.add_parent_family_id(self.family.get_id(),"Birth","Birth") self.parent.update_person_list(person) self.load_family(self.family) def new_child_after_edit(self,epo): - if epo.person.getId() == "": - self.parent.db.addPerson(epo.person) + if epo.person.get_id() == "": + self.parent.db.add_person(epo.person) else: - self.parent.db.addPersonNoMap(epo.person,epo.person.getId()) + self.parent.db.add_person_no_map(epo.person,epo.person.get_id()) - self.parent.db.buildPersonDisplay(epo.person.getId()) + self.parent.db.build_person_display(epo.person.get_id()) self.parent.people_view.add_to_person_list(epo.person,0) if not self.family: - self.family = self.parent.db.newFamily() - self.person.addFamily(self.family) - if self.person.getGender() == RelLib.Person.male: - self.family.setFather(self.person) + self.family = self.parent.db.new_family() + self.person.add_family_id(self.family.get_id()) + if self.person.get_gender() == RelLib.Person.male: + self.family.set_father_id(self.person) else: - self.family.setMother(self.person) + self.family.set_mother_id(self.person) - self.family.addChild(epo.person) - epo.person.addAltFamily(self.family,"Birth","Birth") + self.family.add_child_id(epo.person) + epo.person.add_parent_family_id(self.family.get_id(),"Birth","Birth") self.display_marriage(self.family) def select_child_clicked(self,obj): @@ -703,16 +705,16 @@ class FamilyView: return id = self.child_model.get_value(iter,2) - child = self.parent.db.getPerson(id) + child = self.parent.db.get_person(id) - self.family.removeChild(child) - child.removeAltFamily(self.family) + self.family.remove_child_id(child) + child.remove_parent_family_id(self.family) - if len(self.family.getChildList()) == 0: - if self.family.getFather() == None: - self.delete_family_from(self.family.getMother()) - elif self.family.getMother() == None: - self.delete_family_from(self.family.getFather()) + if len(self.family.get_child_id_list()) == 0: + if self.family.get_father_id() == None: + self.delete_family_from(self.family.get_mother_id()) + elif self.family.get_mother_id() == None: + self.delete_family_from(self.family.get_father_id()) Utils.modified() self.load_family() @@ -727,32 +729,32 @@ class FamilyView: 'remove the spouse from the database'), _('_Remove Spouse'), self.really_remove_spouse) - elif self.family and not self.family.getChildList(): + elif self.family and not self.family.get_child_id_list(): self.really_remove_spouse() def really_remove_spouse(self): """Delete the currently selected spouse from the family""" if self.person == None: return - if self.selected_spouse == self.family.getFather(): - self.family.setFather(None) + if self.selected_spouse == self.family.get_father_id(): + self.family.set_father_id(None) else: - self.family.setMother(None) + self.family.set_mother_id(None) if self.selected_spouse: - self.selected_spouse.removeFamily(self.family) + self.selected_spouse.remove_family_id(self.family.get_id()) - if len(self.family.getChildList()) == 0: - self.person.removeFamily(self.family) - self.parent.db.deleteFamily(self.family) - if len(self.person.getFamilyList()) > 0: - self.load_family(self.person.getFamilyList()[0]) + if len(self.family.get_child_id_list()) == 0: + self.person.remove_family_id(self.family.get_id()) + self.parent.db.delete_family(self.family.get_id()) + if len(self.person.get_family_id_list()) > 0: + self.load_family(self.person.get_family_id_list()[0]) else: self.load_family() else: self.load_family() - if len(self.person.getFamilyList()) <= 1: + if len(self.person.get_family_id_list()) <= 1: self.spouse_selection.set_mode(gtk.SELECTION_NONE) Utils.modified() @@ -771,21 +773,23 @@ class FamilyView: def change_families(self,person): if not person: return - plist = person.getParentList() + plist = person.get_parent_family_id_list() if len(plist) == 0: return if len(plist) == 1: - family,m,r = plist[0] + family_id,m,r = plist[0] else: model, iter = self.ap_selection.get_selected() path = model.get_path(iter) - family,m,r = plist[path[0]] + family_id,m,r = plist[path[0]] + family = self.parent.db.find_family_from_id(family_id) - if family.getFather(): - person = family.getFather() + if family.get_father_id(): + person_id = family.get_father_id() else: - person = family.getMother() + person_id = family.get_mother_id() + person = self.parent.db.find_person_from_id(person_id) self.parent.change_active_person(person) self.load_family(family) @@ -797,13 +801,14 @@ class FamilyView: self.ap_model.clear() def load_family(self,family=None): + self.person = self.parent.active_person if not self.person: self.clear() return - bd = self.person.getBirth().getDate() - dd = self.person.getDeath().getDate() + bd = self.person.get_birth().get_date() + dd = self.person.get_death().get_date() if bd and dd: n = "%s\n\t%s %s\n\t%s %s " % (GrampsCfg.nameof(self.person), @@ -824,7 +829,7 @@ class FamilyView: self.spouse_model.clear() self.child_model.clear() self.sp_parents_model.clear() - splist = self.person.getFamilyList() + splist = self.person.get_family_id_list() if len(splist) > 1: self.spouse_selection.set_mode(gtk.SELECTION_SINGLE) @@ -836,35 +841,39 @@ class FamilyView: for f in splist: if not f: continue - if f.getFather() == self.person: - sp = f.getMother() + fm = self.parent.db.find_family_no_map(f) + + if fm.get_father_id() == self.person.get_id(): + sp_id = fm.get_mother_id() else: - sp = f.getFather() + sp_id = fm.get_father_id() + sp = self.parent.db.find_person_from_id(sp_id) iter = self.spouse_model.append() - flist[f.getId()] = iter + flist[f] = iter if sp: - if f.getMarriage(): - mdate = " - %s" % f.getMarriage().getDate() + if fm.get_marriage(): + mdate = " - %s" % fm.get_marriage().get_date() else: mdate = "" v = "%s\n\t%s%s" % (GrampsCfg.nameof(sp), - const.display_frel(f.getRelationship()), + const.display_frel(fm.get_relationship()), mdate) self.spouse_model.set(iter,0,v) else: self.spouse_model.set(iter,0,"%s\n" % _("")) - if family in splist: + if family and family.get_id() in flist: self.display_marriage(family) - iter = flist[family.getId()] + iter = flist[family.get_id()] self.spouse_selection.select_iter(iter) elif len(flist) > 0: - f = splist[0] - iter = flist[f.getId()] + fid = splist[0] + fam = self.parent.db.find_family_from_id(fid) + self.display_marriage(fam) + iter = flist[fid] self.spouse_selection.select_iter(iter) - self.display_marriage(f) else: self.display_marriage(None) @@ -874,12 +883,16 @@ class FamilyView: model.clear() sel = None selection = tree.get_selection() - list = person.getParentList() + list = person.get_parent_family_id_list() for (f,mrel,frel) in list: - - father = self.nameof(_("Father"),f.getFather(),frel) - mother = self.nameof(_("Mother"),f.getMother(),mrel) + fam = self.parent.db.get_family_id(f) + father_id = fam.get_father_id() + mother_id = fam.get_mother_id() + f = self.parent.db.find_person_from_id(father_id) + m = self.parent.db.find_person_from_id(mother_id) + father = self.nameof(_("Father"),f,frel) + mother = self.nameof(_("Mother"),m,mrel) iter = model.append() if not sel: @@ -900,25 +913,25 @@ class FamilyView: return _("%s: unknown") % (l) def delete_family_from(self,person): - person.removeFamily(self.family) - self.parent.db.deleteFamily(self.family) - flist = self.person.getFamilyList() + person.remove_family_id(self.family.get_id()) + self.parent.db.delete_family(self.family.get_id()) + flist = self.person.get_family_id_list() if len(flist) > 0: self.family = flist[0] else: self.family = None def display_marriage(self,family): - self.child_model.clear() + self.family = family if not family: return - if family.getFather() == self.person: - self.selected_spouse = family.getMother() + if family.get_father_id() == self.person: + self.selected_spouse = self.parent.db.find_person_from_id(family.get_mother_id()) else: - self.selected_spouse = family.getFather() + self.selected_spouse = self.parent.db.find_person_from_id(family.get_father_id()) if self.selected_spouse: self.update_list(self.sp_parents_model,self.sp_parents, @@ -926,34 +939,30 @@ class FamilyView: i = 0 fiter = None - child_list = list(family.getChildList()) + child_list = list(family.get_child_id_list()) self.child_map = {} - for child in child_list: + for child_id in child_list: status = _("Unknown") - for fam in child.getParentList(): + + child = self.parent.db.find_person_from_id(child_id) + for fam in child.get_parent_family_id_list(): if fam[0] == family: - if self.person == family.getFather(): + if self.person == family.get_father_id(): status = "%s/%s" % (_(fam[2]),_(fam[1])) else: status = "%s/%s" % (_(fam[1]),_(fam[2])) iter = self.child_model.append() - self.child_map[iter] = child.getId() + self.child_map[iter] = child.get_id() if fiter == None: fiter = self.child_model.get_path(iter) - val = self.parent.db.getPersonDisplay(child.getId()) + val = self.parent.db.get_person_display(child.get_id()) i += 1 - self.child_model.set(iter, - 0,i, - 1,val[0], - 2,val[1], - 3,val[2], - 4,val[3], - 5,status, - 6,val[6]) + self.child_model.set(iter,0,i,1,val[0],2,val[1],3,val[2], + 4,val[3],5,status,6,val[6]) def build_parents_menu(self,family,event): """Builds the menu that allows editing operations on the child list""" @@ -1043,7 +1052,7 @@ class FamilyView: if event.type == gtk.gdk._2BUTTON_PRESS and event.button == 1: self.parent_editor(self.person,self.ap_selection) elif event.type == gtk.gdk.BUTTON_PRESS and event.button == 3: - plist = self.person.getParentList() + plist = self.person.get_parent_family_id_list() if len(plist) == 0: self.build_parents_nosel_menu(event) @@ -1064,7 +1073,7 @@ class FamilyView: if event.type == gtk.gdk._2BUTTON_PRESS and event.button == 1: self.parent_editor(self.selected_spouse,self.sp_selection) elif event.type == gtk.gdk.BUTTON_PRESS and event.button == 3: - plist = self.selected_spouse.getParentList() + plist = self.selected_spouse.get_parent_family_id_list() if len(plist) == 0: self.build_sp_parents_nosel_menu(event) return @@ -1084,7 +1093,7 @@ class FamilyView: self.parent_add(self.selected_spouse) def del_parents_clicked(self,obj): - if len(self.person.getParentList()) == 0: + if len(self.person.get_parent_family_id_list()) == 0: return n = GrampsCfg.nameof(self.person) QuestionDialog(_('Remove Parents of %s') % n, @@ -1099,7 +1108,7 @@ class FamilyView: self.parent_deleter(self.person,self.ap_selection) def del_sp_parents(self,obj): - if not self.selected_spouse or len(self.selected_spouse.getParentList()) == 0: + if not self.selected_spouse or len(self.selected_spouse.get_parent_family_id_list()) == 0: return n = GrampsCfg.nameof(self.selected_spouse) QuestionDialog(_('Remove Parents of %s') % n, @@ -1118,10 +1127,10 @@ class FamilyView: model, iter = self.child_selection.get_selected() if iter: id = self.child_model.get_value(iter,2) - self.parent.change_active_person(self.parent.db.getPerson(id)) + self.parent.change_active_person(self.parent.db.get_person(id)) self.load_family() else: - list = self.family.getChildList() + list = self.family.get_child_id_list() if len(list) == 1: self.parent.change_active_person(list[0]) self.load_family() @@ -1130,7 +1139,7 @@ class FamilyView: if not person: return - plist = person.getParentList() + plist = person.get_parent_family_id_list() if len(plist) == 0: return @@ -1165,26 +1174,26 @@ class FamilyView: def parent_deleter(self,person,selection): if not person: return - plist = person.getParentList() + plist = person.get_parent_family_id_list() if len(plist) == 0: return if len(plist) == 1: - person.clearAltFamilyList() + person.clear_parent_family_id_list() else: model, iter = selection.get_selected() if not iter: return row = model.get_path(iter) - fam = person.getParentList()[row[0]] - person.removeAltFamily(fam[0]) + fam = person.get_parent_family_id_list()[row[0]] + person.remove_parent_family_id(fam[0]) Utils.modified() self.load_family() def drag_data_received(self,widget,context,x,y,sel_data,info,time): path = self.child_list.get_path_at_pos(x,y) if path == None: - row = len(self.family.getChildList()) + row = len(self.family.get_child_id_list()) else: row = path[0][0] -1 @@ -1202,7 +1211,7 @@ class FamilyView: spath = s.get_path(i) src = spath[0] - list = self.family.getChildList() + list = self.family.get_child_id_list() obj = list[src] list.remove(obj) @@ -1212,7 +1221,7 @@ class FamilyView: WarningDialog(_("Attempt to Reorder Children Failed"), _("Children must be ordered by their birth dates.")) return - self.family.setChildList(list) + self.family.set_child_id_list(list) self.display_marriage(self.family) Utils.modified() @@ -1226,14 +1235,14 @@ class FamilyView: sel_data.set(sel_data.target, bits_per, data) def north_american(self,val): - if self.person.getGender() == RelLib.Person.male: - pname = self.person.getPrimaryName() - return (pname.getSurnamePrefix(),pname.getSurname()) + if self.person.get_gender() == RelLib.Person.male: + pname = self.person.get_primary_name() + return (pname.get_surname_prefix(),pname.get_surname()) elif self.family: - f = self.family.getFather() + f = self.family.get_father_id() if f: - pname = f.getPrimaryName() - return (pname.getSurnamePrefix(),pname.getSurname()) + pname = f.get_primary_name() + return (pname.get_surname_prefix(),pname.get_surname()) return ("","") def no_name(self,val): @@ -1241,12 +1250,12 @@ class FamilyView: def latin_american(self,val): if self.family: - father = self.family.getFather() - mother = self.family.getMother() + father = self.family.get_father_id() + mother = self.family.get_mother_id() if not father or not mother: return ("","") - fsn = father.getPrimaryName().getSurname() - msn = mother.getPrimaryName().getSurname() + fsn = father.get_primary_name().get_surname() + msn = mother.get_primary_name().get_surname() if not father or not mother: return ("","") try: @@ -1258,12 +1267,12 @@ class FamilyView: def icelandic(self,val): fname = "" - if self.person.getGender() == RelLib.Person.male: - fname = self.person.getPrimaryName().getFirstName() + if self.person.get_gender() == RelLib.Person.male: + fname = self.person.get_primary_name().get_first_name() elif self.family: - f = self.family.getFather() + f = self.family.get_father_id() if f: - fname = f.getPrimaryName().getFirstName() + fname = f.get_primary_name().get_first_name() if fname: fname = fname.split()[0] if val == 0: @@ -1304,7 +1313,7 @@ def birth_dates_in_order(list): prev_date = "00000000" for i in range(len(list)): child = list[i] - bday = child.getBirth().getDateObj() + bday = child.get_birth().get_date_object() child_date = sort.build_sort_date(bday) if (child_date == "99999999"): continue diff --git a/src/Find.py b/src/Find.py index cb7443832..f176e523b 100644 --- a/src/Find.py +++ b/src/Find.py @@ -155,11 +155,11 @@ class FindPerson(FindBase): FindBase.__init__(self,task,_("Find Person"),db,valid_map) self.list = [] - for val in db.sortPersonKeys(): - self.list.append(db.getPersonDisplay(val)) + for val in db.sort_person_keys(): + self.list.append(db.get_person_display(val)) def get_value(self,id): - return self.db.getPerson(id) + return self.db.get_person(id) #------------------------------------------------------------------------- # @@ -213,7 +213,7 @@ class FindMedia(FindBase): FindBase.__init__(self,task,_("Find Media Object"),db) self.list = [] - for n in self.db.getObjectMap().values(): - self.list.append((n.getDescription(),n.getId())) + for n in self.db.get_object_map().values(): + self.list.append((n.get_description(),n.get_id())) self.list.sort() diff --git a/src/GenericFilter.py b/src/GenericFilter.py index 51aef4c77..2cb413a45 100644 --- a/src/GenericFilter.py +++ b/src/GenericFilter.py @@ -166,30 +166,30 @@ class RelationshipPathBetween(Rule): def desc_list(self, p, map, first): if not first: - map[p.getId()] = 1 + map[p.get_id()] = 1 - for fam in p.getFamilyList(): - for child in fam.getChildList(): + for fam in p.get_family_id_list(): + for child in fam.get_child_id_list(): self.desc_list(child,map,0) def apply_filter(self,rank,person,plist,pmap): if person == None: return plist.append(person) - pmap[person.getId()] = rank + pmap[person.get_id()] = rank - family = person.getMainParents() + family = person.get_main_parents_family_id() if family != None: - self.apply_filter(rank+1,family.getFather(),plist,pmap) - self.apply_filter(rank+1,family.getMother(),plist,pmap) + self.apply_filter(rank+1,family.get_father_id(),plist,pmap) + self.apply_filter(rank+1,family.get_mother_id(),plist,pmap) def apply(self,db,p): if not self.init: self.init = 1 - root1 = db.getPerson(self.list[0]) - root2 = db.getPerson(self.list[1]) + root1 = db.get_person(self.list[0]) + root2 = db.get_person(self.list[1]) self.init_list(root1,root2) - return self.map.has_key(p.getId()) + return self.map.has_key(p.get_id()) def init_list(self,p1,p2): @@ -205,15 +205,15 @@ class RelationshipPathBetween(Rule): for person in firstList: if person in secondList: - new_rank = firstMap[person.getId()] + new_rank = firstMap[person.get_id()] if new_rank < rank: rank = new_rank common = [ person ] elif new_rank == rank: common.append(person) - path1 = { p1.getId() : 1} - path2 = { p2.getId() : 1} + path1 = { p1.get_id() : 1} + path2 = { p2.get_id() : 1} for person in common: new_map = {} @@ -226,7 +226,7 @@ class RelationshipPathBetween(Rule): for e in path2: self.map[e] = 1 for e in common: - self.map[e.getId()] = 1 + self.map[e.get_id()] = 1 def get_intersection(self,target, map1, map2): for e in map1.keys(): @@ -253,7 +253,7 @@ class HasIdOf(Rule): return _('General filters') def apply(self,db,p): - return p.getId() == self.list[0] + return p.get_id() == self.list[0] #------------------------------------------------------------------------- # @@ -275,7 +275,7 @@ class HasCompleteRecord(Rule): return _('Matches all people whose records are complete') def apply(self,db,p): - return p.getComplete() == 1 + return p.get_complete() == 1 #------------------------------------------------------------------------- @@ -298,7 +298,7 @@ class IsFemale(Rule): return _('Matches all females') def apply(self,db,p): - return p.getGender() == RelLib.Person.female + return p.get_gender() == RelLib.Person.female #------------------------------------------------------------------------- # @@ -337,16 +337,16 @@ class IsDescendantOf(Rule): if not self.init: self.init = 1 - root = db.getPerson(self.list[0]) + root = db.get_person(self.list[0]) self.init_list(root,first) - return self.map.has_key(p.getId()) + return self.map.has_key(p.get_id()) def init_list(self,p,first): if not first: - self.map[p.getId()] = 1 + self.map[p.get_id()] = 1 - for fam in p.getFamilyList(): - for child in fam.getChildList(): + for fam in p.get_family_id_list(): + for child in fam.get_child_id_list(): self.init_list(child,0) #------------------------------------------------------------------------- @@ -385,10 +385,10 @@ class IsDescendantOfFilterMatch(IsDescendantOf): if not self.init: self.init = 1 filter = MatchesFilter(self.list) - for person in db.getPersonMap ().values (): + for person in db.get_person_id_map ().values (): if filter.apply (db, person): self.init_list (person, first) - return self.map.has_key(p.getId()) + return self.map.has_key(p.get_id()) #------------------------------------------------------------------------- # @@ -421,18 +421,18 @@ class IsLessThanNthGenerationDescendantOf(Rule): if not self.init: self.init = 1 - root = db.getPerson(self.list[0]) + root = db.get_person(self.list[0]) self.init_list(root,0) - return self.map.has_key(p.getId()) + return self.map.has_key(p.get_id()) def init_list(self,p,gen): if gen: - self.map[p.getId()] = 1 + self.map[p.get_id()] = 1 if gen >= int(self.list[1]): return - for fam in p.getFamilyList(): - for child in fam.getChildList(): + for fam in p.get_family_id_list(): + for child in fam.get_child_id_list(): self.init_list(child,gen+1) #------------------------------------------------------------------------- @@ -466,16 +466,16 @@ class IsMoreThanNthGenerationDescendantOf(Rule): if not self.init: self.init = 1 - root = db.getPerson(self.list[0]) + root = db.get_person(self.list[0]) self.init_list(root,0) - return self.map.has_key(p.getId()) + return self.map.has_key(p.get_id()) def init_list(self,p,gen): if gen >= int(self.list[1]): - self.map[p.getId()] = 1 + self.map[p.get_id()] = 1 - for fam in p.getFamilyList(): - for child in fam.getChildList(): + for fam in p.get_family_id_list(): + for child in fam.get_child_id_list(): self.init_list(child,gen+1) #------------------------------------------------------------------------- @@ -509,15 +509,15 @@ class IsChildOfFilterMatch(Rule): if not self.init: self.init = 1 filter = MatchesFilter(self.list) - for person in db.getPersonMap ().values (): + for person in db.get_person_id_map ().values (): if filter.apply (db, person): self.init_list (person) - return self.map.has_key(p.getId()) + return self.map.has_key(p.get_id()) def init_list(self,p): - for fam in p.getFamilyList(): - for child in fam.getChildList(): - self.map[child.getId()] = 1 + for fam in p.get_family_id_list(): + for child in fam.get_child_id_list(): + self.map[child.get_id()] = 1 #------------------------------------------------------------------------- # @@ -543,25 +543,30 @@ class IsDescendantFamilyOf(Rule): def apply(self,db,p): self.map = {} self.orig = p + self.db = db return self.search(p,1) def search(self,p,val): - if p.getId() == self.list[0]: - self.map[p.getId()] = 1 + if p.get_id() == self.list[0]: + self.map[p.get_id()] = 1 return 1 - for (f,r1,r2) in p.getParentList(): - for p1 in [f.getMother(),f.getFather()]: - if p1: - if self.search(p1,0): + for (f,r1,r2) in p.get_parent_family_id_list(): + family = self.db.find_family_from_id(f) + for person_id in [family.get_mother_id(),family.get_father_id()]: + if person_id: + person = self.db.find_person_from_id(person_id) + if self.search(person,0): return 1 if val: - for fm in p.getFamilyList(): - if p == fm.getFather(): - s = fm.getMother() + for family_id in p.get_family_id_list(): + family = self.db.find_family_from_id(family_id) + if p == family.get_father_id(): + spouse_id = family.get_mother_id() else: - s = fm.getFather() - if s: - if self.search(s,0): + spouse_id = family.get_father_id() + if spouse_id: + spouse = self.db.find_person_from_id(spouse_id) + if self.search(spouse,0): return 1 return 0 @@ -602,18 +607,18 @@ class IsAncestorOf(Rule): if not self.init: self.init = 1 - root = db.getPerson(self.list[0]) + root = db.get_person(self.list[0]) self.init_ancestor_list(root,first) - return self.map.has_key(p.getId()) + return self.map.has_key(p.get_id()) def init_ancestor_list(self,p,first): if not first: - self.map[p.getId()] = 1 + self.map[p.get_id()] = 1 - fam = p.getMainParents() + fam = p.get_main_parents_family_id() if fam: - f = fam.getFather() - m = fam.getMother() + f = fam.get_father_id() + m = fam.get_mother_id() if f: self.init_ancestor_list(f,0) @@ -657,10 +662,10 @@ class IsAncestorOfFilterMatch(IsAncestorOf): if not self.init: self.init = 1 filter = MatchesFilter(self.list[0]) - for person in db.getPersonMap ().values (): + for person in db.get_person_id_map ().values (): if filter.apply (db, person): self.init_ancestor_list (person,first) - return self.map.has_key(p.getId()) + return self.map.has_key(p.get_id()) #------------------------------------------------------------------------- # @@ -692,22 +697,22 @@ class IsLessThanNthGenerationAncestorOf(Rule): self.orig = p if not self.init: self.init = 1 - root = db.getPerson(self.list[0]) + root = db.get_person(self.list[0]) self.init_ancestor_list(root,0) - return self.map.has_key(p.getId()) + return self.map.has_key(p.get_id()) def init_ancestor_list(self,p,gen): -# if self.map.has_key(p.getId()) == 1: +# if self.map.has_key(p.get_id()) == 1: # loop_error(self.orig,p) if gen: - self.map[p.getId()] = 1 + self.map[p.get_id()] = 1 if gen >= int(self.list[1]): return - fam = p.getMainParents() + fam = p.get_main_parents_family_id() if fam: - f = fam.getFather() - m = fam.getMother() + f = fam.get_father_id() + m = fam.get_mother_id() if f: self.init_ancestor_list(f,gen+1) @@ -744,20 +749,20 @@ class IsMoreThanNthGenerationAncestorOf(Rule): self.orig = p if not self.init: self.init = 1 - root = db.getPerson(self.list[0]) + root = db.get_person(self.list[0]) self.init_ancestor_list(root,0) - return self.map.has_key(p.getId()) + return self.map.has_key(p.get_id()) def init_ancestor_list(self,p,gen): -# if self.map.has_key(p.getId()) == 1: +# if self.map.has_key(p.get_id()) == 1: # loop_error(self.orig,p) if gen >= int(self.list[1]): - self.map[p.getId()] = 1 + self.map[p.get_id()] = 1 - fam = p.getMainParents() + fam = p.get_main_parents_family_id() if fam: - f = fam.getFather() - m = fam.getMother() + f = fam.get_father_id() + m = fam.get_mother_id() if f: self.init_ancestor_list(f,gen+1) @@ -795,16 +800,16 @@ class IsParentOfFilterMatch(Rule): if not self.init: self.init = 1 filter = MatchesFilter(self.list) - for person in db.getPersonMap ().values (): + for person in db.get_person_id_map ().values (): if filter.apply (db, person): self.init_list (person) - return self.map.has_key(p.getId()) + return self.map.has_key(p.get_id()) def init_list(self,p): - for fam in p.getMainParents(): - for parent in [fam.getFather (), fam.getMother ()]: + for fam in p.get_main_parents_family_id(): + for parent in [fam.get_father_id (), fam.get_mother_id ()]: if parent: - self.map[parent.getId()] = 1 + self.map[parent.get_id()] = 1 #------------------------------------------------------------------------- # @@ -836,7 +841,7 @@ class HasCommonAncestorWith(Rule): def init_ancestor_cache(self,db): # list[0] is an Id, but we need to pass a Person to for_each_ancestor. - p = db.getPerson(self.list[0]) + p = db.get_person(self.list[0]) if p: def init(self,pid): self.ancestor_cache[pid] = 1 for_each_ancestor([p],init,self) @@ -878,8 +883,8 @@ class HasCommonAncestorWithFilterMatch(HasCommonAncestorWith): def init_ancestor_cache(self,db): filter = MatchesFilter(self.list) def init(self,pid): self.ancestor_cache[pid] = 1 - for p in db.getPersonMap ().values (): - if (not self.ancestor_cache.has_key (p.getId ()) + for p in db.get_person_id_map ().values (): + if (not self.ancestor_cache.has_key (p.get_id ()) and filter.apply (db, p)): for_each_ancestor([p],init,self) @@ -903,7 +908,7 @@ class IsMale(Rule): return _('Matches all males') def apply(self,db,p): - return p.getGender() == RelLib.Person.male + return p.get_gender() == RelLib.Person.male #------------------------------------------------------------------------- # @@ -933,18 +938,18 @@ class HasEvent(Rule): return _('Event filters') def apply(self,db,p): - for event in p.getEventList(): + for event in p.get_event_list(): val = 1 - if self.list[0] and event.getName() != self.list[0]: + if self.list[0] and event.get_name() != self.list[0]: val = 0 - if self.list[3] and find(event.getDescription().upper(), + if self.list[3] and find(event.get_description().upper(), self.list[3].upper())==-1: val = 0 if self.date: - if date_cmp(self.date,event.getDateObj()): + if date_cmp(self.date,event.get_date_object()): val = 0 if self.list[2]: - pn = event.getPlaceName() + pn = event.get_place_name() if find(pn.upper(),self.list[2].upper()) == -1: val = 0 if val == 1: @@ -980,18 +985,18 @@ class HasFamilyEvent(Rule): return _('Event filters') def apply(self,db,p): - for f in p.getFamilyList(): - for event in f.getEventList(): + for f in p.get_family_id_list(): + for event in f.get_event_list(): val = 1 - if self.list[0] and event.getName() != self.list[0]: + if self.list[0] and event.get_name() != self.list[0]: val = 0 v = self.list[3] - if v and find(event.getDescription().upper(),v.upper())==-1: + if v and find(event.get_description().upper(),v.upper())==-1: val = 0 if self.date: - if date_cmp(self.date,event.getDateObj()): + if date_cmp(self.date,event.get_date_object()): val = 0 - pn = event.getPlaceName().upper() + pn = event.get_place_name().upper() if self.list[2] and find(pn,self.list[2].upper()) == -1: val = 0 if val == 1: @@ -1022,12 +1027,12 @@ class HasRelationship(Rule): def apply(self,db,p): rel_type = 0 cnt = 0 - num_rel = len(p.getFamilyList()) + num_rel = len(p.get_family_id_list()) # count children and look for a relationship type match - for f in p.getFamilyList(): - cnt = cnt + len(f.getChildList()) - if self.list[1] and f.getRelationship() == self.list[1]: + for f in p.get_family_id_list(): + cnt = cnt + len(f.get_child_id_list()) + if self.list[1] and f.get_relationship() == self.list[1]: rel_type = 1 # if number of relations specified @@ -1082,14 +1087,14 @@ class HasBirth(Rule): return _('Event filters') def apply(self,db,p): - event = p.getBirth() - ed = event.getDescription().upper() + event = p.get_birth() + ed = event.get_description().upper() if len(self.list) > 2 and find(ed,self.list[2].upper())==-1: return 0 if self.date: - if date_cmp(self.date,event.getDateObj()) == 0: + if date_cmp(self.date,event.get_date_object()) == 0: return 0 - pn = event.getPlaceName().upper() + pn = event.get_place_name().upper() if len(self.list) > 1 and find(pn,self.list[1].upper()) == -1: return 0 return 1 @@ -1122,14 +1127,14 @@ class HasDeath(Rule): return _('Event filters') def apply(self,db,p): - event = p.getDeath() - ed = event.getDescription().upper() + event = p.get_death() + ed = event.get_description().upper() if self.list[2] and find(ed,self.list[2].upper())==-1: return 0 if self.date: - if date_cmp(self.date,event.getDateObj()) == 0: + if date_cmp(self.date,event.get_date_object()) == 0: return 0 - pn = event.getPlaceName().upper() + pn = event.get_place_name().upper() if self.list[1] and find(pn,self.list[1].upper()) == -1: return 0 return 1 @@ -1149,9 +1154,9 @@ class HasAttribute(Rule): def apply(self,db,p): for event in p.getAttributes(): - if self.list[0] and event.getType() != self.list[0]: + if self.list[0] and event.get_type() != self.list[0]: return 0 - ev = event.getValue().upper() + ev = event.get_value().upper() if self.list[1] and find(ev,self.list[1].upper())==-1: return 0 return 1 @@ -1170,12 +1175,12 @@ class HasFamilyAttribute(Rule): return 'Has the family attribute' def apply(self,db,p): - for f in p.getFamilyList(): + for f in p.get_family_id_list(): for event in f.getAttributes(): val = 1 - if self.list[0] and event.getType() != self.list[0]: + if self.list[0] and event.get_type() != self.list[0]: val = 0 - ev = event.getValue().upper() + ev = event.get_value().upper() if self.list[1] and find(ev,self.list[1].upper())==-1: val = 0 if val == 1: @@ -1206,15 +1211,15 @@ class HasNameOf(Rule): self.l = self.list[1] self.s = self.list[2] self.t = self.list[3] - for name in [p.getPrimaryName()] + p.getAlternateNames(): + for name in [p.get_primary_name()] + p.get_alternate_names(): val = 1 - if self.f and find(name.getFirstName().upper(),self.f.upper()) == -1: + if self.f and find(name.get_first_name().upper(),self.f.upper()) == -1: val = 0 - if self.l and find(name.getSurname().upper(),self.l.upper()) == -1: + if self.l and find(name.get_surname().upper(),self.l.upper()) == -1: val = 0 - if self.s and find(name.getSuffix().upper(),self.s.upper()) == -1: + if self.s and find(name.get_suffix().upper(),self.s.upper()) == -1: val = 0 - if self.t and find(name.getTitle().upper(),self.t.upper()) == -1: + if self.t and find(name.get_title().upper(),self.t.upper()) == -1: val = 0 if val == 1: return 1 @@ -1265,8 +1270,8 @@ class IsSpouseOfFilterMatch(Rule): def apply(self,db,p): filter = MatchesFilter (self.list) - for family in p.getFamilyList (): - for spouse in [family.getFather (), family.getMother ()]: + for family in p.get_family_id_list (): + for spouse in [family.get_father_id (), family.get_mother_id ()]: if not spouse: continue if spouse == p: diff --git a/src/GrampsCfg.py b/src/GrampsCfg.py index c0b242dbc..c4d522296 100644 --- a/src/GrampsCfg.py +++ b/src/GrampsCfg.py @@ -98,10 +98,10 @@ _date_entry_list = [ ] _name_format_list = [ - (_("Firstname Surname"), Utils.normal_name, Utils.phonebook_name, lambda x: x.getSurname()), - (_("Surname, Firstname"), Utils.phonebook_name, Utils.phonebook_name, lambda x: x.getSurname()), - (_("Firstname SURNAME"), Utils.upper_name, Utils.phonebook_upper_name, lambda x : x.getUpperSurname()), - (_("SURNAME, Firstname"), Utils.phonebook_upper_name, Utils.phonebook_upper_name, lambda x: x.getUpperSurname()), + (_("Firstname Surname"), Utils.normal_name, Utils.phonebook_name, lambda x: x.get_surname()), + (_("Surname, Firstname"), Utils.phonebook_name, Utils.phonebook_name, lambda x: x.get_surname()), + (_("Firstname SURNAME"), Utils.upper_name, Utils.phonebook_upper_name, lambda x : x.get_upper_surname()), + (_("SURNAME, Firstname"), Utils.phonebook_upper_name, Utils.phonebook_upper_name, lambda x: x.get_upper_surname()), ] panellist = [ @@ -143,7 +143,7 @@ uncompress = 0 lastfile = None nameof = Utils.normal_name display_name = Utils.normal_name -display_surname = lambda x : x.getSurname() +display_surname = lambda x : x.get_surname() status_bar = 1 toolbar = gtk.TOOLBAR_BOTH save_toolbar = gtk.TOOLBAR_BOTH diff --git a/src/GrampsParser.py b/src/GrampsParser.py index 1f0791b10..19ffa0004 100644 --- a/src/GrampsParser.py +++ b/src/GrampsParser.py @@ -185,7 +185,6 @@ class GrampsParser: "street" : (None, self.stop_street), "suffix" : (None, self.stop_suffix), "title" : (None, self.stop_title), - "uid" : (None, self.stop_uid), "url" : (self.start_url, None) } @@ -197,12 +196,12 @@ class GrampsParser: p.CharacterDataHandler = self.characters p.ParseFile(file) - self.db.setResearcher(self.owner) + self.db.set_researcher(self.owner) if self.tempDefault != None: id = self.tempDefault - if self.db.personMap.has_key(id) and self.db.getDefaultPerson() == None: - person = self.db.personMap[id] - self.db.setDefaultPerson(person) + if self.db.person_map.has_key(id) and self.db.get_default_person() == None: + person = self.db.person_map[id] + self.db.set_default_person(person) for key in self.func_map.keys(): del self.func_map[key] @@ -215,33 +214,33 @@ class GrampsParser: self.ord = RelLib.LdsOrd() if self.person: if type == "baptism": - self.person.setLdsBaptism(self.ord) + self.person.set_lds_baptism(self.ord) elif type == "endowment": - self.person.setLdsEndowment(self.ord) + self.person.set_lds_endowment(self.ord) elif type == "sealed_to_parents": - self.person.setLdsSeal(self.ord) + self.person.set_lds_sealing(self.ord) elif self.family: if type == "sealed_to_spouse": - self.family.setLdsSeal(self.ord) + self.family.set_lds_sealing(self.ord) def start_temple(self,attrs): - self.ord.setTemple(attrs['val']) + self.ord.set_temple(attrs['val']) def start_status(self,attrs): - self.ord.setStatus(int(attrs['val'])) + self.ord.set_status(int(attrs['val'])) def start_sealed_to(self,attrs): id = attrs['ref'] - self.ord.setFamily(self.db.findFamilyNoMap(id)) + self.ord.set_family_id(self.db.find_family_no_map(id)) def start_place(self,attrs): if attrs.has_key('ref'): - self.placeobj = self.db.findPlaceNoMap(attrs['ref']) + self.placeobj = self.db.find_place_from_id(attrs['ref']) else: self.placeobj = None def start_placeobj(self,attrs): - self.placeobj = self.db.findPlaceNoMap(attrs['id']) + self.placeobj = self.db.find_place_from_id(attrs['id']) title = attrs['title'] if title == "": title = attrs['id'] @@ -309,23 +308,23 @@ class GrampsParser: if attrs.has_key("priv"): self.attribute.private = int(attrs["priv"]) if attrs.has_key('type'): - self.attribute.setType(const.save_attr(attrs["type"])) + self.attribute.set_type(const.save_attr(attrs["type"])) if attrs.has_key('value'): - self.attribute.setValue(attrs["value"]) + self.attribute.set_value(attrs["value"]) if self.photo: - self.photo.addAttribute(self.attribute) + self.photo.add_attribute(self.attribute) elif self.object: - self.object.addAttribute(self.attribute) + self.object.add_attribute(self.attribute) elif self.objref: - self.objref.addAttribute(self.attribute) + self.objref.add_attribute(self.attribute) elif self.person: - self.person.addAttribute(self.attribute) + self.person.add_attribute(self.attribute) elif self.family: - self.family.addAttribute(self.attribute) + self.family.add_attribute(self.attribute) def start_address(self,attrs): self.address = RelLib.Address() - self.person.addAddress(self.address) + self.person.add_address(self.address) if attrs.has_key("conf"): self.address.conf = int(attrs["conf"]) else: @@ -334,31 +333,31 @@ class GrampsParser: self.address.private = int(attrs["priv"]) def start_bmark(self,attrs): - person = self.db.findPersonNoMap(attrs["ref"]) + person = self.db.find_person_from_id(attrs["ref"]) self.db.bookmarks.append(person) def start_person(self,attrs): if self.callback != None and self.count % self.increment == 0: self.callback(float(self.count)/float(self.entries)) self.count = self.count + 1 - self.person = self.db.findPersonNoMap(attrs["id"]) + self.person = self.db.find_person_from_id(attrs["id"]) if attrs.has_key("complete"): - self.person.setComplete(int(attrs['complete'])) + self.person.set_complete(int(attrs['complete'])) else: - self.person.setComplete(0) + self.person.set_complete(0) def start_people(self,attrs): if attrs.has_key("default"): self.tempDefault = attrs["default"] def start_father(self,attrs): - self.family.Father = self.db.findPersonNoMap(attrs["ref"]) + self.family.set_father_id(attrs["ref"]) def start_mother(self,attrs): - self.family.Mother = self.db.findPersonNoMap(attrs["ref"]) + self.family.set_mother_id(attrs["ref"]) def start_child(self,attrs): - self.family.Children.append(self.db.findPersonNoMap(attrs["ref"])) + self.family.add_child_id(attrs["ref"]) def start_url(self,attrs): @@ -374,11 +373,11 @@ class GrampsParser: url.set_path(attrs["href"]) url.set_description(desc) if attrs.has_key("priv"): - url.setPrivacy(int(attrs['priv'])) + url.set_privacy(int(attrs['priv'])) if self.person: - self.person.addUrl(url) + self.person.add_url(url) elif self.placeobj: - self.placeobj.addUrl(url) + self.placeobj.add_url(url) except KeyError: return @@ -386,18 +385,18 @@ class GrampsParser: if self.callback != None and self.count % self.increment == 0: self.callback(float(self.count)/float(self.entries)) self.count = self.count + 1 - self.family = self.db.findFamilyNoMap(attrs["id"]) + self.family = self.db.find_family_no_map(attrs["id"]) if attrs.has_key("type"): - self.family.setRelationship(const.save_frel(attrs["type"])) + self.family.set_relationship(const.save_frel(attrs["type"])) else: - self.family.setRelationship("") + self.family.set_relationship("") if attrs.has_key("complete"): - self.family.setComplete(int(attrs['complete'])) + self.family.set_complete(int(attrs['complete'])) else: - self.family.setComplete(0) + self.family.set_complete(0) def start_childof(self,attrs): - family = self.db.findFamilyNoMap(attrs["ref"]) + family = self.db.find_family_no_map(attrs["ref"]) if attrs.has_key("mrel"): mrel = attrs["mrel"] else: @@ -406,95 +405,95 @@ class GrampsParser: frel = attrs["frel"] else: frel = "Birth" - self.person.AltFamilyList.append((family,mrel,frel)) + self.person.add_parent_family_id(family.get_id(),mrel,frel) def start_parentin(self,attrs): - self.person.FamilyList.append(self.db.findFamilyNoMap(attrs["ref"])) + self.person.add_family_id(attrs["ref"]) def start_name(self,attrs): if not self.in_witness: self.name = RelLib.Name() if attrs.has_key("type"): - self.name.setType(attrs["type"]) + self.name.set_type(attrs["type"]) if attrs.has_key("conf"): - self.name.conf = int(attrs["conf"]) + self.name.set_confidence(int(attrs["conf"])) else: self.name.conf = 2 if attrs.has_key("priv"): - self.name.private = int(attrs["priv"]) + self.name.set_privacy(int(attrs["priv"])) def start_last(self,attrs): if attrs.has_key('prefix'): - self.name.Prefix = attrs['prefix'] + self.name.set_prefix(attrs['prefix']) def start_note(self,attrs): self.in_note = 1 self.note = RelLib.Note() if attrs.has_key("format"): - self.note.setFormat(int(attrs['format'])) + self.note.set_format(int(attrs['format'])) def start_sourceref(self,attrs): self.source_ref = RelLib.SourceRef() - source = self.db.findSourceNoMap(attrs["ref"]) + source = self.db.find_source_from_id(attrs["ref"]) if attrs.has_key("conf"): self.source_ref.confidence = int(attrs["conf"]) else: self.source_ref.confidence = self.conf - self.source_ref.setBase(source) + self.source_ref.set_base_id(source.get_id()) if self.photo: - self.photo.addSourceRef(self.source_ref) + self.photo.add_source_reference(self.source_ref) elif self.ord: - self.ord.addSourceRef(self.source_ref) + self.ord.add_source_reference(self.source_ref) elif self.object: - self.object.addSourceRef(self.source_ref) + self.object.add_source_reference(self.source_ref) elif self.event: - self.event.addSourceRef(self.source_ref) + self.event.add_source_reference(self.source_ref) elif self.address: - self.address.addSourceRef(self.source_ref) + self.address.add_source_reference(self.source_ref) elif self.name: - self.name.addSourceRef(self.source_ref) + self.name.add_source_reference(self.source_ref) elif self.attribute: - self.attribute.addSourceRef(self.source_ref) + self.attribute.add_source_reference(self.source_ref) elif self.placeobj: - self.placeobj.addSourceRef(self.source_ref) + self.placeobj.add_source_reference(self.source_ref) elif self.family: - self.family.addSourceRef(self.source_ref) + self.family.add_source_reference(self.source_ref) elif self.person: - self.person.addSourceRef(self.source_ref) + self.person.add_source_reference(self.source_ref) def start_source(self,attrs): if self.num_srcs > 0: if self.callback != None and self.count % self.increment == 0: self.callback(float(self.count)/float(self.entries)) self.count = self.count + 1 - self.source = self.db.findSourceNoMap(attrs["id"]) + self.source = self.db.find_source_from_id(attrs["id"]) def start_objref(self,attrs): self.objref = RelLib.ObjectRef() - self.objref.setReference(self.db.findObjectNoMap(attrs['ref'])) + self.objref.set_reference(self.db.find_object_from_id(attrs['ref'])) if attrs.has_key('priv'): - self.objref.setPrivacy(int(attrs['priv'])) + self.objref.set_privacy(int(attrs['priv'])) if self.family: - self.family.addPhoto(self.objref) + self.family.add_photo(self.objref) elif self.source: - self.source.addPhoto(self.objref) + self.source.add_photo(self.objref) elif self.person: - self.person.addPhoto(self.objref) + self.person.add_photo(self.objref) elif self.placeobj: - self.placeobj.addPhoto(self.objref) + self.placeobj.add_photo(self.objref) def start_object(self,attrs): - self.object = self.db.findObjectNoMap(attrs['id']) - self.object.setMimeType(attrs['mime']) - self.object.setDescription(attrs['description']) + self.object = self.db.find_object_from_id(attrs['id']) + self.object.set_mime_type(attrs['mime']) + self.object.set_description(attrs['description']) src = attrs["src"] if src: if src[0] != '/': - self.object.setPath("%s/%s" % (self.base,src)) - self.object.setLocal(1) + self.object.set_path("%s/%s" % (self.base,src)) + self.object.set_local(1) else: - self.object.setPath(src) - self.object.setLocal(0) + self.object.set_path(src) + self.object.set_local(0) def stop_object(self,tag): self.object = None @@ -505,46 +504,46 @@ class GrampsParser: def start_photo(self,attrs): self.photo = RelLib.Photo() self.pref = RelLib.ObjectRef() - self.pref.setReference(self.photo) + self.pref.set_reference(self.photo) for key in attrs.keys(): if key == "descrip" or key == "description": - self.photo.setDescription(attrs[key]) + self.photo.set_description(attrs[key]) elif key == "priv": - self.pref.setPrivacy(int(attrs[key])) + self.pref.set_privacy(int(attrs[key])) elif key == "src": src = attrs["src"] if src[0] != '/': - self.photo.setPath("%s/%s" % (self.base,src)) - self.photo.setLocal(1) + self.photo.set_path("%s/%s" % (self.base,src)) + self.photo.set_local(1) else: - self.photo.setPath(src) - self.photo.setLocal(0) + self.photo.set_path(src) + self.photo.set_local(0) else: a = RelLib.Attribute() - a.setType(key) - a.setValue(attrs[key]) - self.photo.addAttribute(a) - self.photo.setMimeType(Utils.get_mime_type(self.photo.getPath())) - self.db.addObject(self.photo) + a.set_type(key) + a.set_value(attrs[key]) + self.photo.add_attribute(a) + self.photo.set_mime_type(Utils.get_mime_type(self.photo.get_path())) + self.db.add_object(self.photo) if self.family: - self.family.addPhoto(self.pref) + self.family.add_photo(self.pref) elif self.source: - self.source.addPhoto(self.pref) + self.source.add_photo(self.pref) elif self.person: - self.person.addPhoto(self.pref) + self.person.add_photo(self.pref) elif self.placeobj: - self.placeobj.addPhoto(self.pref) + self.placeobj.add_photo(self.pref) def start_daterange(self,attrs): if self.source_ref: - d = self.source_ref.getDate() + d = self.source_ref.get_date() elif self.ord: - d = self.ord.getDateObj() + d = self.ord.get_date_object() elif self.address: - d = self.address.getDateObj() + d = self.address.get_date_object() else: - d = self.event.getDateObj() + d = self.event.get_date_object() if attrs.has_key("calendar"): d.set_calendar_val(int(attrs['calendar'])) @@ -558,13 +557,13 @@ class GrampsParser: def start_dateval(self,attrs): if self.source_ref: - d = self.source_ref.getDate() + d = self.source_ref.get_date() elif self.ord: - d = self.ord.getDateObj() + d = self.ord.get_date_object() elif self.address: - d = self.address.getDateObj() + d = self.address.get_date_object() else: - d = self.event.getDateObj() + d = self.event.get_date_object() if attrs.has_key("calendar"): d.set_calendar_val(int(attrs['calendar'])) @@ -581,13 +580,13 @@ class GrampsParser: def start_datestr(self,attrs): if self.source_ref: - d = self.source_ref.getDate() + d = self.source_ref.get_date() elif self.ord: - d = self.ord.getDateObj() + d = self.ord.get_date_object() elif self.address: - d = self.address.getDateObj() + d = self.address.get_date_object() else: - d = self.event.getDateObj() + d = self.event.get_date_object() d.set(attrs['val']) @@ -626,10 +625,10 @@ class GrampsParser: self.in_witness = 0 def stop_attr_type(self,tag): - self.attribute.setType(tag) + self.attribute.set_type(tag) def stop_attr_value(self,tag): - self.attribute.setValue(tag) + self.attribute.set_value(tag) def stop_address(self,tag): self.address = None @@ -644,7 +643,7 @@ class GrampsParser: if self.placeobj.get_title() == "": loc = self.placeobj.get_main_location() self.placeobj.set_title(build_place_title(loc)) - self.db.buildPlaceDisplay(self.placeobj.getId()) + self.db.build_place_display(self.placeobj.get_id()) self.placeobj = None def stop_family(self,tag): @@ -654,24 +653,24 @@ class GrampsParser: self.event.name = self.event_type if self.family: - self.family.EventList.append(self.event) + self.family.add_event(self.event) else: if self.event_type == "Birth": - self.person.setBirth(self.event) + self.person.set_birth(self.event) elif self.event_type == "Death": - self.person.setDeath(self.event) + self.person.set_death(self.event) else: - self.person.EventList.append(self.event) + self.person.add_event(self.event) self.event = None def stop_name(self,tag): if self.in_witness: self.witness = RelLib.Witness(RelLib.Event.NAME,tag) else: - if self.name.getType() == "": - self.name.setType("Birth Name") - self.person.setPrimaryName (self.name) - self.person.getPrimaryName().build_sort_name() + if self.name.get_type() == "": + self.name.set_type("Birth Name") + self.person.set_primary_name (self.name) + self.person.get_primary_name().build_sort_name() self.name = None def stop_ref(self,tag): @@ -684,96 +683,93 @@ class GrampsParser: else: self.placeobj = RelLib.Place() self.placeobj.set_title(tag) - self.db.addPlace(self.placeobj) + self.db.add_place(self.placeobj) self.place_map[tag] = self.placeobj if self.ord: - self.ord.setPlace(self.placeobj) + self.ord.set_place_id(self.placeobj) else: - self.event.place = self.placeobj + self.event.place = self.placeobj.get_id() self.placeobj = None - def stop_uid(self,tag): - self.person.setPafUid(tag) - def stop_date(self,tag): if tag: if self.address: - self.address.setDate(tag) + self.address.set_date(tag) else: - self.event.setDate(tag) + self.event.set_date(tag) def stop_first(self,tag): - self.name.FirstName = tag + self.name.set_first_name(tag) def stop_families(self,tag): self.family = None def stop_person(self,tag): - self.db.buildPersonDisplay(self.person.getId()) + self.db.build_person_display(self.person.get_id()) self.person = None def stop_description(self,tag): - self.event.setDescription(tag) + self.event.set_description(tag) def stop_cause(self,tag): - self.event.setCause(tag) + self.event.set_cause(tag) def stop_gender(self,tag): t = tag if t == "M": - self.person.setGender (RelLib.Person.male) + self.person.set_gender (RelLib.Person.male) elif t == "F": - self.person.setGender (RelLib.Person.female) + self.person.set_gender (RelLib.Person.female) else: - self.person.setGender (RelLib.Person.unknown) + self.person.set_gender (RelLib.Person.unknown) def stop_stitle(self,tag): - self.source.setTitle(tag) + self.source.set_title(tag) def stop_sourceref(self,tag): self.source_ref = None def stop_source(self,tag): - self.db.buildSourceDisplay(self.source.getId()) + self.db.build_source_display(self.source.get_id()) self.source = None def stop_sauthor(self,tag): - self.source.setAuthor(tag) + self.source.set_author(tag) def stop_sdate(self,tag): date = Date.Date() date.set(tag) - self.source_ref.setDate(date) + self.source_ref.set_date(date) def stop_phone(self,tag): - self.address.setPhone(tag) + self.address.set_phone(tag) def stop_street(self,tag): - self.address.setStreet(tag) + self.address.set_street(tag) def stop_city(self,tag): - self.address.setCity(tag) + self.address.set_city(tag) def stop_state(self,tag): - self.address.setState(tag) + self.address.set_state(tag) def stop_country(self,tag): self.address.setCountry(tag) def stop_postal(self,tag): - self.address.setPostal(tag) + self.address.set_postal_code(tag) def stop_spage(self,tag): - self.source_ref.setPage(tag) + self.source_ref.set_page(tag) def stop_lds_ord(self,tag): self.ord = None def stop_spubinfo(self,tag): - self.source.setPubInfo(tag) + self.source.set_publication_info(tag) def stop_sabbrev(self,tag): - self.source.setAbbrev(tag) + self.source.set_abbreviation(tag) def stop_stext(self,tag): if self.use_p: @@ -781,7 +777,7 @@ class GrampsParser: note = fix_spaces(self.stext_list) else: note = tag - self.source_ref.setText(note) + self.source_ref.set_text(note) def stop_scomments(self,tag): if self.use_p: @@ -789,23 +785,23 @@ class GrampsParser: note = fix_spaces(self.scomments_list) else: note = tag - self.source_ref.setComments(note) + self.source_ref.set_comments(note) def stop_last(self,tag): if self.name: - self.name.Surname = tag + self.name.set_surname(tag) def stop_suffix(self,tag): if self.name: - self.name.Suffix = tag + self.name.set_suffix(tag) def stop_title(self,tag): if self.name: - self.name.Title = tag + self.name.set_title(tag) def stop_nick(self,tag): if self.person: - self.person.setNickName(tag) + self.person.set_nick_name(tag) def stop_note(self,tag): self.in_note = 0 @@ -817,29 +813,29 @@ class GrampsParser: self.note.set(text) if self.address: - self.address.setNoteObj(self.note) + self.address.set_note_object(self.note) elif self.ord: - self.ord.setNoteObj(self.note) + self.ord.set_note_object(self.note) elif self.attribute: - self.attribute.setNoteObj(self.note) + self.attribute.set_note_object(self.note) elif self.object: - self.object.setNoteObj(self.note) + self.object.set_note_object(self.note) elif self.objref: - self.objref.setNoteObj(self.note) + self.objref.set_note_object(self.note) elif self.photo: - self.photo.setNoteObj(self.note) + self.photo.set_note_object(self.note) elif self.name: - self.name.setNoteObj(self.note) + self.name.set_note_object(self.note) elif self.source: - self.source.setNoteObj(self.note) + self.source.set_note_object(self.note) elif self.event: - self.event.setNoteObj(self.note) + self.event.set_note_object(self.note) elif self.person: - self.person.setNoteObj(self.note) + self.person.set_note_object(self.note) elif self.family: - self.family.setNoteObj(self.note) + self.family.set_note_object(self.note) elif self.placeobj: - self.placeobj.setNoteObj(self.note) + self.placeobj.set_note_object(self.note) def stop_research(self,tag): self.owner.set(self.resname, self.resaddr, self.rescity, self.resstate, @@ -879,9 +875,9 @@ class GrampsParser: self.scomments_list.append(tag) def stop_aka(self,tag): - self.person.addAlternateName(self.name) - if self.name.getType() == "": - self.name.setType("Also Known As") + self.person.add_alternate_name(self.name) + if self.name.get_type() == "": + self.name.set_type("Also Known As") self.name = None def startElement(self,tag,attrs): @@ -936,7 +932,7 @@ class GrampsImportParser(GrampsParser): self.func_map["parentin"] = (self.start_parentin,None) def start_childof(self,attrs): - family = self.db.findFamilyNoConflicts(attrs["ref"],self.fmap) + family = self.db.find_family_no_conflicts(attrs["ref"],self.fmap) if attrs.has_key("mrel"): mrel = attrs["mrel"] else: @@ -945,81 +941,81 @@ class GrampsImportParser(GrampsParser): frel = attrs["frel"] else: frel = "Birth" - self.person.AltFamilyList.append((family,mrel,frel)) + self.person.add_parent_family_id((family.get_id(),mrel,frel)) def start_parentin(self,attrs): - self.person.FamilyList.append(self.db.findFamilyNoConflicts(attrs["ref"],self.fmap)) + self.person.add_family_id(attrs["ref"]) def start_bmark(self,attrs): - person = self.db.findPersonNoConflicts(attrs["ref"],self.pmap) + person = self.db.find_person_no_conflicts(attrs["ref"],self.pmap) self.db.bookmarks.append(person) def start_person(self,attrs): if self.callback != None and self.count % self.increment == 0: self.callback(float(self.count)/float(self.entries)) self.count = self.count + 1 - self.person = self.db.findPersonNoConflicts(attrs["id"],self.pmap) + self.person = self.db.find_person_no_conflicts(attrs["id"],self.pmap) if attrs.has_key("complete"): - self.person.setComplete(int(attrs['complete'])) + self.person.set_complete(int(attrs['complete'])) else: - self.person.setComplete(0) + self.person.set_complete(0) def start_father(self,attrs): - self.family.Father = self.db.findPersonNoConflicts(attrs["ref"],self.pmap) + self.family.set_father_id(attrs["ref"]) def start_mother(self,attrs): - self.family.Mother = self.db.findPersonNoConflicts(attrs["ref"],self.pmap) + self.family.set_mother_id(attrs["ref"]) def start_child(self,attrs): - self.family.Children.append(self.db.findPersonNoConflicts(attrs["ref"],self.pmap)) + self.family.add_child_id(attrs["ref"]) def start_family(self,attrs): if self.callback != None and self.count % self.increment == 0: self.callback(float(self.count)/float(self.entries)) self.count = self.count + 1 - self.family = self.db.findFamilyNoConflicts(attrs["id"],self.fmap) + self.family = self.db.find_family_no_conflicts(attrs["id"],self.fmap) if attrs.has_key("type"): - self.family.setRelationship(const.save_frel(attrs["type"])) + self.family.set_relationship(const.save_frel(attrs["type"])) if attrs.has_key("complete"): - self.family.setComplete(int(attrs['complete'])) + self.family.set_complete(int(attrs['complete'])) else: - self.family.setComplete(0) + self.family.set_complete(0) def start_source(self,attrs): - self.source = self.db.findSourceNoConflicts(attrs["id"],self.smap) + self.source = self.db.find_source_no_conflicts(attrs["id"],self.smap) def start_sourceref(self,attrs): self.source_ref = RelLib.SourceRef() - source = self.db.findSourceNoConflicts(attrs["ref"],self.smap) + source = self.db.find_source_no_conflicts(attrs["ref"],self.smap) if attrs.has_key("conf"): self.source_ref.confidence = int(attrs["conf"]) else: self.source_ref.confidence = self.conf - self.source_ref.setBase(source) + self.source_ref.set_base_id(source.get_id()) if self.photo: - self.photo.addSourceRef(self.source_ref) + self.photo.add_source_reference(self.source_ref) elif self.ord: - self.ord.addSourceRef(self.source_ref) + self.ord.add_source_reference(self.source_ref) elif self.object: - self.object.addSourceRef(self.source_ref) + self.object.add_source_reference(self.source_ref) elif self.event: - self.event.addSourceRef(self.source_ref) + self.event.add_source_reference(self.source_ref) elif self.address: - self.address.addSourceRef(self.source_ref) + self.address.add_source_reference(self.source_ref) elif self.name: - self.name.addSourceRef(self.source_ref) + self.name.add_source_reference(self.source_ref) elif self.attribute: - self.attribute.addSourceRef(self.source_ref) + self.attribute.add_source_reference(self.source_ref) elif self.placeobj: - self.placeobj.addSourceRef(self.source_ref) + self.placeobj.add_source_reference(self.source_ref) elif self.family: - self.family.addSourceRef(self.source_ref) + self.family.add_source_reference(self.source_ref) def start_place(self,attrs): - self.placeobj = self.db.findPlaceNoConflicts(attrs['ref'],self.lmap) + self.placeobj = self.db.find_place_no_conflicts(attrs['ref'],self.lmap) def start_placeobj(self,attrs): - self.placeobj = self.db.findPlaceNoConflicts(attrs['id'],self.lmap) + self.placeobj = self.db.find_place_no_conflicts(attrs['id'],self.lmap) title = attrs['title'] if title == "": title = attrs['id'] @@ -1032,30 +1028,30 @@ class GrampsImportParser(GrampsParser): def start_objref(self,attrs): self.objref = RelLib.ObjectRef() - self.objref.setReference(self.db.findObjectNoConflicts(attrs['ref'],self.MediaFileMap)) + self.objref.set_reference(self.db.find_object_no_conflicts(attrs['ref'],self.MediaFileMap)) if attrs.has_key('priv'): - self.objref.setPrivacy(int(attrs['priv'])) + self.objref.set_privacy(int(attrs['priv'])) if self.family: - self.family.addPhoto(self.objref) + self.family.add_photo(self.objref) elif self.source: - self.source.addPhoto(self.objref) + self.source.add_photo(self.objref) elif self.person: - self.person.addPhoto(self.objref) + self.person.add_photo(self.objref) elif self.placeobj: - self.placeobj.addPhoto(self.objref) + self.placeobj.add_photo(self.objref) def start_object(self,attrs): - self.object = self.db.findObjectNoConflicts(attrs['id'],self.MediaFileMap) - self.object.setMimeType(attrs['mime']) - self.object.setDescription(attrs['description']) + self.object = self.db.find_object_no_conflicts(attrs['id'],self.MediaFileMap) + self.object.set_mime_type(attrs['mime']) + self.object.set_description(attrs['description']) src = attrs["src"] if src: if src[0] != '/': - self.object.setPath("%s/%s" % (self.db.getSavePath(),src)) - self.object.setLocal(1) + self.object.set_path("%s/%s" % (self.db.get_save_path(),src)) + self.object.set_local(1) else: - self.object.setPath(src) - self.object.setLocal(0) + self.object.set_path(src) + self.object.set_local(0) def append_value(orig,val): if orig: diff --git a/src/GrampsXML.py b/src/GrampsXML.py index 263d54ecd..999acd8cd 100644 --- a/src/GrampsXML.py +++ b/src/GrampsXML.py @@ -39,18 +39,18 @@ class GrampsXML(RelLib.GrampsDB): def load(self,name,callback): ReadXML.loadData(self,name,callback) - for key in self.personMap.keys(): - person = self.personMap[key] - self.addSurname(person.getPrimaryName().getSurname()) + for key in self.person_map.keys(): + person = self.person_map[key] + self.add_surname(person.get_primary_name().get_surname()) self.placeTable = {} - for key in self.placeMap.keys(): - place = self.placeMap[key] - self.placeTable[key] = place.getDisplayInfo() + for key in self.place_map.keys(): + place = self.place_map[key] + self.place_table[key] = place.get_display_info() self.sourceTable = {} - for key in self.sourceMap.keys(): - src = self.sourceMap[key] - self.sourceTable[key] = src.getDisplayInfo() + for key in self.source_map.keys(): + src = self.source_map[key] + self.source_table[key] = src.get_display_info() return 1 diff --git a/src/GrampsZODB.py b/src/GrampsZODB.py index 3a8a29828..6a1692277 100644 --- a/src/GrampsZODB.py +++ b/src/GrampsZODB.py @@ -42,54 +42,54 @@ class PersonWrapper: def __init__(self, real, map): self._real = real self._map_ref = PersistentReference(map) - self.id = real.getId() - self.PrimaryName = real.getPrimaryName() - self.gender = real.getGender() - self.birth = real.getBirth() - self.death = real.getDeath() + self.id = real.get_id() + self.PrimaryName = real.get_primary_name() + self.gender = real.get_gender() + self.birth = real.get_birth() + self.death = real.get_death() def _notifyChange(self): # Trigger a change to the PersonMap. self._map_ref.getOb()[self.id] = self - def getId(self): + def get_id(self): return self.id - def setId(self, id): - self._real.setId(id) - self.id = self._real.getId() + def set_id(self, id): + self._real.set_id(id) + self.id = self._real.get_id() self._notifyChange() - def getPrimaryName(self): + def get_primary_name(self): return self.PrimaryName - def setPrimaryName(self, name): - self._real.setPrimaryName(name) - self.PrimaryName = self._real.getPrimaryName() + def set_primary_name(self, name): + self._real.set_primary_name(name) + self.PrimaryName = self._real.get_primary_name() self._notifyChange() - def getGender(self): + def get_gender(self): return self.gender - def setGender(self, gender): - self._real.setGender(gender) - self.gender = self._real.getGender() + def set_gender(self, gender): + self._real.set_gender(gender) + self.gender = self._real.get_gender() self._notifyChange() - def getBirth(self): + def get_birth(self): return self.birth - def setBirth(self, birth): - self._real.setBirth(birth) - self.birth = self._real.getBirth() + def set_birth(self, birth): + self._real.set_birth(birth) + self.birth = self._real.get_birth() self._notifyChange() - def getDeath(self): + def get_death(self): return self.death - def setDeath(self, death): - self._real.setDeath(death) - self.death = self._real.getDeath() + def set_death(self, death): + self._real.set_death(death) + self.death = self._real.get_death() self._notifyChange() @@ -177,7 +177,7 @@ class GrampsZODB(RelLib.GrampsDB): table = OOBTree() for key in src.keys(): obj = src[key] - table[key] = obj.getDisplayInfo() + table[key] = obj.get_display_info() self.root[tag] = table self.need_commit = 1 return table @@ -205,7 +205,7 @@ class GrampsZODB(RelLib.GrampsDB): self.surnames = PersistentList() for key in self.personMap.keys(): person = self.personMap[key] - self.addSurname(person.getPrimaryName().getSurname()) + self.add_surname(person.get_primary_name().get_surname()) self.root['surnames'] = self.surnames self.need_commit = 1 @@ -232,9 +232,9 @@ class GrampsZODB(RelLib.GrampsDB): get_transaction().commit() return 1 - def setDefaultPerson(self,person): + def set_default_person(self,person): """sets the default Person to the passed instance""" - RelLib.GrampsDB.setDefaultPerson(self,person) + RelLib.GrampsDB.set_default_person(self,person) self.root['default'] = person diff --git a/src/GraphLayout.py b/src/GraphLayout.py index 4f6ba9ae2..8c928f9e8 100644 --- a/src/GraphLayout.py +++ b/src/GraphLayout.py @@ -51,8 +51,8 @@ class DescendLine(GraphLayout): if pos > self.maxy: self.maxy = pos - for family in person.getFamilyList(): - for child in family.getChildList(): + for family in person.get_family_id_list(): + for child in family.get_child_id_list(): self.space_for(child,level+1.0,pos) pos = pos + max(self.depth(child),1) if pos > self.maxy: @@ -60,8 +60,8 @@ class DescendLine(GraphLayout): self.elist.pop() def depth(self,person,val=0): - for family in person.getFamilyList(): - clist = family.getChildList() + for family in person.get_family_id_list(): + clist = family.get_child_id_list() val = val + len(clist) for child in clist: d=self.depth(child) diff --git a/src/ImageSelect.py b/src/ImageSelect.py index 3e6fb8a7a..10deebba4 100644 --- a/src/ImageSelect.py +++ b/src/ImageSelect.py @@ -170,29 +170,29 @@ class ImageSelect: return already_imported = None - for o in self.db.getObjectMap().values(): - if o.getPath() == filename: + for o in self.db.get_object_map().values(): + if o.get_path() == filename: already_imported = o break if (already_imported): oref = RelLib.ObjectRef() - oref.setReference(already_imported) - self.dataobj.addPhoto(oref) + oref.set_reference(already_imported) + self.dataobj.add_photo(oref) self.add_thumbnail(oref) else: type = Utils.get_mime_type(filename) mobj = RelLib.Photo() if description == "": description = os.path.basename(filename) - mobj.setDescription(description) - mobj.setMimeType(type) + mobj.set_description(description) + mobj.set_mime_type(type) self.savephoto(mobj) if type[0:5] == "image": if self.external.get_active() == 0: name = RelImage.import_media_object(filename,self.path, - mobj.getId()) + mobj.get_id()) mobj.setLocal(1) else: name = filename @@ -201,9 +201,9 @@ class ImageSelect: name = filename else: name = RelImage.import_media_object(filename,self.path, - mobj.getId()) + mobj.get_id()) mobj.setLocal(1) - mobj.setPath(name) + mobj.set_path(name) self.parent.lists_changed = 1 self.load_images() @@ -247,7 +247,7 @@ class Gallery(ImageSelect): self.dataobj = dataobj; self.iconlist = icon_list; self.root = self.iconlist.root() - self.old_photo_list = self.dataobj.getPhotoList()[:] + self.old_photo_list = self.dataobj.get_photo_list()[:] # Local object variables self.y = 0 @@ -270,7 +270,7 @@ class Gallery(ImageSelect): # hit cancel button or closed the window if not ok: if self.old_photo_list is not None: - self.dataobj.setPhotoList(self.old_photo_list) + self.dataobj.set_photo_list(self.old_photo_list) def on_canvas1_event(self,obj,event): """ @@ -279,8 +279,8 @@ class Gallery(ImageSelect): def on_drag_begin(self,obj,context): if const.dnd_images: - mtype = self.sel_obj.getReference().getMimeType() - name = Utils.thumb_path(self.db.getSavePath(),self.sel_obj.getReference()) + mtype = self.sel_obj.get_reference().get_mime_type() + name = Utils.thumb_path(self.db.get_save_path(),self.sel_obj.get_reference()) pix = gtk.gdk.pixbuf_new_from_file(name) context.set_icon_pixbuf(pix,0,0) @@ -295,7 +295,7 @@ class Gallery(ImageSelect): self.drag_item = widget.get_item_at(self.remember_x, self.remember_y) icon_index = self.get_index(widget,event.x,event.y)-1 - self.sel_obj = self.dataobj.getPhotoList()[icon_index] + self.sel_obj = self.dataobj.get_photo_list()[icon_index] if self.drag_item: widget.drag_begin(_drag_targets, gtk.gdk.ACTION_COPY|gtk.gdk.ACTION_MOVE, @@ -364,15 +364,15 @@ class Gallery(ImageSelect): def savephoto(self, photo): """Save the photo in the dataobj object. (Required function)""" - self.db.addObject(photo) + self.db.add_object(photo) oref = RelLib.ObjectRef() - oref.setReference(photo) - self.dataobj.addPhoto(oref) + oref.set_reference(photo) + self.dataobj.add_photo(oref) def add_thumbnail(self, photo): """Scale the image and add it to the IconList.""" - object = photo.getReference() - oid = object.getId() + object = photo.get_reference() + oid = object.get_id() if self.canvas_list.has_key(oid): (grp,item,text,x,y) = self.canvas_list[oid] @@ -381,9 +381,9 @@ class Gallery(ImageSelect): else: import gobject - name = Utils.thumb_path(self.db.getSavePath(),object) + name = Utils.thumb_path(self.db.get_save_path(),object) - description = object.getDescription() + description = object.get_description() if len(description) > 20: description = "%s..." % description[0:20] @@ -448,7 +448,7 @@ class Gallery(ImageSelect): self.max = (self.x)/(_IMAGEX+_PAD) - for photo in self.dataobj.getPhotoList(): + for photo in self.dataobj.get_photo_list(): self.add_thumbnail(photo) if self.cy > self.y: @@ -456,7 +456,7 @@ class Gallery(ImageSelect): else: self.iconlist.set_scroll_region(0,0,self.x,self.y) - if self.dataobj.getPhotoList(): + if self.dataobj.get_photo_list(): Utils.bold_label(self.parent.gallery_label) else: Utils.unbold_label(self.parent.gallery_label) @@ -465,7 +465,7 @@ class Gallery(ImageSelect): x_offset = x/(_IMAGEX+_PAD) y_offset = y/(_IMAGEY+_PAD) index = (y_offset*(1+self.max))+x_offset - return min(index,len(self.dataobj.getPhotoList())) + return min(index,len(self.dataobj.get_photo_list())) def on_photolist_drag_data_received(self,w, context, x, y, data, info, time): if data and data.format == 8: @@ -476,15 +476,15 @@ class Gallery(ImageSelect): name = file mime = Utils.get_mime_type(name) photo = RelLib.Photo() - photo.setPath(name) - photo.setMimeType(mime) + photo.set_path(name) + photo.set_mime_type(mime) basename = os.path.basename(name) (root,ext) = os.path.splitext(basename) - photo.setDescription(root) + photo.set_description(root) self.savephoto(photo) if GrampsCfg.mediaref == 0: - name = RelImage.import_media_object(name,self.path,photo.getId()) - photo.setPath(name) + name = RelImage.import_media_object(name,self.path,photo.get_id()) + photo.set_path(name) photo.setLocal(1) self.parent.lists_changed = 1 if GrampsCfg.globalprop: @@ -501,21 +501,21 @@ class Gallery(ImageSelect): return mime = Utils.get_mime_type(tfile) photo = RelLib.Photo() - photo.setMimeType(mime) - photo.setDescription(d) + photo.set_mime_type(mime) + photo.set_description(d) photo.setLocal(1) - photo.setPath(tfile) - self.db.addObject(photo) + photo.set_path(tfile) + self.db.add_object(photo) oref = RelLib.ObjectRef() - oref.setReference(photo) - self.dataobj.addPhoto(oref) + oref.set_reference(photo) + self.dataobj.add_photo(oref) try: - id = photo.getId() + id = photo.get_id() name = RelImage.import_media_object(tfile,self.path,id) photo.setLocal(1) - photo.setPath(name) + photo.set_path(name) except: - photo.setPath(tfile) + photo.set_path(tfile) return self.add_thumbnail(oref) self.parent.lists_changed = 1 @@ -523,15 +523,15 @@ class Gallery(ImageSelect): Utils.modified() GlobalMediaProperties(self.db,photo,None) else: - if self.db.getObjectMap().has_key(data.data): + if self.db.get_object_map().has_key(data.data): icon_index = self.get_index(w,x,y) index = 0 - for p in self.dataobj.getPhotoList(): - if data.data == p.getReference().getId(): + for p in self.dataobj.get_photo_list(): + if data.data == p.get_reference().get_id(): if index == icon_index or icon_index == -1: return else: - nl = self.dataobj.getPhotoList() + nl = self.dataobj.get_photo_list() item = nl[index] if icon_index == 0: del nl[index] @@ -539,15 +539,15 @@ class Gallery(ImageSelect): else: del nl[index] nl = nl[0:icon_index] + [item] + nl[icon_index:] - self.dataobj.setPhotoList(nl) + self.dataobj.set_photo_list(nl) Utils.modified() self.parent.lists_changed = 1 self.load_images() return index = index + 1 oref = RelLib.ObjectRef() - oref.setReference(self.db.findObjectNoMap(data.data)) - self.dataobj.addPhoto(oref) + oref.set_reference(self.db.find_object_from_id(data.data)) + self.dataobj.add_photo(oref) self.add_thumbnail(oref) self.parent.lists_changed = 1 if GrampsCfg.globalprop: @@ -575,8 +575,8 @@ class Gallery(ImageSelect): if not object: return oref = RelLib.ObjectRef() - oref.setReference(object) - self.dataobj.addPhoto(oref) + oref.set_reference(object) + self.dataobj.add_photo(oref) self.add_thumbnail(oref) self.parent.lists_changed = 1 @@ -588,14 +588,14 @@ class Gallery(ImageSelect): if self.sel: (i,t,b,photo,oid) = self.p_map[self.sel] - val = self.canvas_list[photo.getReference().getId()] + val = self.canvas_list[photo.get_reference().get_id()] val[0].hide() val[1].hide() val[2].hide() - l = self.dataobj.getPhotoList() + l = self.dataobj.get_photo_list() l.remove(photo) - self.dataobj.setPhotoList(l) + self.dataobj.set_photo_list(l) self.parent.lists_changed = 1 self.load_images() @@ -613,8 +613,8 @@ class Gallery(ImageSelect): menu = gtk.Menu() menu.set_title(_("Media Object")) - object = photo.getReference() - mtype = object.getMimeType() + object = photo.get_reference() + mtype = object.get_mime_type() progname = grampslib.default_application_name(mtype) Utils.add_menuitem(menu,_("Open in %s") % progname, @@ -624,7 +624,7 @@ class Gallery(ImageSelect): photo,self.popup_edit_photo) Utils.add_menuitem(menu,_("Edit Object Properties"),photo, self.popup_change_description) - if object.getLocal() == 0: + if object.get_local() == 0: Utils.add_menuitem(menu,_("Convert to local copy"),photo, self.popup_convert_to_private) menu.popup(None,None,None,event.button,event.time) @@ -632,23 +632,23 @@ class Gallery(ImageSelect): def popup_view_photo(self, obj): """Open this picture in a picture viewer""" photo = obj.get_data('o') - Utils.view_photo(photo.getReference()) + Utils.view_photo(photo.get_reference()) def popup_edit_photo(self, obj): """Open this picture in a picture editor""" photo = obj.get_data('o') if os.fork() == 0: os.execvp(const.editor,[const.editor, - photo.getReference().getPath()]) + photo.get_reference().get_path()]) def popup_convert_to_private(self, obj): """Copy this picture into gramps private database instead of leaving it as an external data object.""" photo = obj.get_data('o') - object = photo.getReference() - name = RelImage.import_media_object(object.getPath(),self.path, - object.getId()) - object.setPath(name) + object = photo.get_reference() + name = RelImage.import_media_object(object.get_path(),self.path, + object.get_id()) + object.set_path(name) object.setLocal(1) def popup_change_description(self, obj): @@ -666,13 +666,13 @@ class LocalMediaProperties: def __init__(self,photo,path,parent,parent_window=None): self.photo = photo - self.object = photo.getReference() - self.alist = photo.getAttributeList()[:] + self.object = photo.get_reference() + self.alist = photo.get_attribute_list()[:] self.lists_changed = 0 self.parent = parent self.db = parent.db - fname = self.object.getPath() + fname = self.object.get_path() self.change_dialog = gtk.glade.XML(const.imageselFile,"change_description","gramps") title = _('Change local media object properties') @@ -697,18 +697,18 @@ class LocalMediaProperties: self.on_attr_list_select_row, self.on_update_attr_clicked) - descr_window.set_text(self.object.getDescription()) - mtype = self.object.getMimeType() + descr_window.set_text(self.object.get_description()) + mtype = self.object.get_mime_type() thumb = Utils.thumb_path(path,self.object) if os.path.isfile(thumb): self.pix = gtk.gdk.pixbuf_new_from_file(thumb) self.pixmap.set_from_pixbuf(self.pix) - self.change_dialog.get_widget("private").set_active(photo.getPrivacy()) - self.change_dialog.get_widget("gid").set_text(self.object.getId()) + self.change_dialog.get_widget("private").set_active(photo.get_privacy()) + self.change_dialog.get_widget("gid").set_text(self.object.get_id()) - if self.object.getLocal(): + if self.object.get_local(): self.change_dialog.get_widget("path").set_text("") else: self.change_dialog.get_widget("path").set_text(fname) @@ -716,10 +716,10 @@ class LocalMediaProperties: mt = Utils.get_mime_description(mtype) self.change_dialog.get_widget("type").set_text(mt) self.notes = self.change_dialog.get_widget("notes") - if self.photo.getNote(): - self.notes.get_buffer().set_text(self.photo.getNote()) + if self.photo.get_note(): + self.notes.get_buffer().set_text(self.photo.get_note()) Utils.bold_label(self.notes_label) - if self.photo.getNoteFormat() == 1: + if self.photo.get_note_format() == 1: self.preform.set_active(1) else: self.flowed.set_active(1) @@ -744,7 +744,7 @@ class LocalMediaProperties: self.atree.clear() self.amap = {} for attr in self.alist: - d = [attr.getType(),attr.getValue()] + d = [attr.get_type(),attr.get_value()] iter = self.atree.add(d,attr) self.amap[str(attr)] = iter if self.alist: @@ -765,18 +765,18 @@ class LocalMediaProperties: t = self.notes.get_buffer() text = unicode(t.get_text(t.get_start_iter(),t.get_end_iter(),gtk.FALSE)) - note = self.photo.getNote() + note = self.photo.get_note() format = self.preform.get_active() - if text != note or priv != self.photo.getPrivacy(): - self.photo.setNote(text) - self.photo.setPrivacy(priv) + if text != note or priv != self.photo.get_privacy(): + self.photo.set_note(text) + self.photo.set_privacy(priv) self.parent.lists_changed = 1 Utils.modified() - if format != self.photo.getNoteFormat(): - self.photo.setNoteFormat(format) + if format != self.photo.get_note_format(): + self.photo.set_note_format(format) Utils.modified() if self.lists_changed: - self.photo.setAttributeList(self.alist) + self.photo.set_attribute_list(self.alist) self.parent.lists_changed = 1 Utils.modified() @@ -793,8 +793,8 @@ class LocalMediaProperties: if iter: attr = self.atree.get_object(iter) - self.attr_type.set_label(attr.getType()) - self.attr_value.set_text(attr.getValue()) + self.attr_type.set_label(attr.get_type()) + self.attr_value.set_text(attr.get_value()) else: self.attr_type.set_label('') self.attr_value.set_text('') @@ -833,13 +833,13 @@ class GlobalMediaProperties: def __init__(self,db,object,update): self.object = object - self.alist = self.object.getAttributeList()[:] + self.alist = self.object.get_attribute_list()[:] self.lists_changed = 0 self.db = db self.update = update self.refs = 0 - self.path = self.db.getSavePath() + self.path = self.db.get_save_path() self.change_dialog = gtk.glade.XML(const.imageselFile,"change_global","gramps") title = _('Change global media object properties') @@ -868,21 +868,21 @@ class GlobalMediaProperties: self.on_attr_list_select_row, self.on_update_attr_clicked) - self.descr_window.set_text(self.object.getDescription()) - mtype = self.object.getMimeType() + self.descr_window.set_text(self.object.get_description()) + mtype = self.object.get_mime_type() pb = gtk.gdk.pixbuf_new_from_file(Utils.thumb_path(self.path,self.object)) self.pixmap.set_from_pixbuf(pb) - self.change_dialog.get_widget("gid").set_text(self.object.getId()) + self.change_dialog.get_widget("gid").set_text(self.object.get_id()) self.makelocal = self.change_dialog.get_widget("makelocal") self.update_info() self.change_dialog.get_widget("type").set_text(Utils.get_mime_description(mtype)) - if self.object.getNote(): - self.notes.get_buffer().set_text(self.object.getNote()) + if self.object.get_note(): + self.notes.get_buffer().set_text(self.object.get_note()) Utils.bold_label(self.notes_label) - if self.object.getNoteFormat() == 1: + if self.object.get_note_format() == 1: self.preform.set_active(1) else: self.flowed.set_active(1) @@ -918,8 +918,8 @@ class GlobalMediaProperties: self.atree.select_row(row+1) def update_info(self): - fname = self.object.getPath() - if self.object.getLocal(): + fname = self.object.get_path() + if self.object.get_local(): self.change_dialog.get_widget("path").set_text("") self.makelocal.set_sensitive(0) else: @@ -927,10 +927,10 @@ class GlobalMediaProperties: self.makelocal.set_sensitive(1) def on_make_local_clicked(self, obj): - name = RelImage.import_media_object(self.object.getPath(), + name = RelImage.import_media_object(self.object.get_path(), self.path, - self.object.getId()) - self.object.setPath(name) + self.object.get_id()) + self.object.set_path(name) self.object.setLocal(1) self.update_info() if self.update != None: @@ -940,7 +940,7 @@ class GlobalMediaProperties: self.atree.clear() self.amap = {} for attr in self.alist: - d = [attr.getType(),attr.getValue()] + d = [attr.get_type(),attr.get_value()] iter = self.atree.add(d,attr) self.amap[str(attr)] = iter if self.alist: @@ -962,28 +962,28 @@ class GlobalMediaProperties: self.refmodel = ListModel.ListModel(self.change_dialog.get_widget("refinfo"), titles,event_func=self.button_press) any = 0 - for key in self.db.getPersonKeys(): - p = self.db.getPerson(key) - for o in p.getPhotoList(): - if o.getReference() == self.object: - self.refmodel.add([_("Person"),p.getId(),GrampsCfg.nameof(p)]) + for key in self.db.get_person_keys(): + p = self.db.get_person(key) + for o in p.get_photo_list(): + if o.get_reference() == self.object: + self.refmodel.add([_("Person"),p.get_id(),GrampsCfg.nameof(p)]) any = 1 - for p in self.db.getFamilyMap().values(): - for o in p.getPhotoList(): - if o.getReference() == self.object: - self.refmodel.add([_("Family"),p.getId(),Utils.family_name(p)]) + for p in self.db.get_family_id_map().values(): + for o in p.get_photo_list(): + if o.get_reference() == self.object: + self.refmodel.add([_("Family"),p.get_id(),Utils.family_name(p)]) any = 1 - for key in self.db.getSourceKeys(): - p = self.db.getSource(key) - for o in p.getPhotoList(): - if o.getReference() == self.object: - self.refmodel.add([_("Source"),p.getId(),p.getTitle()]) + for key in self.db.get_source_keys(): + p = self.db.get_source(key) + for o in p.get_photo_list(): + if o.get_reference() == self.object: + self.refmodel.add([_("Source"),p.get_id(),p.get_title()]) any = 1 - for key in self.db.getPlaceKeys(): - p = self.db.getPlace(key) - for o in p.getPhotoList(): - if o.getReference() == self.object: - self.refmodel.add([_("Place"),p.getId(),p.get_title()]) + for key in self.db.get_place_id_keys(): + p = self.db.get_place_id(key) + for o in p.get_photo_list(): + if o.get_reference() == self.object: + self.refmodel.add([_("Place"),p.get_id(),p.get_title()]) any = 1 if any: Utils.bold_label(self.refs_label) @@ -1004,17 +1004,17 @@ class GlobalMediaProperties: t = self.notes.get_buffer() text = unicode(t.get_text(t.get_start_iter(),t.get_end_iter(),gtk.FALSE)) desc = unicode(self.descr_window.get_text()) - note = self.object.getNote() + note = self.object.get_note() format = self.preform.get_active() - if text != note or desc != self.object.getDescription(): - self.object.setNote(text) - self.object.setDescription(desc) + if text != note or desc != self.object.get_description(): + self.object.set_note(text) + self.object.set_description(desc) Utils.modified() - if format != self.object.getNoteFormat(): - self.object.setNoteFormat(format) + if format != self.object.get_note_format(): + self.object.set_note_format(format) Utils.modified() if self.lists_changed: - self.object.setAttributeList(self.alist) + self.object.set_attribute_list(self.alist) Utils.modified() if self.update != None: self.update() @@ -1032,8 +1032,8 @@ class GlobalMediaProperties: if iter: attr = self.atree.get_object(iter) - self.attr_type.set_label(attr.getType()) - self.attr_value.set_text(attr.getValue()) + self.attr_type.set_label(attr.get_type()) + self.attr_value.set_text(attr.get_value()) else: self.attr_type.set_label('') self.attr_value.set_text('') @@ -1071,55 +1071,55 @@ class DeleteMediaQuery: self.update = update def query_response(self): - del self.db.getObjectMap()[self.media.getId()] + del self.db.get_object_map()[self.media.get_id()] Utils.modified() - for key in self.db.getPersonKeys(): - p = self.db.getPerson(key) + for key in self.db.get_person_keys(): + p = self.db.get_person(key) nl = [] change = 0 - for photo in p.getPhotoList(): - if photo.getReference() != self.media: + for photo in p.get_photo_list(): + if photo.get_reference() != self.media: nl.append(photo) else: change = 1 if change: - p.setPhotoList(nl) + p.set_photo_list(nl) - for p in self.db.getFamilyMap().values(): + for p in self.db.get_family_id_map().values(): nl = [] change = 0 - for photo in p.getPhotoList(): - if photo.getReference() != self.media: + for photo in p.get_photo_list(): + if photo.get_reference() != self.media: nl.append(photo) else: change = 1 if change: - p.setPhotoList(nl) + p.set_photo_list(nl) - for key in self.db.getSourceKeys(): - p = self.db.getSource(key) + for key in self.db.get_source_keys(): + p = self.db.get_source(key) nl = [] change = 0 - for photo in p.getPhotoList(): - if photo.getReference() != self.media: + for photo in p.get_photo_list(): + if photo.get_reference() != self.media: nl.append(photo) else: change = 1 if change: - p.setPhotoList(nl) + p.set_photo_list(nl) - for key in self.db.getPlaceKeys(): - p = self.db.getPlace(key) + for key in self.db.get_place_id_keys(): + p = self.db.get_place_id(key) nl = [] change = 0 - for photo in p.getPhotoList(): - if photo.getReference() != self.media: + for photo in p.get_photo_list(): + if photo.get_reference() != self.media: nl.append(photo) else: change = 1 if change: - p.setPhotoList(nl) + p.set_photo_list(nl) if self.update: self.update(0) diff --git a/src/Marriage.py b/src/Marriage.py index 4a01815d6..f1f7fb4e1 100644 --- a/src/Marriage.py +++ b/src/Marriage.py @@ -73,19 +73,19 @@ class Marriage: """Initializes the Marriage class, and displays the window""" self.family = family self.db = db - self.path = db.getSavePath() + self.path = db.get_save_path() self.cb = callback self.update_fv = update self.pmap = {} self.add_places = [] if family: - self.srcreflist = family.getSourceRefList() + self.srcreflist = family.get_source_references() else: self.srcreflist = [] - for key in db.getPlaceKeys(): - p = db.getPlaceDisplay(key) + for key in db.get_place_id_keys(): + p = db.get_place_display(key) self.pmap[p[0]] = key self.top = gtk.glade.XML(const.marriageFile,"marriageEditor","gramps") @@ -122,8 +122,8 @@ class Marriage: "on_switch_page" : self.on_switch_page }) - title = _("%s and %s") % (GrampsCfg.nameof(family.getFather()), - GrampsCfg.nameof(family.getMother())) + title = _("%s and %s") % (GrampsCfg.nameof(family.get_father_id()), + GrampsCfg.nameof(family.get_mother_id())) Utils.set_title_label(self.top,title) @@ -162,8 +162,8 @@ class Marriage: self.flowed = self.get_widget("mar_flowed") self.preform = self.get_widget("mar_preform") - self.elist = family.getEventList()[:] - self.alist = family.getAttributeList()[:] + self.elist = family.get_event_list()[:] + self.alist = family.get_attribute_list()[:] self.lists_changed = 0 # set initial data @@ -180,9 +180,9 @@ class Marriage: self.on_update_attr_clicked) self.type_field.set_popdown_strings(const.familyRelations) - frel = const.display_frel(family.getRelationship()) + frel = const.display_frel(family.get_relationship()) self.type_field.entry.set_text(frel) - self.gid.set_text(family.getId()) + self.gid.set_text(family.get_id()) self.gid.set_editable(GrampsCfg.id_edit) self.lds_temple.set_popdown_strings(_temple_names) @@ -191,23 +191,23 @@ class Marriage: place_list.sort() self.autoplace = AutoComp.AutoCombo(self.lds_place, place_list) - ord = self.family.getLdsSeal() + ord = self.family.get_lds_sealing() if ord: - if ord.getPlace(): - self.lds_place.entry.set_text(ord.getPlace().get_title()) - self.lds_date.set_text(ord.getDate()) - if ord.getTemple() != "": - name = const.lds_temple_to_abrev[ord.getTemple()] + if ord.get_place_id(): + self.lds_place.entry.set_text(ord.get_place_id().get_title()) + self.lds_date.set_text(ord.get_date()) + if ord.get_temple() != "": + name = const.lds_temple_to_abrev[ord.get_temple()] else: name = "" self.lds_temple.entry.set_text(name) - self.seal_stat = ord.getStatus() + self.seal_stat = ord.get_status() else: self.lds_temple.entry.set_text("") self.lds_place.entry.set_text("") self.seal_stat = 0 - if self.family.getComplete(): + if self.family.get_complete(): self.complete.set_active(1) self.build_seal_menu() @@ -231,10 +231,10 @@ class Marriage: # set notes data self.notes_buffer = self.notes_field.get_buffer() - if family.getNote(): - self.notes_buffer.set_text(family.getNote()) + if family.get_note(): + self.notes_buffer.set_text(family.get_note()) Utils.bold_label(self.notes_label) - if family.getNoteFormat() == 1: + if family.get_note_format() == 1: self.preform.set_active(1) else: self.flowed.set_active(1) @@ -276,18 +276,18 @@ class Marriage: self.seal_stat = obj.get_data("val") def lds_src_clicked(self,obj): - ord = self.family.getLdsSeal() + ord = self.family.get_lds_sealing() if ord == None: ord = RelLib.LdsOrd() - self.family.setLdsSeal(ord) - Sources.SourceSelector(ord.getSourceRefList(),self) + self.family.set_lds_sealing(ord) + Sources.SourceSelector(ord.get_source_references(),self) def lds_note_clicked(self,obj): import NoteEdit - ord = self.family.getLdsSeal() + ord = self.family.get_lds_sealing() if ord == None: ord = RelLib.LdsOrd() - self.family.setLdsSeal(ord) + self.family.set_lds_sealing(ord) NoteEdit.NoteEditor(ord) def on_up_clicked(self,obj): @@ -332,17 +332,17 @@ class Marriage: exec 'family = "%s"' % data[1] if mytype != 'fevent': return - elif family == self.family.getId(): + elif family == self.family.get_id(): self.move_element(self.elist,self.etree.get_selected_row(),row) else: foo = pickle.loads(data[2]); - for src in foo.getSourceRefList(): - base = src.getBase() - newbase = self.db.findSourceNoMap(base.getId()) - src.setBase(newbase) - place = foo.getPlace() + for src in foo.get_source_references(): + base_id = src.get_base_id() + newbase = self.db.find_source_from_id(base_id) + src.set_base_id(newbase) + place = foo.get_place_id() if place: - foo.setPlace(self.db.findPlaceNoMap(place.getId())) + foo.set_place_id(self.db.find_place_from_id(place.get_id())) self.elist.insert(row,foo) self.lists_changed = 1 @@ -353,7 +353,7 @@ class Marriage: bits_per = 8; # we're going to pass a string pickled = pickle.dumps(ev[0]); - data = str(('fevent',self.family.getId(),pickled)); + data = str(('fevent',self.family.get_id(),pickled)); selection_data.set(selection_data.target, bits_per, data) def at_dest_drag_data_received(self,widget,context,x,y,selection_data,info,time): @@ -364,14 +364,14 @@ class Marriage: exec 'family = "%s"' % data[1] if mytype != 'fevent': return - elif family == self.family.getId(): + elif family == self.family.get_id(): self.move_element(self.elist,self.etree.get_selected_row(),row) else: foo = pickle.loads(data[2]); - for src in foo.getSourceRefList(): - base = src.getBase() - newbase = self.db.findSourceNoMap(base.getId()) - src.setBase(newbase) + for src in foo.get_source_references(): + base_id = src.get_base_id() + newbase = self.db.find_source_from_id(base_id) + src.set_base_id(newbase) self.alist.insert(row,foo) self.lists_changed = 1 @@ -382,12 +382,12 @@ class Marriage: bits_per = 8; # we're going to pass a string pickled = pickle.dumps(ev[0]); - data = str(('fattr',self.family.getId(),pickled)); + data = str(('fattr',self.family.get_id(),pickled)); selection_data.set(selection_data.target, bits_per, data) def update_lists(self): - self.family.setEventList(self.elist) - self.family.setAttributeList(self.alist) + self.family.set_event_list(self.elist) + self.family.set_attribute_list(self.alist) def attr_edit_callback(self,attr): self.redraw_attr_list() @@ -397,7 +397,7 @@ class Marriage: self.atree.clear() self.amap = {} for attr in self.alist: - d = [const.display_fattr(attr.getType()),attr.getValue()] + d = [const.display_fattr(attr.get_type()),attr.get_value()] iter = self.atree.add(d,attr) self.amap[str(attr)] = iter if self.alist: @@ -410,7 +410,7 @@ class Marriage: self.etree.clear() self.emap = {} for data in self.elist: - iter = self.etree.add([const.display_fevent(data.getName()),data.getQuoteDate(),data.getPlaceName()],data) + iter = self.etree.add([const.display_fevent(data.get_name()),data.get_quote_date(),data.get_place_name()],data) self.emap[str(data)] = iter if self.elist: self.etree.select_row(0) @@ -424,26 +424,26 @@ class Marriage: def did_data_change(self): changed = 0 relation = unicode(self.type_field.entry.get_text()) - if const.save_frel(relation) != self.family.getRelationship(): + if const.save_frel(relation) != self.family.get_relationship(): changed = 1 - if self.complete.get_active() != self.family.getComplete(): + if self.complete.get_active() != self.family.get_complete(): changed = 1 text = unicode(self.notes_buffer.get_text(self.notes_buffer.get_start_iter(), self.notes_buffer.get_end_iter(),gtk.FALSE)) format = self.preform.get_active() - if text != self.family.getNote(): + if text != self.family.get_note(): changed = 1 - if format != self.family.getNoteFormat(): + if format != self.family.get_note_format(): changed = 1 if self.lists_changed: changed = 1 idval = unicode(self.gid.get_text()) - if self.family.getId() != idval: + if self.family.get_id() != idval: changed = 1 date = unicode(self.lds_date.get_text()) @@ -455,17 +455,17 @@ class Marriage: place = self.get_place(1) - ord = self.family.getLdsSeal() + ord = self.family.get_lds_sealing() if not ord: if date or temple or place or self.seal_stat: changed = 1 else: d = Date.Date() d.set(date) - if Date.compare_dates(d,ord.getDateObj()) != 0 or \ - ord.getTemple() != temple or \ - ord.getPlace() != place or \ - ord.getStatus() != self.seal_stat: + if Date.compare_dates(d,ord.get_date_object()) != 0 or \ + ord.get_temple() != temple or \ + ord.get_place_id() != place or \ + ord.get_status() != self.seal_stat: changed = 1 return changed @@ -497,13 +497,13 @@ class Marriage: def save(self): idval = unicode(self.gid.get_text()) family = self.family - if idval != family.getId(): - m = self.db.getFamilyMap() + if idval != family.get_id(): + m = self.db.get_family_id_map() if not m.has_key(idval): - if m.has_key(family.getId()): - del m[family.getId()] + if m.has_key(family.get_id()): + del m[family.get_id()] m[idval] = family - family.setId(idval) + family.set_id(idval) Utils.modified() else: WarningDialog(_("GRAMPS ID value was not changed."), @@ -511,36 +511,36 @@ class Marriage: 'relationship is already being used.')) relation = unicode(self.type_field.entry.get_text()) - father = self.family.getFather() - mother = self.family.getMother() + father = self.family.get_father_id() + mother = self.family.get_mother_id() if father and mother: - if const.save_frel(relation) != self.family.getRelationship(): - if father.getGender() == mother.getGender(): - self.family.setRelationship("Partners") + if const.save_frel(relation) != self.family.get_relationship(): + if father.get_gender() == mother.get_gender(): + self.family.set_relationship("Partners") else: val = const.save_frel(relation) if val == "Partners": val = "Unknown" - if father.getGender() == RelLib.Person.female or \ - mother.getGender() == RelLib.Person.male: - self.family.setFather(mother) - self.family.setMother(father) - self.family.setRelationship(val) + if father.get_gender() == RelLib.Person.female or \ + mother.get_gender() == RelLib.Person.male: + self.family.set_father_id(mother) + self.family.set_mother_id(father) + self.family.set_relationship(val) Utils.modified() text = unicode(self.notes_buffer.get_text(self.notes_buffer.get_start_iter(), self.notes_buffer.get_end_iter(),gtk.FALSE)) - if text != self.family.getNote(): - self.family.setNote(text) + if text != self.family.get_note(): + self.family.set_note(text) Utils.modified() format = self.preform.get_active() - if format != self.family.getNoteFormat(): - self.family.setNoteFormat(format) + if format != self.family.get_note_format(): + self.family.set_note_format(format) Utils.modified() - if self.complete.get_active() != self.family.getComplete(): - self.family.setComplete(self.complete.get_active()) + if self.complete.get_active() != self.family.get_complete(): + self.family.set_complete(self.complete.get_active()) Utils.modified() date = unicode(self.lds_date.get_text()) @@ -551,37 +551,37 @@ class Marriage: temple = "" place = self.get_place(1) - ord = self.family.getLdsSeal() + ord = self.family.get_lds_sealing() if not ord: if date or temple or place or self.seal_stat: ord = RelLib.LdsOrd() - ord.setDate(date) - ord.setTemple(temple) - ord.setStatus(self.seal_stat) - ord.setPlace(place) - self.family.setLdsSeal(ord) + ord.set_date(date) + ord.set_temple(temple) + ord.set_status(self.seal_stat) + ord.set_place_id(place) + self.family.set_lds_sealing(ord) Utils.modified() else: d = Date.Date() d.set(date) - if Date.compare_dates(d,ord.getDateObj()) != 0: - ord.setDateObj(d) + if Date.compare_dates(d,ord.get_date_object()) != 0: + ord.set_date_object(d) Utils.modified() - if ord.getTemple() != temple: - ord.setTemple(temple) + if ord.get_temple() != temple: + ord.set_temple(temple) Utils.modified() - if ord.getStatus() != self.seal_stat: - ord.setStatus(self.seal_stat) + if ord.get_status() != self.seal_stat: + ord.set_status(self.seal_stat) Utils.modified() - if ord.getPlace() != place: - ord.setPlace(place) + if ord.get_place_id() != place: + ord.set_place_id(place) Utils.modified() self.gallery.close(1) Utils.destroy_passed_object(self.get_widget("marriageEditor")) if self.lists_changed: - self.family.setSourceRefList(self.srcreflist) + self.family.set_source_reference_list(self.srcreflist) Utils.modified() self.update_lists() @@ -626,18 +626,19 @@ class Marriage: return event = self.etree.get_object(iter) - self.date_field.set_text(event.getDate()) - self.place_field.set_text(event.getPlaceName()) - self.cause_field.set_text(event.getCause()) - self.name_field.set_label(const.display_fevent(event.getName())) - if len(event.getSourceRefList()) > 0: - psrc = event.getSourceRefList()[0] - self.event_src_field.set_text(psrc.getBase().getTitle()) - self.event_conf_field.set_text(const.confidence[psrc.getConfidence()]) + self.date_field.set_text(event.get_date()) + self.place_field.set_text(event.get_place_name()) + self.cause_field.set_text(event.get_cause()) + self.name_field.set_label(const.display_fevent(event.get_name())) + if len(event.get_source_references()) > 0: + psrc_id = event.get_source_references()[0].get_id() + psrc = self.db.find_source_from_id(psrc_id) + self.event_src_field.set_text(psrc.get_base_id().get_title()) + self.event_conf_field.set_text(const.confidence[psrc.get_confidence_level()]) else: self.event_src_field.set_text('') self.event_conf_field.set_text('') - self.descr_field.set_text(event.getDescription()) + self.descr_field.set_text(event.get_description()) def on_attr_list_select_row(self,obj): model,iter = self.atree.get_selected() @@ -645,12 +646,13 @@ class Marriage: return attr = self.atree.get_object(iter) - self.attr_type.set_label(const.display_fattr(attr.getType())) - self.attr_value.set_text(attr.getValue()) - if len(attr.getSourceRefList()) > 0: - psrc = attr.getSourceRefList()[0] - self.attr_src_field.set_text(psrc.getBase().getTitle()) - self.attr_conf_field.set_text(const.confidence[psrc.getConfidence()]) + self.attr_type.set_label(const.display_fattr(attr.get_type())) + self.attr_value.set_text(attr.get_value()) + if len(attr.get_source_references()) > 0: + psrc_id = attr.get_source_references()[0].get_id() + psrc = self.db.find_source_from_id(psrc_id) + self.attr_src_field.set_text(psrc.get_base_id().get_title()) + self.attr_conf_field.set_text(const.confidence[psrc.get_confidence_level()]) else: self.attr_src_field.set_text('') self.attr_conf_field.set_text('') @@ -663,15 +665,15 @@ class Marriage: attr = self.atree.get_object(iter) - father = self.family.getFather() - mother = self.family.getMother() + father = self.family.get_father_id() + mother = self.family.get_mother_id() if father and mother: - name = _("%s and %s") % (father.getPrimaryName().getName(), - mother.getPrimaryName().getName()) + name = _("%s and %s") % (father.get_primary_name().get_name(), + mother.get_primary_name().get_name()) elif father: - name = father.getPrimaryName().getName() + name = father.get_primary_name().get_name() else: - name = mother.getPrimaryName().getName() + name = mother.get_primary_name().get_name() AttrEdit.AttributeEditor(self,attr,name,const.familyAttributes, self.attr_edit_callback) @@ -682,15 +684,15 @@ class Marriage: def on_add_attr_clicked(self,obj): import AttrEdit - father = self.family.getFather() - mother = self.family.getMother() + father = self.family.get_father_id() + mother = self.family.get_mother_id() if father and mother: - name = _("%s and %s") % (father.getPrimaryName().getName(), - mother.getPrimaryName().getName()) + name = _("%s and %s") % (father.get_primary_name().get_name(), + mother.get_primary_name().get_name()) elif father: - name = father.getPrimaryName().getName() + name = father.get_primary_name().get_name() else: - name = mother.getPrimaryName().getName() + name = mother.get_primary_name().get_name() AttrEdit.AttributeEditor(self,None,name,const.familyAttributes, self.attr_edit_callback) @@ -727,12 +729,12 @@ class Marriage: text = string.strip(unicode(field.get_text())) if text: if self.pmap.has_key(text): - return self.db.getPlaceMap()[self.pmap[text]] + return self.db.get_place_id_map()[self.pmap[text]] elif makenew: place = RelLib.Place() place.set_title(text) - self.db.addPlace(place) - self.pmap[text] = place.getId() + self.db.add_place(place) + self.pmap[text] = place.get_id() self.add_places.append(place) Utils.modified() return place diff --git a/src/MediaView.py b/src/MediaView.py index 96666f024..7d3f2c5c3 100644 --- a/src/MediaView.py +++ b/src/MediaView.py @@ -148,11 +148,11 @@ class MediaView: id = store.get_value(iter,1) - mobj = self.db.findObjectNoMap(id) - type = mobj.getMimeType() + mobj = self.db.find_object_from_id(id) + type = mobj.get_mime_type() type_name = Utils.get_mime_description(type) - path = mobj.getPath() - thumb_path = Utils.thumb_path(self.db.getSavePath(),mobj) + path = mobj.get_path() + thumb_path = Utils.thumb_path(self.db.get_save_path(),mobj) pexists = os.path.exists(path) if pexists and os.path.exists(thumb_path): self.preview.set_from_pixbuf(gtk.gdk.pixbuf_new_from_file(thumb_path)) @@ -162,9 +162,9 @@ class MediaView: if not pexists: fexists = 0 - self.mid.set_text(mobj.getId()) + self.mid.set_text(mobj.get_id()) self.mtype.set_text(type_name) - self.mdesc.set_text(mobj.getDescription()) + self.mdesc.set_text(mobj.get_description()) if len(path) == 0 or fexists == 0: self.mpath.set_text(_("The file no longer exists")) elif path[0] == "/": @@ -189,13 +189,13 @@ class MediaView: store,iter = self.selection.get_selected() if iter: id = store.get_value(iter,1) - object = self.db.findObjectNoMap(id) + object = self.db.find_object_from_id(id) self.obj = object Utils.add_menuitem(menu,_("View in the default viewer"),None,self.popup_view_photo) - if object.getMimeType()[0:5] == "image": + if object.get_mime_type()[0:5] == "image": Utils.add_menuitem(menu,_("Edit with the GIMP"),\ None,self.popup_edit_photo) - if object.getLocal() == 0: + if object.get_local() == 0: Utils.add_menuitem(menu,_("Convert to local copy"),None, self.popup_convert_to_private) item = gtk.MenuItem() @@ -225,14 +225,14 @@ class MediaView: def popup_edit_photo(self, obj): if os.fork() == 0: - os.execvp(const.editor,[const.editor, self.obj.getPath()]) + os.execvp(const.editor,[const.editor, self.obj.get_path()]) def popup_convert_to_private(self, obj): - path = self.db.getSavePath() - id = self.obj.getId() - name = RelImage.import_media_object(self.obj.getPath(),path,id) + path = self.db.get_save_path() + id = self.obj.get_id() + name = RelImage.import_media_object(self.obj.get_path(),path,id) if name: - self.obj.setPath(name) + self.obj.set_path(name) self.obj.setLocal(1) def popup_change_description(self, obj): @@ -242,16 +242,16 @@ class MediaView: self.model.clear() self.id2col = {} - objects = self.db.getObjectMap().values() + objects = self.db.get_object_map().values() for src in objects: - title = src.getDescription() - id = src.getId() - type = Utils.get_mime_description(src.getMimeType()) - if src.getLocal(): + title = src.get_description() + id = src.get_id() + type = Utils.get_mime_description(src.get_mime_type()) + if src.get_local(): path = _("") else: - path = src.getPath() + path = src.get_path() stitle = string.upper(title) iter = self.model.append() @@ -271,7 +271,7 @@ class MediaView: list_store, iter = self.selection.get_selected() if iter: id = list_store.get_value(iter,1) - object = self.db.getObject(id) + object = self.db.get_object(id) ImageSelect.GlobalMediaProperties(self.db,object,self.load_media) def on_delete_clicked(self,obj): @@ -280,7 +280,7 @@ class MediaView: return id = store.get_value(iter,1) - mobj = self.db.getObject(id) + mobj = self.db.get_object(id) if self.is_object_used(mobj): ans = ImageSelect.DeleteMediaQuery(mobj,self.db,self.update) QuestionDialog(_('Delete Media Object?'), @@ -291,29 +291,29 @@ class MediaView: _('_Delete Media Object'), ans.query_response) else: - self.db.removeObject(mobj.getId()) + self.db.remove_object(mobj.get_id()) Utils.modified() self.update(0) def is_object_used(self,mobj): - for p in self.db.getFamilyMap().values(): - for o in p.getPhotoList(): - if o.getReference() == mobj: + for p in self.db.get_family_id_map().values(): + for o in p.get_photo_list(): + if o.get_reference() == mobj: return 1 - for key in self.db.getPersonKeys(): - p = self.db.getPerson(key) - for o in p.getPhotoList(): - if o.getReference() == mobj: + for key in self.db.get_person_keys(): + p = self.db.get_person(key) + for o in p.get_photo_list(): + if o.get_reference() == mobj: return 1 - for key in self.db.getSourceKeys(): - p = self.db.getSource(key) - for o in p.getPhotoList(): - if o.getReference() == mobj: + for key in self.db.get_source_keys(): + p = self.db.get_source(key) + for o in p.get_photo_list(): + if o.get_reference() == mobj: return 1 - for key in self.db.getPlaceKeys(): - p = self.db.getPlace(key) - for o in p.getPhotoList(): - if o.getReference() == mobj: + for key in self.db.get_place_id_keys(): + p = self.db.get_place_id(key) + for o in p.get_photo_list(): + if o.get_reference() == mobj: return 1 return 0 @@ -322,9 +322,9 @@ class MediaView: if not iter: return if (const.dnd_images): - object = self.db.getObject(store.get_value(iter,1)) - mtype = object.getMimeType() - name = Utils.thumb_path(self.db.getSavePath(),object) + object = self.db.get_object(store.get_value(iter,1)) + mtype = object.get_mime_type() + name = Utils.thumb_path(self.db.get_save_path(),object) pix = gtk.gdk.pixbuf_new_from_file(name) context.set_icon_pixbuf(pix,0,0) @@ -347,19 +347,19 @@ class MediaView: name = file mime = Utils.get_mime_type(name) photo = RelLib.Photo() - photo.setPath(name) - photo.setMimeType(mime) + photo.set_path(name) + photo.set_mime_type(mime) description = os.path.basename(name) - photo.setDescription(description) - self.db.addObject(photo) + photo.set_description(description) + self.db.add_object(photo) Utils.modified() self.load_media() if GrampsCfg.mediaref == 0: name = RelImage.import_media_object(name, - self.db.getSavePath(), - photo.getId()) + self.db.get_save_path(), + photo.get_id()) if name: - photo.setPath(name) + photo.set_path(name) photo.setLocal(1) Utils.modified() if GrampsCfg.globalprop: @@ -374,22 +374,22 @@ class MediaView: return mime = Utils.get_mime_type(tfile) photo = RelLib.Photo() - photo.setMimeType(mime) - photo.setDescription(d) + photo.set_mime_type(mime) + photo.set_description(d) photo.setLocal(1) - photo.setPath(tfile) - self.db.addObject(photo) + photo.set_path(tfile) + self.db.add_object(photo) oref = RelLib.ObjectRef() - oref.setReference(photo) + oref.set_reference(photo) try: - id = photo.getId() - path = self.db.getSavePath() + id = photo.get_id() + path = self.db.get_save_path() name = RelImage.import_media_object(tfile,path,id) if name: photo.setLocal(1) - photo.setPath(name) + photo.set_path(name) except: - photo.setPath(tfile) + photo.set_path(tfile) return Utils.modified() if GrampsCfg.globalprop: diff --git a/src/MergeData.py b/src/MergeData.py index 6e784ff75..dc12f6cbe 100644 --- a/src/MergeData.py +++ b/src/MergeData.py @@ -67,7 +67,7 @@ class MergePeople: self.altname = self.glade.get_widget("altname") self.altbirth = self.glade.get_widget("altbirth") self.altdeath = self.glade.get_widget("altdeath") - self.family_list = db.getFamilyMap().values() + self.family_list = db.get_family_id_map().values() self.glade.signal_autoconnect({ "on_merge_clicked" : self.on_merge_clicked, @@ -82,20 +82,20 @@ class MergePeople: _("Merge %s and %s") % (fname,mname), _("Merge people")) - f1 = person1.getMainParents() - f2 = person2.getMainParents() + f1 = person1.get_main_parents_family_id() + f2 = person2.get_main_parents_family_id() name1 = GrampsCfg.nameof(person1) - death1 = person1.getDeath().getDate() - dplace1 = self.place_name(person1.getDeath()) - birth1 = person1.getBirth().getDate() - bplace1 = self.place_name(person1.getBirth()) + death1 = person1.get_death().get_date() + dplace1 = self.place_name(person1.get_death()) + birth1 = person1.get_birth().get_date() + bplace1 = self.place_name(person1.get_birth()) name2 = GrampsCfg.nameof(person2) - death2 = person2.getDeath().getDate() - dplace2 = self.place_name(person2.getDeath()) - birth2 = person2.getBirth().getDate() - bplace2 = self.place_name(person2.getBirth()) + death2 = person2.get_death().get_date() + dplace2 = self.place_name(person2.get_death()) + birth2 = person2.get_birth().get_date() + bplace2 = self.place_name(person2.get_birth()) if f2 and not f1: self.glade.get_widget("bfather2").set_active(1) @@ -103,21 +103,21 @@ class MergePeople: self.glade.get_widget("bfather1").set_active(1) if f1: - father1 = name_of(f1.getFather()) - mother1 = name_of(f1.getMother()) + father1 = name_of(f1.get_father_id()) + mother1 = name_of(f1.get_mother_id()) else: father1 = "" mother1 = "" if f2: - father2 = name_of(f2.getFather()) - mother2 = name_of(f2.getMother()) + father2 = name_of(f2.get_father_id()) + mother2 = name_of(f2.get_mother_id()) else: father2 = "" mother2 = "" - self.set_field(self.glade.get_widget("id1_text"),person1.getId()) - self.set_field(self.glade.get_widget("id2_text"),person2.getId()) + self.set_field(self.glade.get_widget("id1_text"),person1.get_id()) + self.set_field(self.glade.get_widget("id2_text"),person2.get_id()) self.set_field(self.glade.get_widget("name1_text"),name1) self.set_field(self.glade.get_widget("name2_text"),name2) @@ -182,17 +182,17 @@ class MergePeople: def build_spouse_list(self,person,widget): widget.clear() - for fam in person.getFamilyList(): - if person.getGender() == RelLib.Person.male: - spouse = fam.getMother() + for fam in person.get_family_id_list(): + if person.get_gender() == RelLib.Person.male: + spouse = fam.get_mother_id() else: - spouse = fam.getFather() + spouse = fam.get_father_id() if spouse == None: name = "unknown" else: sname = GrampsCfg.nameof(spouse) - name = "%s [%s]" % (sname,spouse.getId()) + name = "%s [%s]" % (sname,spouse.get_id()) widget.add([name]) def set_field(self,widget,value): @@ -200,9 +200,9 @@ class MergePeople: widget.set_text(value) def place_name(self,event): - place = event.getPlace() + place = event.get_place_id() if place: - return "%s (%s)" % (place.get_title(),place.getId()) + return "%s (%s)" % (place.get_title(),place.get_id()) else: return "" @@ -216,168 +216,168 @@ class MergePeople: EditPerson.EditPerson(self.p1,self.db,self.ep_update) def copy_note(self,one,two): - if one.getNote() != two.getNote(): - one.setNote("%s\n\n%s" % (one.getNote(),two.getNote())) + if one.get_note() != two.get_note(): + one.set_note("%s\n\n%s" % (one.get_note(),two.get_note())) def copy_sources(self,one,two): - slist = one.getSourceRefList()[:] - for xsrc in two.getSourceRefList(): + slist = one.get_source_references()[:] + for xsrc in two.get_source_references(): for src in slist: if src.are_equal(xsrc): break else: - one.addSourceRef(xsrc) + one.add_source_reference(xsrc) def on_merge_clicked(self,obj): Utils.modified() - list = self.p1.getAlternateNames()[:] - for xdata in self.p2.getAlternateNames(): + list = self.p1.get_alternate_names()[:] + for xdata in self.p2.get_alternate_names(): for data in list: if data.are_equal(xdata): self.copy_note(xdata,data) self.copy_sources(xdata,data) break else: - self.p1.addAlternateName(xdata) + self.p1.add_alternate_name(xdata) - list = self.p1.getAttributeList()[:] - for xdata in self.p2.getAttributeList(): + list = self.p1.get_attribute_list()[:] + for xdata in self.p2.get_attribute_list(): for data in list: - if data.getType() == xdata.getType() and \ - data.getValue() == xdata.getValue(): + if data.get_type() == xdata.get_type() and \ + data.getValue() == xdata.get_value(): self.copy_note(xdata,data) self.copy_sources(xdata,data) break else: - self.p1.addAttribute(xdata) + self.p1.add_attribute(xdata) - list = self.p1.getEventList()[:] - for xdata in self.p2.getEventList(): + list = self.p1.get_event_list()[:] + for xdata in self.p2.get_event_list(): for data in list: if data.are_equal(xdata): self.copy_note(xdata,data) self.copy_sources(xdata,data) break else: - self.p1.addEvent(xdata) + self.p1.add_event(xdata) - list = self.p1.getUrlList()[:] - for xdata in self.p2.getUrlList(): + list = self.p1.get_url_list()[:] + for xdata in self.p2.get_url_list(): for data in list: if data.are_equal(xdata): break else: - self.p1.addUrl(xdata) + self.p1.add_url(xdata) self.id2 = self.glade.get_widget("id2") - old_id = self.p1.getId() + old_id = self.p1.get_id() if self.id2.get_active(): - self.p1.setId(self.p2.getId()) + self.p1.set_id(self.p2.get_id()) if self.bname1.get_active(): if self.altname.get_active(): - self.p1.addAlternateName(self.p2.getPrimaryName()) + self.p1.add_alternate_name(self.p2.get_primary_name()) else: if self.altname.get_active(): - self.p1.addAlternateName(self.p1.getPrimaryName()) - self.p1.setPrimaryName(self.p2.getPrimaryName()) + self.p1.add_alternate_name(self.p1.get_primary_name()) + self.p1.set_primary_name(self.p2.get_primary_name()) alt = self.glade.get_widget("altbirth").get_active() if self.glade.get_widget("bbirth2").get_active(): if alt: - event = self.p1.getBirth() - event.setName("Alternate Birth") - self.p1.addEvent(event) - self.p1.setBirth(self.p2.getBirth()) + event = self.p1.get_birth() + event.set_name("Alternate Birth") + self.p1.add_event(event) + self.p1.set_birth(self.p2.get_birth()) else: if alt: - event = self.p2.getBirth() - event.setName("Alternate Birth") - self.p1.addEvent(event) + event = self.p2.get_birth() + event.set_name("Alternate Birth") + self.p1.add_event(event) alt = self.glade.get_widget("altdeath").get_active() if self.glade.get_widget("bbirth2").get_active(): if alt: - event = self.p1.getDeath() - event.setName("Alternate Death") - self.p1.addEvent(event) - self.p1.setDeath(self.p2.getDeath()) + event = self.p1.get_death() + event.set_name("Alternate Death") + self.p1.add_event(event) + self.p1.set_death(self.p2.get_death()) else: if alt: - event = self.p2.getDeath() - event.setName("Alternate Death") - self.p1.addEvent(event) + event = self.p2.get_death() + event.set_name("Alternate Death") + self.p1.add_event(event) if self.glade.get_widget("bfather2").get_active(): - orig_family = self.p1.getMainParents() + orig_family = self.p1.get_main_parents_family_id() if orig_family: - orig_family.removeChild(self.p1) - self.p1.removeAltFamily(orig_family) + orig_family.remove_child_id(self.p1) + self.p1.remove_parent_family_id(orig_family) - (source_family,mrel,frel) = self.p2.getMainParentsRel() - self.p1.setMainParents(source_family) + (source_family,mrel,frel) = self.p2.get_main_parents_family_idRel() + self.p1.set_main_parent_family_id(source_family) if source_family: - if self.p2 in source_family.getChildList(): - source_family.removeChild(self.p2) - self.p2.removeAltFamily(source_family) - if self.p1 not in source_family.getChildList(): - source_family.addChild(self.p1) - self.p1.addAltFamily(source_family,mrel,frel) + if self.p2 in source_family.get_child_id_list(): + source_family.remove_child_id(self.p2) + self.p2.remove_parent_family_id(source_family) + if self.p1 not in source_family.get_child_id_list(): + source_family.add_child_id(self.p1) + self.p1.add_parent_family_id(source_family.get_id(),mrel,frel) else: - source_family = self.p2.getMainParents() + source_family = self.p2.get_main_parents_family_id() if source_family: - source_family.removeChild(self.p2) - self.p2.setMainParents(None) + source_family.remove_child_id(self.p2) + self.p2.set_main_parent_family_id(None) self.merge_families() - for photo in self.p2.getPhotoList(): - self.p1.addPhoto(photo) + for photo in self.p2.get_photo_list(): + self.p1.add_photo(photo) - if self.p1.getNickName() == "": - self.p1.setNickName(self.p2.getNickName()) + if self.p1.get_nick_name() == "": + self.p1.set_nick_name(self.p2.get_nick_name()) - if self.p2.getNote() != "": - old_note = self.p1.getNote() + if self.p2.get_note() != "": + old_note = self.p1.get_note() if old_note: old_note = old_note + "\n\n" - self.p1.setNote(old_note + self.p2.getNote()) + self.p1.set_note(old_note + self.p2.get_note()) try: - self.db.removePerson(self.p2.getId()) - self.db.personMap[self.p1.getId()] = self.p1 - self.db.buildPersonDisplay(self.p1.getId(),old_id) + self.db.remove_person_id(self.p2.get_id()) + self.db.personMap[self.p1.get_id()] = self.p1 + self.db.build_person_display(self.p1.get_id(),old_id) except: print "%s is not in the person map!" % (GrampsCfg.nameof(self.p2)) self.update(self.p1,self.p2,old_id) Utils.destroy_passed_object(self.top) def find_family(self,family): - if self.p1.getGender() == RelLib.Person.male: - mother = family.getMother() + if self.p1.get_gender() == RelLib.Person.male: + mother = family.get_mother_id() father = self.p1 else: - father = family.getFather() + father = family.get_father_id() mother = self.p1 for myfamily in self.family_list: - if myfamily.getFather() == father and myfamily.getMother() == mother: + if myfamily.get_father_id() == father and myfamily.get_mother_id() == mother: return myfamily return None def merge_families(self): family_num = 0 - mylist = self.p2.getFamilyList()[:] + mylist = self.p2.get_family_id_list()[:] for src_family in mylist: family_num = family_num + 1 - if not self.db.getFamilyMap().has_key(src_family.getId()): + if not self.db.get_family_id_map().has_key(src_family.get_id()): continue - if src_family in self.p1.getFamilyList(): + if src_family in self.p1.get_family_id_list(): continue tgt_family = self.find_family(src_family) @@ -389,22 +389,22 @@ class MergePeople: # family (with the pre-merge identity of the p1) from # both the parents # - if tgt_family in self.p1.getFamilyList(): - if tgt_family.getFather() != None and \ - src_family in tgt_family.getFather().getFamilyList(): - tgt_family.getFather().removeFamily(src_family) - if tgt_family.getMother() != None and \ - src_family in tgt_family.getMother().getFamilyList(): - tgt_family.getMother().removeFamily(src_family) + if tgt_family in self.p1.get_family_id_list(): + if tgt_family.get_father_id() != None and \ + src_family in tgt_family.get_father_id().get_family_id_list(): + tgt_family.get_father_id().remove_family_id(src_family) + if tgt_family.get_mother_id() != None and \ + src_family in tgt_family.get_mother_id().get_family_id_list(): + tgt_family.get_mother_id().remove_family_id(src_family) # copy children from source to target - for child in src_family.getChildList(): - if child not in tgt_family.getChildList(): - parents = child.getParentList() - tgt_family.addChild(child) - if child.getMainParents() == src_family: - child.setMainParents(tgt_family) + for child in src_family.get_child_id_list(): + if child not in tgt_family.get_child_id_list(): + parents = child.get_parent_family_id_list() + tgt_family.add_child_id(child) + if child.get_main_parents_family_id() == src_family: + child.set_main_parent_family_id(tgt_family) i = 0 for fam in parents[:]: if fam[0] == src_family: @@ -412,7 +412,7 @@ class MergePeople: i = i + 1 # delete the old source family - del self.db.getFamilyMap()[src_family.getId()] + del self.db.get_family_id_map()[src_family.get_id()] continue @@ -428,12 +428,12 @@ class MergePeople: # transfer child to new family, alter children to # point to the correct family - for child in src_family.getChildList(): - if child not in tgt_family.getChildList(): - parents = child.getParentList() - tgt_family.addChild(child) - if child.getMainParents() == src_family: - child.setMainParents(tgt_family) + for child in src_family.get_child_id_list(): + if child not in tgt_family.get_child_id_list(): + parents = child.get_parent_family_id_list() + tgt_family.add_child_id(child) + if child.get_main_parents_family_id() == src_family: + child.set_main_parent_family_id(tgt_family) i = 0 for fam in parents[:]: if fam[0] == src_family: @@ -441,87 +441,87 @@ class MergePeople: i = i + 1 # add family events from the old to the new - for event in src_family.getEventList(): - tgt_family.addEvent(event) + for event in src_family.get_event_list(): + tgt_family.add_event(event) # change parents of the family to point to the new # family - if src_family.getFather(): - src_family.getFather().removeFamily(src_family) - src_family.getFather().addFamily(tgt_family) + if src_family.get_father_id(): + src_family.get_father_id().remove_family_id(src_family.get_id()) + src_family.get_father_id().add_family_id(tgt_family.get_id()) - if src_family.getMother(): - src_family.getMother().removeFamily(src_family) - src_family.getMother().addFamily(tgt_family) + if src_family.get_mother_id(): + src_family.get_mother_id().remove_family_id(src_family.get_id()) + src_family.get_mother_id().add_family_id(tgt_family.get_id()) - del self.db.getFamilyMap()[src_family.getId()] + del self.db.get_family_id_map()[src_family.get_id()] else: - if src_family not in self.p1.getFamilyList(): - self.p1.addFamily(src_family) - if self.p1.getGender() == RelLib.Person.male: - src_family.setFather(self.p1) + if src_family not in self.p1.get_family_id_list(): + self.p1.add_family_id(src_family) + if self.p1.get_gender() == RelLib.Person.male: + src_family.set_father_id(self.p1) else: - src_family.setMother(self.p1) + src_family.set_mother_id(self.p1) self.remove_marriage(src_family,self.p2) # a little debugging here - for fam in self.db.getFamilyMap().values(): - if self.p2 in fam.getChildList(): - fam.removeChild(self.p2) - fam.addChild(self.p1) - if self.p2 == fam.getFather(): - fam.setFather(self.p1) - if self.p2 == fam.getMother(): - fam.setMother(self.p1) - if fam.getFather() == None and fam.getMother() == None: + for fam in self.db.get_family_id_map().values(): + if self.p2 in fam.get_child_id_list(): + fam.remove_child_id(self.p2) + fam.add_child_id(self.p1) + if self.p2 == fam.get_father_id(): + fam.set_father_id(self.p1) + if self.p2 == fam.get_mother_id(): + fam.set_mother_id(self.p1) + if fam.get_father_id() == None and fam.get_mother_id() == None: self.delete_empty_family(fam) def remove_marriage(self,family,person): if person: - person.removeFamily(family) - if family.getFather() == None and family.getMother() == None: + person.remove_family_id(family) + if family.get_father_id() == None and family.get_mother_id() == None: self.delete_empty_family(family) - def delete_empty_family(self,family): - for child in family.getChildList(): - if child.getMainParents() == family: - child.setMainParents(None) + def delete_empty_family(self,family_id): + for child in family.get_child_id_list(): + if child.get_main_parents_family_id() == family_id: + child.set_main_parent_family_id(None) else: - child.removeAltFamily(family) - self.db.deleteFamily(family) + child.remove_parent_family_id(family_id) + self.db.delete_family(family_id) def compare_people(p1,p2): - name1 = p1.getPrimaryName() - name2 = p2.getPrimaryName() + name1 = p1.get_primary_name() + name2 = p2.get_primary_name() chance = name_match(name1,name2) if chance == -1.0 : return -1.0 - birth1 = p1.getBirth() - death1 = p1.getDeath() - birth2 = p2.getBirth() - death2 = p2.getDeath() + birth1 = p1.get_birth() + death1 = p1.get_death() + birth2 = p2.get_birth() + death2 = p2.get_death() - value = date_match(birth1.getDateObj(),birth2.getDateObj()) + value = date_match(birth1.get_date_object(),birth2.get_date_object()) if value == -1.0 : return -1.0 chance = chance + value - value = date_match(death1.getDateObj(),death2.getDateObj()) + value = date_match(death1.get_date_object(),death2.get_date_object()) if value == -1.0 : return -1.0 chance = chance + value - value = place_match(birth1.getPlace(),birth2.getPlace()) + value = place_match(birth1.get_place_id(),birth2.get_place_id()) if value == -1.0 : return -1.0 chance = chance + value - value = place_match(death1.getPlace(),death2.getPlace()) + value = place_match(death1.get_place_id(),death2.get_place_id()) if value == -1.0 : return -1.0 chance = chance + value @@ -536,16 +536,16 @@ def compare_people(p1,p2): if p1 in ancestors: return -1.0 - f1 = p1.getMainParents() - f2 = p2.getMainParents() + f1 = p1.get_main_parents_family_id() + f2 = p2.get_main_parents_family_id() - if f1 and f1.getFather(): - dad1 = f1.getFather().getPrimaryName() + if f1 and f1.get_father_id(): + dad1 = f1.get_father_id().get_primary_name() else: dad1 = None - if f2 and f2.getFather(): - dad2 = f2.getFather().getPrimaryName() + if f2 and f2.get_father_id(): + dad2 = f2.get_father_id().get_primary_name() else: dad2 = None @@ -556,13 +556,13 @@ def compare_people(p1,p2): chance = chance + value - if f1 and f1.getMother(): - mom1 = f1.getMother().getPrimaryName() + if f1 and f1.get_mother_id(): + mom1 = f1.get_mother_id().get_primary_name() else: mom1 = None - if f2 and f2.getMother(): - mom2 = f2.getMother().getPrimaryName() + if f2 and f2.get_mother_id(): + mom2 = f2.get_mother_id().get_primary_name() else: mom2 = None @@ -572,11 +572,11 @@ def compare_people(p1,p2): chance = chance + value - for f1 in p1.getFamilyList(): - for f2 in p2.getFamilyList(): - if p1.getGender() == RelLib.Person.female: - father1 = f1.getFather() - father2 = f2.getFather() + for f1 in p1.get_family_id_list(): + for f2 in p2.get_family_id_list(): + if p1.get_gender() == RelLib.Person.female: + father1 = f1.get_father_id() + father2 = f2.get_father_id() if father1 and father2: if father1 == father2: chance = chance + 1.0 @@ -587,8 +587,8 @@ def compare_people(p1,p2): if value != -1.0: chance = chance + value else: - mother1 = f1.getMother() - mother2 = f2.getMother() + mother1 = f1.get_mother_id() + mother2 = f2.get_mother_id() if mother1 and mother2: if mother1 == mother2: chance = chance + 1.0 @@ -615,9 +615,9 @@ def name_compare(s1,s2): # #----------------------------------------------------------------- def date_match(date1,date2): - if date1.getDate() == "" or date2.getDate() == "": + if date1.get_date() == "" or date2.get_date() == "": return 0.0 - if date1.getDate() == date2.getDate(): + if date1.get_date() == date2.get_date(): return 1.0 if date1.isRange() or date2.isRange(): @@ -676,10 +676,10 @@ def name_match(name,name1): if not name1 or not name: return 0 - srn1 = name.getSurname() - sfx1 = name.getSuffix() - srn2 = name1.getSurname() - sfx2 = name1.getSuffix() + srn1 = name.get_surname() + sfx1 = name.get_suffix() + srn2 = name1.get_surname() + sfx2 = name1.get_suffix() if not name_compare(srn1,srn2): return -1 @@ -687,11 +687,11 @@ def name_match(name,name1): if sfx1 != "" and sfx2 != "": return -1 - if name.getFirstName() == name1.getFirstName(): + if name.get_first_name() == name1.get_first_name(): return 1 else: - list1 = string.split(name.getFirstName()) - list2 = string.split(name1.getFirstName()) + list1 = string.split(name.get_first_name()) + list2 = string.split(name1.get_first_name()) if len(list1) < len(list2): return list_reduce(list1,list2) @@ -788,10 +788,10 @@ def ancestors_of(p1,list): if p1 == None: return list.append(p1) - f1 = p1.getMainParents() + f1 = p1.get_main_parents_family_id() if f1 != None: - ancestors_of(f1.getFather(),list) - ancestors_of(f1.getMother(),list) + ancestors_of(f1.get_father_id(),list) + ancestors_of(f1.get_mother_id(),list) #--------------------------------------------------------------------- # @@ -801,7 +801,7 @@ def ancestors_of(p1,list): def name_of(p): if not p: return "" - return "%s (%s)" % (GrampsCfg.nameof(p),p.getId()) + return "%s (%s)" % (GrampsCfg.nameof(p),p.get_id()) #------------------------------------------------------------------------- # @@ -838,7 +838,7 @@ class MergePlaces: """ t2active = self.glade.get_widget("title2").get_active() - old_id = self.p1.getId() + old_id = self.p1.get_id() if t2active: self.p1.set_title(self.p2.get_title()) @@ -854,24 +854,24 @@ class MergePlaces: self.p1.set_latitude(self.p2.get_latitude()) # Add URLs from P2 to P1 - for url in self.p2.getUrlList(): - self.p1.addUrl(url) + for url in self.p2.get_url_list(): + self.p1.add_url(url) # Copy photos from P2 to P1 - for photo in self.p2.getPhotoList(): - self.p1.addPhoto(photo) + for photo in self.p2.get_photo_list(): + self.p1.add_photo(photo) # Copy sources from P2 to P1 - for source in self.p2.getSourceRefList(): - self.p1.addSource(source) + for source in self.p2.get_source_references(): + self.p1.add_source(source) # Add notes from P2 to P1 - note = self.p2.getNote() + note = self.p2.get_note() if note != "": - if self.p1.getNote() == "": - self.p1.setNote(note) - elif self.p1.getNote() != note: - self.p1.setNote("%s\n\n%s" % (self.p1.getNote(),note)) + if self.p1.get_note() == "": + self.p1.set_note(note) + elif self.p1.get_note() != note: + self.p1.set_note("%s\n\n%s" % (self.p1.get_note(),note)) if t2active: list = [self.p1.get_main_location()] + self.p1.get_alternate_locations() @@ -886,22 +886,22 @@ class MergePlaces: self.p1.add_alternate_locations(l) # loop through people, changing event references to P2 to P1 - for key in self.db.getPersonKeys(): - p = self.db.getPerson(key) - for event in [p.getBirth(), p.getDeath()] + p.getEventList(): - if event.getPlace() == self.p2: - event.setPlace(self.p1) + for key in self.db.get_person_keys(): + p = self.db.get_person(key) + for event in [p.get_birth(), p.get_death()] + p.get_event_list(): + if event.get_place_id() == self.p2: + event.set_place_id(self.p1) # loop through families, changing event references to P2 to P1 - for f in self.db.getFamilyMap().values(): - for event in f.getEventList(): - if event.getPlace() == self.p2: - event.setPlace(self.p1) + for f in self.db.get_family_id_map().values(): + for event in f.get_event_list(): + if event.get_place_id() == self.p2: + event.set_place_id(self.p1) - self.db.removePlace(self.p2.getId()) - self.db.buildPlaceDisplay(self.p1.getId(),old_id) + self.db.remove_place(self.p2.get_id()) + self.db.build_place_display(self.p1.get_id(),old_id) - self.update(self.p1.getId()) + self.update(self.p1.get_id()) Utils.modified() Utils.destroy_passed_object(obj) diff --git a/src/NameEdit.py b/src/NameEdit.py index de29b2319..4b6453717 100644 --- a/src/NameEdit.py +++ b/src/NameEdit.py @@ -63,7 +63,7 @@ class NameEditor: self.note_field = self.top.get_widget("alt_note") self.slist = self.top.get_widget('slist') slist = self.top.get_widget("alt_surname_list") - self.combo = AutoComp.AutoCombo(slist,self.parent.db.getSurnames()) + self.combo = AutoComp.AutoCombo(slist,self.parent.db.get_surnames()) self.priv = self.top.get_widget("priv") self.sources_label = self.top.get_widget("sourcesName") self.notes_label = self.top.get_widget("noteName") @@ -76,11 +76,11 @@ class NameEditor: self.typecomp = AutoComp.AutoEntry(self.type_field.entry,types) if self.name: - self.srcreflist = self.name.getSourceRefList() + self.srcreflist = self.name.get_source_references() else: self.srcreflist = [] - full_name = parent.person.getPrimaryName().getName() + full_name = parent.person.get_primary_name().get_name() alt_title = self.top.get_widget("title") @@ -105,16 +105,16 @@ class NameEditor: }) if name != None: - self.given_field.set_text(name.getFirstName()) - self.surname_field.set_text(name.getSurname()) - self.title_field.set_text(name.getTitle()) - self.suffix_field.set_text(name.getSuffix()) - self.type_field.entry.set_text(_(name.getType())) - self.priv.set_active(name.getPrivacy()) - if name.getNote(): - self.note_buffer.set_text(name.getNote()) + self.given_field.set_text(name.get_first_name()) + self.surname_field.set_text(name.get_surname()) + self.title_field.set_text(name.get_title()) + self.suffix_field.set_text(name.get_suffix()) + self.type_field.entry.set_text(_(name.get_type())) + self.priv.set_active(name.get_privacy()) + if name.get_note(): + self.note_buffer.set_text(name.get_note()) Utils.bold_label(self.notes_label) - if name.getNoteFormat() == 1: + if name.get_note_format() == 1: self.preform.set_active(1) else: self.flowed.set_active(1) @@ -152,7 +152,7 @@ class NameEditor: self.name = RelLib.Name() self.parent.nlist.append(self.name) - self.name.setSourceRefList(self.srcreflist) + self.name.set_source_reference_list(self.srcreflist) self.update_name(first,last,suffix,title,type,note,format,priv) self.parent.lists_changed = 1 @@ -161,37 +161,37 @@ class NameEditor: def update_name(self,first,last,suffix,title,type,note,format,priv): - if self.name.getFirstName() != first: - self.name.setFirstName(first) + if self.name.get_first_name() != first: + self.name.set_first_name(first) self.parent.lists_changed = 1 - if self.name.getSurname() != last: - self.name.setSurname(last) - self.parent.db.addSurname(last) + if self.name.get_surname() != last: + self.name.set_surname(last) + self.parent.db.add_surname(last) self.parent.lists_changed = 1 - if self.name.getSuffix() != suffix: - self.name.setSuffix(suffix) + if self.name.get_suffix() != suffix: + self.name.set_suffix(suffix) self.parent.lists_changed = 1 - if self.name.getTitle() != title: - self.name.setTitle(title) + if self.name.get_title() != title: + self.name.set_title(title) self.parent.lists_changed = 1 - if self.name.getType() != type: - self.name.setType(type) + if self.name.get_type() != type: + self.name.set_type(type) self.parent.lists_changed = 1 - if self.name.getNote() != note: - self.name.setNote(note) + if self.name.get_note() != note: + self.name.set_note(note) self.parent.lists_changed = 1 - if self.name.getNoteFormat() != format: - self.name.setNoteFormat(format) + if self.name.get_note_format() != format: + self.name.set_note_format(format) self.parent.lists_changed = 1 - if self.name.getPrivacy() != priv: - self.name.setPrivacy(priv) + if self.name.get_privacy() != priv: + self.name.set_privacy(priv) self.parent.lists_changed = 1 def on_switch_page(self,obj,a,page): diff --git a/src/NoteEdit.py b/src/NoteEdit.py index 8960128d2..e7cd3fb46 100644 --- a/src/NoteEdit.py +++ b/src/NoteEdit.py @@ -72,7 +72,7 @@ class NoteEditor: scroll.show() vbox.pack_start(scroll, gtk.TRUE, gtk.TRUE, 0) - self.entry.get_buffer().set_text(self.data.getNote()) + self.entry.get_buffer().set_text(self.data.get_note()) self.top.add_button(gtk.STOCK_CANCEL,1) self.top.add_button(gtk.STOCK_OK,0) @@ -89,6 +89,6 @@ class NoteEditor: buffer = self.entry.get_buffer() text = unicode(buffer.get_text(buffer.get_start_iter(), buffer.get_end_iter(),gtk.FALSE)) - if text != self.data.getNote(): - self.data.setNote(text) + if text != self.data.get_note(): + self.data.set_note(text) Utils.modified() diff --git a/src/PedView.py b/src/PedView.py index f38bbd5fa..141b79917 100644 --- a/src/PedView.py +++ b/src/PedView.py @@ -37,7 +37,7 @@ import pango #------------------------------------------------------------------------- import GrampsCfg from gettext import gettext as _ -from Relationship import apply_filter +#from Relationship import apply_filter _PAD = 3 _CANVASPAD = 3 @@ -60,8 +60,8 @@ class DispBox: self.root = root self.name = GrampsCfg.nameof(person) - bd = person.getBirth().getDate() - dd = person.getDeath().getDate() + bd = person.get_birth().get_date() + dd = person.get_death().get_date() if bd and dd: self.exp = "%s\n%s %s\n%s %s" % (self.name,_BORN,bd,_DIED,dd ) elif bd: @@ -196,8 +196,8 @@ class PedigreeView: for t in list: if t: for n in [GrampsCfg.nameof(t[0]), - u'%s %s' % (_BORN,t[0].getBirth().getDate()), - u'%s %s' % (_DIED,t[0].getDeath().getDate())]: + u'%s %s' % (_BORN,t[0].get_birth().get_date()), + u'%s %s' % (_DIED,t[0].get_death().get_date())]: try: a.set_text(n,len(n)) except TypeError: @@ -233,8 +233,9 @@ class PedigreeView: anchor=gtk.ANCHOR_WEST) self.canvas_items.append(self.anchor_txt) - for family in self.active_person.getFamilyList(): - if len(family.getChildList()) > 0: + for family_id in self.active_person.get_family_id_list(): + family = self.parent.db.find_family_from_id(family_id) + if len(family.get_child_id_list()) > 0: button,arrow = self.make_arrow_button(gtk.ARROW_LEFT, self.on_show_child_menu) item = self.root.add(gnome.canvas.CanvasWidget, widget=button, @@ -323,7 +324,7 @@ class PedigreeView: def make_anchor_label(self): """Make a label containing the name of the anchored person""" if self.anchor: - anchor_string = self.anchor.getPrimaryName().getRegularName() + anchor_string = self.anchor.get_primary_name().get_regular_name() return "%s: %s" % (_("Anchor"),anchor_string) else: return "" @@ -338,8 +339,9 @@ class PedigreeView: def find_children(p): childlist = [] - for family in p.getFamilyList(): - for child in family.getChildList(): + for family_id in p.get_family_id_list(): + family = self.parent.db.find_family_from_id(family_id) + for child in family.get_child_id_list(): childlist.append(child) return childlist @@ -450,18 +452,22 @@ class PedigreeView: if depth > 5 or person == None: return - (family,m,f) = person.getMainParentsRel() - if family: + + (family_id,m,f) = person.get_main_parents_family_idRel() + if family_id: mrel = (m != "Birth") frel = (f != "Birth") - + + family = self.parent.db.find_family_from_id(family_id) list[index] = (person,val) if family != None: - father = family.getFather() - if father != None: + father_id = family.get_father_id() + if father_id != None: + father = self.parent.db.find_person_from_id(father_id) self.find_tree(father,(2*index)+1,depth+1,list,frel) - mother = family.getMother() - if mother != None: + mother_id = family.get_mother_id() + if mother_id != None: + mother = self.parent.db.find_person_from_id(mother_id) self.find_tree(mother,(2*index)+2,depth+1,list,mrel) def on_canvas1_event(self,obj,event): @@ -539,6 +545,9 @@ def get_distance(orig_person,other_person): if orig_person == other_person: return 0 + return 0 + # FIX THIS + try: apply_filter(orig_person,0,firstList,firstMap) apply_filter(other_person,0,secondList,secondMap) @@ -547,7 +556,7 @@ def get_distance(orig_person,other_person): for person in firstList: if person in secondList: - new_rank = firstMap[person.getId()] + new_rank = firstMap[person.get_id()] if new_rank < rank: rank = new_rank common = [ person ] @@ -563,8 +572,8 @@ def get_distance(orig_person,other_person): length = len(common) person = common[0] - secondRel = secondMap[person.getId()] - firstRel = firstMap[person.getId()] + secondRel = secondMap[person.get_id()] + firstRel = firstMap[person.get_id()] if firstRel == None or secondRel == None: return None return firstRel-secondRel diff --git a/src/PeopleView.py b/src/PeopleView.py index 33a270216..da2ff1f5c 100644 --- a/src/PeopleView.py +++ b/src/PeopleView.py @@ -86,7 +86,7 @@ class PeopleView: mlist = self.person_tree.get_selected_objects() if mlist and mlist[0]: try: - self.parent.change_active_person(self.parent.db.getPerson(mlist[0])) + self.parent.change_active_person(self.parent.db.get_person(mlist[0])) except: self.parent.change_active_person(None) self.person_tree.unselect() @@ -141,7 +141,7 @@ class PeopleView: model.clear() def remove_from_person_list(self,person,old_id=None): - pid = person.getId() + pid = person.get_id() if old_id: del_id = old_id else: @@ -157,7 +157,7 @@ class PeopleView: self.parent.active_person = None def remove_from_history(self,person,old_id=None): - pid = person.getId() + pid = person.get_id() if old_id: del_id = old_id else: @@ -185,8 +185,8 @@ class PeopleView: self.goto_active_person() def add_to_person_list(self,person,change): - key = person.getId() - val = self.parent.db.getPersonDisplay(person.getId()) + key = person.get_id() + val = self.parent.db.get_person_display(person.get_id()) pg = unicode(val[5]) pg = pg[0] model = None @@ -223,8 +223,8 @@ class PeopleView: self.ptabs.set_current_page(page) return - id = self.parent.active_person.getId() - val = self.parent.db.getPersonDisplay(id) + id = self.parent.active_person.get_id() + val = self.parent.db.get_person_display(id) if self.id2col.has_key(id): (model,iter) = self.id2col[id] else: @@ -274,9 +274,9 @@ class PeopleView: if current_model == None: self.id2col = {} - for key in self.parent.db.sortPersonKeys(): - person = self.parent.db.getPerson(key) - val = self.parent.db.getPersonDisplay(key) + for key in self.parent.db.sort_person_keys(): + person = self.parent.db.get_person(key) + val = self.parent.db.get_person_display(key) pg = val[5] if pg and pg != '@': pg = pg[0] @@ -405,7 +405,7 @@ class PeopleView: self.add_to_person_list(person,1) def update_person_list(self,person,old_id): - key = person.getId() + key = person.get_id() if old_id != key: (model,iter) = self.id2col[old_id] del self.id2col[old_id] @@ -413,7 +413,7 @@ class PeopleView: else: (model,iter) = self.id2col[key] - val = self.parent.db.getPersonDisplay(person.getId()) + val = self.parent.db.get_person_display(person.get_id()) pg = unicode(val[5])[0] if self.DataFilter.compare(person): col = 0 diff --git a/src/PlaceView.py b/src/PlaceView.py index 63541fd7e..7cdc51a76 100644 --- a/src/PlaceView.py +++ b/src/PlaceView.py @@ -121,8 +121,8 @@ class PlaceView: gobject.TYPE_STRING) self.id2col = {} - for key in self.db.sortPlaceKeys(): - val = self.db.getPlaceDisplay(key) + for key in self.db.sort_place_keys(): + val = self.db.get_place_display(key) iter = self.model.append() self.id2col[key] = iter @@ -197,12 +197,12 @@ class PlaceView: menu.popup(None,None,None,event.button,event.time) def new_place_after_edit(self,place): - self.db.addPlace(place) + self.db.add_place(place) self.update(0) def update_display(self,place): if place: - self.db.buildPlaceDisplay(place.getId()) + self.db.build_place_display(place.get_id()) self.update(0) def on_add_place_clicked(self,obj): @@ -214,25 +214,25 @@ class PlaceView: for place in mlist: used = 0 - for key in self.db.getPersonKeys(): - p = self.db.getPerson(key) - event_list = [p.getBirth(), p.getDeath()] + p.getEventList()[:] - if p.getLdsBaptism(): - event_list.append(p.getLdsBaptism()) - if p.getLdsEndowment(): - event_list.append(p.getLdsEndowment()) - if p.getLdsSeal(): - event_list.append(p.getLdsSeal()) + for key in self.db.get_person_keys(): + p = self.db.get_person(key) + event_list = [p.get_birth(), p.get_death()] + p.get_event_list()[:] + if p.get_lds_baptism(): + event_list.append(p.get_lds_baptism()) + if p.get_lds_endowment(): + event_list.append(p.get_lds_endowment()) + if p.get_lds_sealing(): + event_list.append(p.get_lds_sealing()) for event in event_list: - if event.getPlace() == place: + if event.get_place_id() == place: used = 1 - for f in self.db.getFamilyMap().values(): - event_list = f.getEventList()[:] - if f.getLdsSeal(): - event_list.append(f.getLdsSeal()) + for f in self.db.get_family_id_map().values(): + event_list = f.get_event_list()[:] + if f.get_lds_sealing(): + event_list.append(f.get_lds_sealing()) for event in event_list: - if event.getPlace() == place: + if event.get_place_id() == place: used = 1 if used == 1: @@ -245,7 +245,7 @@ class PlaceView: _('_Delete Place'), ans.query_response) else: - self.db.removePlace(place.getId()) + self.db.remove_place(place.get_id()) self.update(0) Utils.modified() @@ -258,5 +258,5 @@ class PlaceView: EditPlace.EditPlace(self, place, self.update_display) def blist(self,store,path,iter,list): - id = self.db.getPlace(store.get_value(iter,1)) + id = self.db.get_place_id(store.get_value(iter,1)) list.append(id) diff --git a/src/Plugins.py b/src/Plugins.py index 92eed37dd..4d6261289 100644 --- a/src/Plugins.py +++ b/src/Plugins.py @@ -89,8 +89,6 @@ _bkitems = [] #------------------------------------------------------------------------- import Relationship -_relcalc_task = Relationship.get_relationship - #------------------------------------------------------------------------- # # @@ -545,10 +543,8 @@ def register_relcalc(func, languages): except: pass -def relationship_function(): - global _relcalc_task - return _relcalc_task - +def relationship_function(db): + return Relationship.RelationshipCalculator(db) #------------------------------------------------------------------------- # diff --git a/src/ReadXML.py b/src/ReadXML.py index 1604f5784..68727b4a0 100644 --- a/src/ReadXML.py +++ b/src/ReadXML.py @@ -145,34 +145,34 @@ def importData(database, filename, callback,cl=0): def remove_clicked(): # File is lost => remove all references and the object itself mobj = ObjectMap[NewMediaID] - for p in database.getFamilyMap().values(): - nl = p.getPhotoList() + for p in database.get_family_id_map().values(): + nl = p.get_photo_list() for o in nl: - if o.getReference() == mobj: + if o.get_reference() == mobj: nl.remove(o) - p.setPhotoList(nl) - for key in database.getPersonKeys(): - p = database.getPerson(key) - nl = p.getPhotoList() + p.set_photo_list(nl) + for key in database.get_person_keys(): + p = database.get_person(key) + nl = p.get_photo_list() for o in nl: - if o.getReference() == mobj: + if o.get_reference() == mobj: nl.remove(o) - p.setPhotoList(nl) - for key in database.getSourceKeys(): - p = database.getSource(key) - nl = p.getPhotoList() + p.set_photo_list(nl) + for key in database.get_source_keys(): + p = database.get_source(key) + nl = p.get_photo_list() for o in nl: - if o.getReference() == mobj: + if o.get_reference() == mobj: nl.remove(o) - p.setPhotoList(nl) - for key in database.getPlaceKeys(): - p = database.getPlace(key) - nl = p.getPhotoList() + p.set_photo_list(nl) + for key in database.get_place_id_keys(): + p = database.get_place_id(key) + nl = p.get_photo_list() for o in nl: - if o.getReference() == mobj: + if o.get_reference() == mobj: nl.remove(o) - p.setPhotoList(nl) - database.removeObject(NewMediaID) + p.set_photo_list(nl) + database.remove_object(NewMediaID) def leave_clicked(): @@ -204,15 +204,15 @@ def importData(database, filename, callback,cl=0): #------------------------------------------------------------------------- # Rename media files if they were conflicting with existing ones - ObjectMap = database.getObjectMap() - newpath = database.getSavePath() + ObjectMap = database.get_object_map() + newpath = database.get_save_path() for OldMediaID in parser.MediaFileMap.keys(): NewMediaID = parser.MediaFileMap[OldMediaID] - oldfile = ObjectMap[NewMediaID].getPath() + oldfile = ObjectMap[NewMediaID].get_path() (junk,oldext) = os.path.splitext(os.path.basename(oldfile)) oldfile = os.path.join(basefile,OldMediaID+oldext) newfile = os.path.join(newpath,NewMediaID+oldext) - ObjectMap[NewMediaID].setPath(newfile) + ObjectMap[NewMediaID].set_path(newfile) ObjectMap[NewMediaID].setLocal(1) try: shutil.copyfile(oldfile,newfile) diff --git a/src/RelLib.py b/src/RelLib.py index 4f9341807..3e617e13a 100644 --- a/src/RelLib.py +++ b/src/RelLib.py @@ -32,6 +32,7 @@ __version__ = "$Revision$" #------------------------------------------------------------------------- from re import compile import os +import types #------------------------------------------------------------------------- # @@ -82,48 +83,48 @@ class SourceNote: else: self.note = None - def addSourceRef(self,id) : + def add_source_reference(self,id) : """Set the source reference""" self.source_list.append(id) - def getSourceRefList(self) : + def get_source_references(self) : """Return the source reference""" return self.source_list - def setSourceRefList(self,list) : + def set_source_reference_list(self,list) : """Replaces the source reference""" self.source_list = list - def setNote(self,text): + def set_note(self,text): """Set the note to the given text""" if self.note == None: self.note = Note() self.note.set(text) - def getNote(self): + def get_note(self): """Return the current note""" if self.note == None: return "" else: return self.note.get() - def setNoteFormat(self,val): + def set_note_format(self,val): """Set the note's format to the given value""" if self.note: - self.note.setFormat(val) + self.note.set_format(val) - def getNoteFormat(self): + def get_note_format(self): """Return the current note's format""" if self.note == None: return 0 else: - return self.note.getFormat() + return self.note.get_format() - def setNoteObj(self,obj): + def set_note_object(self,obj): """Change the note object instance to obj""" self.note = obj - def getNoteObj(self): + def get_note_object(self): """Return in note instance, not just the text""" return self.note @@ -149,71 +150,72 @@ class LdsOrd(SourceNote): self.status = 0 self.place = None - def getPlaceName(self): + def get_place_name(self): """returns the title of the Place associated with the Ordinance""" if self.place: return self.place.get_title() else: return "" - def setPlace(self,place): + def set_place_id(self,place): """sets the Place instance of the Event""" + assert(type(place) == types.StringType or type(place) == types.UnicodeType) self.place = place - def getPlace(self): + def get_place_id(self): """returns the Place instance of the Event""" return self.place - def setFamily(self,family): + def set_family_id(self,family): """Sets the family associated with the LDS ordinance""" self.famc = family - def getFamily(self): + def get_family_id(self): """Gets the family associated with the LDS ordinance""" return self.famc - def setStatus(self,val): + def set_status(self,val): """Sets the status of the LDS ordinance""" self.status = val - def getStatus(self): + def get_status(self): """Gets the status of the LDS ordinance""" return self.status - def setDate(self, date) : + def set_date(self, date) : """attempts to sets the date of the LdsOrd instance""" if not self.date: self.date = Date() self.date.set(date) - def getDate(self) : + def get_date(self) : """returns a string representation of the date of the LdsOrd instance""" if self.date: - return self.date.getDate() + return self.date.get_date() return "" - def getDateObj(self): + def get_date_object(self): """returns the Date object associated with the LdsOrd""" if not self.date: self.date = Date() return self.date - def setDateObj(self,date): + def set_date_object(self,date): """sets the Date object associated with the LdsOrd""" self.date = date - def setTemple(self,temple): + def set_temple(self,temple): """Sets the temple assocated with the LDS ordinance""" self.temple = temple - def getTemple(self): + def get_temple(self): """Gets the temple assocated with the LDS ordinance""" return self.temple - def isEmpty(self): + def is_empty(self): """Returns 1 if the LDS ordidance is actually empty""" if (self.famc or - (self.date and not self.date.isEmpty()) or + (self.date and not self.date.is_empty()) or self.temple or self.status or self.place): @@ -224,7 +226,7 @@ class LdsOrd(SourceNote): def are_equal(self,other): """returns 1 if the specified ordinance is the same as the instance""" if other == None: - if self.isEmpty(): + if self.is_empty(): return 1 else: return 0 @@ -232,13 +234,13 @@ class LdsOrd(SourceNote): self.place != other.place or self.status != other.status or self.temple != other.temple or - compare_dates(self.getDateObj(),other.getDateObj()) or - len(self.getSourceRefList()) != len(other.getSourceRefList())): + compare_dates(self.get_date_object(),other.get_date_object()) or + len(self.get_source_references()) != len(other.get_source_references())): return 0 index = 0 - olist = other.getSourceRefList() - for a in self.getSourceRefList(): + olist = other.get_source_references() + for a in self.get_source_references(): if not a.are_equal(olist[index]): return 0 index = index + 1 @@ -256,11 +258,11 @@ class DataObj(SourceNote): else: self.private = 0 - def setPrivacy(self,val): + def set_privacy(self,val): """Sets or clears the privacy flag of the data""" self.private = val - def getPrivacy(self): + def get_privacy(self): """Returns the privacy level of the data""" return self.private @@ -287,9 +289,9 @@ class Place(SourceNote): self.urls = [] for u in source.urls: self.urls.append(Url(u)) - self.photoList = [] - for photo in source.photoList: - self.photoList.append(ObjectRef(photo)) + self.photo_list = [] + for photo in source.photo_list: + self.photo_list.append(ObjectRef(photo)) else: self.long = "" self.lat = "" @@ -298,25 +300,25 @@ class Place(SourceNote): self.alt_loc = [] self.id = "" self.urls = [] - self.photoList = [] + self.photo_list = [] - def getUrlList(self): + def get_url_list(self): """Return the list of URLs""" return self.urls - def setUrlList(self,list): + def set_url_list(self,list): """Replace the current URL list with the new one""" self.urls = list - def addUrl(self,url): + def add_url(self,url): """Add a URL to the URL list""" self.urls.append(url) - def setId(self,id): + def set_id(self,id): """Sets the gramps ID for the place object""" self.id = id - def getId(self): + def get_id(self): """Returns the gramps ID for the place object""" return self.id @@ -367,19 +369,19 @@ class Place(SourceNote): if loc not in self.alt_loc: self.alt_loc.append(loc) - def addPhoto(self,photo): + def add_photo(self,photo): """Adds a Photo object to the place object's image list""" - self.photoList.append(photo) + self.photo_list.append(photo) - def getPhotoList(self): + def get_photo_list(self): """Returns the list of Photo objects""" - return self.photoList + return self.photo_list - def setPhotoList(self,list): + def set_photo_list(self,list): """Sets the list of Photo objects""" - self.photoList = list + self.photo_list = list - def getDisplayInfo(self): + def get_display_info(self): """Gets the display information associated with the object. This includes the information that is used for display and for sorting. Returns a list consisting of 13 strings. These are: Place Title, Place ID, Main Location @@ -410,35 +412,35 @@ class Researcher: self.phone = "" self.email = "" - def getName(self): + def get_name(self): """returns the database owner's name""" return self.name - def getAddress(self): + def get_address(self): """returns the database owner's address""" return self.addr - def getCity(self): + def get_city(self): """returns the database owner's city""" return self.city - def getState(self): + def get_state(self): """returns the database owner's state""" return self.state - def getCountry(self): + def get_country(self): """returns the database owner's country""" return self.country - def getPostalCode(self): + def get_postal_code(self): """returns the database owner's postal code""" return self.postal - def getPhone(self): + def get_phone(self): """returns the database owner's phone number""" return self.phone - def getEmail(self): + def get_email(self): """returns the database owner's email""" return self.email @@ -565,11 +567,11 @@ class Note: """adds the text to the note's contents""" self.text = self.text + text - def setFormat(self,format): + def set_format(self,format): """set the format to the passed value""" self.format = format - def getFormat(self): + def get_format(self): """return the note's format""" return self.format @@ -598,55 +600,55 @@ class Photo(SourceNote): self.mime = "" self.desc = "" - def setLocal(self,val): + def set_local(self,val): """set or clear the local flag""" self.local = val - def getLocal(self): + def get_local(self): """return the local flag""" return self.local - def setId(self,id): + def set_id(self,id): """Sets the gramps ID for the place object""" self.id = id - def getId(self): + def get_id(self): """Returns the gramps ID for the place object""" return self.id - def setMimeType(self,type): + def set_mime_type(self,type): self.mime = type - def getMimeType(self): + def get_mime_type(self): return self.mime - def setPath(self,path): + def set_path(self,path): """set the file path to the passed path""" self.path = os.path.normpath(path) - def getPath(self): + def get_path(self): """return the file path""" return self.path - def setDescription(self,text): + def set_description(self,text): """sets the description of the image""" self.desc = text - def getDescription(self): + def get_description(self): """returns the description of the image""" return self.desc - def addAttribute(self,attr): + def add_attribute(self,attr): """Adds a propery to the Photo object. This is not used by gramps, but provides a means for XML users to attach other properties to the image""" self.attrlist.append(attr) - def getAttributeList(self): + def get_attribute_list(self): """returns the property list associated with the image""" return self.attrlist - def setAttributeList(self,list): + def set_attribute_list(self,list): self.attrlist = list @@ -665,50 +667,50 @@ class ObjectRef: self.ref = None self.note = None - def setPrivacy(self,val): + def set_privacy(self,val): """Sets or clears the privacy flag of the data""" self.private = val - def getPrivacy(self): + def get_privacy(self): """Returns the privacy level of the data""" return self.private - def setReference(self,obj): + def set_reference(self,obj): self.ref = obj - def getReference(self): + def get_reference(self): return self.ref - def setNote(self,text): + def set_note(self,text): """Set the note to the given text""" if self.note == None: self.note = Note() self.note.set(text) - def getNote(self): + def get_note(self): """Return the current note""" if self.note == None: return "" else: return self.note.get() - def setNoteFormat(self,val): + def set_note_format(self,val): """Set the note's format to the given value""" if self.note: - self.note.setFormat(val) + self.note.set_format(val) - def getNoteFormat(self): + def get_note_format(self): """Return the current note's format""" if self.note == None: return 0 else: - return self.note.getFormat() + return self.note.get_format() - def setNoteObj(self,obj): + def set_note_object(self,obj): """Change the note object instance to obj""" self.note = obj - def getNoteObj(self): + def get_note_object(self): """Return in note instance, not just the text""" return self.note @@ -716,17 +718,17 @@ class ObjectRef: """Creates a unique instance of the current note""" self.note = Note(self.note.get()) - def addAttribute(self,attr): + def add_attribute(self,attr): """Adds a propery to the Photo object. This is not used by gramps, but provides a means for XML users to attach other properties to the image""" self.attrlist.append(attr) - def getAttributeList(self): + def get_attribute_list(self): """returns the property list associated with the image""" return self.attrlist - def setAttributeList(self,list): + def set_attribute_list(self,list): """sets the property list associated with the image""" self.attrlist = list @@ -745,19 +747,19 @@ class Attribute(DataObj): self.type = "" self.value = "" - def setType(self,val): + def set_type(self,val): """sets the type (or key) of the Attribute instance""" self.type = val - def getType(self): + def get_type(self): """returns the type (or key) or the Attribute instance""" return self.type - def setValue(self,val): + def set_value(self,val): """sets the value of the Attribute instance""" self.value = val - def getValue(self): + def get_value(self): """returns the value of the Attribute instance""" return self.value @@ -787,58 +789,58 @@ class Address(DataObj): self.date = Date() self.phone = "" - def setDate(self,text): + def set_date(self,text): """attempts to sets the date that the person lived at the address from the passed string""" self.date.set(text) - def getDate(self): + def get_date(self): """returns a string representation of the date that the person lived at the address""" - return self.date.getDate() + return self.date.get_date() - def getPrefDate(self): + def get_preferred_date(self): """returns a string representation of the date that the person lived at the address""" - return self.date.getPrefDate() + return self.date.get_preferred_date() - def getDateObj(self): + def get_date_object(self): """returns the Date object associated with the Address""" return self.date - def setDateObj(self,obj): + def set_date_object(self,obj): """sets the Date object associated with the Address""" self.date = obj - def setStreet(self,val): + def set_street(self,val): """sets the street portion of the Address""" self.street = val - def getStreet(self): + def get_street(self): """returns the street portion of the Address""" return self.street - def setPhone(self,val): + def set_phone(self,val): """sets the phone number portion of the Address""" self.phone = val - def getPhone(self): + def get_phone(self): """returns the phone number portion of the Address""" return self.phone - def setCity(self,val): + def set_city(self,val): """sets the city portion of the Address""" self.city = val - def getCity(self): + def get_city(self): """returns the city portion of the Address""" return self.city - def setState(self,val): + def set_state(self,val): """sets the state portion of the Address""" self.state = val - def getState(self): + def get_state(self): """returns the state portion of the Address""" return self.state @@ -846,15 +848,15 @@ class Address(DataObj): """sets the country portion of the Address""" self.country = val - def getCountry(self): + def get_country(self): """returns the country portion of the Address""" return self.country - def setPostal(self,val): + def set_postal_code(self,val): """sets the postal code of the Address""" self.postal = val - def getPostal(self): + def get_postal_code(self): """returns the postal code of the Address""" return self.postal @@ -867,166 +869,166 @@ class Name(DataObj): DataObj.__init__(self,source) if source: - self.FirstName = source.FirstName - self.Surname = source.Surname - self.Suffix = source.Suffix - self.Title = source.Title + self.first_name = source.first_name + self.surname = source.surname + self.suffix = source.suffix + self.title = source.title self.type = source.type - self.Prefix = source.Prefix + self.prefix = source.prefix self.sname = source.sname else: - self.FirstName = "" - self.Surname = "" - self.Suffix = "" - self.Title = "" + self.first_name = "" + self.surname = "" + self.suffix = "" + self.title = "" self.type = "Birth Name" - self.Prefix = "" + self.prefix = "" self.sname = '@' - def getSurnamePrefix(self): - return self.Prefix + def get_surname_prefix(self): + return self.prefix - def setSurnamePrefix(self,val): - self.Prefix = val + def set_surname_prefix(self,val): + self.prefix = val - def setType(self,type): + def set_type(self,type): """sets the type of the Name instance""" self.type = type - def getType(self): + def get_type(self): """returns the type of the Name instance""" return self.type def build_sort_name(self): - if self.Surname: - self.sname = "%-25s%-30s%s" % (self.Surname.upper(),self.FirstName.upper(),self.Suffix.upper()) + if self.surname: + self.sname = "%-25s%-30s%s" % (self.surname.upper(),self.first_name.upper(),self.suffix.upper()) else: self.sname = "@" - def setFirstName(self,name): + def set_first_name(self,name): """sets the given name for the Name instance""" - self.FirstName = name + self.first_name = name self.build_sort_name() - def setSurname(self,name): + def set_surname(self,name): """sets the surname (or last name) for the Name instance""" - self.Surname = name + self.surname = name self.build_sort_name() - def setSuffix(self,name): + def set_suffix(self,name): """sets the suffix (such as Jr., III, etc.) for the Name instance""" - self.Suffix = name + self.suffix = name self.build_sort_name() - def getSortName(self): + def get_sort_name(self): return self.sname - def getFirstName(self): + def get_first_name(self): """returns the given name for the Name instance""" - return self.FirstName + return self.first_name - def getSurname(self): + def get_surname(self): """returns the surname (or last name) for the Name instance""" - return self.Surname + return self.surname - def getUpperSurname(self): + def get_upper_surname(self): """returns the surname (or last name) for the Name instance""" - return self.Surname.upper() + return self.surname.upper() - def getSuffix(self): + def get_suffix(self): """returns the suffix for the Name instance""" - return self.Suffix + return self.suffix - def setTitle(self,title): + def set_title(self,title): """sets the title (Dr., Reverand, Captain) for the Name instance""" - self.Title = title + self.title = title - def getTitle(self): + def get_title(self): """returns the title for the Name instance""" - return self.Title + return self.title - def getName(self): + def get_name(self): """returns a name string built from the components of the Name - instance, in the form of Surname, Firstname""" + instance, in the form of surname, Firstname""" - if self.Suffix: - if self.Prefix: - return "%s %s, %s %s" % (self.Prefix, self.Surname, self.FirstName, self.Suffix) + if self.suffix: + if self.prefix: + return "%s %s, %s %s" % (self.prefix, self.surname, self.first_name, self.suffix) else: - return "%s, %s %s" % (self.Surname, self.FirstName, self.Suffix) + return "%s, %s %s" % (self.surname, self.first_name, self.suffix) else: - if self.Prefix: - return "%s %s, %s" % (self.Prefix,self.Surname, self.FirstName) + if self.prefix: + return "%s %s, %s" % (self.prefix,self.surname, self.first_name) else: - return "%s, %s" % (self.Surname, self.FirstName) + return "%s, %s" % (self.surname, self.first_name) - def getUpperName(self): + def get_upper_name(self): """returns a name string built from the components of the Name - instance, in the form of Surname, Firstname""" + instance, in the form of surname, Firstname""" - if self.Suffix: - if self.Prefix: - return "%s %s, %s %s" % (self.Prefix.upper(), self.Surname.upper(), self.FirstName, self.Suffix) + if self.suffix: + if self.prefix: + return "%s %s, %s %s" % (self.prefix.upper(), self.surname.upper(), self.first_name, self.suffix) else: - return "%s, %s %s" % (self.Surname.upper(), self.FirstName, self.Suffix) + return "%s, %s %s" % (self.surname.upper(), self.first_name, self.suffix) else: - if self.Prefix: - return "%s %s, %s" % (self.Prefix.upper(), self.Surname.upper(), self.FirstName) + if self.prefix: + return "%s %s, %s" % (self.prefix.upper(), self.surname.upper(), self.first_name) else: - return "%s, %s" % (self.Surname.upper(), self.FirstName) + return "%s, %s" % (self.surname.upper(), self.first_name) - def getRegularName(self): + def get_regular_name(self): """returns a name string built from the components of the Name - instance, in the form of Firstname Surname""" - if (self.Suffix == ""): - if self.Prefix: - return "%s %s %s" % (self.FirstName, self.Prefix, self.Surname) + instance, in the form of Firstname surname""" + if (self.suffix == ""): + if self.prefix: + return "%s %s %s" % (self.first_name, self.prefix, self.surname) else: - return "%s %s" % (self.FirstName, self.Surname) + return "%s %s" % (self.first_name, self.surname) else: - if self.Prefix: - return "%s %s %s, %s" % (self.FirstName, self.Prefix, self.Surname, self.Suffix) + if self.prefix: + return "%s %s %s, %s" % (self.first_name, self.prefix, self.surname, self.suffix) else: - return "%s %s, %s" % (self.FirstName, self.Surname, self.Suffix) + return "%s %s, %s" % (self.first_name, self.surname, self.suffix) - def getRegularUpperName(self): + def get_regular_upper_name(self): """returns a name string built from the components of the Name - instance, in the form of Firstname Surname""" - if (self.Suffix == ""): - if self.Prefix: - return "%s %s %s" % (self.FirstName, self.Prefix.upper(), self.Surname.upper()) + instance, in the form of Firstname surname""" + if (self.suffix == ""): + if self.prefix: + return "%s %s %s" % (self.first_name, self.prefix.upper(), self.surname.upper()) else: - return "%s %s" % (self.FirstName, self.Surname.upper()) + return "%s %s" % (self.first_name, self.surname.upper()) else: - if self.Prefix: - return "%s %s %s, %s" % (self.FirstName, self.Prefix.upper(), self.Surname.upper(), self.Suffix) + if self.prefix: + return "%s %s %s, %s" % (self.first_name, self.prefix.upper(), self.surname.upper(), self.suffix) else: - return "%s %s, %s" % (self.FirstName, self.Surname.upper(), self.Suffix) + return "%s %s, %s" % (self.first_name, self.surname.upper(), self.suffix) def are_equal(self,other): """compares to names to see if they are equal, return 0 if they are not""" - if self.FirstName != other.FirstName: + if self.first_name != other.first_name: return 0 - if self.Surname != other.Surname: + if self.surname != other.surname: return 0 - if self.Prefix != other.Prefix: + if self.prefix != other.prefix: return 0 - if self.Suffix != other.Suffix: + if self.suffix != other.suffix: return 0 - if self.Title != other.Title: + if self.title != other.title: return 0 if self.type != other.type: return 0 if self.private != other.private: return 0 - if self.getNote() != other.getNote(): + if self.get_note() != other.get_note(): return 0 - if len(self.getSourceRefList()) != len(other.getSourceRefList()): + if len(self.get_source_references()) != len(other.get_source_references()): return 0 index = 0 - olist = other.getSourceRefList() - for a in self.getSourceRefList(): + olist = other.get_source_references() + for a in self.get_source_references(): if not a.are_equal(olist[index]): return 0 index = index + 1 @@ -1047,11 +1049,11 @@ class Url: self.desc = "" self.private = 0 - def setPrivacy(self,val): + def set_privacy(self,val): """sets the privacy flag for the URL instance""" self.private = val - def getPrivacy(self): + def get_privacy(self): """returns the privacy flag for the URL instance""" return self.private @@ -1093,21 +1095,19 @@ class Person(SourceNote): """creates a new Person instance""" SourceNote.__init__(self) self.id = id - self.PrimaryName = None - self.EventList = [] - self.FamilyList = [] - self.AltFamilyList = [] - self.photoList = [] + self.primary_name = None + self.event_list = [] + self.family_list = [] + self.parent_family_list = [] + self.photo_list = [] self.nickname = "" - self.alternateNames = [] + self.alternate_names = [] self.gender = 2 self.death = None self.birth = None - self.addressList = [] - self.attributeList = [] + self.address_list = [] + self.attribute_list = [] self.urls = [] - self.paf_uid = "" - self.position = None self.ancestor = None self.lds_bapt = None self.lds_endow = None @@ -1119,94 +1119,98 @@ class Person(SourceNote): # GenderStats.count_person. self.db = None - def setComplete(self,val): + def serialize(self): + return (self.id, self.gender, + self.primary_name, self.alternate_names, self.nickname, + self.death, self.birth, self.event_list, + self.family_list, self.parent_family_list, + self.photo_list, + self.address_list, + self.attribute_list, + self.urls, + self.lds_bapt, self.lds_endow, self.lds_seal, + self.complete) + + def set_complete(self,val): self.complete = val - def getComplete(self): + def get_complete(self): return self.complete - def getDisplayInfo(self): + def get_display_info(self): if self.gender == Person.male: gender = const.male elif self.gender == Person.female: gender = const.female else: gender = const.unknown - bday = self.getBirth().getDateObj() - dday = self.getDeath().getDateObj() + bday = self.get_birth().get_date_object() + dday = self.get_death().get_date_object() return [ GrampsCfg.display_name(self),self.id,gender, - bday.getQuoteDate(), dday.getQuoteDate(), - self.getPrimaryName().getSortName(), + bday.get_quote_date(), dday.get_quote_date(), + self.get_primary_name().get_sort_name(), sort.build_sort_date(bday),sort.build_sort_date(dday), - GrampsCfg.display_surname(self.PrimaryName)] + GrampsCfg.display_surname(self.primary_name)] - def setPrimaryName(self,name): + def set_primary_name(self,name): """sets the primary name of the Person to the specified Name instance""" db = self.db if db: db.genderStats.uncount_person (self) - self.PrimaryName = name + self.primary_name = name if db: db.genderStats.count_person (self, db) - def getPrimaryName(self): + def get_primary_name(self): """returns the Name instance marked as the Person's primary name""" - if not self.PrimaryName: - self.PrimaryName = Name() - return self.PrimaryName + if not self.primary_name: + self.primary_name = Name() + return self.primary_name - def setPafUid(self,val): - """sets Personal Ancestral File UID value""" - self.paf_uid = val - - def getPafUid(self) : - """returns the Personal Ancestral File UID value""" - return self.paf_uid - - def getAlternateNames(self): + def get_alternate_names(self): """returns the list of alternate Names""" - return self.alternateNames + return self.alternate_names - def setAlternateNames(self,list): + def set_alternate_names(self,list): """changes the list of alternate names to the passed list""" - self.alternateNames = list + self.alternate_names = list - def addAlternateName(self,name): + def add_alternate_name(self,name): """adds an alternate Name instance to the list""" - self.alternateNames.append(name) + self.alternate_names.append(name) - def getUrlList(self): + def get_url_list(self): """returns the list of URL instances""" return self.urls - def setUrlList(self,list): + def set_url_list(self,list): """sets the list of URL instances to list""" self.urls = list - def addUrl(self,url): + def add_url(self,url): """adds a URL instance to the list""" self.urls.append(url) - def setId(self,id): + def set_id(self,id): """sets the gramps ID for the Person""" self.id = str(id) - def getId(self): + def get_id(self): """returns the gramps ID for the Person""" return self.id - def setNickName(self,name): + def set_nick_name(self,name): """sets the nickname for the Person""" self.nickname = name - def getNickName(self) : + def get_nick_name(self) : """returns the nickname for the Person""" return self.nickname - def setGender(self,val) : + def set_gender(self,val) : """sets the gender of the Person""" db = self.db if db: @@ -1217,33 +1221,33 @@ class Person(SourceNote): if db: db.genderStats.count_person (self, db) - def getGender(self) : + def get_gender(self) : """returns the gender of the Person""" return self.gender - def setBirth(self,event) : + def set_birth(self,event) : """sets the birth event to the passed event""" self.birth = event - def setDeath(self,event) : + def set_death(self,event) : """sets the death event to the passed event""" self.death = event - def getBirth(self) : + def get_birth(self) : """returns the birth event""" if self.birth == None: self.birth = Event() self.birth.name = "Birth" return self.birth - def getDeath(self) : + def get_death(self) : """returns the death event""" if self.death == None: self.death = Event() self.death.name = "Death" return self.death - def getValidDeath(self): + def get_valid_death(self): e = self.death if e == None: return None @@ -1253,7 +1257,7 @@ class Person(SourceNote): else: return e - def getValidBirth(self): + def get_valid_birth(self): e = self.birth if e == None: return None @@ -1263,197 +1267,200 @@ class Person(SourceNote): else: return e - def addPhoto(self,photo): + def add_photo(self,photo): """adds a Photo instance to the image list""" - self.photoList.append(photo) + self.photo_list.append(photo) - def getPhotoList(self): + def get_photo_list(self): """returns the list of Photos""" - return self.photoList + return self.photo_list - def setPhotoList(self,list): + def set_photo_list(self,list): """Sets the list of Photo objects""" - self.photoList = list + self.photo_list = list - def addEvent(self,event): + def add_event(self,event): """adds an Event to the event list""" - self.EventList.append(event) + self.event_list.append(event) - def getEventList(self): + def get_event_list(self): """returns the list of Event instances""" - return self.EventList + return self.event_list - def setEventList(self,list): + def set_event_list(self,list): """sets the event list to the passed list""" - self.EventList = list + self.event_list = list - def addFamily(self,family): + def add_family_id(self,family_id): """adds the specified Family instance to the list of families/marriages/partnerships in which the person is a parent or spouse""" - self.FamilyList.append(family) + assert(type(family_id) == types.StringType or type(family_id) == types.UnicodeType) + + self.family_list.append(family_id) - def setPreferred(self,family): - if family in self.FamilyList: - self.FamilyList.remove(family) - self.FamilyList = [family] + self.FamilyList + def set_preferred_family_id(self,family): + if family in self.family_list: + self.family_list.remove(family) + self.family_list = [family] + self.family_list - def getFamilyList(self) : + def get_family_id_list(self) : """returns the list of Family instances in which the person is a parent or spouse""" - return self.FamilyList + return self.family_list - def clearFamilyList(self) : - self.FamilyList = [] + def clear_family_id_list(self) : + self.family_list = [] - def removeFamily(self,family): + def remove_family_id(self,family): """removes the specified Family instance from the list of marriages/partnerships""" - if family in self.FamilyList: - self.FamilyList.remove(family) + assert(type(family) == types.StringType or type(family) == types.UnicodeType) + if family in self.family_list: + self.family_list.remove(family) - def addAddress(self,address): + def add_address(self,address): """adds the Address instance to the list of addresses""" - self.addressList.append(address) + self.address_list.append(address) - def removeAddress(self,address): + def remove_address(self,address): """removes the Address instance from the list of addresses""" - if address in self.addressList: - self.addressList.remove(address) + if address in self.address_list: + self.address_list.remove(address) - def getAddressList(self): + def get_address_list(self): """returns the list of addresses""" - return self.addressList + return self.address_list - def setAddressList(self,list): + def set_address_list(self,list): """sets the address list to the specified list""" - self.addressList = list + self.address_list = list - def addAttribute(self,attribute): + def add_attribute(self,attribute): """adds an Attribute instance to the attribute list""" - self.attributeList.append(attribute) + self.attribute_list.append(attribute) - def removeAttribute(self,attribute): + def remove_attribute(self,attribute): """removes the specified Attribute instance from the attribute list""" - if attribute in self.attributeList: - self.attributeList.remove(attribute) + if attribute in self.attribute_list: + self.attribute_list.remove(attribute) - def getAttributeList(self): + def get_attribute_list(self): """returns the attribute list""" - return self.attributeList + return self.attribute_list - def setAttributeList(self,list): + def set_attribute_list(self,list): """sets the attribute list to the specified list""" - self.attributeList = list + self.attribute_list = list - def getParentList(self): + def get_parent_family_id_list(self): """returns the list of alternate Family instances, in which the Person is a child of the family, but not a natural child of both parents""" - return self.AltFamilyList + return self.parent_family_list - def addAltFamily(self,family,mrel,frel): + def add_parent_family_id(self,family,mrel,frel): """adds a Family to the alternate family list, indicating the relationship to the mother (mrel) and the father (frel)""" - self.AltFamilyList.append((family,mrel,frel)) + assert(type(family) == types.StringType or type(family) == types.UnicodeType) + self.parent_family_list.append((family,mrel,frel)) - def clearAltFamilyList(self): - self.AltFamilyList = [] + def clear_parent_family_id_list(self): + self.parent_family_list = [] - def removeAltFamily(self,family): + def remove_parent_family_id(self,family): """removes a Family instance from the alternate family list""" - for f in self.AltFamilyList[:]: + assert(type(family) == types.StringType or type(family) == types.UnicodeType) + for f in self.parent_family_list[:]: + assert(type(f[0]) == types.StringType or type(f[0]) == types.UnicodeType) if f[0] == family: - self.AltFamilyList.remove(f) + self.parent_family_list.remove(f) return f else: return None - def changeAltFamily(self,family,mrel,frel): + def change_parent_family_id(self,family,mrel,frel): """removes a Family instance from the alternate family list""" index = 0 - for f in self.AltFamilyList[:]: + assert(type(family) == types.StringType or type(family) == types.UnicodeType) + for f in self.parent_family_list[:]: if f[0] == family: - self.AltFamilyList[index] = (family,mrel,frel) + self.parent_family_list[index] = (family,mrel,frel) index += 1 def has_family(self,family): - for f in self.AltFamilyList: + assert(type(family) == types.StringType or type(family) == types.UnicodeType) + for f in self.parent_family_list: + assert(type(f[0]) == types.StringType or type(f[0]) == types.UnicodeType) if f[0] == family: return f else: return None - def setMainParents(self,family): + def set_main_parent_family_id(self,family): """sets the main Family of the Person, the Family in which the Person is a natural born child""" - f = self.removeAltFamily(family) + assert(type(family) == types.StringType or type(family) == types.UnicodeType) + f = self.remove_parent_family_id(family) if f: - self.AltFamilyList = [f] + self.AltFamilyList + self.parent_family_list = [f] + self.parent_family_list - def getMainParents(self): + def get_main_parents_family_id(self): """returns the main Family of the Person, the Family in which the Person is a natural born child""" - if len(self.AltFamilyList) == 0: + if len(self.parent_family_list) == 0: return None else: - return self.AltFamilyList[0][0] + return self.parent_family_list[0][0] - def getMainParentsRel(self): + def get_main_parents_family_idRel(self): """returns the main Family of the Person, the Family in which the Person is a natural born child""" - if len(self.AltFamilyList) == 0: + if len(self.parent_family_list) == 0: return (None,None,None) else: - return self.AltFamilyList[0] + return self.parent_family_list[0] - def setPosition(self,pos): - """sets a graphical location pointer for graphic display (x,y)""" - self.position = pos - - def getPosition(self): - """returns a graphical location pointer for graphic display (x,y)""" - return self.position - - def setAncestor(self, value): + def set_ancestor(self, value): """set ancestor flag and recurse""" self.ancestor = value - for (family,m,f) in self.AltFamilyList: - if family.Father: - # Don't waste time if the ancestor is already flagged. - # This will happen when cousins marry. - if not family.Father.getAncestor(): - family.Father.setAncestor(value) - if family.getMother(): - if not family.Mother.getAncestor(): - family.Mother.setAncestor(value) +# for (fam,m,f) in self.parent_family_list: +# family +# if family.Father: +# # Don't waste time if the ancestor is already flagged. +# # This will happen when cousins marry. +# if not family.Father.get_ancestor(): +# family.Father.set_ancestor(value) +# if family.get_mother_id(): +# if not family.Mother.get_ancestor(): +# family.Mother.set_ancestor(value) - def getAncestor(self): + def get_ancestor(self): return self.ancestor - def setLdsBaptism(self,ord): + def set_lds_baptism(self,ord): self.lds_bapt = ord - def getLdsBaptism(self): + def get_lds_baptism(self): return self.lds_bapt - def setLdsEndowment(self,ord): + def set_lds_endowment(self,ord): self.lds_endow = ord - def getLdsEndowment(self): + def get_lds_endowment(self): return self.lds_endow - def setLdsSeal(self,ord): + def set_lds_sealing(self,ord): self.lds_seal = ord - def getLdsSeal(self): + def get_lds_sealing(self): return self.lds_seal - def probablyAlive(self): + def probably_alive(self): """Returns true if the person may be alive.""" if not self.death.is_empty (): return 0 - if self.birth.getDate() != "": - return not_too_old(self.birth.getDateObj().get_start_date()) + if self.birth.get_date() != "": + return not_too_old(self.birth.get_date_object().get_start_date()) # Neither birth nor death events are available. Try looking # for descendants that were born more than a lifespan ago. @@ -1462,17 +1469,17 @@ class Person(SourceNote): max_generation = 60 max_age_difference = 60 def descendants_too_old (person, years): - for family in person.getFamilyList (): - for child in family.getChildList (): - if child.birth.getDate () != "": - d = SingleDate (child.birth.getDateObj (). + for family in person.get_family_id_list(): + for child in family.get_child_id_list(): + if child.birth.get_date () != "": + d = SingleDate (child.birth.get_date_object (). get_start_date ()) d.setYear (d.getYear () - years) if not not_too_old (d): return 1 - if child.death.getDate () != "": - d = SingleDate (child.death.getDateObj (). + if child.death.get_date () != "": + d = SingleDate (child.death.get_date_object (). get_start_date ()) if not not_too_old (d): return 1 @@ -1485,22 +1492,22 @@ class Person(SourceNote): # What about their parents? def parents_too_old (person, age_difference): - family = person.getMainParents () + family = person.get_main_parents_family_id () if family: - for parent in [family.getFather (), family.getMother ()]: + for parent in [family.get_father_id (), family.get_mother_id ()]: if not parent: continue - if parent.birth.getDate () != "": - d = SingleDate (parent.birth.getDateObj (). + if parent.birth.get_date () != "": + d = SingleDate (parent.birth.get_date_object (). get_start_date ()) d.setYear (d.getYear () + max_generation + age_difference) if not not_too_old (d): return 1 - if parent.death.getDate () != "": - d = SingleDate (parent.death.getDateObj (). + if parent.death.get_date () != "": + d = SingleDate (parent.death.get_date_object (). get_start_date ()) d.setYear (d.getYear () + age_difference) if not not_too_old (d): @@ -1511,21 +1518,21 @@ class Person(SourceNote): # As a last resort, trying seeing if their spouse's age gives # any clue. - for family in self.getFamilyList (): - for spouse in [family.getFather (), family.getMother ()]: + for family in self.get_family_id_list (): + for spouse in [family.get_father_id (), family.get_mother_id ()]: if not spouse: continue if spouse == self: continue - if spouse.birth.getDate () != "": - d = SingleDate (spouse.birth.getDateObj(). + if spouse.birth.get_date () != "": + d = SingleDate (spouse.birth.get_date_object(). get_start_date ()) d.setYear (d.getYear () + max_age_difference) if not not_too_old (d): return 0 - if spouse.death.getDate () != "": - d = SingleDate (spouse.birth.getDateObj(). + if spouse.death.get_date () != "": + d = SingleDate (spouse.birth.get_date_object(). get_start_date ()) d.setYear (d.getYear () - min_generation) if not not_too_old (d): @@ -1562,7 +1569,7 @@ class Event(DataObj): except: self.witness = None else: - self.place = None + self.place = u'' self.date = None self.description = "" self.name = "" @@ -1585,13 +1592,13 @@ class Event(DataObj): self.witness = [value] def is_empty(self): - date = self.getDateObj() - place = self.getPlace() + date = self.get_date_object() + place = self.get_place_id() description = self.description cause = self.cause name = self.name if (not name or name == "Birth" or name == "Death") and \ - date.isEmpty() and not place and not description and not cause: + date.is_empty() and not place and not description and not cause: return 1 else: return 0 @@ -1601,7 +1608,7 @@ class Event(DataObj): self.name = name self.place = place self.description = description - self.setDate(date) + self.set_date(date) def are_equal(self,other): """returns 1 if the specified event is the same as the instance""" @@ -1610,90 +1617,84 @@ class Event(DataObj): if (self.name != other.name or self.place != other.place or self.description != other.description or self.cause != other.cause or self.private != other.private or - compare_dates(self.getDateObj(),other.getDateObj()) or - len(self.getSourceRefList()) != len(other.getSourceRefList())): + compare_dates(self.get_date_object(),other.get_date_object()) or + len(self.get_source_references()) != len(other.get_source_references())): return 0 index = 0 - olist = other.getSourceRefList() - for a in self.getSourceRefList(): + olist = other.get_source_references() + for a in self.get_source_references(): if not a.are_equal(olist[index]): return 0 index = index + 1 return 1 - def setName(self,name): + def set_name(self,name): """sets the name of the Event""" self.name = name - def getName(self): + def get_name(self): """returns the name of the Event""" return self.name - def setPlace(self,place): + def set_place_id(self,place): """sets the Place instance of the Event""" + assert(type(place) == types.StringType or type(place) == types.UnicodeType) self.place = place - def getPlace(self): + def get_place_id(self): """returns the Place instance of the Event""" return self.place - def setCause(self,cause): + def set_cause(self,cause): """sets the cause of the Event""" self.cause = cause - def getCause(self): + def get_cause(self): """returns the cause of the Event""" return self.cause - def getPlaceName(self): - """returns the title of the Place associated with the Event""" - if self.place: - return self.place.get_title() - else: - return "" - - def setDescription(self,description): + def set_description(self,description): """sets the description of the Event instance""" self.description = description - def getDescription(self) : + def get_description(self) : """returns the description of the Event instance""" return self.description - def setDate(self, date) : + def set_date(self, date) : """attempts to sets the date of the Event instance""" if not self.date: self.date = Date() self.date.set(date) - def getDate(self) : + def get_date(self) : """returns a string representation of the date of the Event instance""" if self.date: - return self.date.getDate() + return self.date.get_date() return "" - def getPrefDate(self) : + def get_preferred_date(self) : """returns a string representation of the date of the Event instance""" if self.date: - return self.date.getDate() + return self.date.get_date() return "" - def getQuoteDate(self) : + def get_quote_date(self) : """returns a string representation of the date of the Event instance, enclosing the results in quotes if it is not a valid date""" if self.date: - return self.date.getQuoteDate() + return self.date.get_quote_date() return "" - def getDateObj(self): + def get_date_object(self): """returns the Date object associated with the Event""" if not self.date: self.date = Date() return self.date - def setDateObj(self,date): + def set_date_object(self,date): """sets the Date object associated with the Event""" self.date = date @@ -1727,171 +1728,164 @@ class Family(SourceNote): def __init__(self): """creates a new Family instance""" SourceNote.__init__(self) - self.Father = None - self.Mother = None - self.Children = [] - self.Marriage = None - self.Divorce = None + father_id = None + self.mother_id = None + self.child_list = [] self.type = "Married" - self.EventList = [] + self.event_list = [] self.id = "" - self.photoList = [] - self.attributeList = [] - self.position = None + self.photo_list = [] + self.attribute_list = [] self.lds_seal = None self.complete = 0 - def setComplete(self,val): + def set_complete(self,val): self.complete = val - def getComplete(self): + def get_complete(self): return self.complete - def setLdsSeal(self,ord): + def set_lds_sealing(self,ord): self.lds_seal = ord - def getLdsSeal(self): + def get_lds_sealing(self): return self.lds_seal - def setPosition(self,pos): - """sets a graphical location pointer for graphic display (x,y)""" - self.position = pos - - def getPosition(self): - """returns a graphical location pointer for graphic display (x,y)""" - return self.position - - def addAttribute(self,attribute) : + def add_attribute(self,attribute) : """adds an Attribute instance to the attribute list""" - self.attributeList.append(attribute) + self.attribute_list.append(attribute) - def removeAttribute(self,attribute): + def remove_attribute(self,attribute): """removes the specified Attribute instance from the attribute list""" - if attribute in self.attributeList: - self.attributeList.remove(attribute) + if attribute in self.attribute_list: + self.attribute_list.remove(attribute) - def getAttributeList(self) : + def get_attribute_list(self) : """returns the attribute list""" - return self.attributeList + return self.attribute_list - def setAttributeList(self,list) : + def set_attribute_list(self,list) : """sets the attribute list to the specified list""" - self.attributeList = list + self.attribute_list = list - def setId(self,id) : + def set_id(self,id) : """sets the gramps ID for the Family""" self.id = str(id) - def getId(self) : + def get_id(self) : """returns the gramps ID for the Family""" return self.id - def setRelationship(self,type): + def set_relationship(self,type): """assigns a string indicating the relationship between the father and the mother""" self.type = type - def getRelationship(self): + def get_relationship(self): """returns a string indicating the relationship between the father and the mother""" return self.type - def setFather(self,person): + def set_father_id(self,person_id): """sets the father of the Family to the specfied Person""" - update = self.someChildIsAncestor() - if update and self.Father: - self.Father.setAncestor(0) - self.Father = person - if update and self.Father: - self.Father.setAncestor(1) + update = self.some_child_is_ancestor() +# if update and father_id: +# father_id.set_ancestor(0) + self.father_id = person_id +# if update and father_id: +# father_id.set_ancestor(1) - def getFather(self): + def get_father_id(self): """returns the father of the Family""" - return self.Father + return father_id - def setMother(self,person): + def set_mother_id(self,person): """sets the mother of the Family to the specfied Person""" - update = self.someChildIsAncestor() - if self.Mother and update: - self.Mother.setAncestor(0) - self.Mother = person - if update and self.Mother: - self.Mother.setAncestor(1) + update = self.some_child_is_ancestor() +# if self.mother_id and update: +# self.mother_id.set_ancestor(0) + self.mother_id = person +# if update and self.mother_id: +# self.mother_id.set_ancestor(1) - def getMother(self): + def get_mother_id(self): """returns the mother of the Family""" - return self.Mother + return self.mother_id - def addChild(self,person): + def add_child_id(self,person): """adds the specfied Person as a child of the Family, adding it to the child list""" - if person not in self.Children: - self.Children.append(person) - if person.getAncestor(): - if self.Father: - self.Father.setAncestor(1) - if self.Mother: - self.Mother.setAncestor(1) + assert(type(person) == types.StringType or type(person) == types.UnicodeType) + + if person not in self.child_list: + self.child_list.append(person) +# if person.get_ancestor(): +# if father_id: +# father_id.set_ancestor(1) +# if self.mother_id: +# self.mother_id.set_ancestor(1) - def removeChild(self,person): + def remove_child_id(self,person): """removes the specified Person from the child list""" - if person in self.Children: - self.Children.remove(person) - if person.getAncestor(): - if self.Father: - self.Father.setAncestor(0) - if self.Mother: - self.Mother.setAncestor(0) + assert(type(person) == types.StringType or type(person) == types.UnicodeType) - def getChildList(self): + if person in self.child_list: + self.child_list.remove(person) +# if person.get_ancestor(): +# if father_id: +# father_id.set_ancestor(0) +# if self.mother_id: +# self.mother_id.set_ancestor(0) + + def get_child_id_list(self): """returns the list of children""" - return self.Children + return self.child_list - def setChildList(self, list): + def set_child_id_list(self, list): """sets the list of children""" - self.Children = list[:] + self.child_list = list[:] - def getMarriage(self): + def get_marriage(self): """returns the marriage event of the Family. Obsolete""" - for e in self.EventList: - if e.getName() == "Marriage": + for e in self.event_list: + if e.get_name() == "Marriage": return e return None - def getDivorce(self): + def get_divorce(self): """returns the divorce event of the Family. Obsolete""" - for e in self.EventList: - if e.getName() == "Divorce": + for e in self.event_list: + if e.get_name() == "Divorce": return e return None - def addEvent(self,event): + def add_event(self,event): """adds an Event to the event list""" - self.EventList.append(event) + self.event_list.append(event) - def getEventList(self) : + def get_event_list(self) : """returns the list of Event instances""" - return self.EventList + return self.event_list - def setEventList(self,list) : + def set_event_list(self,list) : """sets the event list to the passed list""" - self.EventList = list + self.event_list = list - def addPhoto(self,photo): + def add_photo(self,photo): """Adds a Photo object to the Family instance's image list""" - self.photoList.append(photo) + self.photo_list.append(photo) - def getPhotoList(self): + def get_photo_list(self): """Returns the list of Photo objects""" - return self.photoList + return self.photo_list - def setPhotoList(self,list): + def set_photo_list(self,list): """Sets the list of Photo objects""" - self.photoList = list + self.photo_list = list - def someChildIsAncestor(self): - for child in self.Children: - if (child.getAncestor()): + def some_child_is_ancestor(self): + for child in self.child_list: + if (child.get_ancestor()): return 1 return None @@ -1904,62 +1898,62 @@ class Source: self.author = "" self.pubinfo = "" self.note = Note() - self.photoList = [] + self.photo_list = [] self.id = "" self.abbrev = "" - def getDisplayInfo(self): + def get_display_info(self): return [self.title,self.id,self.author,self.title.upper(),self.author.upper()] - def setId(self,newId): + def set_id(self,newId): """sets the gramps' ID for the Source instance""" self.id = str(newId) - def getId(self): + def get_id(self): """returns the gramps' ID of the Source instance""" return self.id - def addPhoto(self,photo): + def add_photo(self,photo): """Adds a Photo object to the Source instance's image list""" - self.photoList.append(photo) + self.photo_list.append(photo) - def getPhotoList(self): + def get_photo_list(self): """Returns the list of Photo objects""" - return self.photoList + return self.photo_list - def setPhotoList(self,list): + def set_photo_list(self,list): """Sets the list of Photo objects""" - self.photoList = list + self.photo_list = list - def setTitle(self,title): + def set_title(self,title): """sets the title of the Source""" self.title = title - def getTitle(self): + def get_title(self): """returns the title of the Source""" return self.title - def setNote(self,text): + def set_note(self,text): """sets the text of the note attached to the Source""" self.note.set(text) - def getNote(self): + def get_note(self): """returns the text of the note attached to the Source""" return self.note.get() - def setNoteFormat(self,val): + def set_note_format(self,val): """Set the note's format to the given value""" - self.note.setFormat(val) + self.note.set_format(val) - def getNoteFormat(self): + def get_note_format(self): """Return the current note's format""" - return self.note.getFormat() + return self.note.get_format() - def setNoteObj(self,obj): + def set_note_object(self,obj): """sets the Note instance attached to the Source""" self.note = obj - def getNoteObj(self): + def get_note_object(self): """returns the Note instance attached to the Source""" return self.note @@ -1967,27 +1961,27 @@ class Source: """Creates a unique instance of the current note""" self.note = Note(self.note.get()) - def setAuthor(self,author): + def set_author(self,author): """sets the author of the Source""" self.author = author - def getAuthor(self): + def get_author(self): """returns the author of the Source""" return self.author - def setPubInfo(self,text): + def set_publication_info(self,text): """sets the publication information of the Source""" self.pubinfo = text - def getPubInfo(self): + def get_publication_info(self): """returns the publication information of the Source""" return self.pubinfo - def setAbbrev(self,abbrev): + def set_abbreviation(self,abbrev): """sets the title abbreviation of the Source""" self.abbrev = abbrev - def getAbbrev(self): + def get_abbreviation(self): """returns the title abbreviation of the Source""" return self.abbrev @@ -1999,6 +1993,7 @@ class SourceRef: """creates a new SourceRef, copying from the source if present""" if source: self.confidence = source.confidence + assert(type(source.ref) == types.StringType or type(source.ref) == types.UnicodeType) self.ref = source.ref self.page = source.page self.date = Date(source.date) @@ -2012,55 +2007,56 @@ class SourceRef: self.comments = Note() self.text = "" - def setConfidence(self,val): + def set_confidence_level(self,val): """Sets the confidence level""" self.confidence = val - def getConfidence(self): + def get_confidence_level(self): """Returns the confidence level""" return self.confidence - def setBase(self,ref): + def set_base_id(self,ref): """sets the Source instance to which the SourceRef refers""" + assert(type(ref) == types.StringType or type(ref) == types.UnicodeType) self.ref = ref - def getBase(self): + def get_base_id(self): """returns the Source instance to which the SourceRef refers""" return self.ref - def setDate(self,date): + def set_date(self,date): """sets the Date instance of the SourceRef""" self.date = date - def getDate(self): + def get_date(self): """returns the Date instance of the SourceRef""" return self.date - def setPage(self,page): + def set_page(self,page): """sets the page indicator of the SourceRef""" self.page = page - def getPage(self): + def get_page(self): """gets the page indicator of the SourceRef""" return self.page - def setText(self,text): + def set_text(self,text): """sets the text related to the SourceRef""" self.text = text - def getText(self): + def get_text(self): """returns the text related to the SourceRef""" return self.text - def setNoteObj(self,note): + def set_note_object(self,note): """Change the Note instance to obj""" self.comments = note - def setComments(self,comments): + def set_comments(self,comments): """sets the comments about the SourceRef""" self.comments.set(comments) - def getComments(self): + def get_comments(self): """returns the comments about the SourceRef""" return self.comments.get() @@ -2071,9 +2067,9 @@ class SourceRef: return 0 if compare_dates(self.date,other.date) != 0: return 0 - if self.getText() != other.getText(): + if self.get_text() != other.get_text(): return 0 - if self.getComments() != other.getComments(): + if self.get_comments() != other.get_comments(): return 0 if self.confidence != other.confidence: return 0 @@ -2092,7 +2088,7 @@ class GenderStats: self.stats = {} def _get_key (self, person): - name = person.getPrimaryName ().getFirstName () + name = person.get_primary_name ().get_first_name () return self._get_key_from_name (name) def _get_key_from_name (self, name): @@ -2111,7 +2107,7 @@ class GenderStats: if not name: return - gender = person.getGender () + gender = person.get_gender () (male, female, unknown) = self.name_stats (name) if not undo: increment = 1 @@ -2158,12 +2154,12 @@ class GrampsDB: def __init__(self): """creates a new GrampsDB""" self.surnames = [] - self.personMap = {} - self.placeTable = {} - self.placeMap = {} - self.sourceTable = {} - self.sourceMap = {} - self.familyMap = {} + self.person_map = {} + self.place_table = {} + self.place_map = {} + self.source_table = {} + self.source_map = {} + self.family_map = {} self.iprefix = "I%d" self.sprefix = "S%d" self.oprefix = "O%d" @@ -2191,37 +2187,37 @@ class GrampsDB: def need_autosave(self): return 1 - def getPersonLength(self): - return len(self.personMap) + def get_number_of_people(self): + return len(self.person_map) - def getPersonKeys(self): - return self.personMap.keys() +v def get_person_keys(self): + return self.person_map.keys() - def sortbyname(self,f,s): - n1 = self.personMap[f].PrimaryName.sname - n2 = self.personMap[s].PrimaryName.sname + def sort_by_name(self,f,s): + n1 = self.person_map[f].primary_name.sname + n2 = self.person_map[s].primary_name.sname return cmp(n1,n2) - def sortPersonKeys(self): - keys = self.personMap.keys() + def sort_person_keys(self): + keys = self.person_map.keys() if type(keys) == type([]): - keys.sort(self.sortbyname) + keys.sort(self.sort_by_name) return keys - def getPersonDisplay(self,key): - return self.personMap[key].getDisplayInfo() + def get_person_display(self,key): + return self.person_map[key].get_display_info() - def buildPersonDisplay(self,nkey,okey=None): - person = self.personMap[nkey] - self.addSurname(person.getPrimaryName().getSurname()) + def build_person_display(self,nkey,okey=None): + person = self.person_map[nkey] + self.add_surname(person.get_primary_name().get_surname()) - def rebuildPersonTable(self): + def rebuild_person_table(self): pass - def buildPlaceDisplay(self,nkey,okey=None): + def build_place_display(self,nkey,okey=None): if okey and nkey != okey: - del self.placeTable[okey] - self.placeTable[nkey] = self.placeMap[nkey].getDisplayInfo() + del self.place_table[okey] + self.place_table[nkey] = self.place_map[nkey].get_display_info() def set_iprefix(self,val): if val: @@ -2272,28 +2268,28 @@ class GrampsDB: """initializes the GrampsDB to empty values""" # eliminate memory reference cycles for 1.5.2 garbage collection - for f in self.familyMap.values(): + for f in self.family_map.values(): f.Father = None f.Mother = None f.Children = [] - self.familyMap = {} + self.family_map = {} - for p in self.personMap.values(): - p.clearAltFamilyList() - p.clearFamilyList() + for p in self.person_map.values(): + p.clear_parent_family_id_list() + p.clear_family_id_list() self.surnames = [] - self.personMap = {} - self.sourceMap = {} - self.sourceTable = {} - self.placeMap = {} - self.placeTable = {} - self.objectMap = {} - self.smapIndex = 0 - self.pmapIndex = 0 - self.fmapIndex = 0 - self.lmapIndex = 0 - self.omapIndex = 0 + self.person_map = {} + self.source_map = {} + self.source_table = {} + self.place_map = {} + self.place_table = {} + self.object_map = {} + self.smap_index = 0 + self.pmap_index = 0 + self.fmap_index = 0 + self.lmap_index = 0 + self.omap_index = 0 self.default = None self.owner = Researcher() self.bookmarks = [] @@ -2301,15 +2297,15 @@ class GrampsDB: self.place2title = {} self.genderStats = GenderStats () - def getSurnames(self): + def get_surnames(self): return self.surnames - def addSurname(self,name): + def add_surname(self,name): if name and name not in self.surnames: self.surnames.append(name) self.surnames.sort() - def getBookmarks(self): + def get_bookmarks(self): """returns the list of Person instances in the bookmarks""" return self.bookmarks @@ -2320,153 +2316,153 @@ class GrampsDB: new_bookmarks.append(person) self.bookmarks = new_bookmarks - def setResearcher(self,owner): + def set_researcher(self,owner): """sets the information about the owner of the database""" - self.owner.set(owner.getName(),owner.getAddress(),owner.getCity(),\ - owner.getState(),owner.getCountry(),\ - owner.getPostalCode(),owner.getPhone(),owner.getEmail()) + self.owner.set(owner.get_name(),owner.get_address(),owner.get_city(),\ + owner.get_state(),owner.get_country(),\ + owner.get_postal_code(),owner.get_phone(),owner.get_email()) - def getResearcher(self): + def get_researcher(self): """returns the Researcher instance, providing information about the owner of the database""" return self.owner - def setDefaultPerson(self,person): + def set_default_person(self,person): """sets the default Person to the passed instance""" if (self.default): - self.default.setAncestor(0) + self.default.set_ancestor(0) self.default = person if person: - self.default.setAncestor(1) + self.default.set_ancestor(1) - def getDefaultPerson(self): + def get_default_person(self): """returns the default Person of the database""" return self.default - def getPerson(self,id): + def get_person(self,id): """returns a map of gramps's IDs to Person instances""" - return self.personMap[id] + return self.person_map[id] - def getPersonMap(self): + def get_person_id_map(self): """returns a map of gramps's IDs to Person instances""" - return self.personMap + return self.person_map - def setPersonMap(self,map): + def set_person_id_map(self,map): """sets the map of gramps's IDs to Person instances""" # Should recalculate self.genderStats here. - self.personMap = map + self.person_map = map - def getPlaceMap(self): + def get_place_id_map(self): """returns a map of gramps's IDs to Place instances""" - return self.placeMap + return self.place_map - def setPlaceMap(self,map): + def set_place_id_map(self,map): """sets the map of gramps's IDs to Place instances""" - self.placeMap = map + self.place_map = map - def getFamilyMap(self): + def get_family_id_map(self): """returns a map of gramps's IDs to Family instances""" - return self.familyMap + return self.family_map - def getFamily(self,id): + def get_family_id(self,id): """returns a map of gramps's IDs to Family instances""" - return self.familyMap[id] + return self.family_map[id] - def setFamilyMap(self,map): + def set_family_id_map(self,map): """sets the map of gramps's IDs to Family instances""" - self.familyMap = map + self.family_map = map - def getSourceMap(self): + def get_source_map(self): """returns a map of gramps's IDs to Source instances""" - return self.sourceMap + return self.source_map - def getObjectMap(self): + def get_object_map(self): """returns a map of gramps's IDs to Object instances""" - return self.objectMap + return self.object_map - def getSavePath(self): + def get_save_path(self): """returns the save path of the file, or "" if one does not exist""" return self.path - def setSavePath(self,path): + def set_save_path(self,path): """sets the save path for the database""" self.path = path - def getPersonEventTypes(self): + def get_person_event_types(self): """returns a list of all Event types assocated with Person instances in the database""" map = {} - for person in self.personMap.values(): - for event in person.getEventList(): - map[event.getName()] = 1 + for person in self.person_map.values(): + for event in person.get_event_list(): + map[event.get_name()] = 1 return map.keys() - def getPersonAttributeTypes(self): + def get_person_attribute_types(self): """returns a list of all Attribute types assocated with Person instances in the database""" map = {} - for key in self.personMap.keys(): - person = self.personMap[key] - for attr in person.getAttributeList(): - map[attr.getType()] = 1 + for key in self.person_map.keys(): + person = self.person_map[key] + for attr in person.get_attribute_list(): + map[attr.get_type()] = 1 return map.keys() - def getFamilyAttributeTypes(self): + def get_family_attribute_types(self): """returns a list of all Attribute types assocated with Family instances in the database""" map = {} - for family in self.familyMap.values(): - for attr in family.getAttributeList(): - map[attr.getType()] = 1 + for family in self.family_map.values(): + for attr in family.get_attribute_list(): + map[attr.get_type()] = 1 return map.keys() - def getFamilyEventTypes(self): + def get_family_event_types(self): """returns a list of all Event types assocated with Family instances in the database""" map = {} - for family in self.familyMap.values(): - for attr in family.getEventList(): - map[attr.getName()] = 1 + for family in self.family_map.values(): + for attr in family.get_event_list(): + map[attr.get_name()] = 1 return map.keys() - def getPlaces(self): + def get_place_ids(self): """returns a list of Place instances""" - return self.placeMap.values() + return self.place_map.values() - def getFamilyRelationTypes(self): + def get_family_relation_types(self): """returns a list of all relationship types assocated with Family instances in the database""" map = {} - for family in self.familyMap.values(): - map[family.getRelationship()] = 1 + for family in self.family_map.values(): + map[family.get_relationship()] = 1 return map.keys() - def removePerson(self,id): - self.genderStats.uncount_person (self.personMap[id]) - del self.personMap[id] + def remove_person_id(self,id): + self.genderStats.uncount_person (self.person_map[id]) + del self.person_map[id] - def removeSource(self,id): - del self.sourceMap[id] - del self.sourceTable[id] + def remove_source_id(self,id): + del self.source_map[id] + del self.source_table[id] - def addPersonAs(self,person): - self.personMap[person.getId()] = person + def add_person_as(self,person): + self.person_map[person.get_id()] = person self.genderStats.count_person (person, self) - return person.getId() + return person.get_id() - def addPerson(self,person): + def add_person(self,person): """adds a Person to the database, assigning a gramps' ID""" - index = self.iprefix % self.pmapIndex - while self.personMap.has_key(index): - self.pmapIndex = self.pmapIndex + 1 - index = self.iprefix % self.pmapIndex - person.setId(index) - self.personMap[index] = person - self.pmapIndex = self.pmapIndex + 1 + index = self.iprefix % self.pmap_index + while self.person_map.has_key(index): + self.pmap_index = self.pmap_index + 1 + index = self.iprefix % self.pmap_index + person.set_id(index) + self.person_map[index] = person + self.pmap_index = self.pmap_index + 1 self.genderStats.count_person (person, self) return index - def findPerson(self,idVal,map): + def find_person(self,idVal,map): """finds a Person in the database using the idVal and map variables to translate between the external ID and gramps' internal ID. If no such Person exists, a new Person instance @@ -2477,207 +2473,190 @@ class GrampsDB: idVal = str(idVal) if map.has_key(idVal): - person = self.personMap[map[idVal]] + person = self.person_map[map[idVal]] else: person = Person() - map[idVal] = self.addPerson(person) + map[idVal] = self.add_person(person) self.genderStats.count_person (person, self) return person - def findPersonNoMap(self,val): + def find_person_from_id(self,val): """finds a Person in the database from the passed gramps' ID. If no such Person exists, a new Person is added to the database.""" - person = self.personMap.get(val) + person = self.person_map.get(val) if not person: person = Person() person.id = val - self.personMap[val] = person - self.pmapIndex = self.pmapIndex+1 + self.person_map[val] = person + self.pmap_index = self.pmap_index+1 self.genderStats.count_person (person, self) return person - def addPersonNoMap(self,person,id): + def add_person_no_map(self,person,id): """adds a Person to the database if the gramps' ID is known""" id = str(id) - person.setId(id) - self.personMap[id] = person - self.pmapIndex = self.pmapIndex+1 + person.set_id(id) + self.person_map[id] = person + self.pmap_index = self.pmap_index+1 self.genderStats.count_person (person, self) return id - def addSource(self,source): + def add_source(self,source): """adds a Source instance to the database, assigning it a gramps' ID number""" - index = self.sprefix % self.smapIndex - while self.sourceMap.has_key(index): - self.smapIndex = self.smapIndex + 1 - index = self.sprefix % self.smapIndex - source.setId(index) - self.sourceMap[index] = source - self.sourceTable[index] = source.getDisplayInfo() - self.smapIndex = self.smapIndex + 1 + index = self.sprefix % self.smap_index + while self.source_map.has_key(index): + self.smap_index = self.smap_index + 1 + index = self.sprefix % self.smap_index + source.set_id(index) + self.source_map[index] = source + self.source_table[index] = source.get_display_info() + self.smap_index = self.smap_index + 1 return index - def addSourceNoMap(self,source,index): + def add_source_no_map(self,source,index): """adds a Source to the database if the gramps' ID is known""" - source.setId(index) - self.sourceMap[index] = source - self.smapIndex = self.smapIndex + 1 - self.sourceTable[index] = source.getDisplayInfo() + source.set_id(index) + self.source_map[index] = source + self.smap_index = self.smap_index + 1 + self.source_table[index] = source.get_display_info() return index - def findSource(self,idVal,map): + def find_source(self,idVal,map): """finds a Source in the database using the idVal and map variables to translate between the external ID and gramps' internal ID. If no such Source exists, a new Source instance is created. idVal - external ID number - map - map build by findSource of external to gramp's IDs""" + map - map build by find_source of external to gramp's IDs""" if map.has_key(idVal): - source = self.sourceMap[map[idVal]] + source = self.source_map[map[idVal]] else: source = Source() - map[idVal] = self.addSource(source) - self.sourceTable[map[idVal]] = source.getDisplayInfo() + map[idVal] = self.add_source(source) + self.source_table[map[idVal]] = source.get_display_info() return source - def findSourceNoMap(self,val): + def find_source_from_id(self,val): """finds a Source in the database from the passed gramps' ID. If no such Source exists, a new Source is added to the database.""" - if self.sourceMap.has_key(val): - source = self.sourceMap[val] + if self.source_map.has_key(val): + source = self.source_map[val] else: source = Source() - self.addSourceNoMap(source,val) - self.sourceTable[val] = source.getDisplayInfo() + self.add_source_no_map(source,val) + self.source_table[val] = source.get_display_info() return source - def addObject(self,object): + def add_object(self,object): """adds an Object instance to the database, assigning it a gramps' ID number""" - index = self.oprefix % self.omapIndex - while self.objectMap.has_key(index): - self.omapIndex = self.omapIndex + 1 - index = self.oprefix % self.omapIndex - object.setId(index) - self.objectMap[index] = object - self.omapIndex = self.omapIndex + 1 + index = self.oprefix % self.omap_index + while self.object_map.has_key(index): + self.omap_index = self.omap_index + 1 + index = self.oprefix % self.omap_index + object.set_id(index) + self.object_map[index] = object + self.omap_index = self.omap_index + 1 self.added_files.append(object) return index - def getObject(self,id): - return self.objectMap[id] + def get_object(self,id): + return self.object_map[id] - def findObject(self,idVal,map): + def find_object(self,idVal,map): """finds an Object in the database using the idVal and map variables to translate between the external ID and gramps' internal ID. If no such Object exists, a new Object instance is created. idVal - external ID number - map - map build by findObject of external to gramp's IDs""" + map - map build by find_object of external to gramp's IDs""" idVal = str(idVal) if map.has_key(idVal): - object = self.objectMap[map[idVal]] + object = self.object_map[map[idVal]] else: object = Photo() - map[idVal] = self.addObject(object) + map[idVal] = self.add_object(object) return object - def findObjectNoConflicts(self,idVal,map): + def find_object_no_conflicts(self,idVal,map): """finds an Object in the database using the idVal and map variables to translate between the external ID and gramps' internal ID. If no such Object exists, a new Object instance is created. idVal - external ID number - map - map build by findObject of external to gramp's IDs""" + map - map build by find_object of external to gramp's IDs""" idVal = str(idVal) if map.has_key(idVal): - object = self.objectMap[map[idVal]] + object = self.object_map[map[idVal]] else: object = Photo() - if self.objectMap.has_key(idVal): - map[idVal] = self.addObject(object) + if self.object_map.has_key(idVal): + map[idVal] = self.add_object(object) else: - map[idVal] = self.addObjectNoMap(object,idVal) + map[idVal] = self.add_object_no_map(object,idVal) return object - def addObjectNoMap(self,object,index): + def add_object_no_map(self,object,index): """adds an Object to the database if the gramps' ID is known""" index = str(index) - object.setId(index) - self.objectMap[index] = object - self.omapIndex = self.omapIndex + 1 + object.set_id(index) + self.object_map[index] = object + self.omap_index = self.omap_index + 1 self.added_files.append(object) return index - def findObjectNoMap(self,idVal): + def find_object_from_id(self,idVal): """finds an Object in the database from the passed gramps' ID. If no such Source exists, a new Source is added to the database.""" val = str(idVal) - if self.objectMap.has_key(val): - object = self.objectMap[val] + if self.object_map.has_key(val): + object = self.object_map[val] else: object = Photo() - self.addObjectNoMap(object,val) + self.add_object_no_map(object,val) return object - def addPlace(self,place): + def add_place(self,place): """adds a Place instance to the database, assigning it a gramps' ID number""" - index = self.pprefix % self.lmapIndex - while self.placeMap.has_key(index): - self.lmapIndex = self.lmapIndex + 1 - index = self.pprefix % self.lmapIndex - place.setId(index) - self.placeMap[index] = place - self.lmapIndex = self.lmapIndex + 1 - self.placeTable[index] = place.getDisplayInfo() + index = self.pprefix % self.lmap_index + while self.place_map.has_key(index): + self.lmap_index = self.lmap_index + 1 + index = self.pprefix % self.lmap_index + place.set_id(index) + self.place_map[index] = place + self.lmap_index = self.lmap_index + 1 + self.place_table[index] = place.get_display_info() return index - def removeObject(self,id): - del self.objectMap[id] + def remove_object(self,id): + del self.object_map[id] - def removePlace(self,id): - del self.placeMap[id] - del self.placeTable[id] + def remove_place(self,id): + del self.place_map[id] + del self.place_table[id] - def addPlaceAs(self,place): - self.placeMap[place.getId()] = place - self.placeTable[place.getId()] = place.getDisplayInfo() - return place.getId() + def add_place_as(self,place): + self.place_map[place.get_id()] = place + self.place_table[place.get_id()] = place.get_display_info() + return place.get_id() - def findPlace(self,idVal,map): - """finds a Place in the database using the idVal and map - variables to translate between the external ID and gramps' - internal ID. If no such Place exists, a new Place instance - is created. - - idVal - external ID number - map - map build by findPlace of external to gramp's IDs""" - - idVal = str(idVal) - if map.has_key(idVal): - place = self.placeMap[map[idVal]] - else: - place = Place() - map[idVal] = self.addPlace(place) - return place - - def findPlaceNoConflicts(self,idVal,map): + def find_place_no_conflicts(self,idVal,map): """finds a Place in the database using the idVal and map variables to translate between the external ID and gramps' internal ID. If no such Place exists, a new Place instance @@ -2687,140 +2666,145 @@ class GrampsDB: map - map build by findPlace of external to gramp's IDs""" if map.has_key(idVal): - place = self.placeMap[map[idVal]] + place = self.place_map[map[idVal]] else: place = Place() - if self.placeMap.has_key(idVal): - map[idVal] = self.addPlace(place) + if self.place_map.has_key(idVal): + map[idVal] = self.add_place(place) else: - place.setId(idVal) - map[idVal] = self.addPlaceAs(place) + place.set_id(idVal) + map[idVal] = self.add_place_as(place) return place - def addPlaceNoMap(self,place,index): + def add_place_no_map(self,place,index): """adds a Place to the database if the gramps' ID is known""" index = str(index) - place.setId(index) - self.placeMap[index] = place - self.lmapIndex = self.lmapIndex + 1 - self.placeTable[index] = place.getDisplayInfo() + place.set_id(index) + self.place_map[index] = place + self.lmap_index = self.lmap_index + 1 + self.place_table[index] = place.get_display_info() return index - def findPlaceNoMap(self,val): + def find_place_from_id(self,val): """finds a Place in the database from the passed gramps' ID. If no such Place exists, a new Place is added to the database.""" - place = self.placeMap.get(val) + place = self.place_map.get(val) if not place: place = Place() place.id = val - self.placeMap[val] = place - self.lmapIndex = self.lmapIndex + 1 - self.placeTable[val] = place.getDisplayInfo() + self.place_map[val] = place + self.lmap_index = self.lmap_index + 1 + self.place_table[val] = place.get_display_info() return place def sortbyplace(self,f,s): - return cmp(self.placeTable[f][7],self.placeTable[s][7]) + return cmp(self.place_table[f][7],self.place_table[s][7]) - def sortPlaceKeys(self): - keys = self.placeTable.keys() + def sort_place_keys(self): + keys = self.place_map.keys() if type(keys) == type([]): keys.sort(self.sortbyplace) return keys - def getPlaceKeys(self): - return self.placeTable.keys() + def get_place_id_keys(self): + return self.place_map.keys() - def getPlace(self,key): - return self.placeMap[key] + def get_place_id(self,key): + return self.place_map[key] - def getPlaceDisplay(self,key): - return self.placeTable[key] + def get_place_display(self,key): + return self.place_table[key] - def getSourceKeys(self): - return self.sourceTable.keys() + def get_source_keys(self): + return self.source_table.keys() def sortbysource(self,f,s): - return cmp(self.sourceTable[f][3],self.sourceTable[s][3]) + return cmp(self.source_table[f][3],self.source_table[s][3]) - def sortSourceKeys(self): - keys = self.sourceTable.keys() + def set_source_keys(self): + keys = self.source_table.keys() if type(keys) == type([]): keys.sort(self.sortbyplace) return keys - def getSourceDisplay(self,key): - return self.sourceTable[key] + def get_source_display(self,key): + return self.source_table[key] - def getSource(self,key): - return self.sourceMap[key] + def get_source(self,key): + return self.source_map[key] - def buildSourceDisplay(self,nkey,okey=None): + def build_source_display(self,nkey,okey=None): if nkey != okey and okey != None: - del self.sourceTable[okey] - if self.sourceTable.has_key(nkey): - del self.sourceTable[nkey] - self.sourceTable[nkey] = self.sourceMap[nkey].getDisplayInfo() + del self.source_table[okey] + if self.source_table.has_key(nkey): + del self.source_table[nkey] + self.source_table[nkey] = self.source_map[nkey].get_display_info() - def newFamily(self): + def new_family(self): """adds a Family to the database, assigning a gramps' ID""" - index = self.fprefix % self.fmapIndex - while self.familyMap.has_key(index): - self.fmapIndex = self.fmapIndex + 1 - index = self.fprefix % self.fmapIndex - self.fmapIndex = self.fmapIndex + 1 + index = self.fprefix % self.fmap_index + while self.family_map.has_key(index): + self.fmap_index = self.fmap_index + 1 + index = self.fprefix % self.fmap_index + self.fmap_index = self.fmap_index + 1 family = Family() - family.setId(index) - self.familyMap[index] = family + family.set_id(index) + self.family_map[index] = family return family - def newFamilyNoMap(self,id): + def new_family_no_map(self,id): """finds a Family in the database from the passed gramps' ID. If no such Family exists, a new Family is added to the database.""" family = Family() id = str(id) - family.setId(id) - self.familyMap[id] = family - self.fmapIndex = self.fmapIndex + 1 + family.set_id(id) + self.family_map[id] = family + self.fmap_index = self.fmap_index + 1 return family - def findFamily(self,idVal,map): + def find_family_with_map(self,idVal,map): """finds a Family in the database using the idVal and map variables to translate between the external ID and gramps' internal ID. If no such Family exists, a new Family instance is created. idVal - external ID number - map - map build by findFamily of external to gramp's IDs""" + map - map build by find_family_with_map of external to gramp's IDs""" if map.has_key(idVal): - family = self.familyMap[map[idVal]] + family = self.family_map[map[idVal]] else: - family = self.newFamily() - map[idVal] = family.getId() + family = self.new_family() + map[idVal] = family.get_id() return family - def findFamilyNoMap(self,val): + def find_family_no_map(self,val): """finds a Family in the database from the passed gramps' ID. If no such Family exists, a new Family is added to the database.""" - family = self.familyMap.get(val) + family = self.family_map.get(val) if not family: family = Family() family.id = val - self.familyMap[val] = family - self.fmapIndex = self.fmapIndex + 1 + self.family_map[val] = family + self.fmap_index = self.fmap_index + 1 return family - def deleteFamily(self,family): + def find_family_from_id(self,val): + """finds a Family in the database from the passed gramps' ID. + If no such Family exists, a new Family is added to the database.""" + + return self.family_map.get(val) + + def delete_family(self,family_id): """deletes the Family instance from the database""" - if self.familyMap.has_key(family.getId()): - del self.familyMap[family.getId()] + if self.family_map.has_key(family_id): + del self.family_map[family_id] - - def findPersonNoConflicts(self,idVal,map): + def find_person_no_conflicts(self,idVal,map): """finds a Person in the database using the idVal and map variables to translate between the external ID and gramps' internal ID. If no such Person exists, a new Person instance @@ -2830,17 +2814,17 @@ class GrampsDB: map - map build by findPerson of external to gramp's IDs""" if map.has_key(idVal): - person = self.personMap[map[idVal]] + person = self.person_map[map[idVal]] else: person = Person() - if self.personMap.has_key(idVal): - map[idVal] = self.addPerson(person) + if self.person_map.has_key(idVal): + map[idVal] = self.add_person(person) else: - person.setId(idVal) - map[idVal] = self.addPersonAs(person) + person.set_id(idVal) + map[idVal] = self.add_person_as(person) return person - def findFamilyNoConflicts(self,idVal,map): + def find_family_no_conflicts(self,idVal,map): """finds a Family in the database using the idVal and map variables to translate between the external ID and gramps' internal ID. If no such Family exists, a new Family instance @@ -2850,16 +2834,16 @@ class GrampsDB: map - map build by findFamily of external to gramp's IDs""" if map.has_key(idVal): - family = self.familyMap[map[idVal]] + family = self.family_map[map[idVal]] else: - if self.familyMap.has_key(idVal): - family = self.newFamily() + if self.family_map.has_key(idVal): + family = self.new_family() else: - family = self.newFamilyNoMap(idVal) - map[idVal] = family.getId() + family = self.new_family_no_map(idVal) + map[idVal] = family.get_id() return family - def findSourceNoConflicts(self,idVal,map): + def find_source_no_conflicts(self,idVal,map): """finds a Source in the database using the idVal and map variables to translate between the external ID and gramps' internal ID. If no such Source exists, a new Source instance @@ -2869,11 +2853,11 @@ class GrampsDB: map - map build by findSource of external to gramp's IDs""" if map.has_key(idVal): - source = self.sourceMap[map[idVal]] + source = self.source_map[map[idVal]] else: source = Source() - if self.sourceMap.has_key(idVal): - map[idVal] = self.addSource(source) + if self.source_map.has_key(idVal): + map[idVal] = self.add_source(source) else: - map[idVal] = self.addSource(source) + map[idVal] = self.add_source(source) return source diff --git a/src/Relationship.py b/src/Relationship.py index 323ab3d45..c34d07207 100644 --- a/src/Relationship.py +++ b/src/Relationship.py @@ -154,218 +154,231 @@ _niece_level = [ "", "niece", "grandniece", "great grandniece", "second great gr # # #------------------------------------------------------------------------- -def apply_filter(person,index,plist,pmap): - if person == None: - return - plist.append(person) - pmap[person.getId()] = index + +class RelationshipCalculator: + + def __init__(self,db): + self.db = db + + def apply_filter(self,person_id,index,plist,pmap): + if person_id == None: + return + plist.append(person_id) + pmap[person_id] = index + + person = self.db.find_person_from_id(person_id) + family_id = person.get_main_parents_family_id() + family = self.db.find_family_from_id(family_id) + if family != None: + self.apply_filter(family.get_father_id(),index+1,plist,pmap) + self.apply_filter(family.get_mother_id(),index+1,plist,pmap) + + def get_cousin(self,level,removed): + if removed > len(_removed_level)-1 or level>len(_level_name)-1: + return "distant relative" + else: + return "%s cousin%s" % (_level_name[level],_removed_level[removed]) + + def get_parents(self,level): + if level>len(_parents_level)-1: + return "distant ancestors" + else: + return _parents_level[level] + + def get_father(self,level): + if level>len(_father_level)-1: + return "distant ancestor" + else: + return _father_level[level] + + def get_son(self,level): + if level>len(_son_level)-1: + return "distant descendant" + else: + return _son_level[level] + + def get_mother(self,level): + if level>len(_mother_level)-1: + return "distant ancestor" + else: + return _mother_level[level] + + def get_daughter(self,level): + if level>len(_daughter_level)-1: + return "distant descendant" + else: + return _daughter_level[level] + + def get_aunt(self,level): + if level>len(_sister_level)-1: + return "distant ancestor" + else: + return _sister_level[level] + + def get_uncle(self,level): + if level>len(_brother_level)-1: + return "distant ancestor" + else: + return _brother_level[level] + + def get_nephew(self,level): + if level>len(_nephew_level)-1: + return "distant descendant" + else: + return _nephew_level[level] + + def get_niece(self,level): + if level>len(_niece_level)-1: + return "distant descendant" + else: + return _niece_level[level] + + def is_spouse(self,orig,other): + for f in orig.get_family_id_list(): + family = self.db.find_family_from_id(f) + if family: + if other == family.get_father_id() or other == family.get_mother_id(): + return 1 + else: + return 0 + return 0 + + def get_relationship(self,orig_person,other_person): + """ + returns a string representping the relationshp between the two people, + along with a list of common ancestors (typically father,mother) + """ + firstMap = {} + firstList = [] + secondMap = {} + secondList = [] + common = [] + rank = 9999999 + + if orig_person == None: + return ("undefined",[]) + + if orig_person == other_person: + return ('', []) + + if self.is_spouse(orig_person,other_person): + return ("spouse",[]) + + try: + self.apply_filter(orig_person,0,firstList,firstMap) + self.apply_filter(other_person,0,secondList,secondMap) + except RuntimeError,msg: + return (_("Relationship loop detected"),None) - family = person.getMainParents() - if family != None: - apply_filter(family.getFather(),index+1,plist,pmap) - apply_filter(family.getMother(),index+1,plist,pmap) + for person in firstList: + if person in secondList: + new_rank = firstMap[person.get_id()] + if new_rank < rank: + rank = new_rank + common = [ person ] + elif new_rank == rank: + common.append(person) -def get_cousin(level,removed): - if removed > len(_removed_level)-1 or level>len(_level_name)-1: - return "distant relative" - else: - return "%s cousin%s" % (_level_name[level],_removed_level[removed]) + firstRel = -1 + secondRel = -1 -def get_parents(level): - if level>len(_parents_level)-1: - return "distant ancestors" - else: - return _parents_level[level] - -def get_father(level): - if level>len(_father_level)-1: - return "distant ancestor" - else: - return _father_level[level] - -def get_son(level): - if level>len(_son_level)-1: - return "distant descendant" - else: - return _son_level[level] - -def get_mother(level): - if level>len(_mother_level)-1: - return "distant ancestor" - else: - return _mother_level[level] - -def get_daughter(level): - if level>len(_daughter_level)-1: - return "distant descendant" - else: - return _daughter_level[level] - -def get_aunt(level): - if level>len(_sister_level)-1: - return "distant ancestor" - else: - return _sister_level[level] - -def get_uncle(level): - if level>len(_brother_level)-1: - return "distant ancestor" - else: - return _brother_level[level] - -def get_nephew(level): - if level>len(_nephew_level)-1: - return "distant descendant" - else: - return _nephew_level[level] - -def get_niece(level): - if level>len(_niece_level)-1: - return "distant descendant" - else: - return _niece_level[level] - -def is_spouse(orig,other): - for f in orig.getFamilyList(): - if other == f.getFather() or other == f.getMother(): - return 1 - return 0 - -def get_relationship(orig_person,other_person): - """ - returns a string representing the relationshp between the two people, - along with a list of common ancestors (typically father,mother) - """ - firstMap = {} - firstList = [] - secondMap = {} - secondList = [] - common = [] - rank = 9999999 - - if orig_person == None: - return ("undefined",[]) - - if orig_person == other_person: - return ('', []) - if is_spouse(orig_person,other_person): - return ("spouse",[]) - - try: - apply_filter(orig_person,0,firstList,firstMap) - apply_filter(other_person,0,secondList,secondMap) - except RuntimeError,msg: - return (_("Relationship loop detected"),None) + length = len(common) - for person in firstList: - if person in secondList: - new_rank = firstMap[person.getId()] - if new_rank < rank: - rank = new_rank - common = [ person ] - elif new_rank == rank: - common.append(person) + if length == 1: + person = common[0] + secondRel = firstMap[person.get_id()] + firstRel = secondMap[person.get_id()] + elif length == 2: + p1 = common[0] + secondRel = firstMap[p1.get_id()] + firstRel = secondMap[p1.get_id()] + elif length > 2: + person = common[0] + secondRel = firstMap[person.get_id()] + firstRel = secondMap[person.get_id()] + + if firstRel == -1: + return ("",[]) + elif firstRel == 0: + if secondRel == 0: + return ('',common) + elif other_person.get_gender() == RelLib.Person.male: + return (self.get_father(secondRel),common) + else: + return (self.get_mother(secondRel),common) + elif secondRel == 0: + if other_person.get_gender() == RelLib.Person.male: + return (self.get_son(firstRel),common) + else: + return (self.get_daughter(firstRel),common) + elif firstRel == 1: + if other_person.get_gender() == RelLib.Person.male: + return (self.get_uncle(secondRel),common) + else: + return (self.get_aunt(secondRel),common) + elif secondRel == 1: + if other_person.get_gender() == RelLib.Person.male: + return (self.get_nephew(firstRel-1),common) + else: + return (self.get_niece(firstRel-1),common) + else: + if secondRel > firstRel: + return (self.get_cousin(firstRel-1,secondRel-firstRel),common) + else: + return (self.get_cousin(secondRel-1,firstRel-secondRel),common) - firstRel = -1 - secondRel = -1 + def get_grandparents_string(self,orig_person,other_person): + """ + returns a string representing the relationshp between the two people, + along with a list of common ancestors (typically father,mother) + """ + firstMap = {} + firstList = [] + secondMap = {} + secondList = [] + common = [] + rank = 9999999 + + if orig_person == None: + return ("undefined",[]) - length = len(common) + if orig_person == other_person: + return ('', []) + + self.apply_filter(orig_person,0,firstList,firstMap) + self.apply_filter(other_person,0,secondList,secondMap) - if length == 1: - person = common[0] - secondRel = firstMap[person.getId()] - firstRel = secondMap[person.getId()] - elif length == 2: - p1 = common[0] - secondRel = firstMap[p1.getId()] - firstRel = secondMap[p1.getId()] - elif length > 2: - person = common[0] - secondRel = firstMap[person.getId()] - firstRel = secondMap[person.getId()] + for person in firstList: + if person in secondList: + new_rank = firstMap[person.get_id()] + if new_rank < rank: + rank = new_rank + common = [ person ] + elif new_rank == rank: + common.append(person) - if firstRel == -1: - return ("",[]) - elif firstRel == 0: - if secondRel == 0: - return ('',common) - elif other_person.getGender() == RelLib.Person.male: - return (get_father(secondRel),common) - else: - return (get_mother(secondRel),common) - elif secondRel == 0: - if other_person.getGender() == RelLib.Person.male: - return (get_son(firstRel),common) - else: - return (get_daughter(firstRel),common) - elif firstRel == 1: - if other_person.getGender() == RelLib.Person.male: - return (get_uncle(secondRel),common) - else: - return (get_aunt(secondRel),common) - elif secondRel == 1: - if other_person.getGender() == RelLib.Person.male: - return (get_nephew(firstRel-1),common) - else: - return (get_niece(firstRel-1),common) - else: - if secondRel > firstRel: - return (get_cousin(firstRel-1,secondRel-firstRel),common) - else: - return (get_cousin(secondRel-1,firstRel-secondRel),common) + firstRel = -1 + secondRel = -1 -def get_grandparents_string(orig_person,other_person): - """ - returns a string representing the relationshp between the two people, - along with a list of common ancestors (typically father,mother) - """ - firstMap = {} - firstList = [] - secondMap = {} - secondList = [] - common = [] - rank = 9999999 - - if orig_person == None: - return ("undefined",[]) - - if orig_person == other_person: - return ('', []) - - apply_filter(orig_person,0,firstList,firstMap) - apply_filter(other_person,0,secondList,secondMap) + length = len(common) - for person in firstList: - if person in secondList: - new_rank = firstMap[person.getId()] - if new_rank < rank: - rank = new_rank - common = [ person ] - elif new_rank == rank: - common.append(person) - - firstRel = -1 - secondRel = -1 - - length = len(common) - - if length == 1: - person = common[0] - secondRel = firstMap[person.getId()] - firstRel = secondMap[person.getId()] - elif length == 2: - p1 = common[0] - secondRel = firstMap[p1.getId()] - firstRel = secondMap[p1.getId()] - elif length > 2: - person = common[0] - secondRel = firstMap[person.getId()] - firstRel = secondMap[person.getId()] - - if firstRel == 0: - if secondRel == 0: - return ('',common) + if length == 1: + person = common[0] + secondRel = firstMap[person.get_id()] + firstRel = secondMap[person.get_id()] + elif length == 2: + p1 = common[0] + secondRel = firstMap[p1.get_id()] + firstRel = secondMap[p1.get_id()] + elif length > 2: + person = common[0] + secondRel = firstMap[person.get_id()] + firstRel = secondMap[person.get_id()] + + if firstRel == 0: + if secondRel == 0: + return ('',common) + else: + return (self.get_parents(secondRel),common) else: - return (get_parents(secondRel),common) - else: - return None + return None diff --git a/src/Report.py b/src/Report.py index f3482c531..f7a05f024 100644 --- a/src/Report.py +++ b/src/Report.py @@ -396,7 +396,7 @@ class BareReportDialog: """Set up the title bar of the dialog. This function relies on the get_title() customization function for what the title should be.""" - self.name = self.person.getPrimaryName().getRegularName() + self.name = self.person.get_primary_name().get_regular_name() self.window.set_title(self.get_title()) def setup_header(self): @@ -432,7 +432,7 @@ class BareReportDialog: self.tbl.attach(center_label,0,4,self.col,self.col+1) self.col += 1 - name = self.person.getPrimaryName().getRegularName() + name = self.person.get_primary_name().get_regular_name() self.person_label = gtk.Label( "%s" % name ) self.person_label.set_alignment(0.0,0.5) self.tbl.attach(self.person_label,2,3,self.col,self.col+1) @@ -737,7 +737,7 @@ class BareReportDialog: new_person = sel_person.run() if new_person: self.new_person = new_person - new_name = new_person.getPrimaryName().getRegularName() + new_name = new_person.get_primary_name().get_regular_name() if new_name: self.person_label.set_text( "%s" % new_name ) self.person_label.set_use_markup(gtk.TRUE) diff --git a/src/SelectChild.py b/src/SelectChild.py index 038f99101..9db6ede6c 100644 --- a/src/SelectChild.py +++ b/src/SelectChild.py @@ -64,7 +64,7 @@ class SelectChild: self.xml = gtk.glade.XML(const.gladeFile,"select_child","gramps") if person: - self.default_name = person.getPrimaryName().getSurname().upper() + self.default_name = person.get_primary_name().get_surname().upper() else: self.default_name = "" @@ -84,27 +84,27 @@ class SelectChild: self.add_child = self.xml.get_widget("childlist") if (self.family): - father = self.family.getFather() - mother = self.family.getMother() + father = self.family.get_father_id() + mother = self.family.get_mother_id() if father != None: - fname = father.getPrimaryName().getName() + fname = father.get_primary_name().get_name() label = _("Relationship to %(father)s") % { 'father' : fname } self.xml.get_widget("flabel").set_text(label) if mother != None: - mname = mother.getPrimaryName().getName() + mname = mother.get_primary_name().get_name() label = _("Relationship to %(mother)s") % { 'mother' : mname } self.xml.get_widget("mlabel").set_text(label) else: - fname = self.person.getPrimaryName().getName() + fname = self.person.get_primary_name().get_name() label = _("Relationship to %s") % fname - if self.person.getGender() == RelLib.Person.male: + if self.person.get_gender() == RelLib.Person.male: self.xml.get_widget("flabel").set_text(label) self.xml.get_widget("mrel_combo").set_sensitive(0) else: @@ -133,28 +133,29 @@ class SelectChild: def redraw_child_list(self,filter): self.refmodel.clear() self.refmodel.new_model() - bday = self.person.getBirth().getDateObj() - dday = self.person.getDeath().getDateObj() + bday = self.person.get_birth().get_date_object() + dday = self.person.get_death().get_date_object() slist = {} - for f in self.person.getParentList(): + for f in self.person.get_parent_family_id_list(): if f: - if f[0].getFather(): - slist[f[0].getFather().getId()] = 1 - elif f[0].getMother(): - slist[f[0].getMother().getId()] = 1 - for c in f[0].getChildList(): - slist[c.getId()] = 1 + family = self.db.find_family_no_map(f[0]) + if family.get_father_id(): + slist[family.get_father_id()] = 1 + elif family.get_mother_id(): + slist[ffamily.get_mother_id()] = 1 + for c in family.get_child_id_list(): + slist[c.get_id()] = 1 person_list = [] - for key in self.db.sortPersonKeys(): - person = self.db.getPerson(key) + for key in self.db.sort_person_keys(): + person = self.db.get_person(key) if filter: - if slist.has_key(key) or person.getMainParents(): + if slist.has_key(key) or person.get_main_parents_family_id(): continue - pdday = person.getDeath().getDateObj() - pbday = person.getBirth().getDateObj() + pdday = person.get_death().get_date_object() + pbday = person.get_birth().get_date_object() if bday.getYearValid(): if pbday.getYearValid(): @@ -182,11 +183,11 @@ class SelectChild: if pdday.getLowYear() > dday.getHighYear() + 150: continue - person_list.append(person.getId()) + person_list.append(person.get_id()) iter = None for idval in person_list: - dinfo = self.db.getPersonDisplay(idval) + dinfo = self.db.get_person_display(idval) rdata = [dinfo[0],dinfo[1],dinfo[3],dinfo[5],dinfo[6]] new_iter = self.refmodel.add(rdata) names = dinfo[0].split(',') @@ -211,30 +212,30 @@ class SelectChild: return id = self.refmodel.model.get_value(iter,1) - select_child = self.db.getPerson(id) + select_child = self.db.get_person(id) if self.family == None: - self.family = self.db.newFamily() - self.person.addFamily(self.family) - if self.person.getGender() == RelLib.Person.male: - self.family.setFather(self.person) + self.family = self.db.new_family() + self.person.add_family_id(self.family.get_id()) + if self.person.get_gender() == RelLib.Person.male: + self.family.set_father_id(self.person) else: - self.family.setMother(self.person) + self.family.set_mother_id(self.person) - self.family.addChild(select_child) + self.family.add_child_id(select_child) - mrel = const.childRelations[unicode(self.mrel.get_text())] - mother = self.family.getMother() - if mother and mother.getGender() != RelLib.Person.female: + mrel = const.child_relations(self.mrel.get_text()) + mother = self.family.get_mother_id() + if mother and mother.get_gender() != RelLib.Person.female: if mrel == "Birth": mrel = "Unknown" - frel = const.childRelations[unicode(self.frel.get_text())] - father = self.family.getFather() - if father and father.getGender() !=RelLib. Person.male: + frel = const.child_relations(self.frel.get_text()) + father = self.family.get_father_id() + if father and father.get_gender() !=RelLib. Person.male: if frel == "Birth": frel = "Unknown" - select_child.addAltFamily(self.family,mrel,frel) + select_child.add_parent_family_id(self.family.get_id(),mrel,frel) Utils.modified() self.top.destroy() @@ -244,13 +245,13 @@ class SelectChild: self.redraw_child_list(not obj.get_active()) def north_american(self,val): - if self.person.getGender() == Person.male: - return self.person.getPrimaryName().getSurname() + if self.person.get_gender() == Person.male: + return self.person.get_primary_name().get_surname() elif self.family: - f = self.family.getFather() + f = self.family.get_father_id() if f: - pname = f.getPrimaryName() - return (pname.getSurnamePrefix(),pname.getSurname()) + pname = f.get_primary_name() + return (pname.get_surname_prefix(),pname.get_surname()) return ("","") def no_name(self,val): @@ -258,12 +259,12 @@ class SelectChild: def latin_american(self,val): if self.family: - father = self.family.getFather() - mother = self.family.getMother() + father = self.family.get_father_id() + mother = self.family.get_mother_id() if not father or not mother: return ("","") - fsn = father.getPrimaryName().getSurname() - msn = mother.getPrimaryName().getSurname() + fsn = father.get_primary_name().get_surname() + msn = mother.get_primary_name().get_surname() if not father or not mother: return ("","") try: @@ -275,12 +276,12 @@ class SelectChild: def icelandic(self,val): fname = "" - if self.person.getGender() == Person.male: - fname = self.person.getPrimaryName().getFirstName() + if self.person.get_gender() == Person.male: + fname = self.person.get_primary_name().get_first_name() elif self.family: - f = self.family.getFather() + f = self.family.get_father_id() if f: - fname = f.getPrimaryName().getFirstName() + fname = f.get_primary_name().get_first_name() if fname: fname = fname.split()[0] if val == 0: @@ -306,15 +307,15 @@ class EditRel: self.mcombo = self.xml.get_widget('mrel_combo') self.fcombo = self.xml.get_widget('frel_combo') - name = child.getPrimaryName().getName() + name = child.get_primary_name().get_name() Utils.set_titles(self.top,self.xml.get_widget('title'), _('Relationships of %s') % name) - father = self.family.getFather() - mother = self.family.getMother() + father = self.family.get_father_id() + mother = self.family.get_mother_id() if father: - fname = father.getPrimaryName().getName() + fname = father.get_primary_name().get_name() val = _("Relationship to %(father)s") % { 'father' : fname } self.fdesc.set_text('%s' % val) @@ -325,7 +326,7 @@ class EditRel: self.fcombo.set_sensitive(0) if mother: - mname = mother.getPrimaryName().getName() + mname = mother.get_primary_name().get_name() val = _("Relationship to %(mother)s") % { 'mother' : mname } self.mdesc.set_text('%s' % val) @@ -340,7 +341,7 @@ class EditRel: "destroy_passed_object" : self.close }) - f = self.child.has_family(self.family) + f = self.child.has_family(self.family.get_id()) self.fentry.set_text(_(f[2])) self.mentry.set_text(_(f[1])) @@ -352,18 +353,18 @@ class EditRel: self.top.destroy() def on_ok_clicked(self,obj): - mrel = const.childRelations[unicode(self.mentry.get_text())] - mother = self.family.getMother() - if mother and mother.getGender() != RelLib.Person.female: + mrel = const.child_relations(self.mentry.get_text()) + mother = self.family.get_mother_id() + if mother and mother.get_gender() != RelLib.Person.female: if mrel == "Birth": mrel = "Unknown" - frel = const.childRelations[unicode(self.fentry.get_text())] - father = self.family.getFather() - if father and father.getGender() !=RelLib. Person.male: + frel = const.child_relations(self.fentry.get_text()) + father = self.family.get_father_id() + if father and father.get_gender() !=RelLib. Person.male: if frel == "Birth": frel = "Unknown" - self.child.changeAltFamily(self.family,mrel,frel) + self.child.change_parent_family_id(self.family,mrel,frel) self.update() self.top.destroy() diff --git a/src/SelectObject.py b/src/SelectObject.py index 062f9dc72..818d6b237 100644 --- a/src/SelectObject.py +++ b/src/SelectObject.py @@ -98,15 +98,15 @@ class SelectObject: self.object_model.clear() self.object_model.new_model() - for key in self.db.getObjectMap().keys(): - object = self.db.getObject(key) - title = object.getDescription() - the_id = object.getId() - the_type = Utils.get_mime_description(object.getMimeType()) - if object.getLocal(): + for key in self.db.get_object_map().keys(): + object = self.db.get_object(key) + title = object.get_description() + the_id = object.get_id() + the_type = Utils.get_mime_description(object.get_mime_type()) + if object.get_local(): path = "" else: - path = object.getPath() + path = object.get_path() self.object_model.add([title,the_id,the_type,path],key) self.object_model.connect_model() @@ -119,11 +119,11 @@ class SelectObject: return data = self.object_model.get_data(iter,range(self.ncols)) the_id = data[4] - object = self.db.getObject(the_id) - the_type = Utils.get_mime_description(object.getMimeType()) - path = object.getPath() + object = self.db.get_object(the_id) + the_type = Utils.get_mime_description(object.get_mime_type()) + path = object.get_path() - thumb_path = Utils.thumb_path(self.db.getSavePath(),object) + thumb_path = Utils.thumb_path(self.db.get_save_path(),object) pexists = os.path.exists(path) if pexists and os.path.exists(thumb_path): self.preview.set_from_pixbuf(gtk.gdk.pixbuf_new_from_file(thumb_path)) @@ -133,9 +133,9 @@ class SelectObject: if not pexists: fexists = 0 - self.object_id.set_text(object.getId()) + self.object_id.set_text(object.get_id()) self.object_type.set_text(the_type) - self.object_desc.set_text(object.getDescription()) + self.object_desc.set_text(object.get_description()) if len(path) == 0 or fexists == 0: self.object_path.set_text(_("The file no longer exists")) elif path[0] == "/": @@ -152,7 +152,7 @@ class SelectObject: if iter: data = self.object_model.get_data(iter,range(self.ncols)) the_id = data[4] - return_value = self.db.getObject(the_id) + return_value = self.db.get_object(the_id) else: return_value = None self.top.destroy() diff --git a/src/SelectPerson.py b/src/SelectPerson.py index 52398aa86..bbdd55499 100644 --- a/src/SelectPerson.py +++ b/src/SelectPerson.py @@ -107,13 +107,13 @@ class SelectPerson: self.umodel.clear() self.umodel.new_model() - for key in self.db.sortPersonKeys(): - person = self.db.getPerson(key) + for key in self.db.sort_person_keys(): + person = self.db.get_person(key) if self.use_filter and not self.filter(person): continue - data = self.db.getPersonDisplay(key) - gender = person.getGender() + data = self.db.get_person_display(key) + gender = person.get_gender() if gender == RelLib.Person.male: self.mmodel.add([data[0],data[1],data[3],data[5],data[6]],key) elif gender == RelLib.Person.female: @@ -140,7 +140,7 @@ class SelectPerson: model,iter = lmodel.get_selected() if iter: id = lmodel.get_object(iter) - return_value = self.db.getPerson(id) + return_value = self.db.get_person(id) else: return_value = None self.top.destroy() diff --git a/src/SourceView.py b/src/SourceView.py index db433fdf6..d2423767b 100644 --- a/src/SourceView.py +++ b/src/SourceView.py @@ -113,8 +113,8 @@ class SourceView: gobject.TYPE_STRING) self.map = {} - for key in self.db.getSourceKeys(): - val = self.db.getSourceDisplay(key) + for key in self.db.get_source_keys(): + val = self.db.get_source_display(key) iter = self.model.append() self.map[val[1]] = iter @@ -127,7 +127,7 @@ class SourceView: if event.type == gtk.gdk._2BUTTON_PRESS and event.button == 1: store,iter = self.selection.get_selected() id = store.get_value(iter,1) - source = self.db.getSource(id) + source = self.db.get_source(id) EditSource.EditSource(source,self.db,self.topWindow,self.update_display) return 1 elif event.type == gtk.gdk.BUTTON_PRESS and event.button == 3: @@ -170,58 +170,58 @@ class SourceView: return id = store.get_value(iter,1) - source = self.db.getSource(id) + source = self.db.get_source(id) if self.is_used(source): ans = EditSource.DelSrcQuery(source,self.db,self.update) - QuestionDialog(_('Delete %s?') % source.getTitle(), + QuestionDialog(_('Delete %s?') % source.get_title(), _('This source is currently being used. Deleting it ' 'will remove it from the database and from all ' 'records that reference it.'), _('_Delete Source'), ans.query_response,self.topWindow) else: - self.db.removeSource(source.getId()) + self.db.remove_source_id(source.get_id()) Utils.modified() self.update(0) def is_used(self,source): - for key in self.db.getPlaceKeys(): - p = self.db.getPlace(key) - for sref in p.getSourceRefList(): - if sref.getBase() == source: + for key in self.db.get_place_id_keys(): + p = self.db.get_place_id(key) + for sref in p.get_source_references(): + if sref.get_base_id() == source.get_id(): return 1 - for key in self.db.getPersonKeys(): - p = self.db.getPerson(key) - for v in p.getEventList() + [p.getBirth(), p.getDeath()]: - for sref in v.getSourceRefList(): - if sref.getBase() == source: + for key in self.db.get_person_keys(): + p = self.db.get_person(key) + for v in p.get_event_list() + [p.get_birth(), p.get_death()]: + for sref in v.get_source_references(): + if sref.get_base_id() == source.get_id(): return 1 - for v in p.getAttributeList(): - for sref in v.getSourceRefList(): - if sref.getBase() == source: + for v in p.get_attribute_list(): + for sref in v.get_source_references(): + if sref.get_base_id() == source.get_id(): return 1 - for v in p.getAlternateNames() + [p.getPrimaryName()]: - for sref in v.getSourceRefList(): - if sref.getBase() == source: + for v in p.get_alternate_names() + [p.get_primary_name()]: + for sref in v.get_source_references(): + if sref.get_base_id() == source.get_id(): return 1 - for v in p.getAddressList(): - for sref in v.getSourceRefList(): - if sref.getBase() == source: + for v in p.get_address_list(): + for sref in v.get_source_references(): + if sref.get_base_id() == source.get_id(): return 1 - for p in self.db.getObjectMap().values(): - for sref in p.getSourceRefList(): - if sref.getBase() == source: + for p in self.db.get_object_map().values(): + for sref in p.get_source_references(): + if sref.get_base_id() == source.get_id(): return 1 - for p in self.db.getFamilyMap().values(): - for v in p.getEventList(): - for sref in v.getSourceRefList(): - if sref.getBase() == source: + for p in self.db.get_family_id_map().values(): + for v in p.get_event_list(): + for sref in v.get_source_references(): + if sref.get_base_id() == source.get_id(): return 1 - for v in p.getAttributeList(): - for sref in v.getSourceRefList(): - if sref.getBase() == source: + for v in p.get_attribute_list(): + for sref in v.get_source_references(): + if sref.get_base_id() == source.get_id(): return 1 return 0 @@ -229,14 +229,14 @@ class SourceView: list_store, iter = self.selection.get_selected() if iter: id = list_store.get_value(iter,1) - source = self.db.getSource(id) + source = self.db.get_source(id) EditSource.EditSource(source, self.db, self.topWindow, self.update_display) def new_after_edit(self,source): - self.db.addSource(source) + self.db.add_source(source) self.update(0) def update_display(self,place): - self.db.buildSourceDisplay(place.getId()) + self.db.build_source_display(place.get_id()) self.update(0) diff --git a/src/Sources.py b/src/Sources.py index 80a910e59..1641e9796 100644 --- a/src/Sources.py +++ b/src/Sources.py @@ -118,9 +118,10 @@ class SourceSelector: def redraw(self): self.model.clear() for s in self.list: - base = s.getBase() + base_id = s.get_base_id() + base = self.db.find_source_from_id(base_id) iter = self.model.append() - self.model.set(iter,0,base.getId(),1,base.getTitle()) + self.model.set(iter,0,base_id,1,base.get_title()) def src_ok_clicked(self): del self.orig[:] @@ -197,9 +198,10 @@ class SourceTab: def redraw(self): self.model.clear() for s in self.list: - base = s.getBase() + base_id = s.get_base_id() iter = self.model.append() - self.model.set(iter,0,base.getId(),1,base.getTitle()) + base = self.db.find_source_from_id(base_id) + self.model.set(iter,0,base_id,1,base.get_title()) if self.list: Utils.bold_label(self.parent.sources_label) else: @@ -262,7 +264,7 @@ class SourceEditor: self.conf_menu = self.get_widget("conf") self.ok = self.get_widget("ok") Utils.build_confidence_menu(self.conf_menu) - self.conf_menu.set_history(srcref.getConfidence()) + self.conf_menu.set_history(srcref.get_confidence_level()) self.list = [] self.title_menu.list.select_item(0) @@ -272,7 +274,7 @@ class SourceEditor: self.pub_field = self.get_widget("spubinfo") if self.source_ref: - self.active_source = self.source_ref.getBase() + self.active_source = self.db.find_source_from_id(self.source_ref.get_base_id()) else: self.active_source = None @@ -305,33 +307,33 @@ class SourceEditor: self.title_menu.list.remove_items(self.list) if self.source_ref: spage = self.get_widget("spage") - spage.get_buffer().set_text(self.source_ref.getPage()) - date = self.source_ref.getDate() + spage.get_buffer().set_text(self.source_ref.get_page()) + date = self.source_ref.get_date() if date: - self.get_widget("sdate").set_text(date.getDate()) + self.get_widget("sdate").set_text(date.get_date()) text = self.get_widget("stext") - text.get_buffer().set_text(self.source_ref.getText()) + text.get_buffer().set_text(self.source_ref.get_text()) scom = self.get_widget("scomment") - scom.get_buffer().set_text(self.source_ref.getComments()) - src = self.source_ref.getBase() + scom.get_buffer().set_text(self.source_ref.get_comments()) + src = self.db.find_source_from_id(self.source_ref.get_base_id()) self.active_source = src if src: - self.author_field.set_text(src.getAuthor()) - self.pub_field.set_text(src.getPubInfo()) + self.author_field.set_text(src.get_author()) + self.pub_field.set_text(src.get_publication_info()) else: self.author_field.set_text("") self.pub_field.set_text("") - values = self.db.getSourceMap().values() + values = self.db.get_source_map().values() values.sort(by_title) sel_child = None self.list = [] self.active_source = sel for src in values: - l = gtk.Label("%s [%s]" % (src.getTitle(),src.getId())) + l = gtk.Label("%s [%s]" % (src.get_title(),src.get_id())) l.show() l.set_alignment(0,0.5) c = gtk.ListItem() @@ -352,8 +354,8 @@ class SourceEditor: def on_sourceok_clicked(self): - if self.active_source != self.source_ref.getBase(): - self.source_ref.setBase(self.active_source) + if self.active_source != self.db.find_source_from_id(self.source_ref.get_base_id()): + self.source_ref.set_base_id(self.active_source) date = unicode(self.get_widget("sdate").get_text()) conf = self.get_widget("conf").get_menu().get_active().get_data('a') @@ -370,11 +372,11 @@ class SourceEditor: page = unicode(buffer.get_text(buffer.get_start_iter(), buffer.get_end_iter(),gtk.FALSE)) - self.source_ref.setPage(page) - self.source_ref.getDate().set(date) - self.source_ref.setText(text) - self.source_ref.setComments(comments) - self.source_ref.setConfidence(conf) + self.source_ref.set_page(page) + self.source_ref.get_date().set(date) + self.source_ref.set_text(text) + self.source_ref.set_comments(comments) + self.source_ref.set_confidence_level(conf) if self.update: self.update(self.parent,self.source_ref) @@ -387,12 +389,12 @@ class SourceEditor: self.active_source = sel[0].get_data("s") if self.active_source: - self.author_field.set_text(self.active_source.getAuthor()) - self.pub_field.set_text(self.active_source.getPubInfo()) + self.author_field.set_text(self.active_source.get_author()) + self.pub_field.set_text(self.active_source.get_publication_info()) self.set_button() def update_display(self,source): - self.db.addSource(source) + self.db.add_source(source) self.draw(source) # self.update(0) @@ -402,4 +404,4 @@ class SourceEditor: def by_title(first,second): - return cmp(first.getTitle(),second.getTitle()) + return cmp(first.get_title(),second.get_title()) diff --git a/src/SubstKeywords.py b/src/SubstKeywords.py index c285786cf..16dde41a2 100644 --- a/src/SubstKeywords.py +++ b/src/SubstKeywords.py @@ -66,33 +66,33 @@ class SubstKeywords: def __init__(self,person): """Creates a new object and associates a person with it.""" - self.n = person.getPrimaryName().getRegularName() - self.N = person.getPrimaryName().getName() - self.b = person.getBirth().getDate() - self.d = person.getDeath().getDate() - self.B = person.getBirth().getPlaceName() - self.D = person.getDeath().getPlaceName() - self.i = str(person.getId()) + self.n = person.get_primary_name().get_regular_name() + self.N = person.get_primary_name().get_name() + self.b = person.get_birth().get_date() + self.d = person.get_death().get_date() + self.B = person.get_birth().get_place_name() + self.D = person.get_death().get_place_name() + self.i = str(person.get_id()) self.s = "" self.S = "" self.m = "" self.M = "" - if person.getFamilyList(): - f = person.getFamilyList()[0] - if f.getFather() == person: - if f.getMother(): - self.s = f.getMother().getPrimaryName().getRegularName() - self.S = f.getMother().getPrimaryName().getName() + if person.get_family_id_list(): + f = person.get_family_id_list()[0] + if f.get_father_id() == person: + if f.get_mother_id(): + self.s = f.get_mother_id().get_primary_name().get_regular_name() + self.S = f.get_mother_id().get_primary_name().get_name() else: - if f.getFather(): - self.s = f.getFather().getPrimaryName().getRegularName() - self.S = f.getFather().getPrimaryName().getName() - for e in f.getEventList(): - if e.getName() == 'Marriage': - self.m = e.getDate() - self.M = e.getPlaceName() + if f.get_father_id(): + self.s = f.get_father_id().get_primary_name().get_regular_name() + self.S = f.get_father_id().get_primary_name().get_name() + for e in f.get_event_list(): + if e.get_name() == 'Marriage': + self.m = e.get_date() + self.M = e.get_place_name() def replace(self,line): """Returns a new line of text with the substitutions performed.""" diff --git a/src/TransTable.py b/src/TransTable.py index 7610c173c..030ea7e8a 100644 --- a/src/TransTable.py +++ b/src/TransTable.py @@ -30,7 +30,7 @@ class TransTable: for key in map.keys(): val = unicode(map[key]) self.map[key] = val - self.rmap[val] = key + self.rmap[val] = unicode(key) def add_pair(self,first,second): first = unicode(first) diff --git a/src/UrlEdit.py b/src/UrlEdit.py index d41f903c4..dc550ea15 100644 --- a/src/UrlEdit.py +++ b/src/UrlEdit.py @@ -67,7 +67,7 @@ class UrlEditor: if url != None: self.des.set_text(url.get_description()) self.addr.set_text(url.get_path()) - self.priv.set_active(url.getPrivacy()) + self.priv.set_active(url.get_privacy()) self.top.signal_autoconnect({ "on_help_url_clicked" : self.on_help_clicked, @@ -106,7 +106,7 @@ class UrlEditor: self.url.set_description(des) self.parent.lists_changed = 1 - if self.url.getPrivacy() != priv: - self.url.setPrivacy(priv) + if self.url.get_privacy() != priv: + self.url.set_privacy(priv) self.parent.lists_changed = 1 diff --git a/src/Utils.py b/src/Utils.py index e19d3a18e..f591b8835 100644 --- a/src/Utils.py +++ b/src/Utils.py @@ -146,54 +146,54 @@ def wasHistory_broken(): #------------------------------------------------------------------------- def phonebook_name(person): if person: - return person.getPrimaryName().getName() + return person.get_primary_name().get_name() else: return u'' def phonebook_upper_name(person): if person: - return person.getPrimaryName().getUpperName() + return person.get_primary_name().get_upper_name() else: return u'' def normal_name(person): if person: - return person.getPrimaryName().getRegularName() + return person.get_primary_name().get_regular_name() else: return u'' def upper_name(person): if person: - return person.getPrimaryName().getRegularUpperName() + return person.get_primary_name().get_regular_upper_name() else: return u'' def family_name(family): """Builds a name for the family from the parents names""" - father = family.getFather() - mother = family.getMother() + father = family.get_father_id() + mother = family.get_mother_id() if father and mother: - fname = father.getPrimaryName().getName() - mname = mother.getPrimaryName().getName() + fname = father.get_primary_name().get_name() + mname = mother.get_primary_name().get_name() name = _("%s and %s") % (fname,mname) elif father: - name = father.getPrimaryName().getName() + name = father.get_primary_name().get_name() else: - name = mother.getPrimaryName().getName() + name = mother.get_primary_name().get_name() return name def family_upper_name(family): """Builds a name for the family from the parents names""" - father = family.getFather() - mother = family.getMother() + father = family.get_father_id() + mother = family.get_mother_id() if father and mother: - fname = father.getPrimaryName().getUpperName() - mname = mother.getPrimaryName().getUpperName() + fname = father.get_primary_name().get_upper_name() + mname = mother.get_primary_name().get_upper_name() name = _("%s and %s") % (fname,mname) elif father: - name = father.getPrimaryName().getUpperName() + name = father.get_primary_name().get_upper_name() else: - name = mother.getPrimaryName().getUpperName() + name = mother.get_primary_name().get_upper_name() return name @@ -221,16 +221,16 @@ def get_detail_flags(obj,priv=1): # #------------------------------------------------------------------------- def get_detail_text(obj,priv=1): - if obj.getNote() != "": + if obj.get_note() != "": details = "%s" % _("Note") else: details = "" - if len(obj.getSourceRefList()) > 0: + if len(obj.get_source_references()) > 0: if details == "": details = _("Source") else: details = "%s, %s" % (details,_("Source")) - if priv and obj.getPrivacy() == 1: + if priv and obj.get_privacy() == 1: if details == "": details = _("Private") else: @@ -302,14 +302,14 @@ def add_menuitem(menu,msg,obj,func): # #------------------------------------------------------------------------- def view_photo(photo): - type = photo.getMimeType() + type = photo.get_mime_type() prog = grampslib.default_application_command(type) if not prog: return args = string.split(prog) - args.append(photo.getPath()) + args.append(photo.get_path()) if os.fork() == 0: os.execvp(args[0],args) @@ -344,7 +344,7 @@ def attach_places(values,combo,place): mymap = {} placenamemap = {} for src in values: - placenamemap["%s [%s]" % (src.get_title(),src.getId())] = src + placenamemap["%s [%s]" % (src.get_title(),src.get_id())] = src placenames = placenamemap.keys() placenames.sort() for key in placenames: @@ -442,17 +442,17 @@ def get_mime_description(type): #------------------------------------------------------------------------- def birthday(person): if person: - return person.getBirth().getQuoteDate() + return person.get_birth().get_quote_date() else: return "" def thumb_path(dir,mobj): - type = mobj.getMimeType() + type = mobj.get_mime_type() if type[0:5] == "image": - thumb = "%s/.thumb/%s.jpg" % (dir,mobj.getId()) + thumb = "%s/.thumb/%s.jpg" % (dir,mobj.get_id()) try: - if RelImage.check_thumb(mobj.getPath(),thumb,const.thumbScale): + if RelImage.check_thumb(mobj.get_path(),thumb,const.thumbScale): return thumb else: return find_icon(type) @@ -528,7 +528,7 @@ def for_each_ancestor(start, func, data): doneIds = {} while len(todo): p = todo.pop() - pid = p.getId() + pid = p.get_id() # Don't process the same Id twice. This can happen # if there is a cycle in the database, or if the # initial list contains X and some of X's ancestors. @@ -537,9 +537,9 @@ def for_each_ancestor(start, func, data): doneIds[pid] = 1 if func(data,pid): return 1 - for fam, mrel, frel in p.getParentList(): - f = fam.getFather() - m = fam.getMother() + for fam, mrel, frel in p.get_parent_family_id_list(): + f = fam.get_father_id() + m = fam.get_mother_id() if f: todo.append(f) if m: todo.append(m) return 0 diff --git a/src/Witness.py b/src/Witness.py index 777f82947..79226e955 100644 --- a/src/Witness.py +++ b/src/Witness.py @@ -68,8 +68,8 @@ class WitnessTab: for s in self.list: if s.get_type() == RelLib.Event.ID: id = s.get_value() - if self.db.getPersonMap().has_key(id): - n = self.db.getPerson(id).getPrimaryName().getName() + if self.db.get_person_id_map().has_key(id): + n = self.db.get_person(id).get_primary_name().get_name() else: n = _('Unknown') self.model.add([n,s.get_value()],s) @@ -136,8 +136,8 @@ class WitnessEditor: if self.ref.get_type(): self.in_db.set_active(1) self.idval = self.ref.get_value() - person = self.db.getPerson(self.idval) - self.name.set_text(person.getPrimaryName().getRegularName()) + person = self.db.get_person(self.idval) + self.name.set_text(person.get_primary_name().get_regular_name()) else: self.name.set_text(self.ref.get_value()) self.in_db.set_active(0) @@ -161,8 +161,8 @@ class WitnessEditor: new_person = sel_person.run() if new_person: self.new_person = new_person - self.idval = new_person.getId() - new_name = new_person.getPrimaryName().getRegularName() + self.idval = new_person.get_id() + new_name = new_person.get_primary_name().get_regular_name() if new_name: self.name.set_text(new_name) diff --git a/src/WriteXML.py b/src/WriteXML.py index b99f373bf..cdf5251bf 100644 --- a/src/WriteXML.py +++ b/src/WriteXML.py @@ -187,14 +187,14 @@ class XmlWriter: def write_xml_data(self): date = string.split(time.ctime(time.time())) - owner = self.db.getResearcher() - familyMap = self.db.getFamilyMap() + owner = self.db.get_researcher() + familyMap = self.db.get_family_id_map() familyList = familyMap.keys () - person_len = self.db.getPersonLength() + person_len = self.db.get_number_of_people() family_len = len(familyMap) - source_len = len(self.db.getSourceKeys()) - place_len = len(self.db.getPlaceKeys()) - objMap = self.db.getObjectMap() + source_len = len(self.db.get_source_keys()) + place_len = len(self.db.get_place_id_keys()) + objMap = self.db.get_object_map() objList = objMap.keys () total = person_len + family_len + place_len + source_len @@ -210,14 +210,14 @@ class XmlWriter: self.g.write(" sources=\"%d\"" % source_len) self.g.write(" places=\"%d\"/>\n" % place_len) self.g.write(" \n") - self.write_line("resname",owner.getName(),3) - self.write_line("resaddr",owner.getAddress(),3) - self.write_line("rescity",owner.getCity(),3) - self.write_line("resstate",owner.getState(),3) - self.write_line("rescountry",owner.getCountry(),3) - self.write_line("respostal",owner.getPostalCode(),3) - self.write_line("resphone",owner.getPhone(),3) - self.write_line("resemail",owner.getEmail(),3) + self.write_line("resname",owner.get_name(),3) + self.write_line("resaddr",owner.get_address(),3) + self.write_line("rescity",owner.get_city(),3) + self.write_line("resstate",owner.get_state(),3) + self.write_line("rescountry",owner.get_country(),3) + self.write_line("respostal",owner.get_postal_code(),3) + self.write_line("resphone",owner.get_phone(),3) + self.write_line("resemail",owner.get_email(),3) self.g.write(" \n") self.g.write(" \n") @@ -226,16 +226,16 @@ class XmlWriter: if person_len > 0: self.g.write(" \n") - keys = self.db.getPersonKeys() + keys = self.db.get_person_keys() keys.sort () for key in keys: try: - person = self.db.getPerson(key) + person = self.db.get_person(key) except: print "Key error %s" % key continue @@ -245,52 +245,48 @@ class XmlWriter: count = count + 1 self.write_id("person",person,2) - if person.getGender() == RelLib.Person.male: + if person.get_gender() == RelLib.Person.male: self.write_line("gender","M",3) - elif person.getGender() == RelLib.Person.female: + elif person.get_gender() == RelLib.Person.female: self.write_line("gender","F",3) else: self.write_line("gender","U",3) - self.dump_name("name",person.getPrimaryName(),3) - for name in person.getAlternateNames(): + self.dump_name("name",person.get_primary_name(),3) + for name in person.get_alternate_names(): self.dump_name("aka",name,3) - self.write_line("uid",person.getPafUid(),3) - self.write_line("nick",person.getNickName(),3) - pos = person.getPosition() - if pos != None: - self.g.write(' \n'% pos) - self.dump_my_event("Birth",person.getBirth(),3) - self.dump_my_event("Death",person.getDeath(),3) - for event in person.getEventList(): + self.write_line("nick",person.get_nick_name(),3) + self.dump_my_event("Birth",person.get_birth(),3) + self.dump_my_event("Death",person.get_death(),3) + for event in person.get_event_list(): self.dump_event(event,3) - self.dump_ordinance("baptism",person.getLdsBaptism(),3) - self.dump_ordinance("endowment",person.getLdsEndowment(),3) - self.dump_ordinance("sealed_to_parents",person.getLdsSeal(),3) + self.dump_ordinance("baptism",person.get_lds_baptism(),3) + self.dump_ordinance("endowment",person.get_lds_endowment(),3) + self.dump_ordinance("sealed_to_parents",person.get_lds_sealing(),3) - self.write_photo_list(person.getPhotoList()) + self.write_photo_list(person.get_photo_list()) - if len(person.getAddressList()) > 0: - for address in person.getAddressList(): + if len(person.get_address_list()) > 0: + for address in person.get_address_list(): self.g.write(' \n' % conf_priv(address)) - self.write_date(address.getDateObj(),4) - self.write_line("street",address.getStreet(),4) - self.write_line("city",address.getCity(),4) - self.write_line("state",address.getState(),4) - self.write_line("country",address.getCountry(),4) - self.write_line("postal",address.getPostal(),4) - self.write_line("phone",address.getPhone(),4) - if address.getNote() != "": - self.write_note("note",address.getNoteObj(),4) - for s in address.getSourceRefList(): + self.write_date(address.get_date_object(),4) + self.write_line("street",address.get_street(),4) + self.write_line("city",address.get_city(),4) + self.write_line("state",address.get_state(),4) + self.write_line("country",address.get_country(),4) + self.write_line("postal",address.get_postal_code(),4) + self.write_line("phone",address.get_phone(),4) + if address.get_note() != "": + self.write_note("note",address.get_note_object(),4) + for s in address.get_source_references(): self.dump_source_ref(s,4) self.g.write(' \n') - self.write_attribute_list(person.getAttributeList()) - self.write_url_list(person.getUrlList()) + self.write_attribute_list(person.get_attribute_list()) + self.write_url_list(person.get_url_list()) - for alt in person.getParentList(): + for alt in person.get_parent_family_id_list(): if alt[1] != "Birth": mrel=' mrel="%s"' % alt[1] else: @@ -300,13 +296,13 @@ class XmlWriter: else: frel='' self.g.write(" \n" % \ - (alt[0].getId(), mrel, frel)) + (alt[0], mrel, frel)) - for family in person.getFamilyList(): + for family in person.get_family_id_list(): self.write_ref("parentin",family,3) - self.write_note("note",person.getNoteObj(),3) - for s in person.getSourceRefList(): + self.write_note("note",person.get_note_object(),3) + for s in person.get_source_references(): self.dump_source_ref(s,4) self.g.write(" \n") @@ -323,55 +319,51 @@ class XmlWriter: count = count + 1 self.write_family_id(family,2) - self.write_ref("father",family.getFather(),3) - self.write_ref("mother",family.getMother(),3) - pos = family.getPosition() - if pos != None: - self.g.write(' \n'% pos) - - for event in family.getEventList(): + self.write_ref("father",family.get_father_id(),3) + self.write_ref("mother",family.get_mother_id(),3) + for event in family.get_event_list(): self.dump_event(event,3) - self.dump_ordinance("sealed_to_spouse",family.getLdsSeal(),3) + self.dump_ordinance("sealed_to_spouse",family.get_lds_sealing(),3) - self.write_photo_list(family.getPhotoList()) + self.write_photo_list(family.get_photo_list()) - if len(family.getChildList()) > 0: - for person in family.getChildList(): + if len(family.get_child_id_list()) > 0: + for person in family.get_child_id_list(): self.write_ref("child",person,3) - self.write_attribute_list(family.getAttributeList()) - self.write_note("note",family.getNoteObj(),3) - for s in family.getSourceRefList(): + self.write_attribute_list(family.get_attribute_list()) + self.write_note("note",family.get_note_object(),3) + for s in family.get_source_references(): self.dump_source_ref(s,3) self.g.write(" \n") self.g.write(" \n") if source_len > 0: self.g.write(" \n") - keys = self.db.getSourceKeys () + keys = self.db.get_source_keys () keys.sort () for key in keys: - source = self.db.getSource(key) + source = self.db.get_source(key) if self.callback and count % delta == 0: self.callback(float(count)/float(total)) count = count + 1 - self.g.write(" \n") - self.write_force_line("stitle",source.getTitle(),3) - self.write_line("sauthor",source.getAuthor(),3) - self.write_line("spubinfo",source.getPubInfo(),3) - self.write_line("sabbrev",source.getAbbrev(),3) - if source.getNote() != "": - self.write_note("note",source.getNoteObj(),3) - self.write_photo_list(source.getPhotoList()) + self.g.write(" \n") + self.write_force_line("stitle",source.get_title(),3) + self.write_line("sauthor",source.get_author(),3) + self.write_line("spubinfo",source.get_publication_info(),3) + self.write_line("sabbrev",source.get_abbreviation(),3) + if source.get_note() != "": + self.write_note("note",source.get_note_object(),3) + self.write_photo_list(source.get_photo_list()) self.g.write(" \n") self.g.write(" \n") if place_len > 0: self.g.write(" \n") - keys = self.db.getPlaceKeys() + keys = self.db.get_place_id_keys() keys.sort () for key in keys: try: - place = self.db.getPlace(key) + place = self.db.get_place_id(key) if self.callback and count % delta == 0: self.callback(float(count)/float(total)) self.write_place_obj(place) @@ -389,10 +381,10 @@ class XmlWriter: self.write_object(object) self.g.write(" \n") - if len(self.db.getBookmarks()) > 0: + if len(self.db.get_bookmarks()) > 0: self.g.write(" \n") - for person in self.db.getBookmarks(): - self.g.write(' \n' % person.getId()) + for person in self.db.get_bookmarks(): + self.g.write(' \n' % person.get_id()) self.g.write(" \n") self.g.write("\n") @@ -413,7 +405,7 @@ class XmlWriter: if indent != 0: self.g.write(" " * indent) - format = noteobj.getFormat() + format = noteobj.get_format() if format: self.g.write('<%s format="%d">' % (val,format)) else: @@ -433,7 +425,7 @@ class XmlWriter: def dump_event(self,event,index=1): if event: - self.dump_my_event(event.getName(),event,index) + self.dump_my_event(event.get_name(),event,index) def write_witness(self,witness_list,index): if not witness_list: @@ -462,16 +454,16 @@ class XmlWriter: sp = " " * index name = const.save_event(name) self.g.write('%s\n' % (sp,self.fix(name),conf_priv(event))) - self.write_date(event.getDateObj(),index+1) + self.write_date(event.get_date_object(),index+1) self.write_witness(event.get_witness_list(),index+1) - self.write_ref("place",event.getPlace(),index+1) - self.write_line("cause",event.getCause(),index+1) - self.write_line("description",event.getDescription(),index+1) - if event.getNote(): - self.write_note("note",event.getNoteObj(),index+1) + self.write_ref("place",event.get_place_id(),index+1) + self.write_line("cause",event.get_cause(),index+1) + self.write_line("description",event.get_description(),index+1) + if event.get_note(): + self.write_note("note",event.get_note_object(),index+1) - for s in event.getSourceRefList(): + for s in event.get_source_references(): self.dump_source_ref(s,index+1) self.g.write("%s\n" % sp) @@ -482,62 +474,62 @@ class XmlWriter: sp = " " * index sp2 = " " * (index+1) self.g.write('%s\n' % (sp,self.fix(name))) - dateobj = ord.getDateObj() - if dateobj != None and not dateobj.isEmpty(): + dateobj = ord.get_date_object() + if dateobj != None and not dateobj.is_empty(): self.write_date(dateobj,index+1) - if ord.getTemple(): - self.g.write('%s\n' % (sp2,self.fix(ord.getTemple()))) - self.write_ref("place",ord.getPlace(),index+1) - if ord.getStatus() != 0: - self.g.write('%s\n' % (sp2,ord.getStatus())) - if ord.getFamily(): - self.g.write('%s\n' % (sp2,self.fix(ord.getFamily().getId()))) - if ord.getNote() != "": - self.write_note("note",ord.getNoteObj(),index+1) - for s in ord.getSourceRefList(): + if ord.get_temple(): + self.g.write('%s\n' % (sp2,self.fix(ord.get_temple()))) + self.write_ref("place",ord.get_place_id(),index+1) + if ord.get_status() != 0: + self.g.write('%s\n' % (sp2,ord.get_status())) + if ord.get_family_id(): + self.g.write('%s\n' % (sp2,self.fix(ord.get_family_id().get_id()))) + if ord.get_note() != "": + self.write_note("note",ord.get_note_object(),index+1) + for s in ord.get_source_references(): self.dump_source_ref(s,index+1) self.g.write('%s\n' % sp) def dump_source_ref(self,source_ref,index=1): - source = source_ref.getBase() + source = self.db.find_source_from_id(source_ref.get_base_id()) if source: - p = source_ref.getPage() - c = source_ref.getComments() - t = source_ref.getText() - d = source_ref.getDate() - q = source_ref.getConfidence() + p = source_ref.get_page() + c = source_ref.get_comments() + t = source_ref.get_text() + d = source_ref.get_date() + q = source_ref.get_confidence_level() self.g.write(" " * index) - if p == "" and c == "" and t == "" and d.isEmpty() and q == 2: - self.g.write('\n' % source.getId()) + if p == "" and c == "" and t == "" and d.is_empty() and q == 2: + self.g.write('\n' % source.get_id()) else: if q == 2: - self.g.write('\n' % source.getId()) + self.g.write('\n' % source.get_id()) else: - self.g.write('\n' % (source.getId(),q)) + self.g.write('\n' % (source.get_id(),q)) self.write_line("spage",p,index+1) self.write_text("scomments",c,index+1) self.write_text("stext",t,index+1) self.write_date(d,index+1) self.g.write("%s\n" % (" " * index)) - def write_ref(self,label,person,index=1): - if person: - self.g.write('%s<%s ref="%s"/>\n' % (" "*index,label,person.getId())) + def write_ref(self,label,id,index=1): + if id: + self.g.write('%s<%s ref="%s"/>\n' % (" "*index,label,id)) def write_id(self,label,person,index=1): if person: - self.g.write('%s<%s id="%s"' % (" "*index,label,person.getId())) - comp = person.getComplete() + self.g.write('%s<%s id="%s"' % (" "*index,label,person.get_id())) + comp = person.get_complete() if comp: self.g.write(' complete="1"') self.g.write('>\n') def write_family_id(self,family,index=1): if family: - rel = family.getRelationship() - comp = family.getComplete() + rel = family.get_relationship() + comp = family.get_complete() sp = " " * index - self.g.write('%s\n' % (sp,dstr,pref,calstr)) else: - self.g.write('%s\n' %(sp,self.fix(date.getText()))) + self.g.write('%s\n' %(sp,self.fix(date.get_text()))) def write_force_line(self,label,value,indent=1): if value != None: @@ -596,18 +588,18 @@ class XmlWriter: def dump_name(self,label,name,index=1): sp = " "*index - type = name.getType() + type = name.get_type() if type: self.g.write('%s<%s type="%s"%s>\n' % (sp,label,type,conf_priv(name))) else: self.g.write('%s<%s%s>\n' % (sp,label,conf_priv(name))) - self.write_line("first",name.getFirstName(),index+1) + self.write_line("first",name.get_first_name(),index+1) self.write_last(name,index+1) - self.write_line("suffix",name.getSuffix(),index+1) - self.write_line("title",name.getTitle(),index+1) - if name.getNote() != "": - self.write_note("note",name.getNoteObj(),index+1) - for s in name.getSourceRefList(): + self.write_line("suffix",name.get_suffix(),index+1) + self.write_line("title",name.get_title(),index+1) + if name.get_note() != "": + self.write_note("note",name.get_note_object(),index+1) + for s in name.get_source_references(): self.dump_source_ref(s,index+1) self.g.write('%s\n' % (sp,label)) @@ -674,39 +666,39 @@ class XmlWriter: sp = ' ' * indent for attr in list: self.g.write('%s\n') else: self.g.write('>\n') - for s in attr.getSourceRefList(): + for s in attr.get_source_references(): self.dump_source_ref(s,indent+1) - self.write_note("note",attr.getNoteObj(),4) + self.write_note("note",attr.get_note_object(),4) self.g.write('%s\n' % sp) def write_photo_list(self,list,indent=3): sp = ' '*indent for photo in list: - mobj = photo.getReference() - self.g.write('%s\n") else: self.g.write(">\n") self.write_attribute_list(proplist,indent+1) - self.write_note("note",photo.getNoteObj(),indent+1) + self.write_note("note",photo.get_note_object(),indent+1) self.g.write('%s\n' % sp) def write_url_list(self,list): for url in list: self.g.write(' \n') @@ -715,13 +707,13 @@ class XmlWriter: title = self.fix(place.get_title()) long = self.fix(place.get_longitude()) lat = self.fix(place.get_latitude()) - id = place.getId() + id = place.get_id() main_loc = place.get_main_location() - llen = len(place.get_alternate_locations()) + len(place.getUrlList()) + \ - len(place.getPhotoList()) + len(place.getSourceRefList()) + llen = len(place.get_alternate_locations()) + len(place.get_url_list()) + \ + len(place.get_photo_list()) + len(place.get_source_references()) ml_empty = main_loc.is_empty() - note = place.getNote() + note = place.get_note() if title == "": title = self.fix(self.build_place_title(place.get_main_location())) @@ -740,18 +732,18 @@ class XmlWriter: self.dump_location(main_loc) for loc in place.get_alternate_locations(): self.dump_location(loc) - self.write_photo_list(place.getPhotoList()) - self.write_url_list(place.getUrlList()) + self.write_photo_list(place.get_photo_list()) + self.write_url_list(place.get_url_list()) if note != "": - self.write_note("note",place.getNoteObj(),3) - for s in place.getSourceRefList(): + self.write_note("note",place.get_note_object(),3) + for s in place.get_source_references(): self.dump_source_ref(s,3) self.g.write(" \n") def write_object(self,object): - id = object.getId() - type = object.getMimeType() - path = object.getPath() + id = object.get_id() + type = object.get_mime_type() + path = object.get_path() if self.strip_photos: path = os.path.basename(path) else: @@ -760,17 +752,17 @@ class XmlWriter: if self.fileroot == path[0:l]: path = path[l+1:] self.g.write(' \n') else: self.g.write('>\n') self.write_attribute_list(alist) if note != "": - self.write_note("note",object.getNoteObj(),3) + self.write_note("note",object.get_note_object(),3) for s in slist: self.dump_source_ref(s,3) self.g.write(" \n") @@ -781,8 +773,8 @@ class XmlWriter: # #------------------------------------------------------------------------- def sortById(first,second): - fid = first.getId() - sid = second.getId() + fid = first.get_id() + sid = second.get_id() if fid < sid: return -1 @@ -795,7 +787,7 @@ def sortById(first,second): # #------------------------------------------------------------------------- def conf_priv(obj): - if obj.getPrivacy() != 0: - return ' priv="%d"' % obj.getPrivacy() + if obj.get_privacy() != 0: + return ' priv="%d"' % obj.get_privacy() else: return '' diff --git a/src/filters/After.py b/src/filters/After.py index 07966ab1e..228aa9ce8 100644 --- a/src/filters/After.py +++ b/src/filters/After.py @@ -38,10 +38,10 @@ class EventAfter(Filter.Filter): Filter.Filter.__init__(self,text) def match(self,p): - for event in p.getEventList() + [p.getBirth(), p.getDeath()]: - if self.date.getDate() == "" or event.getDate() == "": + for event in p.get_event_list() + [p.get_birth(), p.get_death()]: + if self.date.get_date() == "" or event.get_date() == "": continue - if event.getDateObj().greater_than(self.date): + if event.get_date_object().greater_than(self.date): return 1 return 0 diff --git a/src/filters/AltFam.py b/src/filters/AltFam.py index 5b54e438e..fe2b905ea 100644 --- a/src/filters/AltFam.py +++ b/src/filters/AltFam.py @@ -27,7 +27,7 @@ class HaveAltFamilies(Filter.Filter): "People who were adopted" def match(self,person): - for vals in person.getParentList(): + for vals in person.get_parent_family_id_list(): if vals[1] == "Adopted" or vals[2] == "Adopted": return 1 return 0 diff --git a/src/filters/Before.py b/src/filters/Before.py index 8f413af99..50d112c55 100644 --- a/src/filters/Before.py +++ b/src/filters/Before.py @@ -38,10 +38,10 @@ class EventBefore(Filter.Filter): Filter.Filter.__init__(self,text) def match(self,p): - for event in p.getEventList() + [p.getBirth(), p.getDeath()]: - if self.date.getDate() == "" or event.getDate() == "": + for event in p.get_event_list() + [p.get_birth(), p.get_death()]: + if self.date.get_date() == "" or event.get_date() == "": continue - if event.getDateObj().less_than(self.date): + if event.get_date_object().less_than(self.date): return 1 return 0 diff --git a/src/filters/Complete.py b/src/filters/Complete.py index eedc681c4..06c8cc685 100644 --- a/src/filters/Complete.py +++ b/src/filters/Complete.py @@ -29,7 +29,7 @@ class IsComplete(Filter.Filter): "People with complete information" def match(self,person): - return person.getComplete() == 1 + return person.get_complete() == 1 #------------------------------------------------------------------------ # diff --git a/src/filters/Disconnected.py b/src/filters/Disconnected.py index 7831312ef..72b2b5368 100644 --- a/src/filters/Disconnected.py +++ b/src/filters/Disconnected.py @@ -27,7 +27,7 @@ class Disconnected(Filter.Filter): "Disconnected individuals" def match(self,person): - return person.getMainParents() == None and len(person.getFamilyList()) == 0 + return person.get_main_parents_family_id() == None and len(person.get_family_id_list()) == 0 #------------------------------------------------------------------------ # diff --git a/src/filters/EventPlace.py b/src/filters/EventPlace.py index 0ab815418..3f998dea1 100644 --- a/src/filters/EventPlace.py +++ b/src/filters/EventPlace.py @@ -36,13 +36,13 @@ class EventPlace(Filter.Filter): Filter.Filter.__init__(self,text) def match(self,person): - list = person.getEventList()[:] - list.append(person.getBirth()) - list.append(person.getDeath()) + list = person.get_event_list()[:] + list.append(person.get_birth()) + list.append(person.get_death()) for event in list: - if self.regexp.search(event.getPlaceName()): + if self.regexp.search(event.get_place_name()): return 1 - place = event.getPlace() + place = event.get_place_id() if not place: continue locs = [place.get_main_location()] + place.get_alternate_locations() diff --git a/src/filters/EventType.py b/src/filters/EventType.py index 1e46ffaf4..64b00761a 100644 --- a/src/filters/EventType.py +++ b/src/filters/EventType.py @@ -26,8 +26,8 @@ from gettext import gettext as _ class EventType(Filter.Filter): def match(self,person): - for event in person.getEventList(): - if event.getName() == self.text: + for event in person.get_event_list(): + if event.get_name() == self.text: return 1 return 0 diff --git a/src/filters/Females.py b/src/filters/Females.py index 153dd60c6..88710c205 100644 --- a/src/filters/Females.py +++ b/src/filters/Females.py @@ -28,7 +28,7 @@ class Females(Filter.Filter): "Females" def match(self,person): - return person.getGender() == RelLib.Person.female + return person.get_gender() == RelLib.Person.female #------------------------------------------------------------------------ # diff --git a/src/filters/HavePhotos.py b/src/filters/HavePhotos.py index f38e941f6..d9a2db0a7 100644 --- a/src/filters/HavePhotos.py +++ b/src/filters/HavePhotos.py @@ -27,7 +27,7 @@ class HavePhotos(Filter.Filter): "People who have images" def match(self,person): - return len(person.getPhotoList()) > 0 + return len(person.get_photo_list()) > 0 #------------------------------------------------------------------------ # diff --git a/src/filters/IncompleteNames.py b/src/filters/IncompleteNames.py index 9412f58b6..07c165f09 100644 --- a/src/filters/IncompleteNames.py +++ b/src/filters/IncompleteNames.py @@ -27,8 +27,8 @@ class IncompleteNames(Filter.Filter): "People with incomplete names" def match(self,person): - name = person.getPrimaryName() - return name.getFirstName() == "" or name.getSurname() == "" + name = person.get_primary_name() + return name.get_first_name() == "" or name.get_surname() == "" #------------------------------------------------------------------------ # diff --git a/src/filters/Males.py b/src/filters/Males.py index a7a9275d8..0d3846cde 100644 --- a/src/filters/Males.py +++ b/src/filters/Males.py @@ -28,7 +28,7 @@ class Males(Filter.Filter): "Males" def match(self,person): - return person.getGender() == RelLib.Person.male + return person.get_gender() == RelLib.Person.male #------------------------------------------------------------------------ # diff --git a/src/filters/MatchSndEx.py b/src/filters/MatchSndEx.py index b1ca39066..cc103d3dd 100644 --- a/src/filters/MatchSndEx.py +++ b/src/filters/MatchSndEx.py @@ -32,7 +32,7 @@ class MatchSndEx(Filter.Filter): Filter.Filter.__init__(self,text) def match(self,person): - return self.sndex == soundex.soundex(person.getPrimaryName().getSurname()) + return self.sndex == soundex.soundex(person.get_primary_name().get_surname()) #------------------------------------------------------------------------ # diff --git a/src/filters/MatchSndEx2.py b/src/filters/MatchSndEx2.py index 56c7e9bf8..43d194d58 100644 --- a/src/filters/MatchSndEx2.py +++ b/src/filters/MatchSndEx2.py @@ -30,7 +30,7 @@ class MatchSndEx2(Filter.Filter): "Names with SoundEx code of ..." def match(self,person): - return self.text == soundex.soundex(person.getPrimaryName().getSurname()) + return self.text == soundex.soundex(person.get_primary_name().get_surname()) #------------------------------------------------------------------------ # diff --git a/src/filters/MutlipleMarriages.py b/src/filters/MutlipleMarriages.py index 8e1ccd7da..b61d2bc88 100644 --- a/src/filters/MutlipleMarriages.py +++ b/src/filters/MutlipleMarriages.py @@ -27,7 +27,7 @@ class MultipleMarriages(Filter.Filter): "People with multiple marriage records" def match(self,person): - return len(person.getFamilyList()) > 1 + return len(person.get_family_id_list()) > 1 #------------------------------------------------------------------------ # diff --git a/src/filters/NeverMarried.py b/src/filters/NeverMarried.py index 7db1556af..30392f340 100644 --- a/src/filters/NeverMarried.py +++ b/src/filters/NeverMarried.py @@ -27,7 +27,7 @@ class NeverMarried(Filter.Filter): "People with no marriage records" def match(self,person): - return len(person.getFamilyList()) == 0 + return len(person.get_family_id_list()) == 0 #------------------------------------------------------------------------ # diff --git a/src/filters/NoBirthdate.py b/src/filters/NoBirthdate.py index 860dc248f..3cc38b1c6 100644 --- a/src/filters/NoBirthdate.py +++ b/src/filters/NoBirthdate.py @@ -27,7 +27,7 @@ class NoBirthdate(Filter.Filter): "People without a birth date" def match(self,person): - return person.getBirth().getDate() == "" + return person.get_birth().get_date() == "" #------------------------------------------------------------------------ # diff --git a/src/filters/NoChildren.py b/src/filters/NoChildren.py index da3f9e088..fbddaca1b 100644 --- a/src/filters/NoChildren.py +++ b/src/filters/NoChildren.py @@ -28,8 +28,8 @@ class HaveChildren(Filter.Filter): def match(self,person): val = 0 - for family in person.getFamilyList(): - if len(family.getChildList()) > 0: + for family in person.get_family_id_list(): + if len(family.get_child_id_list()) > 0: val = 1 break return val diff --git a/src/gramps.glade b/src/gramps.glade index 5257e58e7..8cb871680 100644 --- a/src/gramps.glade +++ b/src/gramps.glade @@ -780,7 +780,7 @@ Make the Home Person the active person Home True - gtk-home + home.png diff --git a/src/gramps_main.py b/src/gramps_main.py index edacb5bf5..278828eb0 100755 --- a/src/gramps_main.py +++ b/src/gramps_main.py @@ -141,7 +141,7 @@ class Gramps: self.db.set_pprefix(GrampsCfg.pprefix) GrampsCfg.loadConfig(self.pref_callback) - self.relationship = Plugins.relationship_function() + self.relationship = Plugins.relationship_function(self.db) self.init_interface() if args: @@ -157,10 +157,10 @@ class Gramps: Utils.enable_autosave(self.autosave_database, GrampsCfg.autosave_int) - self.db.setResearcher(GrampsCfg.get_researcher()) + self.db.set_researcher(GrampsCfg.get_researcher()) def pref_callback(self,val): - self.db.rebuildPersonTable() + self.db.rebuild_person_table() self.modify_statusbar() self.family_view.init_interface() self.people_view.clear_person_tabs() @@ -423,9 +423,9 @@ class Gramps: break if pid not in haveit: haveit.append(pid) - person = self.db.getPerson(pid) + person = self.db.get_person(pid) item = gtk.MenuItem("_%d. %s [%s]" % - (num,person.getPrimaryName().getName(),pid)) + (num,person.get_primary_name().get_name(),pid)) item.connect("activate",self.bookmark_callback,person) item.show() gomenu.append(item) @@ -455,9 +455,9 @@ class Gramps: hotkey = "_%s" % chr(ord('a')+num-11) elif num >= 21: break - person = self.db.getPerson(pid) + person = self.db.get_person(pid) item = gtk.MenuItem("%s. %s [%s]" % - (hotkey,person.getPrimaryName().getName(),pid)) + (hotkey,person.get_primary_name().get_name(),pid)) item.connect("activate",self.back_clicked,num) item.show() backhistmenu.append(item) @@ -483,9 +483,9 @@ class Gramps: hotkey = "_%s" % chr(ord('a')+num-11) elif num >= 21: break - person = self.db.getPerson(pid) + person = self.db.get_person(pid) item = gtk.MenuItem("%s. %s [%s]" % - (hotkey,person.getPrimaryName().getName(),pid)) + (hotkey,person.get_primary_name().get_name(),pid)) item.connect("activate",self.fwd_clicked,num) item.show() fwdhistmenu.append(item) @@ -511,7 +511,7 @@ class Gramps: if self.hindex > 0: try: self.hindex -= step - self.active_person = self.db.getPerson(self.history[self.hindex]) + self.active_person = self.db.get_person(self.history[self.hindex]) self.modify_statusbar() self.update_display(0) self.mhistory.append(self.history[self.hindex]) @@ -537,7 +537,7 @@ class Gramps: if self.hindex+1 < len(self.history): try: self.hindex += step - self.active_person = self.db.getPerson(self.history[self.hindex]) + self.active_person = self.db.get_person(self.history[self.hindex]) self.modify_statusbar() self.update_display(0) self.mhistory.append(self.history[self.hindex]) @@ -660,7 +660,7 @@ class Gramps: Plugins.build_export_menu(export_menu,self.export_callback) Plugins.build_import_menu(import_menu,self.import_callback) - self.relationship = Plugins.relationship_function() + self.relationship = Plugins.relationship_function(self.db) def init_filters(self): @@ -742,8 +742,8 @@ class Gramps: ErrorDialog(msg,msg2) else: import MergeData - p1 = self.db.getPerson(mlist[0]) - p2 = self.db.getPerson(mlist[1]) + p1 = self.db.get_person(mlist[0]) + p2 = self.db.get_person(mlist[1]) MergeData.MergePeople(self.db,p1,p2,self.merge_update, self.update_after_edit) elif page == PLACE_VIEW: @@ -806,14 +806,14 @@ class Gramps: on if the image was previewed. """ for obj in self.db.get_added_media_objects(): - if obj.getLocal(): + if obj.get_local(): try: - os.unlink(obj.getPath()) + os.unlink(obj.get_path()) except IOError: pass except: DisplayTrace.DisplayTrace() - thumb = "%s/.thumb/%s.jpg" % (self.db.getSavePath(),obj.getId()) + thumb = "%s/.thumb/%s.jpg" % (self.db.get_save_path(),obj.get_id()) if os.path.isfile(thumb): try: os.unlink(thumb) @@ -940,7 +940,7 @@ class Gramps: elif page == SOURCE_VIEW: self.source_view.load_sources() elif page == PLACE_VIEW: - if len(self.db.getPlaceKeys()) > 2000: + if len(self.db.get_place_id_keys()) > 2000: self.status_text(_('Updating display - this may take a few seconds...')) else: self.status_text(_('Updating display...')) @@ -1078,34 +1078,34 @@ class Gramps: def remove_clicked(): # File is lost => remove all references and the object itself mobj = ObjectMap[ObjectId] - for p in self.db.getFamilyMap().values(): - nl = p.getPhotoList() + for p in self.db.get_family_id_map().values(): + nl = p.get_photo_list() for o in nl: - if o.getReference() == mobj: + if o.get_reference() == mobj: nl.remove(o) - p.setPhotoList(nl) - for key in self.db.getPersonKeys(): - p = self.db.getPerson(key) - nl = p.getPhotoList() + p.set_photo_list(nl) + for key in self.db.get_person_keys(): + p = self.db.get_person(key) + nl = p.get_photo_list() for o in nl: - if o.getReference() == mobj: + if o.get_reference() == mobj: nl.remove(o) - p.setPhotoList(nl) - for key in self.db.getSourceKeys(): - p = self.db.getSource(key) - nl = p.getPhotoList() + p.set_photo_list(nl) + for key in self.db.get_source_keys(): + p = self.db.get_source(key) + nl = p.get_photo_list() for o in nl: - if o.getReference() == mobj: + if o.get_reference() == mobj: nl.remove(o) - p.setPhotoList(nl) - for key in self.db.getPlaceKeys(): - p = self.db.getPlace(key) - nl = p.getPhotoList() + p.set_photo_list(nl) + for key in self.db.get_place_id_keys(): + p = self.db.get_place_id(key) + nl = p.get_photo_list() for o in nl: - if o.getReference() == mobj: + if o.get_reference() == mobj: nl.remove(o) - p.setPhotoList(nl) - self.db.removeObject(ObjectId) + p.set_photo_list(nl) + self.db.remove_object(ObjectId) def leave_clicked(): # File is lost => do nothing, leave as is @@ -1120,7 +1120,7 @@ class Gramps: name = fs_top.get_filename() if os.path.isfile(name): RelImage.import_media_object(name,filename,base) - ObjectMap[ObjectId].setPath(newfile) + ObjectMap[ObjectId].set_path(newfile) Utils.destroy_passed_object(fs_top) fs_top = gtk.FileSelection("%s - GRAMPS" % _("Select file")) @@ -1131,13 +1131,13 @@ class Gramps: fs_top.run() #------------------------------------------------------------------------- - ObjectMap = self.db.getObjectMap() + ObjectMap = self.db.get_object_map() for ObjectId in ObjectMap.keys(): - if ObjectMap[ObjectId].getLocal(): - oldfile = ObjectMap[ObjectId].getPath() + if ObjectMap[ObjectId].get_local(): + oldfile = ObjectMap[ObjectId].get_path() (base,ext) = os.path.splitext(os.path.basename(oldfile)) newfile = os.path.join(filename,os.path.basename(oldfile)) - ObjectMap[ObjectId].setPath(newfile) + ObjectMap[ObjectId].set_path(newfile) if os.path.isfile(oldfile): RelImage.import_media_object(oldfile,filename,base) else: @@ -1203,14 +1203,14 @@ class Gramps: ErrorDialog(emsg,msg) return - self.db.setSavePath(old_file) + self.db.set_save_path(old_file) GrampsCfg.save_last_file(old_file) if GrampsCfg.usevc: vc = VersionControl.RcsVersionControl(path) vc.checkin(filename,comment,not GrampsCfg.uncompress) - filename = self.db.getSavePath() + filename = self.db.get_save_path() if filename[-1] == '/': filename = filename[:-1] name = os.path.basename(filename) @@ -1228,7 +1228,7 @@ class Gramps: pass def autosave_database(self): - path = self.db.getSavePath() + path = self.db.get_save_path() if not path: return 1 @@ -1251,7 +1251,7 @@ class Gramps: def load_selected_people(self,obj): """Display the selected people in the EditPerson display""" mlist = self.people_view.person_tree.get_selected_objects() - if mlist and self.active_person == self.db.getPerson(mlist[0]): + if mlist and self.active_person == self.db.get_person(mlist[0]): self.load_person(self.active_person) def load_active_person(self,obj): @@ -1273,10 +1273,10 @@ class Gramps: if cpage == PERSON_VIEW: mlist = self.people_view.person_tree.get_selected_objects() else: - mlist = [ self.active_person.getId() ] + mlist = [ self.active_person.get_id() ] for sel in mlist: - p = self.db.getPerson(sel) + p = self.db.get_person(sel) self.active_person = p name = GrampsCfg.nameof(p) @@ -1293,38 +1293,42 @@ class Gramps: def delete_person_response(self): - if self.db.getDefaultPerson() == self.active_person: - self.db.setDefaultPerson(None) + if self.db.get_default_person() == self.active_person: + self.db.set_default_person(None) - for family in self.active_person.getFamilyList(): - if not family: + for family_id in self.active_person.get_family_id_list(): + if not family_id: continue - if self.active_person == family.getFather(): - if family.getMother() == None: - for child in family.getChildList(): - child.removeAltFamily(family) - self.db.deleteFamily(family) + family = self.db.find_family_from_id(family_id) + if self.active_person.get_id() == family.get_father_id(): + if family.get_mother_id() == None: + for child_id in family.get_child_id_list(): + child = self.db.find_person_from_id(child_id) + child.remove_parent_family_id(family.get_id()) + self.db.delete_family(family.get_id()) else: - family.setFather(None) + family.set_father_id(None) else: - if family.getFather() == None: - for child in family.getChildList(): - child.removeAltFamily(family) - self.db.deleteFamily(family) + if family.get_father_id() == None: + for child_id in family.get_child_id_list(): + child = self.db.find_person_from_id(child_id) + child.remove_parent_family_id(family) + self.db.delete_family(family) else: - family.setMother(None) + family.set_mother_id(None) - for (family,mrel,frel) in self.active_person.getParentList(): - if family: - family.removeChild(self.active_person) + for (family_id,mrel,frel) in self.active_person.get_parent_family_id_list(): + if family_id: + family = self.db.find_family_from_id(family_id) + family.remove_child_id(self.active_person.get_id()) self.people_view.remove_from_history(self.active_person) - self.db.removePerson(self.active_person.getId()) - self.people_view.remove_from_person_list(self.active_person) + self.db.remove_person_id(self.active_person.get_id()) + self.people_view.remove_from_person_list(self.active_person.get_id()) self.people_view.person_model.sort_column_changed() if self.hindex >= 0: - self.active_person = self.db.getPerson(self.history[self.hindex]) + self.active_person = self.db.get_person(self.history[self.hindex]) else: self.change_active_person(None) self.redraw_histmenu() @@ -1351,8 +1355,8 @@ class Gramps: if self.hindex+1 < len(self.history): self.history = self.history[0:self.hindex+1] - self.history.append(person.getId()) - self.mhistory.append(person.getId()) + self.history.append(person.get_id()) + self.mhistory.append(person.get_id()) self.hindex += 1 self.redraw_histmenu() @@ -1382,7 +1386,7 @@ class Gramps: else: if GrampsCfg.status_bar <= 1: pname = GrampsCfg.nameof(self.active_person) - name = "[%s] %s" % (self.active_person.getId(),pname) + name = "[%s] %s" % (self.active_person.get_id(),pname) else: name = self.display_relationship() self.status_text(name) @@ -1390,9 +1394,9 @@ class Gramps: def display_relationship(self): try: - pname = GrampsCfg.nameof(self.db.getDefaultPerson()) - (name,plist) = self.relationship(self.db.getDefaultPerson(), - self.active_person) + pname = GrampsCfg.nameof(self.db.get_default_person()) + (name,plist) = self.relationship.get_relationship(self.db.get_default_person(), + self.active_person) if name: if plist == None: @@ -1444,7 +1448,7 @@ class Gramps: def on_revert_activate(self,obj): - if self.db.getSavePath() != "": + if self.db.get_save_path() != "": QuestionDialog(_('Revert to last saved database?'), _('Reverting to the last saved database ' 'will cause all unsaved changes to be lost, and ' @@ -1463,7 +1467,7 @@ class Gramps: const.familyAttributes = const.init_family_attribute_list() const.familyRelations = const.init_family_relation_list() - file = self.db.getSavePath() + file = self.db.get_save_path() self.db.new() self.active_person = None self.place_loaded = 0 @@ -1485,26 +1489,26 @@ class Gramps: def on_save_activate(self,obj): """Saves the file, first prompting for a comment if revision control needs it""" - if not self.db.getSavePath(): + if not self.db.get_save_path(): self.on_save_as_activate(obj) else: if GrampsCfg.usevc and GrampsCfg.vc_comment: - self.display_comment_box(self.db.getSavePath()) + self.display_comment_box(self.db.get_save_path()) else: msg = _("No Comment Provided") - self.save_file(self.db.getSavePath(),msg) + self.save_file(self.db.get_save_path(),msg) def on_save_activate_quit(self): """Saves the file, first prompting for a comment if revision control needs it""" - if not self.db.getSavePath(): + if not self.db.get_save_path(): self.on_save_as_activate(None) else: if GrampsCfg.usevc and GrampsCfg.vc_comment: - self.display_comment_box(self.db.getSavePath()) + self.display_comment_box(self.db.get_save_path()) else: msg = _("No Comment Provided") - self.save_file(self.db.getSavePath(),msg) + self.save_file(self.db.get_save_path(),msg) def display_comment_box(self,filename): """Displays a dialog box, prompting for a revison control comment""" @@ -1540,7 +1544,7 @@ class Gramps: def on_places_activate(self,obj): """Switches to the places view""" - if len(self.db.getPlaceKeys()) > 2000: + if len(self.db.get_place_id_keys()) > 2000: self.status_text(_('Updating display - this may take a few seconds...')) else: self.status_text(_('Updating display...')) @@ -1596,11 +1600,11 @@ class Gramps: def new_after_edit(self,epo): if epo: - if epo.person.getId() == "": - self.db.addPerson(epo.person) + if epo.person.get_id() == "": + self.db.add_person(epo.person) else: - self.db.addPersonNoMap(epo.person,epo.person.getId()) - self.db.buildPersonDisplay(epo.person.getId()) + self.db.add_person_no_map(epo.person,epo.person.get_id()) + self.db.build_person_display(epo.person.get_id()) self.change_active_person(epo.person) self.people_view.redisplay_person_list(epo.person) if self.views.get_current_page() in [FAMILY_VIEW1,FAMILY_VIEW2]: @@ -1614,15 +1618,15 @@ class Gramps: def update_after_edit(self,epo): if epo: - self.db.buildPersonDisplay(epo.person.getId(),epo.original_id) + self.db.build_person_display(epo.person.get_id(),epo.original_id) self.people_view.remove_from_person_list(epo.person,epo.original_id) self.people_view.redisplay_person_list(epo.person) self.update_display(0) def update_after_merge(self,person,old_id): if person: - self.people_view.remove_from_person_list(person.getId(),old_id) - self.db.buildPersonDisplay(person.getId(),old_id) + self.people_view.remove_from_person_list(person.get_id(),old_id) + self.db.build_person_display(person.get_id(),old_id) self.people_view.redisplay_person_list(person) self.update_display(0) @@ -1667,41 +1671,41 @@ class Gramps: gtk.threads_leave() def post_load(self,name): - self.db.setSavePath(name) - res = self.db.getResearcher() + self.db.set_save_path(name) + res = self.db.get_researcher() owner = GrampsCfg.get_researcher() - if res.getName() == "" and owner.getName(): - self.db.setResearcher(owner) + if res.get_name() == "" and owner.get_name(): + self.db.set_researcher(owner) Utils.modified() self.setup_bookmarks() try: - mylist = self.db.getPersonEventTypes() + mylist = self.db.get_person_event_types() for type in mylist: ntype = const.display_pevent(type) if ntype not in const.personalEvents: const.personalEvents.append(ntype) - mylist = self.db.getFamilyEventTypes() + mylist = self.db.get_family_event_types() for type in mylist: ntype = const.display_fevent(type) if ntype not in const.marriageEvents: const.marriageEvents.append(ntype) - mylist = self.db.getPersonAttributeTypes() + mylist = self.db.get_person_attribute_types() for type in mylist: ntype = const.display_pattr(type) if ntype not in const.personalAttributes: const.personalAttributes.append(ntype) - mylist = self.db.getFamilyAttributeTypes() + mylist = self.db.get_family_attribute_types() for type in mylist: if type not in const.familyAttributes: const.familyAttributes.append(type) - mylist = self.db.getFamilyRelationTypes() + mylist = self.db.get_family_relation_types() for type in mylist: if type not in const.familyRelations: const.familyRelations.append(type) @@ -1720,12 +1724,12 @@ class Gramps: return 1 def find_initial_person(self): - person = self.db.getDefaultPerson() + person = self.db.get_default_person() if not person: - the_ids = self.db.getPersonMap().keys() + the_ids = self.db.get_person_id_map().keys() if the_ids: the_ids.sort() - person = self.db.getPerson(the_ids[0]) + person = self.db.get_person(the_ids[0]) return person def load_database(self,name): @@ -1750,7 +1754,7 @@ class Gramps: return self.post_load(name) def setup_bookmarks(self): - self.bookmarks = Bookmarks.Bookmarks(self.db.getBookmarks(), + self.bookmarks = Bookmarks.Bookmarks(self.db.get_bookmarks(), self.gtop.get_widget("jump_to"), self.bookmark_callback) @@ -1764,7 +1768,7 @@ class Gramps: self.modify_statusbar() def on_home_clicked(self,obj): - temp = self.db.getDefaultPerson() + temp = self.db.get_default_person() if temp: self.change_active_person(temp) self.update_display(0) @@ -1799,7 +1803,7 @@ class Gramps: def on_default_person_activate(self,obj): if self.active_person: - name = self.active_person.getPrimaryName().getRegularName() + name = self.active_person.get_primary_name().get_regular_name() QuestionDialog(_('Set %s as the Home Person') % name, _('Once a Home Person is defined, pressing the ' 'Home button on the toolbar will make the home ' @@ -1808,7 +1812,7 @@ class Gramps: self.set_person) def set_person(self): - self.db.setDefaultPerson(self.active_person) + self.db.set_default_person(self.active_person) Utils.modified() def export_callback(self,obj,plugin_function): @@ -1823,7 +1827,7 @@ class Gramps: def import_callback(self,obj,plugin_function): """Call the import plugin""" plugin_function(self.db,self.active_person,self.import_tool_callback) - self.topWindow.set_title("%s - GRAMPS" % self.db.getSavePath()) + self.topWindow.set_title("%s - GRAMPS" % self.db.get_save_path()) def on_preferences_activate(self,obj): GrampsCfg.display_preferences_box(self.db) diff --git a/src/plugins/AncestorChart.py b/src/plugins/AncestorChart.py index 1e186300f..6a63f68ad 100644 --- a/src/plugins/AncestorChart.py +++ b/src/plugins/AncestorChart.py @@ -69,7 +69,7 @@ class AncestorChart: def __init__(self,database,person,max,display,doc,output,newpage=0): self.doc = doc - self.doc.creator(database.getResearcher().getName()) + self.doc.creator(database.get_researcher().get_name()) self.map = {} self.text = {} self.start = person @@ -109,10 +109,10 @@ class AncestorChart: self.lines = max(self.lines,len(self.text[index])) - family = person.getMainParents() + family = person.get_main_parents_family_id() if family != None: - self.filter(family.getFather(),index*2) - self.filter(family.getMother(),(index*2)+1) + self.filter(family.get_father_id(),index*2) + self.filter(family.get_mother_id(),(index*2)+1) def write_report(self): @@ -318,7 +318,7 @@ class AncestorChartBareDialog(Report.BareReportDialog): self.options = opt self.db = database if self.options[0]: - self.person = self.db.getPerson(self.options[0]) + self.person = self.db.get_person(self.options[0]) else: self.person = person self.style_name = stl @@ -377,7 +377,7 @@ class AncestorChartBareDialog(Report.BareReportDialog): if self.new_person: self.person = self.new_person - self.options = ( self.person.getId(), self.max_gen, self.report_text ) + self.options = ( self.person.get_id(), self.max_gen, self.report_text ) self.style_name = self.selected_style.get_name() #------------------------------------------------------------------------ @@ -390,7 +390,7 @@ def write_book_item(database,person,doc,options,newpage=0): All user dialog has already been handled and the output file opened.""" try: if options[0]: - person = database.getPerson(options[0]) + person = database.get_person(options[0]) max_gen = int(options[1]) disp_format = options[2] return AncestorChart(database, person, max_gen, diff --git a/src/plugins/AncestorChart2.py b/src/plugins/AncestorChart2.py index 28631f0c0..239692645 100644 --- a/src/plugins/AncestorChart2.py +++ b/src/plugins/AncestorChart2.py @@ -174,7 +174,7 @@ class AncestorChart: title,newpage=0): self.doc = doc self.title = title.strip() - self.doc.creator(database.getResearcher().getName()) + self.doc.creator(database.get_researcher().get_name()) self.map = {} self.text = {} self.start = person @@ -225,10 +225,10 @@ class AncestorChart: self.lines = max(self.lines,len(self.text[index])) - family = person.getMainParents() + family = person.get_main_parents_family_id() if family: - self.filter(family.getFather(),index*2) - self.filter(family.getMother(),(index*2)+1) + self.filter(family.get_father_id(),index*2) + self.filter(family.get_mother_id(),(index*2)+1) def write_report(self): @@ -445,7 +445,7 @@ class AncestorChartDialog(Report.DrawReportDialog): def add_user_options(self): self.title=gtk.Entry() - self.title.set_text(self.get_header(self.person.getPrimaryName().getName())) + self.title.set_text(self.get_header(self.person.get_primary_name().get_name())) self.title.show() self.add_option(_('Title'),self.title) self.compress = gtk.CheckButton(_('Co_mpress chart')) @@ -545,7 +545,7 @@ class AncestorChartBareDialog(Report.BareReportDialog): self.options = opt self.db = database if self.options[0]: - self.person = self.db.getPerson(self.options[0]) + self.person = self.db.get_person(self.options[0]) else: self.person = person self.style_name = stl @@ -590,7 +590,7 @@ class AncestorChartBareDialog(Report.BareReportDialog): def get_the_title(self,person): """The header line at the top of the dialog contents.""" - return _("Ancestor Chart for %s") % person.getPrimaryName().getName() + return _("Ancestor Chart for %s") % person.get_primary_name().get_name() def get_header(self,name): """The header line at the top of the dialog contents""" @@ -646,7 +646,7 @@ class AncestorChartBareDialog(Report.BareReportDialog): if self.new_person: self.person = self.new_person - self.options = ( self.person.getId(), self.max_gen, self.report_text, + self.options = ( self.person.get_id(), self.max_gen, self.report_text, self.do_compress, self.the_title ) self.style_name = self.selected_style.get_name() @@ -660,7 +660,7 @@ def write_book_item(database,person,doc,options,newpage=0): All user dialog has already been handled and the output file opened.""" try: if options[0]: - person = database.getPerson(options[0]) + person = database.get_person(options[0]) max_gen = int(options[1]) disp_format = options[2] compress = int(options[3]) diff --git a/src/plugins/AncestorReport.py b/src/plugins/AncestorReport.py index 7f7bdfe44..16d3a393f 100644 --- a/src/plugins/AncestorReport.py +++ b/src/plugins/AncestorReport.py @@ -67,10 +67,10 @@ class AncestorReport(Report.Report): return self.map[index] = person - family = person.getMainParents() + family = person.get_main_parents_family_id() if family != None: - self.filter(family.getFather(),index*2,generation+1) - self.filter(family.getMother(),(index*2)+1,generation+1) + self.filter(family.get_father_id(),index*2,generation+1) + self.filter(family.get_mother_id(),(index*2)+1,generation+1) def write_report(self): @@ -79,7 +79,7 @@ class AncestorReport(Report.Report): self.filter(self.start,1) - name = self.start.getPrimaryName().getRegularName() + name = self.start.get_primary_name().get_regular_name() self.doc.start_paragraph("AHN-Title") title = _("Ahnentafel Report for %s") % name self.doc.write_text(title) @@ -101,7 +101,7 @@ class AncestorReport(Report.Report): self.doc.start_paragraph("AHN-Entry","%s." % str(key)) person = self.map[key] - name = person.getPrimaryName().getRegularName() + name = person.get_primary_name().get_regular_name() self.doc.start_bold() self.doc.write_text(name) @@ -113,98 +113,98 @@ class AncestorReport(Report.Report): # Check birth record - birth = person.getBirth() + birth = person.get_birth() if birth: - date = birth.getDateObj().get_start_date() - place = birth.getPlaceName() + date = birth.get_date_object().get_start_date() + place = birth.get_place_name() if place[-1:] == '.': place = place[:-1] - if date.getDate() != "" or place != "": - if date.getDate() != "": + if date.get_date() != "" or place != "": + if date.get_date() != "": if date.getDayValid() and date.getMonthValid(): if place != "": t = _("%s was born on %s in %s. ") % \ - (name,date.getDate(),place) + (name,date.get_date(),place) else: t = _("%s was born on %s. ") % \ - (name,date.getDate()) + (name,date.get_date()) else: if place != "": t = _("%s was born in the year %s in %s. ") % \ - (name,date.getDate(),place) + (name,date.get_date(),place) else: t = _("%s was born in the year %s. ") % \ - (name,date.getDate()) + (name,date.get_date()) self.doc.write_text(t) - death = person.getDeath() + death = person.get_death() buried = None - for event in person.getEventList(): - if string.lower(event.getName()) == "burial": + for event in person.get_event_list(): + if string.lower(event.get_name()) == "burial": buried = event if death: - date = death.getDateObj().get_start_date() - place = death.getPlaceName() + date = death.get_date_object().get_start_date() + place = death.get_place_name() if place[-1:] == '.': place = place[:-1] - if date.getDate() != "" or place != "": - if person.getGender() == RelLib.Person.male: + if date.get_date() != "" or place != "": + if person.get_gender() == RelLib.Person.male: male = 1 else: male = 0 - if date.getDate() != "": + if date.get_date() != "": if date.getDayValid() and date.getMonthValid(): if male: if place != "": t = _("He died on %s in %s") % \ - (date.getDate(),place) + (date.get_date(),place) else: - t = _("He died on %s") % date.getDate() + t = _("He died on %s") % date.get_date() else: if place != "": t = _("She died on %s in %s") % \ - (date.getDate(),place) + (date.get_date(),place) else: - t = _("She died on %s") % date.getDate() + t = _("She died on %s") % date.get_date() else: if male: if place != "": t = _("He died in the year %s in %s") % \ - (date.getDate(),place) + (date.get_date(),place) else: - t = _("He died in the year %s") % date.getDate() + t = _("He died in the year %s") % date.get_date() else: if place != "": t = _("She died in the year %s in %s") % \ - (date.getDate(),place) + (date.get_date(),place) else: - t = _("She died in the year %s") % date.getDate() + t = _("She died in the year %s") % date.get_date() self.doc.write_text(t) if buried: - date = buried.getDateObj().get_start_date() - place = buried.getPlaceName() + date = buried.get_date_object().get_start_date() + place = buried.get_place_name() if place[-1:] == '.': place = place[:-1] - if date.getDate() != "" or place != "": - if date.getDate() != "": + if date.get_date() != "" or place != "": + if date.get_date() != "": if date.getDayValid() and date.getMonthValid(): if place != "": t = _(", and was buried on %s in %s.") % \ - (date.getDate(),place) + (date.get_date(),place) else: t = _(", and was buried on %s.") % \ - date.getDate() + date.get_date() else: if place != "": t = _(", and was buried in the year %s in %s.") % \ - (date.getDate(),place) + (date.get_date(),place) else: t = _(", and was buried in the year %s.") % \ - date.getDate() + date.get_date() else: t = _(" and was buried in %s." % place) self.doc.write_text(t) @@ -305,7 +305,7 @@ class AncestorBareReportDialog(Report.BareReportDialog): self.options = opt self.db = database if self.options[0]: - self.person = self.db.getPerson(self.options[0]) + self.person = self.db.get_person(self.options[0]) else: self.person = person self.style_name = stl @@ -354,7 +354,7 @@ class AncestorBareReportDialog(Report.BareReportDialog): if self.new_person: self.person = self.new_person - self.options = ( self.person.getId(), self.max_gen, self.pg_brk ) + self.options = ( self.person.get_id(), self.max_gen, self.pg_brk ) self.style_name = self.selected_style.get_name() #------------------------------------------------------------------------ @@ -367,7 +367,7 @@ def write_book_item(database,person,doc,options,newpage=0): All user dialog has already been handled and the output file opened.""" try: if options[0]: - person = database.getPerson(options[0]) + person = database.get_person(options[0]) max_gen = int(options[1]) pg_brk = int(options[2]) return AncestorReport(database, person, max_gen, pg_brk, doc, None, newpage ) diff --git a/src/plugins/Ancestors.py b/src/plugins/Ancestors.py index 18a21278a..14fa6e92e 100644 --- a/src/plugins/Ancestors.py +++ b/src/plugins/Ancestors.py @@ -125,7 +125,7 @@ class ComprehensiveAncestorsReport (Report.Report): self.write_paragraphs (self.person (self.start, suppress_children = 1, needs_name = 1)) - families = [self.start.getMainParents ()] + families = [self.start.get_main_parents_family_id ()] if len (families) > 0: self.generation (self.max_generations, families, [], [self.start]) @@ -137,9 +137,9 @@ class ComprehensiveAncestorsReport (Report.Report): i = 1 for source in self.sources: self.doc.start_paragraph ("AR-Entry") - self.doc.write_text ("[%d] %s" % (i, source.getTitle ())) - author = source.getAuthor () - pubinfo = source.getPubInfo () + self.doc.write_text ("[%d] %s" % (i, source.get_title ())) + author = source.get_author () + pubinfo = source.get_publication_info () extra = author if pubinfo: if extra: @@ -149,8 +149,8 @@ class ComprehensiveAncestorsReport (Report.Report): self.doc.write_text ('; %s' % extra) self.doc.end_paragraph () - note = source.getNote () - format = source.getNoteFormat () + note = source.get_note () + format = source.get_note_format () if note: self.doc.write_note (note, format, "AR-Details") @@ -180,8 +180,8 @@ class ComprehensiveAncestorsReport (Report.Report): ret = [] if not family: return ret - father = family.getFather () - mother = family.getMother () + father = family.get_father_id () + mother = family.get_mother_id () if father: ret.extend (self.person (father, short_form = father in already_described, @@ -196,7 +196,7 @@ class ComprehensiveAncestorsReport (Report.Report): needs_name = not father, from_family = family)) - children = family.getChildList () + children = family.get_child_id_list () if len (children): ret.append ((self.doc.start_paragraph, ['AR-ChildTitle'])) ret.append ((self.doc.write_text, [_('Their children:')])) @@ -219,8 +219,8 @@ class ComprehensiveAncestorsReport (Report.Report): people.extend (self.family (family, already_described)) if thisgen > 2 and len (mfamilies): - for self.gp in [mfamilies[0].getFather (), - mfamilies[0].getMother ()]: + for self.gp in [mfamilies[0].get_father_id (), + mfamilies[0].get_mother_id ()]: if self.gp: break @@ -242,8 +242,8 @@ class ComprehensiveAncestorsReport (Report.Report): self.doc.start_paragraph ("AR-Heading") families = pfamilies families.extend (mfamilies) - for self.gp in [families[0].getFather (), - families[0].getMother ()]: + for self.gp in [families[0].get_father_id (), + families[0].get_mother_id ()]: if self.gp: break @@ -265,17 +265,17 @@ class ComprehensiveAncestorsReport (Report.Report): next_pfamilies = [] next_mfamilies = [] for family in families: - father = family.getFather () + father = family.get_father_id () if father: already_described.append (father) - father_family = father.getMainParents () + father_family = father.get_main_parents_family_id () if father_family: next_pfamilies.append (father_family) - mother = family.getMother () + mother = family.get_mother_id () if mother: already_described.append (mother) - mother_family = mother.getMainParents () + mother_family = mother.get_main_parents_family_id () if mother_family: next_mfamilies.append (mother_family) @@ -292,7 +292,7 @@ class ComprehensiveAncestorsReport (Report.Report): ret = [] name = self.person_name (person) if name: - photos = person.getPhotoList () + photos = person.get_photo_list () bits = '' bits += self.short_occupation (person) @@ -313,24 +313,24 @@ class ComprehensiveAncestorsReport (Report.Report): spouse = [] if from_family: - from_family_father = from_family.getFather () - from_family_mother = from_family.getMother () + from_family_father = from_family.get_father_id () + from_family_mother = from_family.get_mother_id () else: from_family_father = from_family_mother = None - for family in person.getFamilyList (): - for partner in [family.getFather (), - family.getMother ()]: + for family in person.get_family_id_list (): + for partner in [family.get_father_id (), + family.get_mother_id ()]: if partner == person or not partner: continue if (suppress_children or (partner != from_family_father and partner != from_family_mother)): - for photo in partner.getPhotoList ()[:1]: - if photo.ref.getMimeType()[0:5] == "image": + for photo in partner.get_photo_list ()[:1]: + if photo.ref.get_mime_type()[0:5] == "image": spouse.append ((self.doc.add_photo, - [photo.ref.getPath (), + [photo.ref.get_path (), 'right', 2, 2])) if suppress_children and len (already_described): @@ -359,9 +359,9 @@ class ComprehensiveAncestorsReport (Report.Report): else: ret.append ((self.doc.start_cell, ["AR-Photo"])) for photo in photos[:1]: - if photo.ref.getMimeType()[0:5] == "image": + if photo.ref.get_mime_type()[0:5] == "image": ret.append ((self.doc.add_photo, - [photo.ref.getPath (), 'left', 2, 2])) + [photo.ref.get_path (), 'left', 2, 2])) ret.append ((self.doc.end_cell, [])) ret.append ((self.doc.start_cell, ["AR-Entry"])) @@ -391,12 +391,12 @@ class ComprehensiveAncestorsReport (Report.Report): def short_occupation (self, person): occupation = '' - for event in person.getEventList (): - if event.getName () == 'Occupation': + for event in person.get_event_list (): + if event.get_name () == 'Occupation': if occupation: return '' - occupation = event.getDescription () + occupation = event.get_description () if occupation: return ' (%s)' % occupation @@ -405,36 +405,36 @@ class ComprehensiveAncestorsReport (Report.Report): def event_info (self, event): info = '' - name = event.getName () - description = event.getDescription () + name = event.get_name () + description = event.get_description () if name != 'Birth' and name != 'Death' and name != 'Marriage': info += const.display_pevent (name) if description: info += ': ' + description description = None - dateobj = event.getDateObj () + dateobj = event.get_date_object () if dateobj: - text = dateobj.getText () + text = dateobj.get_text() if text: info += ' ' + text[0].lower() + text[1:] elif dateobj.getValid (): if dateobj.isRange (): - info += ' ' + dateobj.getDate () + info += ' ' + dateobj.get_date () elif (dateobj.getDayValid () and dateobj.getMonthValid () and dateobj.getYearValid ()): info += _(' on %(specific_date)s') % \ - {'specific_date': dateobj.getDate ()} + {'specific_date': dateobj.get_date ()} else: info += _(' in %(month_or_year)s') % \ - {'month_or_year': dateobj.getDate ()} + {'month_or_year': dateobj.get_date ()} - placename = event.getPlaceName () + placename = event.get_place_name () if placename: info += _(' in %(place)s') % {'place': placename} - note = event.getNote () - note_format = event.getNoteFormat () + note = event.get_note () + note_format = event.get_note_format () inline_note = note and (note_format == 0) if inline_note or description: info += ' (' @@ -446,46 +446,46 @@ class ComprehensiveAncestorsReport (Report.Report): info += note info += ')' - info += self.cite_sources (event.getSourceRefList ()) + info += self.cite_sources (event.get_source_references ()) return info def address_info (self, address): - info = _('Address:') + ' %s %s %s %s' % (address.getStreet (), - address.getCity (), - address.getState (), - address.getCountry ()) + info = _('Address:') + ' %s %s %s %s' % (address.get_street (), + address.get_city (), + address.get_state (), + address.get_country ()) info = info.rstrip () - date = address.getDate () + date = address.get_date () if date: info += ', ' + date - info += self.cite_sources (address.getSourceRefList ()) + info += self.cite_sources (address.get_source_references ()) return info def abbrev_born_died (self, person): ret = '' - birth = person.getBirth () - date = birth.getDate () + birth = person.get_birth () + date = birth.get_date () if date: ret += _(" b. %(date)s") % {'date': date} - ret += self.cite_sources (birth.getSourceRefList ()) + ret += self.cite_sources (birth.get_source_references ()) - death = person.getDeath () - date = death.getDate () + death = person.get_death () + date = death.get_date () if date: ret += _(" d. %(date)s)") % {'date': date} - ret += self.cite_sources (death.getSourceRefList ()) + ret += self.cite_sources (death.get_source_references ()) return ret def long_born_died (self, person): ret = '' - born_info = self.event_info (person.getBirth ()) + born_info = self.event_info (person.get_birth ()) if born_info: ret = ", " + _("born") + born_info - died_info = self.event_info (person.getDeath ()) + died_info = self.event_info (person.get_death ()) if died_info: if born_info: ret += '; ' @@ -497,16 +497,16 @@ class ComprehensiveAncestorsReport (Report.Report): return ret def parents_of (self, person): - gender = person.getGender () + gender = person.get_gender () - family = person.getMainParents () + family = person.get_main_parents_family_id () ret = '. ' if family: fathername = mothername = None - father = family.getFather () + father = family.get_father_id () if father: fathername = self.person_name (father) - mother = family.getMother () + mother = family.get_mother_id () if mother: mothername = self.person_name (mother) @@ -540,22 +540,22 @@ class ComprehensiveAncestorsReport (Report.Report): return ret def first_name_or_nick (self, person): - nickname = person.getNickName () + nickname = person.get_nick_name () if nickname: return nickname - name = person.getPrimaryName ().getFirstName () + name = person.get_primary_name ().get_first_name () return name.split (' ')[0] def title (self, person): - name = person.getPrimaryName () - t = name.getTitle () + name = person.get_primary_name () + t = name.get_title () if t: return t - gender = person.getGender () + gender = person.get_gender () if gender == RelLib.Person.female: - if name.getType () == 'Married Name': + if name.get_type () == 'Married Name': return _('Mrs.') return _('Miss') @@ -572,7 +572,7 @@ class ComprehensiveAncestorsReport (Report.Report): continue self.sourcerefs.append (ref) - source = ref.getBase () + source = ref.get_base_id () if source in self.sources: ind = self.sources.index (source) + 1 else: @@ -580,7 +580,7 @@ class ComprehensiveAncestorsReport (Report.Report): ind = len (self.sources) citation += "[%d" % ind - comments = ref.getComments () + comments = ref.get_comments () if comments and comments.find ('\n') == -1: citation += " - %s" % comments.rstrip ('.') @@ -589,21 +589,21 @@ class ComprehensiveAncestorsReport (Report.Report): return citation def person_name (self, person): - primary = person.getPrimaryName () + primary = person.get_primary_name () - name = primary.getTitle () + name = primary.get_title () if name: name += ' ' - first = primary.getFirstName () - last = primary.getSurname () + first = primary.get_first_name () + last = primary.get_surname () first_replaced = first.replace ('?', '') if first_replaced == '': name += self.title (person) else: name += first - nick = person.getNickName () + nick = person.get_nick_name () if nick: nick.strip ('"') name += ' ("%s")' % nick @@ -614,29 +614,29 @@ class ComprehensiveAncestorsReport (Report.Report): else: name += ' ' + last - suffix = primary.getSuffix () + suffix = primary.get_suffix () if suffix: name += ', ' + suffix - type = primary.getType () + type = primary.get_type () if type != 'Birth Name': name += ' (%s)' % type - name += self.cite_sources (primary.getSourceRefList ()) + name += self.cite_sources (primary.get_source_references ()) return name def married_whom (self, person, from_family, listing_children = 0): - gender = person.getGender () + gender = person.get_gender () first_marriage = 1 ret = '' - for family in person.getFamilyList (): - mother = family.getMother () - for spouse in [family.getFather (), mother]: + for family in person.get_family_id_list (): + mother = family.get_mother_id () + for spouse in [family.get_father_id (), mother]: if spouse == person or not spouse: continue children = '' - childlist = family.getChildList () + childlist = family.get_child_id_list () child_count = len (childlist) if ((listing_children or family != from_family) and child_count > 0): @@ -649,8 +649,8 @@ class ComprehensiveAncestorsReport (Report.Report): count = 1 for child in childlist: children += self.first_name_or_nick (child) - children += self.cite_sources (child.getPrimaryName (). - getSourceRefList ()) + children += self.cite_sources (child.get_primary_name (). + get_source_references ()) children += self.abbrev_born_died (child) if child_count - count > 1: children += ', ' @@ -659,7 +659,7 @@ class ComprehensiveAncestorsReport (Report.Report): count += 1 - marriage = family.getMarriage () + marriage = family.get_marriage () if not first_marriage: if gender == RelLib.Person.female: ret += _(' She later married %(name)s') % \ @@ -690,11 +690,11 @@ class ComprehensiveAncestorsReport (Report.Report): return ret def inline_notes (self, person): - name_note = person.getPrimaryName ().getNote () + name_note = person.get_primary_name ().get_note () if not (name_note == '' or name_note.find ('\n') != -1): return _(' Note about their name: ') + name_note - note = person.getNote () - if not (person.getNoteFormat () != 0 or + note = person.get_note () + if not (person.get_note_format () != 0 or note == '' or note.find ('\n') != -1): return ' ' + note @@ -714,8 +714,8 @@ class ComprehensiveAncestorsReport (Report.Report): def long_notes (self, person, suppress_children = 0, already_described = []): - note = person.getNote () - format = person.getNoteFormat () + note = person.get_note () + format = person.get_note_format () if format != 0: paras = [ (self.doc.write_note, [note, format, 'AR-Details']) ] elif note != '' and note.find ('\n') != -1: @@ -723,9 +723,9 @@ class ComprehensiveAncestorsReport (Report.Report): else: paras = [] - names = person.getAlternateNames () - events = person.getEventList () - addresses = person.getAddressList () + names = person.get_alternate_names () + events = person.get_event_list () + addresses = person.get_address_list () if (len (events) + len (addresses) + len (names)) > 0: paras.append ((self.doc.start_paragraph, ['AR-SubEntry'])) paras.append ((self.doc.write_text, @@ -736,13 +736,13 @@ class ComprehensiveAncestorsReport (Report.Report): for name in names: paras.append ((self.doc.start_paragraph, ['AR-Details'])) paras.append ((self.doc.write_text, - [const.NameTypesMap.find_value(name.getType ()) + - ': ' + name.getRegularName ()])) + [const.NameTypesMap.find_value(name.get_type ()) + + ': ' + name.get_regular_name ()])) paras.append ((self.doc.end_paragraph, [])) - for event in [person.getBirth (), person.getDeath ()]: - note = event.getNote () - note_format = event.getNoteFormat () + for event in [person.get_birth (), person.get_death ()]: + note = event.get_note () + note_format = event.get_note_format () if note and (note_format != 0): paras.append ((self.doc.write_note, [note, format, 'AR-Details'])) @@ -751,8 +751,8 @@ class ComprehensiveAncestorsReport (Report.Report): paras.append ((self.doc.start_paragraph, ['AR-Details'])) paras.append ((self.doc.write_text, [self.event_info (event)])) paras.append ((self.doc.end_paragraph, [])) - note = event.getNote () - note_format = event.getNoteFormat () + note = event.get_note () + note_format = event.get_note_format () if note and (note_format != 0): paras.append ((self.doc.write_note, [note, format, 'AR-Details'])) @@ -927,7 +927,7 @@ class ComprehensiveAncestorsBareReportDialog(Report.BareReportDialog): self.options = opt self.db = database if self.options[0]: - self.person = self.db.getPerson(self.options[0]) + self.person = self.db.get_person(self.options[0]) else: self.person = person self.style_name = stl @@ -987,7 +987,7 @@ class ComprehensiveAncestorsBareReportDialog(Report.BareReportDialog): if self.new_person: self.person = self.new_person - self.options = ( self.person.getId(), self.max_gen, self.pg_brk, self.opt_cite ) + self.options = ( self.person.get_id(), self.max_gen, self.pg_brk, self.opt_cite ) self.style_name = self.selected_style.get_name() #------------------------------------------------------------------------ @@ -1000,7 +1000,7 @@ def write_book_item(database,person,doc,options,newpage=0): All user dialog has already been handled and the output file opened.""" try: if options[0]: - person = database.getPerson(options[0]) + person = database.get_person(options[0]) max_gen = int(options[1]) pg_brk = int(options[2]) opt_cite = int(options[3]) diff --git a/src/plugins/BookReport.py b/src/plugins/BookReport.py index 636b3b2d7..b58171675 100644 --- a/src/plugins/BookReport.py +++ b/src/plugins/BookReport.py @@ -653,7 +653,7 @@ class BookReportSelector: book: the book object to load. """ - if book.get_dbname() == self.db.getSavePath(): + if book.get_dbname() == self.db.get_save_path(): same_db = 1 else: same_db = 0 @@ -671,7 +671,7 @@ class BookReportSelector: item = BookItem(name) options = saved_item.get_options() if not same_db or not options[0]: - options[0] = self.person.getId() + options[0] = self.person.get_id() item.set_options(options) item.set_style_name(saved_item.get_style_name()) self.book.append_item(item) @@ -680,8 +680,8 @@ class BookReportSelector: if data[1] == _("Title"): data.append(_("Not Applicable")) else: - pname = self.db.getPerson(options[0]) - data.append(pname.getPrimaryName().getRegularName()) + pname = self.db.get_person(options[0]) + data.append(pname.get_primary_name().get_regular_name()) self.bk_model.add(data) def on_add_clicked(self,obj): @@ -697,12 +697,12 @@ class BookReportSelector: if data[1] == _("Title"): data.append(_("Not Applicable")) else: - data.append(self.person.getPrimaryName().getRegularName()) + data.append(self.person.get_primary_name().get_regular_name()) self.bk_model.add(data) item = BookItem(data[0]) options = item.get_options() if not options[0]: - options[0] = self.person.getId() + options[0] = self.person.get_id() item.set_options(options) self.book.append_item(item) @@ -769,7 +769,7 @@ class BookReportSelector: opt_dlg.window.destroy() if opt_dlg.person and data[1] != _("Title"): self.bk_model.model.set_value(iter,2, - opt_dlg.person.getPrimaryName().getRegularName()) + opt_dlg.person.get_primary_name().get_regular_name()) item.set_options(opt_dlg.options) item.set_style_name(opt_dlg.style_name) self.book.set_item(row,item) @@ -863,7 +863,7 @@ class BookReportSelector: self.book_list = BookList(self.file) name = unicode(self.name_entry.get_text()) self.book.set_name(name) - self.book.set_dbname(self.db.getSavePath()) + self.book.set_dbname(self.db.get_save_path()) self.book_list.set_book(name,self.book) self.book_list.save() diff --git a/src/plugins/ChangeTypes.py b/src/plugins/ChangeTypes.py index a0fbcf55f..278066718 100644 --- a/src/plugins/ChangeTypes.py +++ b/src/plugins/ChangeTypes.py @@ -78,10 +78,10 @@ class ChangeTypes: original = unicode(self.glade.get_widget("original_text").get_text()) new = unicode(self.glade.get_widget("new_text").get_text()) - for person in self.db.getPersonMap().values(): - for event in person.getEventList(): - if event.getName() == original: - event.setName(new) + for person in self.db.get_person_id_map().values(): + for event in person.get_event_list(): + if event.get_name() == original: + event.set_name(new) modified = modified + 1 Utils.modified() diff --git a/src/plugins/Check.py b/src/plugins/Check.py index 0941953b6..acd0f0551 100644 --- a/src/plugins/Check.py +++ b/src/plugins/Check.py @@ -89,27 +89,27 @@ class CheckIntegrity: def check_for_broken_family_links(self): self.broken_links = [] - for key in self.db.getFamilyMap().keys(): - family = self.db.getFamily(key) - father = family.getFather() - mother = family.getMother() + for key in self.db.get_family_id_map().keys(): + family = self.db.get_family_id(key) + father = family.get_father_id() + mother = family.get_mother_id() - if father and family not in father.getFamilyList(): + if father and family not in father.get_family_id_list(): Utils.modified() self.broken_parent_links.append((father,family)) - father.addFamily(family) - if mother and family not in mother.getFamilyList(): + father.add_family_id(family) + if mother and family not in mother.get_family_id_list(): Utils.modified() self.broken_parent_links.append((mother,family)) - mother.addFamily(family) - for child in family.getChildList(): - if family == child.getMainParents(): + mother.add_family_id(family) + for child in family.get_child_id_list(): + if family == child.get_main_parents_family_id(): continue - for family_type in child.getParentList(): + for family_type in child.get_parent_family_id_list(): if family_type[0] == family: break else: - family.removeChild(child) + family.remove_child_id(child) Utils.modified() self.broken_links.append((child,family)) @@ -119,35 +119,35 @@ class CheckIntegrity: def remove_clicked(): # File is lost => remove all references and the object itself mobj = ObjectMap[ObjectId] - for p in self.db.getFamilyMap().values(): - nl = p.getPhotoList() + for p in self.db.get_family_id_map().values(): + nl = p.get_photo_list() for o in nl: - if o.getReference() == mobj: + if o.get_reference() == mobj: nl.remove(o) - p.setPhotoList(nl) - for key in self.db.getPersonKeys(): - p = self.db.getPerson(key) - nl = p.getPhotoList() + p.set_photo_list(nl) + for key in self.db.get_person_keys(): + p = self.db.get_person(key) + nl = p.get_photo_list() for o in nl: - if o.getReference() == mobj: + if o.get_reference() == mobj: nl.remove(o) - p.setPhotoList(nl) - for key in self.db.getSourceKeys(): - p = self.db.getSource(key) - nl = p.getPhotoList() + p.set_photo_list(nl) + for key in self.db.get_source_keys(): + p = self.db.get_source(key) + nl = p.get_photo_list() for o in nl: - if o.getReference() == mobj: + if o.get_reference() == mobj: nl.remove(o) - p.setPhotoList(nl) - for key in self.db.getPlaceKeys(): - p = self.db.getPlace(key) - nl = p.getPhotoList() + p.set_photo_list(nl) + for key in self.db.get_place_id_keys(): + p = self.db.get_place_id(key) + nl = p.get_photo_list() for o in nl: - if o.getReference() == mobj: + if o.get_reference() == mobj: nl.remove(o) - p.setPhotoList(nl) + p.set_photo_list(nl) self.removed_photo.append(ObjectMap[ObjectId]) - self.db.removeObject(ObjectId) + self.db.remove_object(ObjectId) Utils.modified() def leave_clicked(): @@ -179,9 +179,9 @@ class CheckIntegrity: fs_top.destroy() #------------------------------------------------------------------------- - ObjectMap = self.db.getObjectMap() + ObjectMap = self.db.get_object_map() for ObjectId in ObjectMap.keys(): - photo_name = ObjectMap[ObjectId].getPath() + photo_name = ObjectMap[ObjectId].get_path() if not os.path.isfile(photo_name): if cl: print "Warning: media file %s was not found." \ @@ -205,53 +205,53 @@ class CheckIntegrity: select_clicked() def cleanup_empty_families(self,automatic): - for key in self.db.getFamilyMap().keys(): - family = self.db.getFamily(key) - if family.getFather() == None and family.getMother() == None: + for key in self.db.get_family_id_map().keys(): + family = self.db.get_family_id(key) + if family.get_father_id() == None and family.get_mother_id() == None: Utils.modified() self.empty_family.append(family) self.delete_empty_family(family) def delete_empty_family(self,family): - for key in self.db.getPersonKeys(): - child = self.db.getPerson(key) - child.removeAltFamily(family) - self.db.deleteFamily(family) + for key in self.db.get_person_keys(): + child = self.db.get_person(key) + child.remove_parent_family_id(family.get_id()) + self.db.delete_family(family.get_id()) def check_parent_relationships(self): - for key in self.db.getFamilyMap().keys(): - family = self.db.getFamily(key) - father = family.getFather() - mother = family.getMother() - type = family.getRelationship() + for key in self.db.get_family_id_map().keys(): + family = self.db.get_family_id(key) + father = family.get_father_id() + mother = family.get_mother_id() + type = family.get_relationship() if not father and not mother: continue elif father == None: - if mother.getGender() == RelLib.Person.male: - family.setFather(mother) - family.setMother(None) + if mother.get_gender() == RelLib.Person.male: + family.set_father_id(mother) + family.set_mother_id(None) elif mother == None: - if father.getGender() == RelLib.Person.female: - family.setMother(father) - family.setFather(None) + if father.get_gender() == RelLib.Person.female: + family.set_mother_id(father) + family.set_father_id(None) else: - fgender = father.getGender() - mgender = mother.getGender() + fgender = father.get_gender() + mgender = mother.get_gender() if type != "Partners": if fgender == mgender and fgender != RelLib.Person.unknown: - family.setRelationship("Partners") + family.set_relationship("Partners") self.fam_rel.append(family) elif fgender == RelLib.Person.female or mgender == RelLib.Person.male: - family.setFather(mother) - family.setMother(father) + family.set_father_id(mother) + family.set_mother_id(father) self.fam_rel.append(family) elif fgender != mgender: - family.setRelationship("Unknown") + family.set_relationship("Unknown") self.fam_rel.append(family) if fgender == RelLib.Person.female or mgender == RelLib.Person.male: - family.setFather(mother) - family.setMother(father) + family.set_father_id(mother) + family.set_mother_id(father) def build_report(self,cl=0): bad_photos = len(self.bad_photo) @@ -280,16 +280,16 @@ class CheckIntegrity: else: self.text.write(_("%d broken child/family links were found\n") % blink) for c in self.broken_links: - cn = c[0].getPrimaryName().getName() - f = c[1].getFather() - m = c[1].getMother() + cn = c[0].get_primary_name().get_name() + f = c[1].get_father_id() + m = c[1].get_mother_id() if f and m: - pn = _("%s and %s") % (f.getPrimaryName().getName(),\ - m.getPrimaryName().getName()) + pn = _("%s and %s") % (f.get_primary_name().get_name(),\ + m.get_primary_name().get_name()) elif f: - pn = f.getPrimaryName().getName() + pn = f.get_primary_name().get_name() elif m: - pn = m.getPrimaryName().getName() + pn = m.get_primary_name().get_name() else: pn = _("unknown") self.text.write('\t') @@ -301,16 +301,16 @@ class CheckIntegrity: else: self.text.write(_("%d broken spouse/family links were found\n") % plink) for c in self.broken_parent_links: - cn = c[0].getPrimaryName().getName() - f = c[1].getFather() - m = c[1].getMother() + cn = c[0].get_primary_name().get_name() + f = c[1].get_father_id() + m = c[1].get_mother_id() if f and m: - pn = _("%s and %s") % (f.getPrimaryName().getName(),\ - m.getPrimaryName().getName()) + pn = _("%s and %s") % (f.get_primary_name().get_name(),\ + m.get_primary_name().get_name()) elif f: - pn = f.getPrimaryName().getName() + pn = f.get_primary_name().get_name() else: - pn = m.getPrimaryName().getName() + pn = m.get_primary_name().get_name() self.text.write('\t') self.text.write(_("%s was restored to the family of %s\n") % (cn,pn)) diff --git a/src/plugins/CustomBookText.py b/src/plugins/CustomBookText.py index d2fb40dc5..3e378f856 100644 --- a/src/plugins/CustomBookText.py +++ b/src/plugins/CustomBookText.py @@ -141,7 +141,7 @@ class CustomTextDialog(Report.BareReportDialog): self.options = opt self.db = database if self.options[0]: - self.person = self.db.getPerson(self.options[0]) + self.person = self.db.get_person(self.options[0]) else: self.person = person self.style_name = stl @@ -245,7 +245,7 @@ class CustomTextDialog(Report.BareReportDialog): if self.new_person: self.person = self.new_person - self.options = ( self.person.getId(), + self.options = ( self.person.get_id(), self.top_text, self.middle_text, self.bottom_text ) self.style_name = self.selected_style.get_name() @@ -259,7 +259,7 @@ def write_book_item(database,person,doc,options,newpage=0): All user dialog has already been handled and the output file opened.""" try: if options[0]: - person = database.getPerson(options[0]) + person = database.get_person(options[0]) top_text = options[1] middle_text = options[2] bottom_text = options[3] diff --git a/src/plugins/DesGraph.py b/src/plugins/DesGraph.py index e9362b746..056bad434 100644 --- a/src/plugins/DesGraph.py +++ b/src/plugins/DesGraph.py @@ -76,7 +76,7 @@ class DescendantReport: def __init__(self,database,person,display,doc,output,newpage=0): self.doc = doc - self.doc.creator(database.getResearcher().getName()) + self.doc.creator(database.get_researcher().get_name()) self.map = {} self.text = {} self.start = person @@ -92,24 +92,24 @@ class DescendantReport: else: self.standalone = 0 - plist = database.getPersonMap().values() + plist = database.get_person_id_map().values() self.layout = GraphLayout.DescendLine(plist,person) (self.v,self.e) = self.layout.layout() self.text = {} for (p,x,y) in self.v: - self.text[p.getId()] = [] + self.text[p.get_id()] = [] subst = SubstKeywords(p) for line in self.display: - self.text[p.getId()].append(subst.replace(line)) + self.text[p.get_id()].append(subst.replace(line)) self.font = self.doc.style_list["DG-Normal"].get_font() - for line in self.text[p.getId()]: + for line in self.text[p.get_id()]: new_width = FontScale.string_width(self.font,line) self.box_width = max(self.box_width,new_width) - self.lines = max(self.lines,len(self.text[p.getId()])) + self.lines = max(self.lines,len(self.text[p.get_id()])) def write_report(self): @@ -255,7 +255,7 @@ class DescendantReport: if plist: for (p,x,y) in plist: - name = string.join(self.text[p.getId()],"\n") + name = string.join(self.text[p.get_id()],"\n") x = (x-1)*delta + left + _sep y = (y-1)*(self.height+_sep)+top self.doc.draw_box("box",name,x,y) @@ -399,7 +399,7 @@ class DescendantGraphBareDialog(Report.BareReportDialog): self.options = opt self.db = database if self.options[0]: - self.person = self.db.getPerson(self.options[0]) + self.person = self.db.get_person(self.options[0]) else: self.person = person self.style_name = stl @@ -456,7 +456,7 @@ class DescendantGraphBareDialog(Report.BareReportDialog): if self.new_person: self.person = self.new_person - self.options = ( self.person.getId(), self.report_text ) + self.options = ( self.person.get_id(), self.report_text ) self.style_name = self.selected_style.get_name() #------------------------------------------------------------------------ @@ -469,7 +469,7 @@ def write_book_item(database,person,doc,options,newpage=0): All user dialog has already been handled and the output file opened.""" try: if options[0]: - person = database.getPerson(options[0]) + person = database.get_person(options[0]) disp_format = options[1] return DescendantReport(database, person, disp_format, doc, None, newpage ) diff --git a/src/plugins/Desbrowser.py b/src/plugins/Desbrowser.py index e1e665011..ccbd0ea15 100644 --- a/src/plugins/Desbrowser.py +++ b/src/plugins/Desbrowser.py @@ -94,8 +94,8 @@ class DesBrowse: self.model.set(item,0,GrampsCfg.nameof(person)) self.model.set(item,1,person) prev = None - for family in person.getFamilyList(): - for child in family.getChildList(): + for family in person.get_family_id_list(): + for child in family.get_child_id_list(): prev = self.add_to_tree(item,prev,child) return item diff --git a/src/plugins/DescendReport.py b/src/plugins/DescendReport.py index e6c28ef9a..054859c1c 100644 --- a/src/plugins/DescendReport.py +++ b/src/plugins/DescendReport.py @@ -58,7 +58,7 @@ _DIED = _('d.') class DescendantReport: def __init__(self,database,person,max,pgbrk,doc,output,newpage=0): - self.creator = database.getResearcher().getName() + self.creator = database.get_researcher().get_name() self.name = output self.person = person self.max_generations = max @@ -73,8 +73,8 @@ class DescendantReport: self.standalone = 0 def dump_dates(self, person): - birth = person.getBirth().getDateObj().get_start_date() - death = person.getDeath().getDateObj().get_start_date() + birth = person.get_birth().get_date_object().get_start_date() + death = person.get_death().get_date_object().get_start_date() if birth.getYearValid() or death.getYearValid(): self.doc.write_text(' (') if birth.getYearValid(): @@ -89,7 +89,7 @@ class DescendantReport: if self.newpage: self.doc.page_break() self.doc.start_paragraph("DR-Title") - name = self.person.getPrimaryName().getRegularName() + name = self.person.get_primary_name().get_regular_name() self.doc.write_text(_("Descendants of %s") % name) self.dump_dates(self.person) self.doc.end_paragraph() @@ -102,7 +102,7 @@ class DescendantReport: if level != 0: self.doc.start_paragraph("DR-Level%d" % level) self.doc.write_text("%d." % level) - self.doc.write_text(person.getPrimaryName().getRegularName()) + self.doc.write_text(person.get_primary_name().get_regular_name()) self.dump_dates(person) self.doc.end_paragraph() @@ -110,8 +110,8 @@ class DescendantReport: return childlist = [] - for family in person.getFamilyList(): - for child in family.getChildList(): + for family in person.get_family_id_list(): + for child in family.get_child_id_list(): childlist.append(child) childlist.sort(sort.by_birthdate) @@ -198,7 +198,7 @@ class DescendantBareReportDialog(Report.BareReportDialog): self.options = opt self.db = database if self.options[0]: - self.person = self.db.getPerson(self.options[0]) + self.person = self.db.get_person(self.options[0]) else: self.person = person @@ -248,7 +248,7 @@ class DescendantBareReportDialog(Report.BareReportDialog): if self.new_person: self.person = self.new_person - self.options = ( self.person.getId(), self.max_gen, self.pg_brk ) + self.options = ( self.person.get_id(), self.max_gen, self.pg_brk ) self.style_name = self.selected_style.get_name() #------------------------------------------------------------------------ @@ -261,7 +261,7 @@ def write_book_item(database,person,doc,options,newpage=0): All user dialog has already been handled and the output file opened.""" try: if options[0]: - person = database.getPerson(options[0]) + person = database.get_person(options[0]) max_gen = int(options[1]) pg_brk = int(options[2]) return DescendantReport(database, person, max_gen, diff --git a/src/plugins/DetAncestralReport.py b/src/plugins/DetAncestralReport.py index c2358652f..5d32d3e9a 100644 --- a/src/plugins/DetAncestralReport.py +++ b/src/plugins/DetAncestralReport.py @@ -79,10 +79,10 @@ class DetAncestorReport(Report.Report): return self.map[index] = person - family = person.getMainParents() + family = person.get_main_parents_family_id() if family != None: - self.filter(family.getFather(),index*2) - self.filter(family.getMother(),(index*2)+1) + self.filter(family.get_father_id(),index*2) + self.filter(family.get_mother_id(),(index*2)+1) def write_children(self, family, rptOptions): @@ -109,14 +109,14 @@ class DetAncestorReport(Report.Report): NAME 0 """ - num_children= len(family.getChildList()) + num_children= len(family.get_child_id_list()) if num_children > 0: self.doc.start_paragraph("DAR-ChildTitle") - if family.getMother() != None: - mother= family.getMother().getPrimaryName().getRegularName() + if family.get_mother_id() != None: + mother= family.get_mother_id().get_primary_name().get_regular_name() else: mother= "unknown" - if family.getFather() != None: - father= family.getFather().getPrimaryName().getRegularName() + if family.get_father_id() != None: + father= family.get_father_id().get_primary_name().get_regular_name() else: father= "unknown" self.doc.start_bold() if num_children == 1: @@ -125,72 +125,72 @@ class DetAncestorReport(Report.Report): self.doc.end_bold() self.doc.end_paragraph() - for child in family.getChildList(): + for child in family.get_child_id_list(): self.doc.start_paragraph("DAR-ChildList") - name= child.getPrimaryName().getRegularName() - birth= child.getBirth() - death= child.getDeath() + name= child.get_primary_name().get_regular_name() + birth= child.get_birth() + death= child.get_death() if rptOptions.childRef == reportOptions.Yes: - childID= child.getId() + childID= child.get_id() if self.prevGenIDs.get(childID) != None: name= "[" + str(self.prevGenIDs.get(childID)) + "] "+ name - if birth.getDate() != "": - if birth.getPlaceName() != "": - if death.getDate() != "": - if death.getPlaceName() != "": + if birth.get_date() != "": + if birth.get_place_name() != "": + if death.get_date() != "": + if death.get_place_name() != "": self.doc.write_text(_("- %s Born: %s %s Died: %s %s") % \ - (name, birth.getDate(), birth.getPlaceName(), - death.getDate(), death.getPlaceName())) # f + (name, birth.get_date(), birth.get_place_name(), + death.get_date(), death.get_place_name())) # f else: self.doc.write_text(_("- %s Born: %s %s Died: %s") % \ - (name, birth.getDate(), birth.getPlaceName(), - death.getDate())) # e - elif death.getPlaceName() != "": + (name, birth.get_date(), birth.get_place_name(), + death.get_date())) # e + elif death.get_place_name() != "": self.doc.write_text(_("- %s Born: %s %s Died: %s") % \ - (name, birth.getDate(), birth.getPlaceName(), - death.getPlaceName())) # d + (name, birth.get_date(), birth.get_place_name(), + death.get_place_name())) # d else: self.doc.write_text(_("- %s Born: %s %s") % \ - (name, birth.getDate(), birth.getPlaceName())) # c + (name, birth.get_date(), birth.get_place_name())) # c else: - if death.getDate() != "": - if death.getPlaceName() != "": + if death.get_date() != "": + if death.get_place_name() != "": self.doc.write_text(_("- %s Born: %s Died: %s %s") % \ - (name, birth.getDate(), death.getDate(), \ - death.getPlaceName())) # b + (name, birth.get_date(), death.get_date(), \ + death.get_place_name())) # b else: self.doc.write_text(_("- %s Born: %s Died: %s") % \ - (name, birth.getDate(), death.getDate())) # a - elif death.getPlaceName() != "": + (name, birth.get_date(), death.get_date())) # a + elif death.get_place_name() != "": self.doc.write_text(_("- %s Born: %s Died: %s") % \ - (name, birth.getDate(), death.getPlaceName())) # 9 + (name, birth.get_date(), death.get_place_name())) # 9 else: self.doc.write_text(_("- %s Born: %s") % \ - (name, birth.getDate())) # 8 + (name, birth.get_date())) # 8 else: - if birth.getPlaceName() != "": - if death.getDate() != "": - if death.getPlaceName() != "": + if birth.get_place_name() != "": + if death.get_date() != "": + if death.get_place_name() != "": self.doc.write_text(_("- %s Born: %s Died: %s %s") % \ - (name, birth.getPlaceName(), \ - death.getDate(), death.getPlaceName())) # 7 + (name, birth.get_place_name(), \ + death.get_date(), death.get_place_name())) # 7 else: self.doc.write_text(_("- %s Born: %s Died: %s") % \ - (name, birth.getPlaceName(), death.getDate())) # 6 - elif death.getPlaceName() != "": + (name, birth.get_place_name(), death.get_date())) # 6 + elif death.get_place_name() != "": self.doc.write_text(_("- %s Born: %s Died: %s") % \ - (name, birth.getPlaceName(), death.getPlaceName())) # 5 + (name, birth.get_place_name(), death.get_place_name())) # 5 else: self.doc.write_text(_("- %s Born: %s") % \ - (name, birth.getPlaceName())) # 4 + (name, birth.get_place_name())) # 4 else: - if death.getDate() != "": - if death.getPlaceName() != "": + if death.get_date() != "": + if death.get_place_name() != "": self.doc.write_text(_("- %s Died: %s %s") % \ - (name, death.getDate(), death.getPlaceName())) # 3 + (name, death.get_date(), death.get_place_name())) # 3 else: self.doc.write_text(_("- %s Died: %s") % \ - (name, death.getDate())) # 2 - elif death.getPlaceName() != "": + (name, death.get_date())) # 2 + elif death.get_place_name() != "": self.doc.write_text(_("- %s Died: %s") % \ - (name, death.getPlaceName())) # 1 + (name, death.get_place_name())) # 1 else: self.doc.write_text(_("- %s") % name) # 0 self.doc.end_paragraph() @@ -204,11 +204,11 @@ class DetAncestorReport(Report.Report): if rptOptions.addImages == reportOptions.Yes: self.insert_images(person) - name = person.getPrimaryName().getRegularName() + name = person.get_primary_name().get_regular_name() if rptOptions.firstName == reportOptions.Yes: - firstName= person.getPrimaryName().getFirstName() - elif person.getGender() == RelLib.Person.male: + firstName= person.get_primary_name().get_first_name() + elif person.get_gender() == RelLib.Person.male: firstName= _("He") else: firstName= _("She") @@ -223,13 +223,13 @@ class DetAncestorReport(Report.Report): keys.sort() for dkey in keys: if dkey >= key: break - if self.map[key].getId() == self.map[dkey].getId(): + if self.map[key].get_id() == self.map[dkey].get_id(): self.doc.write_text(_(" is the same person as [%s].") % str(dkey)) self.doc.end_paragraph() return 1 # Duplicate person # Check birth record - birth = person.getBirth() + birth = person.get_birth() if birth: self.write_birth(person, rptOptions) self.write_death(person, firstName, rptOptions) @@ -239,13 +239,13 @@ class DetAncestorReport(Report.Report): if key == 1: self.write_mate(person, rptOptions) - if person.getNote() != "" and rptOptions.includeNotes == reportOptions.Yes: + if person.get_note() != "" and rptOptions.includeNotes == reportOptions.Yes: self.doc.start_paragraph("DAR-NoteHeader") self.doc.start_bold() self.doc.write_text(_("Notes for %s" % name)) self.doc.end_bold() self.doc.end_paragraph() - self.doc.write_note(person.getNote(),person.getNoteFormat(),"DAR-Entry") + self.doc.write_note(person.get_note(),person.get_note_format(),"DAR-Entry") return 0 # Not duplicate person @@ -262,24 +262,24 @@ class DetAncestorReport(Report.Report): was born in ____________. """ - birth = person.getBirth() + birth = person.get_birth() if birth: - date = birth.getDateObj().get_start_date() - if birth.getPlaceName() != "": - place = birth.getPlaceName() + date = birth.get_date_object().get_start_date() + if birth.get_place_name() != "": + place = birth.get_place_name() if place[-1:] == '.': place = place[:-1] elif rptOptions.blankDate == reportOptions.Yes: place= "______________" else: place= "" - if date.getDate() != "": + if date.get_date() != "": if date.getDayValid() and date.getMonthValid() and \ rptOptions.fullDate == reportOptions.Yes: if place != "": - self.doc.write_text(_(" was born on %s in %s.") % (date.getDate(), place)) + self.doc.write_text(_(" was born on %s in %s.") % (date.get_date(), place)) else: - self.doc.write_text(_(" was born on %s.") % date.getDate()) + self.doc.write_text(_(" was born on %s.") % date.get_date()) elif place != "": self.doc.write_text(_(" was born in the year %s in %s.") % \ (date.getYear(), place)) @@ -320,19 +320,19 @@ class DetAncestorReport(Report.Report): . """ t= "" - death = person.getDeath() + death = person.get_death() if death != None: - date = death.getDateObj().get_start_date() - place = death.getPlaceName() + date = death.get_date_object().get_start_date() + place = death.get_place_name() if place[-1:] == '.': place = place[:-1] elif place == "" and rptOptions.blankPlace == reportOptions.Yes: place= "_____________" - if date.getDate() != "": + if date.get_date() != "": if date.getDay() and date.getMonth() and \ rptOptions.fullDate == reportOptions.Yes: - fulldate= date.getDate() + fulldate= date.get_date() elif date.getMonth() and rptOptions.fullDate == reportOptions.Yes: fulldate= "%s %s" % (date.getMonth(), date.getYear()) else: fulldate= "" @@ -359,20 +359,20 @@ class DetAncestorReport(Report.Report): else: return t= "" - famList= person.getFamilyList() + famList= person.get_family_id_list() if len(famList) > 0: for fam in famList: buried= None if buried: - date = buried.getDateObj().get_start_date() - place = buried.getPlaceName() + date = buried.get_date_object().get_start_date() + place = buried.get_place_name() if place[-1:] == '.': place = place[:-1] fulldate= "" - if date.getDate() != "": + if date.get_date() != "": if date.getDayValid() and date.getMonthValid() and \ rptOptions.fullDate == reportOptions.Yes: - fulldate= date.getDate() + fulldate= date.get_date() elif rptOptions.blankDate == reportOptions.Yes: fulldate= "___________" @@ -398,17 +398,17 @@ class DetAncestorReport(Report.Report): FIRSTNAME was the daughter of FATHER. FIRSTNAME was the daughter of MOTHER. """ - ext_family= person.getMainParents() + ext_family= person.get_main_parents_family_id() if ext_family != None: - if ext_family.getFather() != None: - father= ext_family.getFather().getPrimaryName().getRegularName() + if ext_family.get_father_id() != None: + father= ext_family.get_father_id().get_primary_name().get_regular_name() else: father= "" - if ext_family.getMother() != None: - mother= ext_family.getMother().getPrimaryName().getRegularName() + if ext_family.get_mother_id() != None: + mother= ext_family.get_mother_id().get_primary_name().get_regular_name() else: mother= "" if father != "" or mother != "": - if person.getGender() == RelLib.Person.male: + if person.get_gender() == RelLib.Person.male: if father != "": if mother != "": self.doc.write_text(_(" %s was the son of %s and %s.") % \ @@ -442,7 +442,7 @@ class DetAncestorReport(Report.Report): HE/SHE married on FULLDATE. HE/SHE married in PLACE. """ - famList= person.getFamilyList() + famList= person.get_family_id_list() if len(famList) > 0: fam_num= 0 endOfSent= "" @@ -450,9 +450,9 @@ class DetAncestorReport(Report.Report): fam_num= fam_num + 1 spouse= "" t= "" - if person.getGender() == RelLib.Person.male: - if fam.getMother() != None: - spouse= fam.getMother().getPrimaryName().getRegularName() + if person.get_gender() == RelLib.Person.male: + if fam.get_mother_id() != None: + spouse= fam.get_mother_id().get_primary_name().get_regular_name() if fam_num == 1: heshe= _("He") elif fam_num < len(famList): @@ -465,25 +465,25 @@ class DetAncestorReport(Report.Report): heshe= _(",") else: heshe= _("and she") - if fam.getFather() != None: - spouse= fam.getFather().getPrimaryName().getRegularName() + if fam.get_father_id() != None: + spouse= fam.get_father_id().get_primary_name().get_regular_name() - marriage= fam.getMarriage() + marriage= fam.get_marriage() fulldate= "" place= "" if marriage != None: - if marriage.getPlace() != None and \ - marriage.getPlaceName() != "": - place= marriage.getPlaceName() + if marriage.get_place_id() != None and \ + marriage.get_place_name() != "": + place= marriage.get_place_name() elif rptOptions.blankPlace == reportOptions.Yes: place= "____________" - date= marriage.getDateObj() + date= marriage.get_date_object() if date != None: if date.getYearValid(): if date.getDayValid() and date.getMonthValid() and \ rptOptions.fullDate == reportOptions.Yes: - fulldate= date.getDate() + fulldate= date.get_date() elif rptOptions.blankDate == reportOptions.Yes: fulldate= "__________" @@ -515,22 +515,22 @@ class DetAncestorReport(Report.Report): def write_mate(self, mate, rptOptions): """Output birth, death, parentage, marriage and notes information """ - famList= mate.getFamilyList() + famList= mate.get_family_id_list() if len(famList) > 0: for fam in famList: person= "" - if mate.getGender() == RelLib.Person.male: - if fam.getMother() != None: - ind= fam.getMother() - person= fam.getMother().getPrimaryName().getRegularName() - firstName= fam.getMother().getPrimaryName().getFirstName() + if mate.get_gender() == RelLib.Person.male: + if fam.get_mother_id() != None: + ind= fam.get_mother_id() + person= fam.get_mother_id().get_primary_name().get_regular_name() + firstName= fam.get_mother_id().get_primary_name().get_first_name() heshe= _("She") else: heshe= _("He") - if fam.getFather() != None: - ind= fam.getFather() - person= fam.getFather().getPrimaryName().getRegularName() - firstName= fam.getFather().getPrimaryName().getFirstName() + if fam.get_father_id() != None: + ind= fam.get_father_id() + person= fam.get_father_id().get_primary_name().get_regular_name() + firstName= fam.get_father_id().get_primary_name().get_first_name() if person != "": self.doc.start_paragraph("DAR-Entry") @@ -552,7 +552,7 @@ class DetAncestorReport(Report.Report): self.doc.end_paragraph() if rptOptions.listChildren == reportOptions.Yes \ - and mate.getGender() == RelLib.Person.male: + and mate.get_gender() == RelLib.Person.male: self.write_children(fam, rptOptions) #-------------------------------------------------------------------- @@ -562,12 +562,12 @@ class DetAncestorReport(Report.Report): #-------------------------------------------------------------------- def insert_images(self, person): - photos = person.getPhotoList() + photos = person.get_photo_list() paragraph_started = 0 for photo in photos : - object = photo.getReference() - if object.getMimeType()[0:5] == "image": - file = object.getPath() + object = photo.get_reference() + if object.get_mime_type()[0:5] == "image": + file = object.get_path() if not paragraph_started: self.doc.start_paragraph("DAR-Entry") paragraph_started = 1 @@ -587,7 +587,7 @@ class DetAncestorReport(Report.Report): #rptOpt= reportOptions() rptOpt = self.rptOpt - name = self.start.getPrimaryName().getRegularName() + name = self.start.get_primary_name().get_regular_name() self.doc.start_paragraph("DAR-Title") title = _("Detailed Ancestral Report for %s") % name self.doc.write_text(title) @@ -612,13 +612,13 @@ class DetAncestorReport(Report.Report): self.genIDs.clear() person = self.map[key] - self.genIDs[person.getId()]= key + self.genIDs[person.get_id()]= key dupPerson= self.write_person(key, rptOpt) if dupPerson == 0: # Is this a duplicate ind record - if person.getGender() == RelLib.Person.female and \ + if person.get_gender() == RelLib.Person.female and \ rptOpt.listChildren == reportOptions.Yes and \ - len(person.getFamilyList()) > 0: - family= person.getFamilyList()[0] + len(person.get_family_id_list()) > 0: + family= person.get_family_id_list()[0] self.write_children(family, rptOpt) #if rptOpt.addImages == reportOptions.Yes: @@ -922,7 +922,7 @@ class DetAncestorBareReportDialog(Report.BareReportDialog): self.options = opt self.db = database if self.options[0]: - self.person = self.db.getPerson(self.options[0]) + self.person = self.db.get_person(self.options[0]) else: self.person = person self.style_name = stl @@ -1094,7 +1094,7 @@ class DetAncestorBareReportDialog(Report.BareReportDialog): if self.new_person: self.person = self.new_person - self.options = ( self.person.getId(), self.max_gen, self.pg_brk, + self.options = ( self.person.get_id(), self.max_gen, self.pg_brk, self.first_name, self.full_date, self.list_children, self.include_notes, self.place, self.date, self.age, self.dup_persons, self.child_ref, self.images ) @@ -1111,7 +1111,7 @@ def write_book_item(database,person,doc,options,newpage=0): All user dialog has already been handled and the output file opened.""" try: if options[0]: - person = database.getPerson(options[0]) + person = database.get_person(options[0]) max_gen = int(options[1]) pg_brk = int(options[2]) rptOpt = reportOptions() @@ -1304,8 +1304,8 @@ class reportOptions: null """ - birth= ind.getBirth().getDateObj().get_start_date() - death= ind.getDeath().getDateObj().get_start_date() + birth= ind.get_birth().get_date_object().get_start_date() + death= ind.get_death().get_date_object().get_start_date() self.t= "" if birth.getYearValid() and death.getYearValid(): self.age= death.getYear() - birth.getYear() diff --git a/src/plugins/DetDescendantReport.py b/src/plugins/DetDescendantReport.py index 25a166afb..6f4382613 100644 --- a/src/plugins/DetDescendantReport.py +++ b/src/plugins/DetDescendantReport.py @@ -85,8 +85,8 @@ class DetDescendantReport(Report.Report): else: self.genKeys[cur_gen-1].append(index) - for family in person.getFamilyList(): - for child in family.getChildList(): + for family in person.get_family_id_list(): + for child in family.get_child_id_list(): ix = max(self.map.keys()) self.apply_filter(child, ix+1, cur_gen+1) @@ -114,14 +114,14 @@ class DetDescendantReport(Report.Report): NAME 0 """ - num_children= len(family.getChildList()) + num_children= len(family.get_child_id_list()) if num_children > 0: self.doc.start_paragraph("DDR-ChildTitle") - if family.getMother() != None: - mother= family.getMother().getPrimaryName().getRegularName() + if family.get_mother_id() != None: + mother= family.get_mother_id().get_primary_name().get_regular_name() else: mother= "unknown" - if family.getFather() != None: - father= family.getFather().getPrimaryName().getRegularName() + if family.get_father_id() != None: + father= family.get_father_id().get_primary_name().get_regular_name() else: father= "unknown" self.doc.start_bold() if num_children == 1: @@ -130,74 +130,74 @@ class DetDescendantReport(Report.Report): self.doc.end_bold() self.doc.end_paragraph() - for child in family.getChildList(): + for child in family.get_child_id_list(): self.doc.start_paragraph("DDR-ChildList") - name= child.getPrimaryName().getRegularName() - birth= child.getBirth() - death= child.getDeath() + name= child.get_primary_name().get_regular_name() + birth= child.get_birth() + death= child.get_death() if rptOptions.childRef == reportOptions.Yes: - childID= child.getId() + childID= child.get_id() if self.prevGenIDs.get(childID) != None: name= "[" + str(self.prevGenIDs.get(childID)) + "] "+ name - #print "Child List: <", birth.getDate(), ">", birth.getPlaceName() - if birth.getDate() != "": - #print birth.getPlaceName() - if birth.getPlaceName() != "": - if death.getDate() != "": - if death.getPlaceName() != "": + #print "Child List: <", birth.get_date(), ">", birth.get_place_name() + if birth.get_date() != "": + #print birth.get_place_name() + if birth.get_place_name() != "": + if death.get_date() != "": + if death.get_place_name() != "": self.doc.write_text(_("- %s Born: %s %s Died: %s %s") % \ - (name, birth.getDate(), birth.getPlaceName(), - death.getDate(), death.getPlaceName())) # f + (name, birth.get_date(), birth.get_place_name(), + death.get_date(), death.get_place_name())) # f else: self.doc.write_text(_("- %s Born: %s %s Died: %s") % \ - (name, birth.getDate(), birth.getPlaceName(), - death.getDate())) # e - elif death.getPlaceName() != "": + (name, birth.get_date(), birth.get_place_name(), + death.get_date())) # e + elif death.get_place_name() != "": self.doc.write_text(_("- %s Born: %s %s Died: %s") % \ - (name, birth.getDate(), birth.getPlaceName(), - death.getPlaceName())) # d + (name, birth.get_date(), birth.get_place_name(), + death.get_place_name())) # d else: self.doc.write_text(_("- %s Born: %s %s") % \ - (name, birth.getDate(), birth.getPlaceName())) # c + (name, birth.get_date(), birth.get_place_name())) # c else: - if death.getDate() != "": - if death.getPlaceName() != "": + if death.get_date() != "": + if death.get_place_name() != "": self.doc.write_text(_("- %s Born: %s Died: %s %s") % \ - (name, birth.getDate(), death.getDate(), \ - death.getPlaceName())) # b + (name, birth.get_date(), death.get_date(), \ + death.get_place_name())) # b else: self.doc.write_text(_("- %s Born: %s Died: %s") % \ - (name, birth.getDate(), death.getDate())) # a - elif death.getPlaceName() != "": + (name, birth.get_date(), death.get_date())) # a + elif death.get_place_name() != "": self.doc.write_text(_("- %s Born: %s Died: %s") % \ - (name, birth.getDate(), death.getPlaceName())) # 9 + (name, birth.get_date(), death.get_place_name())) # 9 else: self.doc.write_text(_("- %s Born: %s") % \ - (name, birth.getDate())) # 8 + (name, birth.get_date())) # 8 else: - if birth.getPlaceName() != "": - if death.getDate() != "": - if death.getPlaceName() != "": + if birth.get_place_name() != "": + if death.get_date() != "": + if death.get_place_name() != "": self.doc.write_text(_("- %s Born: %s Died: %s %s") % \ - (name, birth.getPlaceName(), \ - death.getDate(), death.getPlaceName())) # 7 + (name, birth.get_place_name(), \ + death.get_date(), death.get_place_name())) # 7 else: self.doc.write_text(_("- %s Born: %s Died: %s") % \ - (name, birth.getPlaceName(), death.getDate())) # 6 - elif death.getPlaceName() != "": + (name, birth.get_place_name(), death.get_date())) # 6 + elif death.get_place_name() != "": self.doc.write_text(_("- %s Born: %s Died: %s") % \ - (name, birth.getPlaceName(), death.getPlaceName())) # 5 + (name, birth.get_place_name(), death.get_place_name())) # 5 else: self.doc.write_text(_("- %s Born: %s") % \ - (name, birth.getPlaceName())) # 4 + (name, birth.get_place_name())) # 4 else: - if death.getDate() != "": - if death.getPlaceName() != "": + if death.get_date() != "": + if death.get_place_name() != "": self.doc.write_text(_("- %s Died: %s %s") % \ - (name, death.getDate(), death.getPlaceName())) # 3 + (name, death.get_date(), death.get_place_name())) # 3 else: self.doc.write_text(_("- %s Died: %s") % \ - (name, death.getDate())) # 2 - elif death.getPlaceName() != "": + (name, death.get_date())) # 2 + elif death.get_place_name() != "": self.doc.write_text(_("- %s Died: %s") % \ - (name, death.getPlaceName())) # 1 + (name, death.get_place_name())) # 1 else: self.doc.write_text(_("- %s") % name) # 0 self.doc.end_paragraph() @@ -211,11 +211,11 @@ class DetDescendantReport(Report.Report): if rptOptions.addImages == reportOptions.Yes: self.insert_images(person) - name = person.getPrimaryName().getRegularName() + name = person.get_primary_name().get_regular_name() if rptOptions.firstName == reportOptions.Yes: - firstName= person.getPrimaryName().getFirstName() - elif person.getGender() == RelLib.Person.male: + firstName= person.get_primary_name().get_first_name() + elif person.get_gender() == RelLib.Person.male: firstName= _("He") else: firstName= _("She") @@ -230,13 +230,13 @@ class DetDescendantReport(Report.Report): keys.sort() for dkey in keys: if dkey >= key: break - if self.map[key].getId() == self.map[dkey].getId(): + if self.map[key].get_id() == self.map[dkey].get_id(): self.doc.write_text(_(" is the same person as [%s].") % str(dkey)) self.doc.end_paragraph() return 1 # Duplicate person # Check birth record - birth = person.getBirth() + birth = person.get_birth() if birth: self.write_birth(person, rptOptions) self.write_death(person, firstName, rptOptions) @@ -246,13 +246,13 @@ class DetDescendantReport(Report.Report): self.write_mate(person, rptOptions) - if person.getNote() != "" and rptOptions.includeNotes == reportOptions.Yes: + if person.get_note() != "" and rptOptions.includeNotes == reportOptions.Yes: self.doc.start_paragraph("DDR-NoteHeader") self.doc.start_bold() self.doc.write_text(_("Notes for %s" % name)) self.doc.end_bold() self.doc.end_paragraph() - self.doc.write_note(person.getNote(),person.getNoteFormat(),"DDR-Entry") + self.doc.write_note(person.get_note(),person.get_note_format(),"DDR-Entry") return 0 # Not duplicate person @@ -269,24 +269,24 @@ class DetDescendantReport(Report.Report): was born in ____________. """ - birth = person.getBirth() + birth = person.get_birth() if birth: - date = birth.getDateObj().get_start_date() - if birth.getPlaceName() != "": - place = birth.getPlaceName() + date = birth.get_date_object().get_start_date() + if birth.get_place_name() != "": + place = birth.get_place_name() if place[-1:] == '.': place = place[:-1] elif rptOptions.blankDate == reportOptions.Yes: place= "______________" else: place= "" - if date.getDate() != "": + if date.get_date() != "": if date.getDayValid() and date.getMonthValid() and \ rptOptions.fullDate == reportOptions.Yes: if place != "": - self.doc.write_text(_(" was born on %s in %s.") % (date.getDate(), place)) + self.doc.write_text(_(" was born on %s in %s.") % (date.get_date(), place)) else: - self.doc.write_text(_(" was born on %s.") % date.getDate()) + self.doc.write_text(_(" was born on %s.") % date.get_date()) elif place != "": self.doc.write_text(_(" was born in the year %s in %s.") % \ (date.getYear(), place)) @@ -327,19 +327,19 @@ class DetDescendantReport(Report.Report): . """ t= "" - death = person.getDeath() + death = person.get_death() if death != None: - date = death.getDateObj().get_start_date() - place = death.getPlaceName() + date = death.get_date_object().get_start_date() + place = death.get_place_name() if place[-1:] == '.': place = place[:-1] elif place == "" and rptOptions.blankPlace == reportOptions.Yes: place= "_____________" - if date.getDate() != "": + if date.get_date() != "": if date.getDay() and date.getMonth() and \ rptOptions.fullDate == reportOptions.Yes: - fulldate= date.getDate() + fulldate= date.get_date() elif date.getMonth() and rptOptions.fullDate == reportOptions.Yes: fulldate= "%s %s" % (date.getMonth(), date.getYear()) else: fulldate= "" @@ -366,20 +366,20 @@ class DetDescendantReport(Report.Report): else: return t= "" - famList= person.getFamilyList() + famList= person.get_family_id_list() if len(famList) > 0: for fam in famList: buried= None if buried: - date = buried.getDateObj().get_start_date() - place = buried.getPlaceName() + date = buried.get_date_object().get_start_date() + place = buried.get_place_name() if place[-1:] == '.': place = place[:-1] fulldate= "" - if date.getDate() != "": + if date.get_date() != "": if date.getDayValid() and date.getMonthValid() and \ rptOptions.fullDate == reportOptions.Yes: - fulldate= date.getDate() + fulldate= date.get_date() elif rptOptions.blankDate == reportOptions.Yes: fulldate= "___________" @@ -405,17 +405,17 @@ class DetDescendantReport(Report.Report): FIRSTNAME was the daughter of FATHER. FIRSTNAME was the daughter of MOTHER. """ - ext_family= person.getMainParents() + ext_family= person.get_main_parents_family_id() if ext_family != None: - if ext_family.getFather() != None: - father= ext_family.getFather().getPrimaryName().getRegularName() + if ext_family.get_father_id() != None: + father= ext_family.get_father_id().get_primary_name().get_regular_name() else: father= "" - if ext_family.getMother() != None: - mother= ext_family.getMother().getPrimaryName().getRegularName() + if ext_family.get_mother_id() != None: + mother= ext_family.get_mother_id().get_primary_name().get_regular_name() else: mother= "" if father != "" or mother != "": - if person.getGender() == RelLib.Person.male: + if person.get_gender() == RelLib.Person.male: if father != "": if mother != "": self.doc.write_text(_(" %s was the son of %s and %s.") % \ @@ -446,15 +446,15 @@ class DetDescendantReport(Report.Report): HE/SHE married SPOUSE in PLACE. HE/SHE married SPOUSE """ - famList= person.getFamilyList() + famList= person.get_family_id_list() if len(famList) > 0: fam_num= 0 for fam in famList: fam_num= fam_num + 1 spouse= "" - if person.getGender() == RelLib.Person.male: - if fam.getMother() != None: - spouse= fam.getMother().getPrimaryName().getRegularName() + if person.get_gender() == RelLib.Person.male: + if fam.get_mother_id() != None: + spouse= fam.get_mother_id().get_primary_name().get_regular_name() if fam_num == 1: heshe= _("He") elif fam_num < len(famList): @@ -467,25 +467,25 @@ class DetDescendantReport(Report.Report): heshe= _(",") else: heshe= _("and she") - if fam.getFather() != None: - spouse= fam.getFather().getPrimaryName().getRegularName() + if fam.get_father_id() != None: + spouse= fam.get_father_id().get_primary_name().get_regular_name() - marriage= fam.getMarriage() + marriage= fam.get_marriage() fulldate= "" place= "" if marriage != None: - if marriage.getPlace() != None and \ - marriage.getPlaceName() != "": - place= marriage.getPlaceName() + if marriage.get_place_id() != None and \ + marriage.get_place_name() != "": + place= marriage.get_place_name() elif rptOptions.blankPlace == reportOptions.Yes: place= "____________" - date= marriage.getDateObj() + date= marriage.get_date_object() if date != None: if date.getYearValid(): if date.getDayValid() and date.getMonthValid() and \ rptOptions.fullDate == reportOptions.Yes: - fulldate= date.getDate() + fulldate= date.get_date() elif rptOptions.blankDate == reportOptions.Yes: fulldate= "__________" @@ -514,20 +514,20 @@ class DetDescendantReport(Report.Report): def write_mate(self, person, rptOptions): """Output birth, death, parentage, marriage and notes information """ - for fam in person.getFamilyList(): + for fam in person.get_family_id_list(): mate = "" - if person.getGender() == RelLib.Person.male: + if person.get_gender() == RelLib.Person.male: heshe = _("She") - if fam.getMother(): - mate = fam.getMother() - mateName = mate.getPrimaryName().getRegularName() - mateFirstName = mate.getPrimaryName().getFirstName() + if fam.get_mother_id(): + mate = fam.get_mother_id() + mateName = mate.get_primary_name().get_regular_name() + mateFirstName = mate.get_primary_name().get_first_name() else: heshe = _("He") - if fam.getFather(): - mate = fam.getFather() - mateName = mate.getPrimaryName().getRegularName() - mateFirstName = mate.getPrimaryName().getFirstName() + if fam.get_father_id(): + mate = fam.get_father_id() + mateName = mate.get_primary_name().get_regular_name() + mateFirstName = mate.get_primary_name().get_first_name() if mate: self.doc.start_paragraph("DDR-Entry") @@ -545,7 +545,7 @@ class DetDescendantReport(Report.Report): self.doc.end_paragraph() #if rptOptions.listChildren == reportOptions.Yes \ - # and mate.getGender() == RelLib.Person.male: + # and mate.get_gender() == RelLib.Person.male: # self.write_children(fam, rptOptions) #-------------------------------------------------------------------- @@ -555,12 +555,12 @@ class DetDescendantReport(Report.Report): #-------------------------------------------------------------------- def insert_images(self, person): - photos = person.getPhotoList() + photos = person.get_photo_list() paragraph_started = 0 for photo in photos : - object = photo.getReference() - if object.getMimeType()[0:5] == "image": - file = object.getPath() + object = photo.get_reference() + if object.get_mime_type()[0:5] == "image": + file = object.get_path() if not paragraph_started: self.doc.start_paragraph("DDR-Entry") paragraph_started = 1 @@ -581,18 +581,18 @@ class DetDescendantReport(Report.Report): self.cur_gen= 1 self.apply_filter(self.start,1) - name = self.start.getPrimaryName().getRegularName() + name = self.start.get_primary_name().get_regular_name() - famList= self.start.getFamilyList() + famList= self.start.get_family_id_list() spouseName= "" if len(famList) > 0: for fam in famList: - if self.start.getGender() == RelLib.Person.male: - if fam.getMother() != None: - spouseName= fam.getMother().getPrimaryName().getFirstName() + if self.start.get_gender() == RelLib.Person.male: + if fam.get_mother_id() != None: + spouseName= fam.get_mother_id().get_primary_name().get_first_name() else: - if fam.getFather() != None: - spouseName= fam.getFather().getPrimaryName().getFirstName() + if fam.get_father_id() != None: + spouseName= fam.get_father_id().get_primary_name().get_first_name() self.doc.start_paragraph("DDR-Title") if spouseName != "": @@ -621,12 +621,12 @@ class DetDescendantReport(Report.Report): for key in self.genKeys[generation]: person = self.map[key] - self.genIDs[person.getId()]= key + self.genIDs[person.get_id()]= key dupPerson= self.write_person(key, rptOpt) if dupPerson == 0: # Is this a duplicate ind record if rptOpt.listChildren == reportOptions.Yes and \ - len(person.getFamilyList()) > 0: - family= person.getFamilyList()[0] + len(person.get_family_id_list()) > 0: + family= person.get_family_id_list()[0] self.write_children(family, rptOpt) #if rptOpt.addImages == reportOptions.Yes: @@ -931,7 +931,7 @@ class DetDescendantBareReportDialog(Report.BareReportDialog): self.options = opt self.db = database if self.options[0]: - self.person = self.db.getPerson(self.options[0]) + self.person = self.db.get_person(self.options[0]) else: self.person = person @@ -1104,7 +1104,7 @@ class DetDescendantBareReportDialog(Report.BareReportDialog): if self.new_person: self.person = self.new_person - self.options = ( self.person.getId(), self.max_gen, self.pg_brk, + self.options = ( self.person.get_id(), self.max_gen, self.pg_brk, self.first_name, self.full_date, self.list_children, self.include_notes, self.place, self.date, self.age, self.dup_persons, self.child_ref, self.images ) @@ -1120,7 +1120,7 @@ def write_book_item(database,person,doc,options,newpage=0): All user dialog has already been handled and the output file opened.""" try: if options[0]: - person = database.getPerson(options[0]) + person = database.get_person(options[0]) max_gen = int(options[1]) pg_brk = int(options[2]) rptOpt = reportOptions() @@ -1311,8 +1311,8 @@ class reportOptions: null """ - birth= ind.getBirth().getDateObj().get_start_date() - death= ind.getDeath().getDateObj().get_start_date() + birth= ind.get_birth().get_date_object().get_start_date() + death= ind.get_death().get_date_object().get_start_date() #print "birth=", birth.__dict__ #print "death=", death.__dict__ self.t= "" diff --git a/src/plugins/EventCmp.py b/src/plugins/EventCmp.py index aaf94d531..fafa9c718 100644 --- a/src/plugins/EventCmp.py +++ b/src/plugins/EventCmp.py @@ -165,7 +165,7 @@ class EventComparison: def on_apply_clicked(self,obj): cfilter = self.filter_menu.get_active().get_data("filter") - plist = cfilter.apply(self.db,self.db.getPersonMap().values()) + plist = cfilter.apply(self.db,self.db.get_person_id_map().values()) if len(plist) == 0: WarningDialog(_("No matches were found")) @@ -243,13 +243,13 @@ class DisplayChart: def build_row_data(self): for individual in self.my_list: - name = individual.getPrimaryName().getName() - birth = individual.getBirth() - death = individual.getDeath() + name = individual.get_primary_name().get_name() + birth = individual.get_birth() + death = individual.get_death() map = {} - elist = individual.getEventList()[:] + elist = individual.get_event_list()[:] for ievent in elist: - event_name = ievent.getName() + event_name = ievent.get_name() if map.has_key(event_name): map[event_name].append(ievent) else: @@ -260,15 +260,15 @@ class DisplayChart: while done == 0: added = 0 if first: - tlist = [name,"%s\n%s" % (birth.getDate(),birth.getPlaceName()), - "%s\n%s" % (death.getDate(),death.getPlaceName())] + tlist = [name,"%s\n%s" % (birth.get_date(),birth.get_place_name()), + "%s\n%s" % (death.get_date(),death.get_place_name())] else: tlist = ["","",""] for ename in self.event_titles[3:]: if map.has_key(ename) and len(map[ename]) > 0: event = map[ename][0] del map[ename][0] - tlist.append("%s\n%s" % (event.getDate(), event.getPlaceName())) + tlist.append("%s\n%s" % (event.get_date(), event.get_place_name())) added = 1 else: tlist.append("") @@ -286,9 +286,9 @@ class DisplayChart: name, birth, and death. This should be the column titles of the report""" map = {} for individual in self.my_list: - elist = individual.getEventList() + elist = individual.get_event_list() for event in elist: - name = event.getName() + name = event.get_name() if not name: break if map.has_key(name): diff --git a/src/plugins/FamilyGroup.py b/src/plugins/FamilyGroup.py index cca52572e..5a4f0ab19 100644 --- a/src/plugins/FamilyGroup.py +++ b/src/plugins/FamilyGroup.py @@ -131,7 +131,7 @@ class FamilyGroup: if not person: return - if person.getGender() == RelLib.Person.male: + if person.get_gender() == RelLib.Person.male: id = _("Husband") else: id = _("Wife") @@ -141,13 +141,13 @@ class FamilyGroup: self.doc.start_cell('FGR-ParentHead',3) self.doc.start_paragraph('FGR-ParentName') self.doc.write_text(id + ': ') - self.doc.write_text(person.getPrimaryName().getRegularName()) + self.doc.write_text(person.get_primary_name().get_regular_name()) self.doc.end_paragraph() self.doc.end_cell() self.doc.end_row() - birth = person.getBirth() - death = person.getDeath() + birth = person.get_birth() + death = person.get_death() self.doc.start_row() self.doc.start_cell("FGR-TextContents") @@ -157,12 +157,12 @@ class FamilyGroup: self.doc.end_cell() self.doc.start_cell("FGR-TextContents") self.doc.start_paragraph('FGR-Normal') - self.doc.write_text(birth.getDate()) + self.doc.write_text(birth.get_date()) self.doc.end_paragraph() self.doc.end_cell() self.doc.start_cell("FGR-TextContentsEnd") self.doc.start_paragraph('FGR-Normal') - self.doc.write_text(birth.getPlaceName()) + self.doc.write_text(birth.get_place_name()) self.doc.end_paragraph() self.doc.end_cell() self.doc.end_row() @@ -175,25 +175,25 @@ class FamilyGroup: self.doc.end_cell() self.doc.start_cell("FGR-TextContents") self.doc.start_paragraph('FGR-Normal') - self.doc.write_text(death.getDate()) + self.doc.write_text(death.get_date()) self.doc.end_paragraph() self.doc.end_cell() self.doc.start_cell("FGR-TextContentsEnd") self.doc.start_paragraph('FGR-Normal') - self.doc.write_text(death.getPlaceName()) + self.doc.write_text(death.get_place_name()) self.doc.end_paragraph() self.doc.end_cell() self.doc.end_row() - family = person.getMainParents() - if family == None or family.getFather() == None: + family = person.get_main_parents_family_id() + if family == None or family.get_father_id() == None: father_name = "" else: - father_name = family.getFather().getPrimaryName().getRegularName() - if family == None or family.getMother() == None: + father_name = family.get_father_id().get_primary_name().get_regular_name() + if family == None or family.get_mother_id() == None: mother_name = "" else: - mother_name = family.getMother().getPrimaryName().getRegularName() + mother_name = family.get_mother_id().get_primary_name().get_regular_name() self.doc.start_row() self.doc.start_cell("FGR-TextContents") @@ -225,8 +225,8 @@ class FamilyGroup: def dump_child_event(self,text,name,event): if event: - date = event.getDate() - place = event.getPlaceName() + date = event.get_date() + place = event.get_place_name() else: date = "" place = "" @@ -257,7 +257,7 @@ class FamilyGroup: self.doc.start_row() self.doc.start_cell('FGR-TextChild1') self.doc.start_paragraph('FGR-ChildText') - if person.getGender() == RelLib.Person.male: + if person.get_gender() == RelLib.Person.male: self.doc.write_text("%dM" % index) else: self.doc.write_text("%dF" % index) @@ -265,25 +265,25 @@ class FamilyGroup: self.doc.end_cell() self.doc.start_cell('FGR-ChildName',3) self.doc.start_paragraph('FGR-ChildText') - self.doc.write_text(person.getPrimaryName().getRegularName()) + self.doc.write_text(person.get_primary_name().get_regular_name()) self.doc.end_paragraph() self.doc.end_cell() self.doc.end_row() - families = len(person.getFamilyList()) - self.dump_child_event('FGR-TextChild1','Birth',person.getBirth()) + families = len(person.get_family_id_list()) + self.dump_child_event('FGR-TextChild1','Birth',person.get_birth()) if families == 0: - self.dump_child_event('FGR-TextChild2',_('Death'),person.getDeath()) + self.dump_child_event('FGR-TextChild2',_('Death'),person.get_death()) else: - self.dump_child_event('FGR-TextChild1',_('Death'),person.getDeath()) + self.dump_child_event('FGR-TextChild1',_('Death'),person.get_death()) index = 1 - for family in person.getFamilyList(): - m = family.getMarriage() - if person == family.getFather(): - spouse = family.getMother() + for family in person.get_family_id_list(): + m = family.get_marriage() + if person == family.get_father_id(): + spouse = family.get_mother_id() else: - spouse = family.getFather() + spouse = family.get_father_id() self.doc.start_row() self.doc.start_cell('FGR-TextChild1') self.doc.start_paragraph('FGR-Normal') @@ -297,7 +297,7 @@ class FamilyGroup: self.doc.start_cell('FGR-TextContentsEnd',2) self.doc.start_paragraph('FGR-Normal') if spouse: - self.doc.write_text(spouse.getPrimaryName().getRegularName()) + self.doc.write_text(spouse.get_primary_name().get_regular_name()) self.doc.end_paragraph() self.doc.end_cell() self.doc.end_row() @@ -321,12 +321,12 @@ class FamilyGroup: self.doc.end_paragraph() if self.family: - self.dump_parent(self.family.getFather()) + self.dump_parent(self.family.get_father_id()) self.doc.start_paragraph("FGR-blank") self.doc.end_paragraph() - self.dump_parent(self.family.getMother()) + self.dump_parent(self.family.get_mother_id()) - length = len(self.family.getChildList()) + length = len(self.family.get_child_id_list()) if length > 0: self.doc.start_paragraph("FGR-blank") self.doc.end_paragraph() @@ -339,7 +339,7 @@ class FamilyGroup: self.doc.end_cell() self.doc.end_row() index = 1 - for child in self.family.getChildList(): + for child in self.family.get_child_id_list(): self.dump_child(index,child) index = index + 1 self.doc.end_table() @@ -450,7 +450,7 @@ class FamilyGroupBareDialog(Report.BareReportDialog): self.options = opt self.db = database if self.options[0]: - self.person = self.db.getPerson(self.options[0]) + self.person = self.db.get_person(self.options[0]) else: self.person = person self.style_name = stl @@ -527,7 +527,7 @@ class FamilyGroupBareDialog(Report.BareReportDialog): self.window.show_all() self.extra_menu = None - new_name = new_person.getPrimaryName().getRegularName() + new_name = new_person.get_primary_name().get_regular_name() if new_name: self.person_label.set_text( "%s" % new_name ) self.person_label.set_use_markup(gtk.TRUE) @@ -555,7 +555,7 @@ class FamilyGroupBareDialog(Report.BareReportDialog): else: self.spouse_name = "" - self.options = ( self.person.getId(), self.spouse_name ) + self.options = ( self.person.get_id(), self.spouse_name ) self.style_name = self.selected_style.get_name() #------------------------------------------------------------------------ @@ -568,7 +568,7 @@ def write_book_item(database,person,doc,options,newpage=0): All user dialog has already been handled and the output file opened.""" try: if options[0]: - person = database.getPerson(options[0]) + person = database.get_person(options[0]) spouse_name = options[1] spouse_map = _build_spouse_map(person) if spouse_map: @@ -647,14 +647,14 @@ def _build_spouse_map(person): the selected person has never been married then this routine will return a placebo label and disable the OK button.""" spouse_map = {} - family_list = person.getFamilyList() + family_list = person.get_family_id_list() for family in family_list: - if person == family.getFather(): - spouse = family.getMother() + if person == family.get_father_id(): + spouse = family.get_mother_id() else: - spouse = family.getFather() + spouse = family.get_father_id() if spouse: - name = spouse.getPrimaryName().getName() + name = spouse.get_primary_name().get_name() else: name= _("unknown") spouse_map[name] = family diff --git a/src/plugins/FanChart.py b/src/plugins/FanChart.py index 61e699a3b..314bb70e4 100644 --- a/src/plugins/FanChart.py +++ b/src/plugins/FanChart.py @@ -58,7 +58,7 @@ class FanChart: def __init__(self,database,person,display,doc,output,newpage=0): self.doc = doc - self.doc.creator(database.getResearcher().getName()) + self.doc.creator(database.get_researcher().get_name()) self.map = {} self.text = {} self.start = person @@ -162,10 +162,10 @@ class FanChart: self.lines = max(self.lines,len(self.text[index-1])) - family = person.getMainParents() + family = person.get_main_parents_family_id() if family != None: - self.filter(family.getFather(),index*2) - self.filter(family.getMother(),(index*2)+1) + self.filter(family.get_father_id(),index*2) + self.filter(family.get_mother_id(),(index*2)+1) def write_report(self): @@ -183,7 +183,7 @@ class FanChart: self.doc.start_page() - n = self.start.getPrimaryName().getRegularName() + n = self.start.get_primary_name().get_regular_name() self.doc.center_text('t', _('Five Generation Fan Chart for %s') % n, center, 0) self.circle_5(center,y,block_size) @@ -197,9 +197,9 @@ class FanChart: self.doc.close() def get_info(self,person): - pn = person.getPrimaryName() - b = person.getBirth().getDateObj().getYear() - d = person.getDeath().getDateObj().getYear() + pn = person.get_primary_name() + b = person.get_birth().get_date_object().getYear() + d = person.get_death().get_date_object().getYear() if b == Calendar.UNDEF: b = "" if d == Calendar.UNDEF: @@ -210,7 +210,7 @@ class FanChart: else: val = "" - return [ pn.getFirstName(), pn.getSurname(), val ] + return [ pn.get_first_name(), pn.get_surname(), val ] def circle_1(self,center,y,size): (xc,yc) = self.doc.draw_wedge("FC-c1", center, y, size, 180, 360) @@ -377,7 +377,7 @@ class FanChartBareDialog(Report.BareReportDialog): self.options = opt self.db = database if self.options[0]: - self.person = self.db.getPerson(self.options[0]) + self.person = self.db.get_person(self.options[0]) else: self.person = person self.style_name = stl @@ -422,7 +422,7 @@ class FanChartBareDialog(Report.BareReportDialog): if self.new_person: self.person = self.new_person - self.options = ( self.person.getId(), ) + self.options = ( self.person.get_id(), ) self.style_name = self.selected_style.get_name() #------------------------------------------------------------------------ @@ -435,7 +435,7 @@ def write_book_item(database,person,doc,options,newpage=0): All user dialog has already been handled and the output file opened.""" try: if options[0]: - person = database.getPerson(options[0]) + person = database.get_person(options[0]) return FanChart(database, person, "%n", doc, None, newpage ) except Errors.ReportError, msg: diff --git a/src/plugins/FilterEditor.py b/src/plugins/FilterEditor.py index ac2f372e5..cc0f42941 100644 --- a/src/plugins/FilterEditor.py +++ b/src/plugins/FilterEditor.py @@ -175,15 +175,15 @@ class MyID(gtk.HBox): if val == None: self.set_text('') else: - self.set_text(val.getId()) + self.set_text(val.get_id()) def get_text(self): return unicode(self.entry.get_text()) def set_text(self,val): try: - p = self.db.getPerson(val) - n = p.getPrimaryName().getName() + p = self.db.get_person(val) + n = p.get_primary_name().get_name() self.tooltips.set_tip(self.entry,n) except: self.tooltips.set_tip(self.entry,_('Not a valid person')) @@ -293,7 +293,7 @@ class FilterEditor: store,iter = self.clist.get_selected() if iter: filt = self.clist.get_object(iter) - list = filt.apply(self.db,self.db.getPersonMap().values()) + list = filt.apply(self.db,self.db.get_person_id_map().values()) ShowResults(list) def delete_filter(self,obj): @@ -404,7 +404,7 @@ class FilterEditor: self.pmap = {} self.add_places = [] - for p in self.db.getPlaces(): + for p in self.db.get_place_ids(): self.pmap[p.get_title()] = p self.active_rule = val @@ -600,7 +600,7 @@ class ShowResults: n = [] for p in plist: - n.append ("%s [%s]\n" % (p.getPrimaryName().getName(),p.getId())) + n.append ("%s [%s]\n" % (p.get_primary_name().get_name(),p.get_id())) n.sort () text.get_buffer().set_text(string.join (n, '')) diff --git a/src/plugins/FtmStyleAncestors.py b/src/plugins/FtmStyleAncestors.py index 4d50ec9f7..d22436835 100644 --- a/src/plugins/FtmStyleAncestors.py +++ b/src/plugins/FtmStyleAncestors.py @@ -69,10 +69,10 @@ class FtmAncestorReport(Report.Report): return self.map[index] = (person,generation) - family = person.getMainParents() + family = person.get_main_parents_family_id() if family != None: - self.apply_filter(family.getFather(),index*2,generation+1) - self.apply_filter(family.getMother(),(index*2)+1,generation+1) + self.apply_filter(family.get_father_id(),index*2,generation+1) + self.apply_filter(family.get_mother_id(),(index*2)+1,generation+1) def write_report(self): @@ -81,7 +81,7 @@ class FtmAncestorReport(Report.Report): self.apply_filter(self.start,1) - name = self.start.getPrimaryName().getRegularName() + name = self.start.get_primary_name().get_regular_name() self.doc.start_paragraph("FTA-Title") title = _("Ancestors of %s") % name self.doc.write_text(title) @@ -101,28 +101,28 @@ class FtmAncestorReport(Report.Report): self.doc.end_paragraph() old_gen = generation - pri_name = person.getPrimaryName() + pri_name = person.get_primary_name() self.doc.start_paragraph("FTA-Entry","%d." % key) - name = pri_name.getRegularName() + name = pri_name.get_regular_name() self.doc.start_bold() self.doc.write_text(name) self.doc.end_bold() # Check birth record - birth = person.getBirth() - bplace = birth.getPlaceName() - bdate = birth.getDate() + birth = person.get_birth() + bplace = birth.get_place_name() + bdate = birth.get_date() - death = person.getDeath() - dplace = death.getPlaceName() - ddate = death.getDate() + death = person.get_death() + dplace = death.get_place_name() + ddate = death.get_date() birth_valid = bdate != "" or bplace != "" death_valid = ddate != "" or dplace != "" if birth_valid or death_valid: - if person.getGender() == RelLib.Person.male: + if person.get_gender() == RelLib.Person.male: if bdate: if bplace: if ddate: @@ -426,24 +426,24 @@ class FtmAncestorReport(Report.Report): keys.sort() for key in keys: srcref = self.sref_map[key] - base = srcref.getBase() + base = srcref.get_base_id() self.doc.start_paragraph('FTA-Endnotes',"%d." % key) - self.doc.write_text(base.getTitle()) + self.doc.write_text(base.get_title()) - for item in [ base.getAuthor(), base.getPubInfo(), base.getAbbrev(), - srcref.getDate().getDate(),]: + for item in [ base.get_author(), base.get_publication_info(), base.getAbbrev(), + srcref.get_date().get_date(),]: if item: self.doc.write_text('; %s' % item) - item = srcref.getText() + item = srcref.get_text() if item: self.doc.write_text('; ') self.doc.write_text(_('Text:')) self.doc.write_text(' ') self.doc.write_text(item) - item = srcref.getComments() + item = srcref.get_comments() if item: self.doc.write_text('; ') self.doc.write_text(_('Comments:')) @@ -455,7 +455,7 @@ class FtmAncestorReport(Report.Report): def endnotes(self,obj): msg = cStringIO.StringIO() - slist = obj.getSourceRefList() + slist = obj.get_source_references() if slist: msg.write('') first = 1 @@ -472,44 +472,44 @@ class FtmAncestorReport(Report.Report): return str def print_notes(self,person): - note = person.getNote() + note = person.get_note() if not note.strip(): return self.doc.start_paragraph('FTA-SubEntry') self.doc.write_text(_('Notes for %(person)s:') % { - 'person' : person.getPrimaryName().getRegularName()} ) + 'person' : person.get_primary_name().get_regular_name()} ) self.doc.end_paragraph() - format = person.getNoteFormat() + format = person.get_note_format() self.doc.write_note(note,format,'FTA-Details') def print_more_about(self,person): first = 1 ncount = 0 - for name in person.getAlternateNames(): + for name in person.get_alternate_names(): if first: self.doc.start_paragraph('FTA-SubEntry') self.doc.write_text(_('More about %(person_name)s:') % { - 'person_name' : person.getPrimaryName().getRegularName() }) + 'person_name' : person.get_primary_name().get_regular_name() }) self.doc.end_paragraph() first = 0 self.doc.start_paragraph('FTA-Details') self.doc.write_text(_('Name %(count)d: %(name)s%(endnotes)s') % { - 'count' : ncount, 'name' : name.getRegularName(), + 'count' : ncount, 'name' : name.get_regular_name(), 'endnotes' : self.endnotes(name), }) self.doc.end_paragraph() ncount += 1 - for event in person.getEventList(): - date = event.getDate() - place = event.getPlace() + for event in person.get_event_list(): + date = event.get_date() + place = event.get_place_id() if not date and not place: continue if first: self.doc.start_paragraph('FTA-SubEntry') - name = person.getPrimaryName().getRegularName() + name = person.get_primary_name().get_regular_name() self.doc.write_text(_('More about %(person_name)s:') % { 'person_name' : name }) self.doc.end_paragraph() @@ -518,100 +518,100 @@ class FtmAncestorReport(Report.Report): self.doc.start_paragraph('FTA-Details') if date and place: self.doc.write_text(_('%(event_name)s: %(date)s, %(place)s%(endnotes)s') % { - 'event_name' : event.getName(), - 'date' : event.getDate(), + 'event_name' : event.get_name(), + 'date' : event.get_date(), 'endnotes' : self.endnotes(event), - 'place' : event.getPlaceName() }) + 'place' : event.get_place_name() }) elif date: self.doc.write_text(_('%(event_name)s: %(date)s%(endnotes)s') % { - 'event_name' : event.getName(), + 'event_name' : event.get_name(), 'endnotes' : self.endnotes(event), - 'date' : event.getDate()}) + 'date' : event.get_date()}) else: self.doc.write_text(_('%(event_name)s: %(place)s%(endnotes)s') % { - 'event_name' : event.getName(), + 'event_name' : event.get_name(), 'endnotes' : self.endnotes(event), - 'place' : event.getPlaceName() }) + 'place' : event.get_place_name() }) self.doc.end_paragraph() def print_spouse(self,person): - family_list = person.getFamilyList() + family_list = person.get_family_id_list() if not family_list: return family = family_list[0] - if family.getFather() == person: - spouse = family.getMother() + if family.get_father_id() == person: + spouse = family.get_mother_id() else: - spouse = family.getFather() + spouse = family.get_father_id() if not spouse: return - event = family.getMarriage() + event = family.get_marriage() if not event: return - date = event.getDate() - place = event.getPlaceName() + date = event.get_date() + place = event.get_place_name() if date and place: - if person.getGender() == RelLib.Person.male: + if person.get_gender() == RelLib.Person.male: self.doc.write_text(_('He married %(spouse)s %(date)s in %(place)s%(endnotes)s.') % { - 'spouse' : spouse.getPrimaryName().getRegularName(), + 'spouse' : spouse.get_primary_name().get_regular_name(), 'endnotes' : self.endnotes(event), 'date' : date, 'place' : place}) else: self.doc.write_text(_('She married %(spouse)s %(date)s in %(place)s%(endnotes)s.') % { - 'spouse' : spouse.getPrimaryName().getRegularName(), + 'spouse' : spouse.get_primary_name().get_regular_name(), 'date' : date, 'endnotes' : self.endnotes(event), 'place' : place}) elif date: - if person.getGender() == RelLib.Person.male: + if person.get_gender() == RelLib.Person.male: self.doc.write_text(_('He married %(spouse)s %(date)s%(endnotes)s.') % { - 'spouse' : spouse.getPrimaryName().getRegularName(), + 'spouse' : spouse.get_primary_name().get_regular_name(), 'endnotes' : self.endnotes(event), 'date' : date,}) else: self.doc.write_text(_('She married %(spouse)s in %(place)s%(endnotes)s.') % { - 'spouse' : spouse.getPrimaryName().getRegularName(), + 'spouse' : spouse.get_primary_name().get_regular_name(), 'endnotes' : self.endnotes(event), 'place' : place,}) elif place: - if person.getGender() == RelLib.Person.male: + if person.get_gender() == RelLib.Person.male: self.doc.write_text(_('He married %(spouse)s in %(place)s%(endnotes)s.') % { - 'spouse' : spouse.getPrimaryName().getRegularName(), + 'spouse' : spouse.get_primary_name().get_regular_name(), 'endnotes' : self.endnotes(event), 'place' : place}) else: self.doc.write_text(_('She married %(spouse)s in %(place)s%(endnotes)s.') % { - 'spouse' : spouse.getPrimaryName().getRegularName(), + 'spouse' : spouse.get_primary_name().get_regular_name(), 'endnotes' : self.endnotes(event), 'place' : place}) else: - if person.getGender() == RelLib.Person.male: + if person.get_gender() == RelLib.Person.male: self.doc.write_text(_('He married %(spouse)s%(endnotes)s.') % { - 'spouse' : spouse.getPrimaryName().getRegularName(), + 'spouse' : spouse.get_primary_name().get_regular_name(), 'endnotes' : self.endnotes(event), }) else: self.doc.write_text(_('She married %(spouse)s%(endnotes)s.') % { - 'spouse' : spouse.getPrimaryName().getRegularName(), + 'spouse' : spouse.get_primary_name().get_regular_name(), 'endnotes' : self.endnotes(event), }) self.doc.write_text(' ') - death = spouse.getDeath() - dplace = death.getPlaceName() - ddate = death.getDate() + death = spouse.get_death() + dplace = death.get_place_name() + ddate = death.get_date() - birth = spouse.getBirth() - bplace = birth.getPlaceName() - bdate = birth.getDate() + birth = spouse.get_birth() + bplace = birth.get_place_name() + bdate = birth.get_date() death_valid = ddate != "" or dplace != "" birth_valid = bdate != "" or bplace != "" if birth_valid or death_valid: - if spouse.getGender() == RelLib.Person.male: + if spouse.get_gender() == RelLib.Person.male: if bdate: if bplace: if ddate: @@ -886,58 +886,58 @@ class FtmAncestorReport(Report.Report): def print_parents(self,person,dead): - family = person.getMainParents() + family = person.get_main_parents_family_id() if family: - mother = family.getMother() - father = family.getFather() - if person.getGender() == RelLib.Person.male: + mother = family.get_mother_id() + father = family.get_father_id() + if person.get_gender() == RelLib.Person.male: if mother and father: if dead: self.doc.write_text(_("He was the son of %(father)s and %(mother)s.") % { - 'father' : father.getPrimaryName().getRegularName(), - 'mother' : mother.getPrimaryName().getRegularName(), }) + 'father' : father.get_primary_name().get_regular_name(), + 'mother' : mother.get_primary_name().get_regular_name(), }) else: self.doc.write_text(_("He is the son of %(father)s and %(mother)s.") % { - 'father' : father.getPrimaryName().getRegularName(), - 'mother' : mother.getPrimaryName().getRegularName(), }) + 'father' : father.get_primary_name().get_regular_name(), + 'mother' : mother.get_primary_name().get_regular_name(), }) elif mother: if dead: self.doc.write_text(_("He was the son of %(mother)s.") % { - 'mother' : mother.getPrimaryName().getRegularName(), }) + 'mother' : mother.get_primary_name().get_regular_name(), }) else: self.doc.write_text(_("He is the son of %(mother)s.") % { - 'mother' : mother.getPrimaryName().getRegularName(), }) + 'mother' : mother.get_primary_name().get_regular_name(), }) elif father: if dead: self.doc.write_text(_("He was the son of %(father)s.") % { - 'father' : father.getPrimaryName().getRegularName(), }) + 'father' : father.get_primary_name().get_regular_name(), }) else: self.doc.write_text(_("He is the son of %(father)s.") % { - 'father' : father.getPrimaryName().getRegularName(), }) + 'father' : father.get_primary_name().get_regular_name(), }) else: if mother and father: if dead: self.doc.write_text(_("She was the daughter of %(father)s and %(mother)s.") % { - 'father' : father.getPrimaryName().getRegularName(), - 'mother' : mother.getPrimaryName().getRegularName(), }) + 'father' : father.get_primary_name().get_regular_name(), + 'mother' : mother.get_primary_name().get_regular_name(), }) else: self.doc.write_text(_("She is the daughter of %(father)s and %(mother)s.") % { - 'father' : father.getPrimaryName().getRegularName(), - 'mother' : mother.getPrimaryName().getRegularName(), }) + 'father' : father.get_primary_name().get_regular_name(), + 'mother' : mother.get_primary_name().get_regular_name(), }) elif mother: if dead: self.doc.write_text(_("She was the daughter of %(mother)s.") % { - 'mother' : mother.getPrimaryName().getRegularName(), }) + 'mother' : mother.get_primary_name().get_regular_name(), }) else: self.doc.write_text(_("She is the daughter of %(mother)s.") % { - 'mother' : mother.getPrimaryName().getRegularName(), }) + 'mother' : mother.get_primary_name().get_regular_name(), }) elif father: if dead: self.doc.write_text(_("She was the daughter of %(father)s.") % { - 'father' : father.getPrimaryName().getRegularName(), }) + 'father' : father.get_primary_name().get_regular_name(), }) else: self.doc.write_text(_("She is the daughter of %(father)s.") % { - 'father' : father.getPrimaryName().getRegularName(), }) + 'father' : father.get_primary_name().get_regular_name(), }) self.doc.write_text(' '); @@ -1072,7 +1072,7 @@ class FtmAncestorBareReportDialog(Report.BareReportDialog): self.options = opt self.db = database if self.options[0]: - self.person = self.db.getPerson(self.options[0]) + self.person = self.db.get_person(self.options[0]) else: self.person = person self.style_name = stl @@ -1121,7 +1121,7 @@ class FtmAncestorBareReportDialog(Report.BareReportDialog): if self.new_person: self.person = self.new_person - self.options = ( self.person.getId(), self.max_gen, self.pg_brk ) + self.options = ( self.person.get_id(), self.max_gen, self.pg_brk ) self.style_name = self.selected_style.get_name() @@ -1135,7 +1135,7 @@ def write_book_item(database,person,doc,options,newpage=0): All user dialog has already been handled and the output file opened.""" try: if options[0]: - person = database.getPerson(options[0]) + person = database.get_person(options[0]) max_gen = int(options[1]) pg_brk = int(options[2]) return FtmAncestorReport(database, person, max_gen, pg_brk, doc, None, newpage ) diff --git a/src/plugins/FtmStyleDescendants.py b/src/plugins/FtmStyleDescendants.py index 0fc26a9a9..a30a53b31 100644 --- a/src/plugins/FtmStyleDescendants.py +++ b/src/plugins/FtmStyleDescendants.py @@ -97,8 +97,8 @@ class FtmDescendantReport(Report.Report): self.gen_map[generation] = [] self.gen_map[generation].append(index) - for family in person.getFamilyList(): - for child in family.getChildList(): + for family in person.get_family_id_list(): + for child in family.get_child_id_list(): ix = max(self.anc_map.keys()) self.apply_filter(child,ix+1,generation+1) @@ -110,7 +110,7 @@ class FtmDescendantReport(Report.Report): self.apply_filter(self.start,1) - name = self.start.getPrimaryName().getRegularName() + name = self.start.get_primary_name().get_regular_name() self.doc.start_paragraph("FTD-Title") title = _("Descendants of %s") % name self.doc.write_text(title) @@ -132,28 +132,28 @@ class FtmDescendantReport(Report.Report): for key in indexlist: person = self.anc_map[key] - pri_name = person.getPrimaryName() + pri_name = person.get_primary_name() self.doc.start_paragraph("FTD-Entry","%d." % key) - name = pri_name.getRegularName() + name = pri_name.get_regular_name() self.doc.start_bold() self.doc.write_text(name) self.doc.end_bold() # Check birth record - birth = person.getBirth() - bplace = birth.getPlaceName() - bdate = birth.getDate() + birth = person.get_birth() + bplace = birth.get_place_name() + bdate = birth.get_date() - death = person.getDeath() - dplace = death.getPlaceName() - ddate = death.getDate() + death = person.get_death() + dplace = death.get_place_name() + ddate = death.get_date() birth_valid = bdate != "" or bplace != "" death_valid = ddate != "" or dplace != "" if birth_valid or death_valid: - if person.getGender() == RelLib.Person.male: + if person.get_gender() == RelLib.Person.male: if bdate: if bplace: if ddate: @@ -460,24 +460,24 @@ class FtmDescendantReport(Report.Report): keys.sort() for key in keys: srcref = self.sref_map[key] - base = srcref.getBase() + base = srcref.get_base_id() self.doc.start_paragraph('FTD-Endnotes',"%d." % key) - self.doc.write_text(base.getTitle()) + self.doc.write_text(base.get_title()) - for item in [ base.getAuthor(), base.getPubInfo(), base.getAbbrev(), - srcref.getDate().getDate(),]: + for item in [ base.get_author(), base.get_publication_info(), base.getAbbrev(), + srcref.get_date().get_date(),]: if item: self.doc.write_text('; %s' % item) - item = srcref.getText() + item = srcref.get_text() if item: self.doc.write_text('; ') self.doc.write_text(_('Text:')) self.doc.write_text(' ') self.doc.write_text(item) - item = srcref.getComments() + item = srcref.get_comments() if item: self.doc.write_text('; ') self.doc.write_text(_('Comments:')) @@ -489,7 +489,7 @@ class FtmDescendantReport(Report.Report): def endnotes(self,obj): msg = cStringIO.StringIO() - slist = obj.getSourceRefList() + slist = obj.get_source_references() if slist: msg.write('') first = 1 @@ -506,44 +506,44 @@ class FtmDescendantReport(Report.Report): return str def print_notes(self,person): - note = person.getNote() + note = person.get_note() if not note.strip(): return self.doc.start_paragraph('FTD-SubEntry') self.doc.write_text(_('Notes for %(person)s:') % { - 'person' : person.getPrimaryName().getRegularName()} ) + 'person' : person.get_primary_name().get_regular_name()} ) self.doc.end_paragraph() - format = person.getNoteFormat() + format = person.get_note_format() self.doc.write_note(note,format,'FTD-Details') def print_more_about(self,person): first = 1 ncount = 1 - for name in person.getAlternateNames(): + for name in person.get_alternate_names(): if first: self.doc.start_paragraph('FTD-SubEntry') self.doc.write_text(_('More about %(person_name)s:') % { - 'person_name' : person.getPrimaryName().getRegularName() }) + 'person_name' : person.get_primary_name().get_regular_name() }) self.doc.end_paragraph() first = 0 self.doc.start_paragraph('FTD-Details') self.doc.write_text(_('Name %(count)d: %(name)s%(endnotes)s') % { - 'count' : ncount, 'name' : name.getRegularName(), + 'count' : ncount, 'name' : name.get_regular_name(), 'endnotes' : self.endnotes(name), }) self.doc.end_paragraph() ncount += 1 - for event in person.getEventList(): - date = event.getDate() - place = event.getPlace() + for event in person.get_event_list(): + date = event.get_date() + place = event.get_place_id() if not date and not place: continue if first: self.doc.start_paragraph('FTD-SubEntry') - name = person.getPrimaryName().getRegularName() + name = person.get_primary_name().get_regular_name() self.doc.write_text(_('More about %(person_name)s:') % { 'person_name' : name }) self.doc.end_paragraph() first = 0 @@ -551,20 +551,20 @@ class FtmDescendantReport(Report.Report): self.doc.start_paragraph('FTD-Details') if date and place: self.doc.write_text(_('%(event_name)s: %(date)s, %(place)s%(endnotes)s') % { - 'event_name' : event.getName(), - 'date' : event.getDate(), + 'event_name' : event.get_name(), + 'date' : event.get_date(), 'endnotes' : self.endnotes(event), - 'place' : event.getPlaceName() }) + 'place' : event.get_place_name() }) elif date: self.doc.write_text(_('%(event_name)s: %(date)s%(endnotes)s') % { - 'event_name' : event.getName(), + 'event_name' : event.get_name(), 'endnotes' : self.endnotes(event), - 'date' : event.getDate()}) + 'date' : event.get_date()}) else: self.doc.write_text(_('%(event_name)s: %(place)s%(endnotes)s') % { - 'event_name' : event.getName(), + 'event_name' : event.get_name(), 'endnotes' : self.endnotes(event), - 'place' : event.getPlaceName() }) + 'place' : event.get_place_name() }) self.doc.end_paragraph() @@ -573,15 +573,15 @@ class FtmDescendantReport(Report.Report): first = 1 - for family in person.getFamilyList(): - if family.getFather() and family.getMother(): - husband = family.getFather().getPrimaryName().getRegularName() - wife = family.getMother().getPrimaryName().getRegularName() + for family in person.get_family_id_list(): + if family.get_father_id() and family.get_mother_id(): + husband = family.get_father_id().get_primary_name().get_regular_name() + wife = family.get_mother_id().get_primary_name().get_regular_name() else: continue - for event in family.getEventList(): - date = event.getDate() - place = event.getPlace() + for event in family.get_event_list(): + date = event.get_date() + place = event.get_place_id() if not date and not place: continue @@ -594,40 +594,40 @@ class FtmDescendantReport(Report.Report): self.doc.start_paragraph('FTD-Details') if date and place: self.doc.write_text(_('%(event_name)s: %(date)s, %(place)s%(endnotes)s') % { - 'event_name' : event.getName(), - 'date' : event.getDate(), + 'event_name' : event.get_name(), + 'date' : event.get_date(), 'endnotes' : self.endnotes(event), - 'place' : event.getPlaceName() }) + 'place' : event.get_place_name() }) elif date: self.doc.write_text(_('%(event_name)s: %(date)s%(endnotes)s') % { - 'event_name' : event.getName(), + 'event_name' : event.get_name(), 'endnotes' : self.endnotes(event), - 'date' : event.getDate()}) + 'date' : event.get_date()}) else: self.doc.write_text(_('%(event_name)s: %(place)s%(endnotes)s') % { - 'event_name' : event.getName(), + 'event_name' : event.get_name(), 'endnotes' : self.endnotes(event), - 'place' : event.getPlaceName() }) + 'place' : event.get_place_name() }) self.doc.end_paragraph() def print_children(self,person): "Children of such-and-such" - name = person.getPrimaryName().getRegularName() + name = person.get_primary_name().get_regular_name() - for family in person.getFamilyList(): + for family in person.get_family_id_list(): first = 1 - if family.getFather() == person: - spouse = family.getMother() + if family.get_father_id() == person: + spouse = family.get_mother_id() else: - spouse = family.getFather() + spouse = family.get_father_id() child_index = 0 - for child in family.getChildList(): + for child in family.get_child_id_list(): child_index = child_index + 1 - child_name = child.getPrimaryName().getRegularName() + child_name = child.get_primary_name().get_regular_name() for (ind,p) in self.anc_map.items(): if p == child: index = ind @@ -637,11 +637,11 @@ class FtmDescendantReport(Report.Report): self.doc.start_paragraph('FTD-SubEntry') if spouse: self.doc.write_text(_('Children of %(person_name)s and %(spouse_name)s are:') % { - 'person_name' : name, 'spouse_name' : spouse.getPrimaryName().getRegularName() }) + 'person_name' : name, 'spouse_name' : spouse.get_primary_name().get_regular_name() }) else: self.doc.write_text(_('Children of %(person_name)s are:') % { 'person_name' : name }) self.doc.end_paragraph() - self.doc.start_table(family.getId(),'FTD-ChildTable') + self.doc.start_table(family.get_id(),'FTD-ChildTable') self.doc.start_row() self.doc.start_cell('FTD-Normal') @@ -659,15 +659,15 @@ class FtmDescendantReport(Report.Report): self.doc.start_cell('FTD-Normal') self.doc.start_paragraph('FTD-Details') - death = child.getDeath() - dplace = death.getPlaceName() - ddate = death.getDate() + death = child.get_death() + dplace = death.get_place_name() + ddate = death.get_date() - birth = child.getBirth() - bplace = birth.getPlaceName() - bdate = birth.getDate() + birth = child.get_birth() + bplace = birth.get_place_name() + bdate = birth.get_date() - if child.getGender() == RelLib.Person.male: + if child.get_gender() == RelLib.Person.male: if bdate: if bplace: if ddate: @@ -675,7 +675,7 @@ class FtmDescendantReport(Report.Report): self.doc.write_text(_("%(male_name)s%(endnotes)s " "was born %(birth_date)s in %(birth_place)s%(birth_endnotes)s, " "and died %(death_date)s in %(death_place)s%(death_endnotes)s.") % { - 'male_name' : child_name, 'endnotes' : self.endnotes(child.getPrimaryName()), + 'male_name' : child_name, 'endnotes' : self.endnotes(child.get_primary_name()), 'birth_date' : bdate, 'birth_place' : bplace, 'death_date' : ddate,'death_place' : dplace, 'birth_endnotes' : self.endnotes(birth), @@ -684,7 +684,7 @@ class FtmDescendantReport(Report.Report): self.doc.write_text(_("%(male_name)s%(endnotes)s " "was born %(birth_date)s in %(birth_place)s%(birth_endnotes)s, " "and died %(death_date)s%(death_endnotes)s.") % { - 'male_name' : child_name, 'endnotes' : self.endnotes(child.getPrimaryName()), + 'male_name' : child_name, 'endnotes' : self.endnotes(child.get_primary_name()), 'birth_date' : bdate, 'birth_place' : bplace, 'death_date' : ddate, 'birth_endnotes' : self.endnotes(birth), 'death_endnotes' : self.endnotes(death) }) @@ -693,14 +693,14 @@ class FtmDescendantReport(Report.Report): self.doc.write_text(_("%(male_name)s%(endnotes)s " "was born %(birth_date)s in %(birth_place)s%(birth_endnotes)s, " "and died in %(death_place)s%(death_endnotes)s.") % { - 'male_name' : child_name, 'endnotes' : self.endnotes(child.getPrimaryName()), + 'male_name' : child_name, 'endnotes' : self.endnotes(child.get_primary_name()), 'birth_date' : bdate, 'birth_place' : bplace, 'death_place' : dplace, 'birth_endnotes' : self.endnotes(birth), 'death_endnotes' : self.endnotes(death) }) else: self.doc.write_text(_("%(male_name)s%(endnotes)s " "was born %(birth_date)s in %(birth_place)s%(birth_endnotes)s.") % { - 'male_name' : child_name, 'endnotes' : self.endnotes(child.getPrimaryName()), + 'male_name' : child_name, 'endnotes' : self.endnotes(child.get_primary_name()), 'birth_date' : bdate, 'birth_place' : bplace, 'birth_endnotes' : self.endnotes(birth) }) else: @@ -709,7 +709,7 @@ class FtmDescendantReport(Report.Report): self.doc.write_text(_("%(male_name)s%(endnotes)s " "was born %(birth_date)s%(birth_endnotes)s, " "and died %(death_date)s in %(death_place)s%(death_endnotes)s.") % { - 'male_name' : child_name, 'endnotes' : self.endnotes(child.getPrimaryName()), + 'male_name' : child_name, 'endnotes' : self.endnotes(child.get_primary_name()), 'birth_date' : bdate, 'death_date' : ddate,'death_place' : dplace, 'birth_endnotes' : self.endnotes(birth), @@ -718,7 +718,7 @@ class FtmDescendantReport(Report.Report): self.doc.write_text(_("%(male_name)s%(endnotes)s " "was born %(birth_date)s%(birth_endnotes)s, " "and died %(death_date)s%(death_endnotes)s.") % { - 'male_name' : child_name, 'endnotes' : self.endnotes(child.getPrimaryName()), + 'male_name' : child_name, 'endnotes' : self.endnotes(child.get_primary_name()), 'birth_date' : bdate, 'death_date' : ddate, 'birth_endnotes' : self.endnotes(birth), 'death_endnotes' : self.endnotes(death) }) @@ -727,14 +727,14 @@ class FtmDescendantReport(Report.Report): self.doc.write_text(_("%(male_name)s%(endnotes)s " "was born %(birth_date)s%(birth_endnotes)s, " "and died in %(death_place)s%(death_endnotes)s.") % { - 'male_name' : child_name, 'endnotes' : self.endnotes(child.getPrimaryName()), + 'male_name' : child_name, 'endnotes' : self.endnotes(child.get_primary_name()), 'birth_date' : bdate, 'death_place' : dplace, 'birth_endnotes' : self.endnotes(birth), 'death_endnotes' : self.endnotes(death) }) else: self.doc.write_text(_("%(male_name)s%(endnotes)s " "was born %(birth_date)s%(birth_endnotes)s.") % { - 'male_name' : child_name, 'endnotes' : self.endnotes(child.getPrimaryName()), + 'male_name' : child_name, 'endnotes' : self.endnotes(child.get_primary_name()), 'birth_date' : bdate, 'birth_endnotes' : self.endnotes(birth) }) else: if bplace: @@ -743,7 +743,7 @@ class FtmDescendantReport(Report.Report): self.doc.write_text(_("%(male_name)s%(endnotes)s " "was born in %(birth_place)s%(birth_endnotes)s, " "and died %(death_date)s in %(death_place)s%(death_endnotes)s.") % { - 'male_name' : child_name, 'endnotes' : self.endnotes(child.getPrimaryName()), + 'male_name' : child_name, 'endnotes' : self.endnotes(child.get_primary_name()), 'birth_place' : bplace, 'death_date' : ddate,'death_place' : dplace, 'birth_endnotes' : self.endnotes(birth), @@ -752,7 +752,7 @@ class FtmDescendantReport(Report.Report): self.doc.write_text(_("%(male_name)s%(endnotes)s " "was born in %(birth_place)s%(birth_endnotes)s, " "and died %(death_date)s%(death_endnotes)s.") % { - 'male_name' : child_name, 'endnotes' : self.endnotes(child.getPrimaryName()), + 'male_name' : child_name, 'endnotes' : self.endnotes(child.get_primary_name()), 'birth_place' : bplace, 'death_date' : ddate, 'birth_endnotes' : self.endnotes(birth), 'death_endnotes' : self.endnotes(death) }) @@ -761,14 +761,14 @@ class FtmDescendantReport(Report.Report): self.doc.write_text(_("%(male_name)s%(endnotes)s " "was born in %(birth_place)s%(birth_endnotes)s, " "and died in %(death_place)s%(death_endnotes)s.") % { - 'male_name' : child_name, 'endnotes' : self.endnotes(child.getPrimaryName()), + 'male_name' : child_name, 'endnotes' : self.endnotes(child.get_primary_name()), 'birth_place' : bplace, 'death_place' : dplace, 'birth_endnotes' : self.endnotes(birth), 'death_endnotes' : self.endnotes(death) }) else: self.doc.write_text(_("%(male_name)s%(endnotes)s " "was born in %(birth_place)s%(birth_endnotes)s.") % { - 'male_name' : child_name, 'endnotes' : self.endnotes(child.getPrimaryName()), + 'male_name' : child_name, 'endnotes' : self.endnotes(child.get_primary_name()), 'birth_place' : bplace, 'birth_endnotes' : self.endnotes(birth) }) else: @@ -776,25 +776,25 @@ class FtmDescendantReport(Report.Report): if dplace: self.doc.write_text(_("%(male_name)s%(endnotes)s " "died %(death_date)s in %(death_place)s%(death_endnotes)s.") % { - 'male_name' : child_name, 'endnotes' : self.endnotes(child.getPrimaryName()), + 'male_name' : child_name, 'endnotes' : self.endnotes(child.get_primary_name()), 'death_date' : ddate, 'death_place' : dplace, 'death_endnotes' : self.endnotes(death) }) else: self.doc.write_text(_("%(male_name)s%(endnotes)s " "died %(death_date)s%(death_endnotes)s.") % { - 'male_name' : child_name, 'endnotes' : self.endnotes(child.getPrimaryName()), + 'male_name' : child_name, 'endnotes' : self.endnotes(child.get_primary_name()), 'death_date' : ddate, 'death_endnotes' : self.endnotes(death) }) else: if dplace: self.doc.write_text(_("%(male_name)s%(endnotes)s " "died in %(death_place)s%(death_endnotes)s.") % { - 'male_name' : child_name, 'endnotes' : self.endnotes(child.getPrimaryName()), + 'male_name' : child_name, 'endnotes' : self.endnotes(child.get_primary_name()), 'death_place' : dplace, 'death_endnotes' : self.endnotes(death) }) else: self.doc.write_text(_("%(male_name)s%(endnotes)s.") % { - 'male_name' : child_name, 'endnotes' : self.endnotes(child.getPrimaryName()) }) + 'male_name' : child_name, 'endnotes' : self.endnotes(child.get_primary_name()) }) else: if bdate: if bplace: @@ -803,7 +803,7 @@ class FtmDescendantReport(Report.Report): self.doc.write_text(_("%(female_name)s%(endnotes)s " "was born %(birth_date)s in %(birth_place)s%(birth_endnotes)s, " "and died %(death_date)s in %(death_place)s%(death_endnotes)s.") % { - 'female_name' : child_name, 'endnotes' : self.endnotes(child.getPrimaryName()), + 'female_name' : child_name, 'endnotes' : self.endnotes(child.get_primary_name()), 'birth_date' : bdate, 'birth_place' : bplace, 'death_date' : ddate,'death_place' : dplace, 'birth_endnotes' : self.endnotes(birth), @@ -812,7 +812,7 @@ class FtmDescendantReport(Report.Report): self.doc.write_text(_("%(female_name)s%(endnotes)s " "was born %(birth_date)s in %(birth_place)s%(birth_endnotes)s, " "and died %(death_date)s%(death_endnotes)s.") % { - 'female_name' : child_name, 'endnotes' : self.endnotes(child.getPrimaryName()), + 'female_name' : child_name, 'endnotes' : self.endnotes(child.get_primary_name()), 'birth_date' : bdate, 'birth_place' : bplace, 'death_date' : ddate, 'birth_endnotes' : self.endnotes(birth), 'death_endnotes' : self.endnotes(death) }) @@ -821,14 +821,14 @@ class FtmDescendantReport(Report.Report): self.doc.write_text(_("%(female_name)s%(endnotes)s " "was born %(birth_date)s in %(birth_place)s%(birth_endnotes)s, " "and died in %(death_place)s%(death_endnotes)s.") % { - 'female_name' : child_name, 'endnotes' : self.endnotes(child.getPrimaryName()), + 'female_name' : child_name, 'endnotes' : self.endnotes(child.get_primary_name()), 'birth_date' : bdate, 'birth_place' : bplace, 'death_place' : dplace, 'birth_endnotes' : self.endnotes(birth), 'death_endnotes' : self.endnotes(death) }) else: self.doc.write_text(_("%(female_name)s%(endnotes)s " "was born %(birth_date)s in %(birth_place)s%(birth_endnotes)s.") % { - 'female_name' : child_name, 'endnotes' : self.endnotes(child.getPrimaryName()), + 'female_name' : child_name, 'endnotes' : self.endnotes(child.get_primary_name()), 'birth_date' : bdate, 'birth_place' : bplace, 'birth_endnotes' : self.endnotes(birth) }) else: @@ -837,7 +837,7 @@ class FtmDescendantReport(Report.Report): self.doc.write_text(_("%(female_name)s%(endnotes)s " "was born %(birth_date)s%(birth_endnotes)s, " "and died %(death_date)s in %(death_place)s%(death_endnotes)s.") % { - 'female_name' : child_name, 'endnotes' : self.endnotes(child.getPrimaryName()), + 'female_name' : child_name, 'endnotes' : self.endnotes(child.get_primary_name()), 'birth_date' : bdate, 'death_date' : ddate,'death_place' : dplace, 'birth_endnotes' : self.endnotes(birth), @@ -846,7 +846,7 @@ class FtmDescendantReport(Report.Report): self.doc.write_text(_("%(female_name)s%(endnotes)s " "was born %(birth_date)s%(birth_endnotes)s, " "and died %(death_date)s%(death_endnotes)s.") % { - 'female_name' : child_name, 'endnotes' : self.endnotes(child.getPrimaryName()), + 'female_name' : child_name, 'endnotes' : self.endnotes(child.get_primary_name()), 'birth_date' : bdate, 'death_date' : ddate, 'birth_endnotes' : self.endnotes(birth), 'death_endnotes' : self.endnotes(death) }) @@ -855,14 +855,14 @@ class FtmDescendantReport(Report.Report): self.doc.write_text(_("%(female_name)s%(endnotes)s " "was born %(birth_date)s%(birth_endnotes)s, " "and died in %(death_place)s%(death_endnotes)s.") % { - 'female_name' : child_name, 'endnotes' : self.endnotes(child.getPrimaryName()), + 'female_name' : child_name, 'endnotes' : self.endnotes(child.get_primary_name()), 'birth_date' : bdate, 'death_place' : dplace, 'birth_endnotes' : self.endnotes(birth), 'death_endnotes' : self.endnotes(death) }) else: self.doc.write_text(_("%(female_name)s%(endnotes)s " "was born %(birth_date)s%(birth_endnotes)s.") % { - 'female_name' : child_name, 'endnotes' : self.endnotes(child.getPrimaryName()), + 'female_name' : child_name, 'endnotes' : self.endnotes(child.get_primary_name()), 'birth_date' : bdate, 'birth_endnotes' : self.endnotes(birth) }) else: if bplace: @@ -871,7 +871,7 @@ class FtmDescendantReport(Report.Report): self.doc.write_text(_("%(female_name)s%(endnotes)s " "was born in %(birth_place)s%(birth_endnotes)s, " "and died %(death_date)s in %(death_place)s%(death_endnotes)s.") % { - 'female_name' : child_name, 'endnotes' : self.endnotes(child.getPrimaryName()), + 'female_name' : child_name, 'endnotes' : self.endnotes(child.get_primary_name()), 'birth_place' : bplace, 'death_date' : ddate,'death_place' : dplace, 'birth_endnotes' : self.endnotes(birth), @@ -880,7 +880,7 @@ class FtmDescendantReport(Report.Report): self.doc.write_text(_("%(female_name)s%(endnotes)s " "was born in %(birth_place)s%(birth_endnotes)s, " "and died %(death_date)s%(death_endnotes)s.") % { - 'female_name' : child_name, 'endnotes' : self.endnotes(child.getPrimaryName()), + 'female_name' : child_name, 'endnotes' : self.endnotes(child.get_primary_name()), 'birth_place' : bplace, 'death_date' : ddate, 'birth_endnotes' : self.endnotes(birth), 'death_endnotes' : self.endnotes(death) }) @@ -889,14 +889,14 @@ class FtmDescendantReport(Report.Report): self.doc.write_text(_("%(female_name)s%(endnotes)s " "was born in %(birth_place)s%(birth_endnotes)s, " "and died in %(death_place)s%(death_endnotes)s.") % { - 'female_name' : child_name, 'endnotes' : self.endnotes(child.getPrimaryName()), + 'female_name' : child_name, 'endnotes' : self.endnotes(child.get_primary_name()), 'birth_place' : bplace, 'death_place' : dplace, 'birth_endnotes' : self.endnotes(birth), 'death_endnotes' : self.endnotes(death) }) else: self.doc.write_text(_("%(female_name)s%(endnotes)s " "was born in %(birth_place)s%(birth_endnotes)s.") % { - 'female_name' : child_name, 'endnotes' : self.endnotes(child.getPrimaryName()), + 'female_name' : child_name, 'endnotes' : self.endnotes(child.get_primary_name()), 'birth_place' : bplace, 'birth_endnotes' : self.endnotes(birth) }) else: @@ -904,25 +904,25 @@ class FtmDescendantReport(Report.Report): if dplace: self.doc.write_text(_("%(female_name)s%(endnotes)s " "died %(death_date)s in %(death_place)s%(death_endnotes)s.") % { - 'female_name' : child_name, 'endnotes' : self.endnotes(child.getPrimaryName()), + 'female_name' : child_name, 'endnotes' : self.endnotes(child.get_primary_name()), 'death_date' : ddate, 'death_place' : dplace, 'death_endnotes' : self.endnotes(death) }) else: self.doc.write_text(_("%(female_name)s%(endnotes)s " "died %(death_date)s%(death_endnotes)s.") % { - 'female_name' : child_name, 'endnotes' : self.endnotes(child.getPrimaryName()), + 'female_name' : child_name, 'endnotes' : self.endnotes(child.get_primary_name()), 'death_date' : ddate, 'death_endnotes' : self.endnotes(death) }) else: if dplace: self.doc.write_text(_("%(female_name)s%(endnotes)s " "died in %(death_place)s%(death_endnotes)s.") % { - 'female_name' : child_name, 'endnotes' : self.endnotes(child.getPrimaryName()), + 'female_name' : child_name, 'endnotes' : self.endnotes(child.get_primary_name()), 'death_place' : dplace, 'death_endnotes' : self.endnotes(death) }) else: self.doc.write_text(_("%(female_name)s%(endnotes)s.") % { - 'female_name' : child_name, 'endnotes' : self.endnotes(child.getPrimaryName()) }) + 'female_name' : child_name, 'endnotes' : self.endnotes(child.get_primary_name()) }) self.doc.end_paragraph() self.doc.end_cell() self.doc.end_row() @@ -933,81 +933,81 @@ class FtmDescendantReport(Report.Report): def print_spouse(self,person): - family_list = person.getFamilyList() + family_list = person.get_family_id_list() if not family_list: return family = family_list[0] - if family.getFather() == person: - spouse = family.getMother() + if family.get_father_id() == person: + spouse = family.get_mother_id() else: - spouse = family.getFather() + spouse = family.get_father_id() if not spouse: return - event = family.getMarriage() + event = family.get_marriage() if not event: return - date = event.getDate() - place = event.getPlaceName() + date = event.get_date() + place = event.get_place_name() if date and place: - if person.getGender() == RelLib.Person.male: + if person.get_gender() == RelLib.Person.male: self.doc.write_text(_('He married %(spouse)s %(date)s in %(place)s%(endnotes)s.') % { - 'spouse' : spouse.getPrimaryName().getRegularName(), + 'spouse' : spouse.get_primary_name().get_regular_name(), 'endnotes' : self.endnotes(event), 'date' : date, 'place' : place}) else: self.doc.write_text(_('She married %(spouse)s %(date)s in %(place)s%(endnotes)s.') % { - 'spouse' : spouse.getPrimaryName().getRegularName(), + 'spouse' : spouse.get_primary_name().get_regular_name(), 'date' : date, 'endnotes' : self.endnotes(event), 'place' : place}) elif date: - if person.getGender() == RelLib.Person.male: + if person.get_gender() == RelLib.Person.male: self.doc.write_text(_('He married %(spouse)s %(date)s%(endnotes)s.') % { - 'spouse' : spouse.getPrimaryName().getRegularName(), + 'spouse' : spouse.get_primary_name().get_regular_name(), 'endnotes' : self.endnotes(event), 'date' : date,}) else: self.doc.write_text(_('She married %(spouse)s in %(place)s%(endnotes)s.') % { - 'spouse' : spouse.getPrimaryName().getRegularName(), + 'spouse' : spouse.get_primary_name().get_regular_name(), 'endnotes' : self.endnotes(event), 'place' : place,}) elif place: - if person.getGender() == RelLib.Person.male: + if person.get_gender() == RelLib.Person.male: self.doc.write_text(_('He married %(spouse)s in %(place)s%(endnotes)s.') % { - 'spouse' : spouse.getPrimaryName().getRegularName(), + 'spouse' : spouse.get_primary_name().get_regular_name(), 'endnotes' : self.endnotes(event), 'place' : place}) else: self.doc.write_text(_('She married %(spouse)s in %(place)s%(endnotes)s.') % { - 'spouse' : spouse.getPrimaryName().getRegularName(), + 'spouse' : spouse.get_primary_name().get_regular_name(), 'endnotes' : self.endnotes(event), 'place' : place}) else: - if person.getGender() == RelLib.Person.male: + if person.get_gender() == RelLib.Person.male: self.doc.write_text(_('He married %(spouse)s%(endnotes)s.') % { - 'spouse' : spouse.getPrimaryName().getRegularName(), + 'spouse' : spouse.get_primary_name().get_regular_name(), 'endnotes' : self.endnotes(event) }) else: self.doc.write_text(_('She married %(spouse)s%(endnotes)s.') % { - 'spouse' : spouse.getPrimaryName().getRegularName(), + 'spouse' : spouse.get_primary_name().get_regular_name(), 'endnotes' : self.endnotes(event)}) self.doc.write_text(' ') - death = spouse.getDeath() - dplace = death.getPlaceName() - ddate = death.getDate() + death = spouse.get_death() + dplace = death.get_place_name() + ddate = death.get_date() - birth = spouse.getBirth() - bplace = birth.getPlaceName() - bdate = birth.getDate() + birth = spouse.get_birth() + bplace = birth.get_place_name() + bdate = birth.get_date() death_valid = ddate != "" or dplace != "" birth_valid = bdate != "" or bplace != "" if birth_valid or death_valid: - if spouse.getGender() == RelLib.Person.male: + if spouse.get_gender() == RelLib.Person.male: if bdate: if bplace: if ddate: @@ -1290,58 +1290,58 @@ class FtmDescendantReport(Report.Report): def print_parents(self,person,dead): - family = person.getMainParents() + family = person.get_main_parents_family_id() if family: - mother = family.getMother() - father = family.getFather() - if person.getGender() == RelLib.Person.male: + mother = family.get_mother_id() + father = family.get_father_id() + if person.get_gender() == RelLib.Person.male: if mother and father: if dead: self.doc.write_text(_("He was the son of %(father)s and %(mother)s.") % { - 'father' : father.getPrimaryName().getRegularName(), - 'mother' : mother.getPrimaryName().getRegularName(), }) + 'father' : father.get_primary_name().get_regular_name(), + 'mother' : mother.get_primary_name().get_regular_name(), }) else: self.doc.write_text(_("He is the son of %(father)s and %(mother)s.") % { - 'father' : father.getPrimaryName().getRegularName(), - 'mother' : mother.getPrimaryName().getRegularName(), }) + 'father' : father.get_primary_name().get_regular_name(), + 'mother' : mother.get_primary_name().get_regular_name(), }) elif mother: if dead: self.doc.write_text(_("He was the son of %(mother)s.") % { - 'mother' : mother.getPrimaryName().getRegularName(), }) + 'mother' : mother.get_primary_name().get_regular_name(), }) else: self.doc.write_text(_("He is the son of %(mother)s.") % { - 'mother' : mother.getPrimaryName().getRegularName(), }) + 'mother' : mother.get_primary_name().get_regular_name(), }) elif father: if dead: self.doc.write_text(_("He was the son of %(father)s.") % { - 'father' : father.getPrimaryName().getRegularName(), }) + 'father' : father.get_primary_name().get_regular_name(), }) else: self.doc.write_text(_("He is the son of %(father)s.") % { - 'father' : father.getPrimaryName().getRegularName(), }) + 'father' : father.get_primary_name().get_regular_name(), }) else: if mother and father: if dead: self.doc.write_text(_("She was the daughter of %(father)s and %(mother)s.") % { - 'father' : father.getPrimaryName().getRegularName(), - 'mother' : mother.getPrimaryName().getRegularName(), }) + 'father' : father.get_primary_name().get_regular_name(), + 'mother' : mother.get_primary_name().get_regular_name(), }) else: self.doc.write_text(_("She is the daughter of %(father)s and %(mother)s.") % { - 'father' : father.getPrimaryName().getRegularName(), - 'mother' : mother.getPrimaryName().getRegularName(), }) + 'father' : father.get_primary_name().get_regular_name(), + 'mother' : mother.get_primary_name().get_regular_name(), }) elif mother: if dead: self.doc.write_text(_("She was the daughter of %(mother)s.") % { - 'mother' : mother.getPrimaryName().getRegularName(), }) + 'mother' : mother.get_primary_name().get_regular_name(), }) else: self.doc.write_text(_("She is the daughter of %(mother)s.") % { - 'mother' : mother.getPrimaryName().getRegularName(), }) + 'mother' : mother.get_primary_name().get_regular_name(), }) elif father: if dead: self.doc.write_text(_("She was the daughter of %(father)s.") % { - 'father' : father.getPrimaryName().getRegularName(), }) + 'father' : father.get_primary_name().get_regular_name(), }) else: self.doc.write_text(_("She is the daughter of %(father)s.") % { - 'father' : father.getPrimaryName().getRegularName(), }) + 'father' : father.get_primary_name().get_regular_name(), }) self.doc.write_text(' '); @@ -1481,7 +1481,7 @@ class FtmDescendantBareReportDialog(Report.BareReportDialog): self.options = opt self.db = database if self.options[0]: - self.person = self.db.getPerson(self.options[0]) + self.person = self.db.get_person(self.options[0]) else: self.person = person self.style_name = stl @@ -1530,7 +1530,7 @@ class FtmDescendantBareReportDialog(Report.BareReportDialog): if self.new_person: self.person = self.new_person - self.options = ( self.person.getId(), self.max_gen, self.pg_brk ) + self.options = ( self.person.get_id(), self.max_gen, self.pg_brk ) self.style_name = self.selected_style.get_name() #------------------------------------------------------------------------ @@ -1543,7 +1543,7 @@ def write_book_item(database,person,doc,options,newpage=0): All user dialog has already been handled and the output file opened.""" try: if options[0]: - person = database.getPerson(options[0]) + person = database.get_person(options[0]) max_gen = int(options[1]) pg_brk = int(options[2]) return FtmDescendantReport(database, person, max_gen, diff --git a/src/plugins/GraphViz.py b/src/plugins/GraphViz.py index 6a9ee2f48..c575e061a 100644 --- a/src/plugins/GraphViz.py +++ b/src/plugins/GraphViz.py @@ -98,7 +98,7 @@ class GraphVizDialog(Report.ReportDialog): def get_report_filters(self): """Set up the list of possible content filters.""" - name = self.person.getPrimaryName().getName() + name = self.person.get_primary_name().get_name() all = GenericFilter.GenericFilter() all.set_name(_("Entire Database")) @@ -106,15 +106,15 @@ class GraphVizDialog(Report.ReportDialog): des = GenericFilter.GenericFilter() des.set_name(_("Descendants of %s") % name) - des.add_rule(GenericFilter.IsDescendantOf([self.person.getId(),1])) + des.add_rule(GenericFilter.IsDescendantOf([self.person.get_id(),1])) ans = GenericFilter.GenericFilter() ans.set_name(_("Ancestors of %s") % name) - ans.add_rule(GenericFilter.IsAncestorOf([self.person.getId(),1])) + ans.add_rule(GenericFilter.IsAncestorOf([self.person.get_id(),1])) com = GenericFilter.GenericFilter() com.set_name(_("People with common ancestor with %s") % name) - com.add_rule(GenericFilter.HasCommonAncestorWith([self.person.getId()])) + com.add_rule(GenericFilter.HasCommonAncestorWith([self.person.get_id()])) return [all,des,ans,com] @@ -321,7 +321,7 @@ class GraphVizDialog(Report.ReportDialog): file = open(self.target_path,"w") try: - ind_list = self.filter.apply(self.db, self.db.getPersonMap().values()) + ind_list = self.filter.apply(self.db, self.db.get_person_id_map().values()) except Errors.FilterError, msg: from QuestionDialog import ErrorDialog (m1,m2) = msg.messages() @@ -388,20 +388,20 @@ def dump_person(person_list,file,adoptionsdashed,arrowheadstyle, # Hash people in a dictionary for faster inclusion checking. person_dict = {} for p in person_list: - person_dict[p.getId()] = 1 + person_dict[p.get_id()] = 1 for person in person_list: - pid = string.replace(person.getId(),'-','_') - for family, mrel, frel in person.getParentList(): - father = family.getFather() - mother = family.getMother() + pid = string.replace(person.get_id(),'-','_') + for family, mrel, frel in person.get_parent_family_id_list(): + father = family.get_father_id() + mother = family.get_mother_id() fadopted = frel != _("Birth") madopted = mrel != _("Birth") if (show_families and - (father and person_dict.has_key(father.getId()) or - mother and person_dict.has_key(mother.getId()))): + (father and person_dict.has_key(father.get_id()) or + mother and person_dict.has_key(mother.get_id()))): # Link to the family node. - famid = string.replace(family.getId(),'-','_') + famid = string.replace(family.get_id(),'-','_') file.write('p%s -> f%s [' % (pid, famid)) file.write('arrowhead=%s, arrowtail=%s, ' % (arrowheadstyle, arrowtailstyle)) @@ -412,8 +412,8 @@ def dump_person(person_list,file,adoptionsdashed,arrowheadstyle, file.write('];\n') else: # Link to the parents' nodes directly. - if father and person_dict.has_key(father.getId()): - fid = string.replace(father.getId(),'-','_') + if father and person_dict.has_key(father.get_id()): + fid = string.replace(father.get_id(),'-','_') file.write('p%s -> p%s [' % (pid, fid)) file.write('arrowhead=%s, arrowtail=%s, ' % (arrowheadstyle, arrowtailstyle)) @@ -422,8 +422,8 @@ def dump_person(person_list,file,adoptionsdashed,arrowheadstyle, else: file.write('style=solid') file.write('];\n') - if mother and person_dict.has_key(mother.getId()): - mid = string.replace(mother.getId(),'-','_') + if mother and person_dict.has_key(mother.get_id()): + mid = string.replace(mother.get_id(),'-','_') file.write('p%s -> p%s [' % (pid, mid)) file.write('arrowhead=%s, arrowtail=%s, ' % (arrowheadstyle, arrowtailstyle)) @@ -445,21 +445,21 @@ def dump_index(person_list,file,includedates,includeurl,colorize, families_done = [] for person in person_list: # Output the person's node. - label = person.getPrimaryName().getName() - id = string.replace(person.getId(),'-','_') + label = person.get_primary_name().get_name() + id = string.replace(person.get_id(),'-','_') if includedates: - if person.getBirth().getDateObj().getYearValid(): + if person.get_birth().get_date_object().getYearValid(): if just_year: - birth = '%i' % person.getBirth().getDateObj().getYear() + birth = '%i' % person.get_birth().get_date_object().getYear() else: - birth = person.getBirth().getDate() + birth = person.get_birth().get_date() else: birth = '' - if person.getDeath().getDateObj().getYearValid(): + if person.get_death().get_date_object().getYearValid(): if just_year: - death = '%i' % person.getDeath().getDateObj().getYear() + death = '%i' % person.get_death().get_date_object().getYear() else: - death = person.getDeath().getDate() + death = person.get_death().get_date() else: death = '' label = label + '\\n(%s - %s)' % (birth, death) @@ -467,7 +467,7 @@ def dump_index(person_list,file,includedates,includeurl,colorize, if includeurl: file.write('URL="%s.html", ' % id) if colorize: - gender = person.getGender() + gender = person.get_gender() if gender == person.male: file.write('color=dodgerblue4, ') elif gender == person.female: @@ -477,22 +477,22 @@ def dump_index(person_list,file,includedates,includeurl,colorize, file.write('fontname="%s", label="%s"];\n' % (font,utf8_to_latin(label))) # Output families's nodes. if show_families: - family_list = person.getFamilyList() + family_list = person.get_family_id_list() for fam in family_list: - fid = string.replace(fam.getId(),'-','_') + fid = string.replace(fam.get_id(),'-','_') if fam not in families_done: families_done.append(fam) file.write('f%s [shape=ellipse, ' % fid) marriage = "" - m = fam.getMarriage() + m = fam.get_marriage() if m != None: - do = m.getDateObj() + do = m.get_date_object() if do != None: if do.getYearValid(): if just_year: marriage = '%i' % do.getYear() else: - marriage = m.getDate() + marriage = m.get_date() file.write('fontname="%s", label="%s"];\n' % (font,marriage)) # Link this person to all his/her families. file.write('f%s -> p%s [' % (fid, id)) diff --git a/src/plugins/IndivComplete.py b/src/plugins/IndivComplete.py index d4d6fc61a..a99563aa9 100644 --- a/src/plugins/IndivComplete.py +++ b/src/plugins/IndivComplete.py @@ -71,7 +71,7 @@ class IndivComplete(Report.Report): self.d = document self.use_srcs = use_srcs self.filter = filter - c = database.getResearcher().getName() + c = database.get_researcher().get_name() self.d.creator(c) self.map = {} self.database = database @@ -119,10 +119,10 @@ class IndivComplete(Report.Report): def write_fact(self,event): if event == None: return - name = _(event.getName()) - date = event.getDate() - place = event.getPlaceName() - description = event.getDescription() + name = _(event.get_name()) + date = event.get_date() + place = event.get_place_name() + description = event.get_description() if date == "": if place == "": return @@ -139,8 +139,8 @@ class IndivComplete(Report.Report): self.d.start_row() self.normal_cell(name) if self.use_srcs: - for s in event.getSourceRefList(): - text = "%s [%s]" % (text,s.getBase().getId()) + for s in event.get_source_references(): + text = "%s [%s]" % (text,s.get_base_id().get_id()) self.slist.append(s) self.normal_cell(text) self.d.end_row() @@ -157,7 +157,7 @@ class IndivComplete(Report.Report): self.d.end_row() def write_note(self): - note = self.person.getNote() + note = self.person.get_note() if note == '': return self.d.start_table('note','IDS-IndTable') @@ -171,7 +171,7 @@ class IndivComplete(Report.Report): self.d.start_row() self.d.start_cell('IDS-NormalCell',2) - format = self.person.getNoteFormat() + format = self.person.get_note_format() self.d.write_note(note,format,'IDS-Normal') self.d.end_cell() self.d.end_row() @@ -182,7 +182,7 @@ class IndivComplete(Report.Report): def write_alt_parents(self): - if len(self.person.getParentList()) < 2: + if len(self.person.get_parent_family_id_list()) < 2: return self.d.start_table("altparents","IDS-IndTable") @@ -194,22 +194,22 @@ class IndivComplete(Report.Report): self.d.end_cell() self.d.end_row() - for (family,mrel,frel) in self.person.getParentList(): - if family == self.person.getMainParents(): + for (family,mrel,frel) in self.person.get_parent_family_id_list(): + if family == self.person.get_main_parents_family_id(): continue - father = family.getFather() + father = family.get_father_id() if father: - fname = father.getPrimaryName().getRegularName() - frel = const.childRelations[frel] + fname = father.get_primary_name().get_regular_name() + frel = const.child_relations[frel] self.write_p_entry(_('Father'),fname,frel) else: self.write_p_entry(_('Father'),'','') - mother = family.getMother() + mother = family.get_mother_id() if mother: - fname = mother.getPrimaryName().getRegularName() - frel = const.childRelations[frel] + fname = mother.get_primary_name().get_regular_name() + frel = const.child_relations(frel) self.write_p_entry(_('Mother'),fname,frel) else: self.write_p_entry(_('Mother'),'','') @@ -220,7 +220,7 @@ class IndivComplete(Report.Report): def write_alt_names(self): - if len(self.person.getAlternateNames()) < 1: + if len(self.person.get_alternate_names()) < 1: return self.d.start_table("altparents","IDS-IndTable") @@ -232,14 +232,14 @@ class IndivComplete(Report.Report): self.d.end_cell() self.d.end_row() - for name in self.person.getAlternateNames(): - type = const.NameTypesMap.find_value(name.getType()) + for name in self.person.get_alternate_names(): + type = const.NameTypesMap.find_value(name.get_type()) self.d.start_row() self.normal_cell(type) - text = name.getRegularName() + text = name.get_regular_name() if self.use_srcs: - for s in name.getSourceRefList(): - text = "%s [%s]" % (text,s.getBase().getId()) + for s in name.get_source_references(): + text = "%s [%s]" % (text,s.get_base_id().get_id()) self.slist.append(s) self.normal_cell(text) self.d.end_row() @@ -249,7 +249,7 @@ class IndivComplete(Report.Report): def write_families(self): - if len(self.person.getFamilyList()) == 0: + if len(self.person.get_family_id_list()) == 0: return self.d.start_table("three","IDS-IndTable") @@ -261,16 +261,16 @@ class IndivComplete(Report.Report): self.d.end_cell() self.d.end_row() - for family in self.person.getFamilyList(): - if self.person == family.getFather(): - spouse = family.getMother() + for family in self.person.get_family_id_list(): + if self.person == family.get_father_id(): + spouse = family.get_mother_id() else: - spouse = family.getFather() + spouse = family.get_father_id() self.d.start_row() self.d.start_cell("IDS-NormalCell",2) self.d.start_paragraph("IDS-Spouse") if spouse: - text = spouse.getPrimaryName().getRegularName() + text = spouse.get_primary_name().get_regular_name() else: text = _("unknown") self.d.write_text(text) @@ -278,10 +278,10 @@ class IndivComplete(Report.Report): self.d.end_cell() self.d.end_row() - for event in family.getEventList(): + for event in family.get_event_list(): self.write_fact(event) - child_list = family.getChildList() + child_list = family.get_child_id_list() if len(child_list) > 0: self.d.start_row() self.normal_cell(_("Children")) @@ -290,12 +290,12 @@ class IndivComplete(Report.Report): self.d.start_paragraph("IDS-Normal") first = 1 - for child in family.getChildList(): + for child in family.get_child_id_list(): if first == 1: first = 0 else: self.d.write_text('\n') - self.d.write_text(child.getPrimaryName().getRegularName()) + self.d.write_text(child.get_primary_name().get_regular_name()) self.d.end_paragraph() self.d.end_cell() self.d.end_row() @@ -319,9 +319,9 @@ class IndivComplete(Report.Report): for source in self.slist: self.d.start_row() - sname = source.getBase() - self.normal_cell(sname.getId()) - self.normal_cell(sname.getTitle()) + sname = source.get_base_id() + self.normal_cell(sname.get_id()) + self.normal_cell(sname.get_title()) self.d.end_row() self.d.end_table() @@ -335,8 +335,8 @@ class IndivComplete(Report.Report): self.d.end_cell() self.d.end_row() - event_list = [ self.person.getBirth(), self.person.getDeath() ] - event_list = event_list + self.person.getEventList() + event_list = [ self.person.get_birth(), self.person.get_death() ] + event_list = event_list + self.person.get_event_list() for event in event_list: self.write_fact(event) self.d.end_table() @@ -354,7 +354,7 @@ class IndivComplete(Report.Report): if self.newpage: self.d.page_break() - plist = self.database.getPersonMap().values() + plist = self.database.get_person_id_map().values() if self.filter: ind_list = self.filter.apply(self.database,plist) else: @@ -371,8 +371,8 @@ class IndivComplete(Report.Report): self.d.page_break() self.slist = [] - photo_list = self.person.getPhotoList() - name = self.person.getPrimaryName().getRegularName() + photo_list = self.person.get_photo_list() + name = self.person.get_primary_name().get_regular_name() self.d.start_paragraph("IDS-Title") self.d.write_text(_("Summary of %s") % name) self.d.end_paragraph() @@ -381,9 +381,9 @@ class IndivComplete(Report.Report): self.d.end_paragraph() if len(photo_list) > 0: - object = photo_list[0].getReference() - if object.getMimeType()[0:5] == "image": - file = object.getPath() + object = photo_list[0].get_reference() + if object.get_mime_type()[0:5] == "image": + file = object.get_path() self.d.start_paragraph("IDS-Normal") self.d.add_photo(file,"row",4.0,4.0) self.d.end_paragraph() @@ -392,33 +392,33 @@ class IndivComplete(Report.Report): self.d.start_row() self.normal_cell("%s:" % _("Name")) - name = self.person.getPrimaryName() - text = name.getRegularName() + name = self.person.get_primary_name() + text = name.get_regular_name() if self.use_srcs: - for s in name.getSourceRefList(): + for s in name.get_source_references(): self.slist.append(s) - text = "%s [%s]" % (text,s.getBase().getId()) + text = "%s [%s]" % (text,s.get_base_id().get_id()) self.normal_cell(text) self.d.end_row() self.d.start_row() self.normal_cell("%s:" % _("Gender")) - if self.person.getGender() == RelLib.Person.male: + if self.person.get_gender() == RelLib.Person.male: self.normal_cell(_("Male")) else: self.normal_cell(_("Female")) self.d.end_row() - family = self.person.getMainParents() + family = self.person.get_main_parents_family_id() if family: - father_inst = family.getFather() + father_inst = family.get_father_id() if father_inst: - father = father_inst.getPrimaryName().getRegularName() + father = father_inst.get_primary_name().get_regular_name() else: father = "" - mother_inst = family.getMother() + mother_inst = family.get_mother_id() if mother_inst: - mother = mother_inst.getPrimaryName().getRegularName() + mother = mother_inst.get_primary_name().get_regular_name() else: mother = "" else: @@ -555,7 +555,7 @@ class IndivCompleteBareReportDialog(Report.BareReportDialog): self.options = opt self.db = database if self.options[0]: - self.person = self.db.getPerson(self.options[0]) + self.person = self.db.get_person(self.options[0]) else: self.person = person self.style_name = stl @@ -610,7 +610,7 @@ class IndivCompleteBareReportDialog(Report.BareReportDialog): if self.new_person: self.person = self.new_person self.filter_num = self.filter_combo.get_history() - self.options = ( self.person.getId(), self.max_gen, self.pg_brk, self.filter_num ) + self.options = ( self.person.get_id(), self.max_gen, self.pg_brk, self.filter_num ) self.style_name = self.selected_style.get_name() @@ -624,7 +624,7 @@ def write_book_item(database,person,doc,options,newpage=0): All user dialog has already been handled and the output file opened.""" try: if options[0]: - person = database.getPerson(options[0]) + person = database.get_person(options[0]) max_gen = int(options[1]) pg_brk = int(options[2]) filter_num = int(options[3]) @@ -697,19 +697,19 @@ def _make_default_style(default_style): def _get_report_filters(person): """Set up the list of possible content filters.""" - name = person.getPrimaryName().getName() + name = person.get_primary_name().get_name() filt_id = GenericFilter.GenericFilter() filt_id.set_name(name) - filt_id.add_rule(GenericFilter.HasIdOf([person.getId()])) + filt_id.add_rule(GenericFilter.HasIdOf([person.get_id()])) des = GenericFilter.GenericFilter() des.set_name(_("Descendants of %s") % name) - des.add_rule(GenericFilter.IsDescendantOf([person.getId()])) + des.add_rule(GenericFilter.IsDescendantOf([person.get_id()])) ans = GenericFilter.GenericFilter() ans.set_name(_("Ancestors of %s") % name) - ans.add_rule(GenericFilter.IsAncestorOf([person.getId()])) + ans.add_rule(GenericFilter.IsAncestorOf([person.get_id()])) all = GenericFilter.GenericFilter() all.set_name(_("Entire Database")) diff --git a/src/plugins/IndivSummary.py b/src/plugins/IndivSummary.py index 342524c93..3615f2dd2 100644 --- a/src/plugins/IndivSummary.py +++ b/src/plugins/IndivSummary.py @@ -70,7 +70,7 @@ class IndivSummary(Report.Report): def __init__(self,database,person,output,document,newpage=0): self.d = document - c = database.getResearcher().getName() + c = database.get_researcher().get_name() self.d.creator(c) self.map = {} self.database = database @@ -111,10 +111,10 @@ class IndivSummary(Report.Report): def write_fact(self,event): if event == None: return - name = const.display_event(event.getName()) - date = event.getDate() - place = event.getPlaceName() - description = event.getDescription() + name = const.display_event(event.get_name()) + date = event.get_date() + place = event.get_place_name() + description = event.get_description() if date == "": if place == "": return @@ -158,26 +158,26 @@ class IndivSummary(Report.Report): self.d.end_cell() self.d.end_row() - for family in self.person.getFamilyList(): - if self.person == family.getFather(): - spouse = family.getMother() + for family in self.person.get_family_id_list(): + if self.person == family.get_father_id(): + spouse = family.get_mother_id() else: - spouse = family.getFather() + spouse = family.get_father_id() self.d.start_row() self.d.start_cell("IVS-NormalCell",2) self.d.start_paragraph("IVS-Spouse") if spouse: - self.d.write_text(spouse.getPrimaryName().getRegularName()) + self.d.write_text(spouse.get_primary_name().get_regular_name()) else: self.d.write_text(_("unknown")) self.d.end_paragraph() self.d.end_cell() self.d.end_row() - for event in family.getEventList(): + for event in family.get_event_list(): self.write_fact(event) - child_list = family.getChildList() + child_list = family.get_child_id_list() if len(child_list) > 0: self.d.start_row() self.d.start_cell("IVS-NormalCell") @@ -190,12 +190,12 @@ class IndivSummary(Report.Report): self.d.start_paragraph("IVS-Normal") first = 1 - for child in family.getChildList(): + for child in family.get_child_id_list(): if first == 1: first = 0 else: self.d.write_text('\n') - self.d.write_text(child.getPrimaryName().getRegularName()) + self.d.write_text(child.get_primary_name().get_regular_name()) self.d.end_paragraph() self.d.end_cell() self.d.end_row() @@ -206,9 +206,9 @@ class IndivSummary(Report.Report): if self.newpage: self.d.page_break() - photo_list = self.person.getPhotoList() + photo_list = self.person.get_photo_list() - name = self.person.getPrimaryName().getRegularName() + name = self.person.get_primary_name().get_regular_name() self.d.start_paragraph("IVS-Title") self.d.write_text(_("Summary of %s") % name) self.d.end_paragraph() @@ -217,9 +217,9 @@ class IndivSummary(Report.Report): self.d.end_paragraph() if len(photo_list) > 0: - object = photo_list[0].getReference() - if object.getMimeType()[0:5] == "image": - file = object.getPath() + object = photo_list[0].get_reference() + if object.get_mime_type()[0:5] == "image": + file = object.get_path() self.d.start_paragraph("IVS-Normal") self.d.add_photo(file,"row",4.0,4.0) self.d.end_paragraph() @@ -235,7 +235,7 @@ class IndivSummary(Report.Report): self.d.start_cell("IVS-NormalCell") self.d.start_paragraph("IVS-Normal") - self.d.write_text(self.person.getPrimaryName().getRegularName()) + self.d.write_text(self.person.get_primary_name().get_regular_name()) self.d.end_paragraph() self.d.end_cell() self.d.end_row() @@ -249,7 +249,7 @@ class IndivSummary(Report.Report): self.d.start_cell("IVS-NormalCell") self.d.start_paragraph("IVS-Normal") - if self.person.getGender() == RelLib.Person.male: + if self.person.get_gender() == RelLib.Person.male: self.d.write_text(_("Male")) else: self.d.write_text(_("Female")) @@ -257,16 +257,16 @@ class IndivSummary(Report.Report): self.d.end_cell() self.d.end_row() - family = self.person.getMainParents() + family = self.person.get_main_parents_family_id() if family: - father_inst = family.getFather() + father_inst = family.get_father_id() if father_inst: - father = father_inst.getPrimaryName().getRegularName() + father = father_inst.get_primary_name().get_regular_name() else: father = "" - mother_inst = family.getMother() + mother_inst = family.get_mother_id() if mother_inst: - mother = mother_inst.getPrimaryName().getRegularName() + mother = mother_inst.get_primary_name().get_regular_name() else: mother = "" else: @@ -314,8 +314,8 @@ class IndivSummary(Report.Report): self.d.end_cell() self.d.end_row() - event_list = [ self.person.getBirth(), self.person.getDeath() ] - event_list = event_list + self.person.getEventList() + event_list = [ self.person.get_birth(), self.person.get_death() ] + event_list = event_list + self.person.get_event_list() for event in event_list: self.write_fact(event) self.d.end_table() @@ -493,7 +493,7 @@ class IndivSummaryBareReportDialog(Report.BareReportDialog): self.options = opt self.db = database if self.options[0]: - self.person = self.db.getPerson(self.options[0]) + self.person = self.db.get_person(self.options[0]) else: self.person = person self.style_name = stl @@ -545,7 +545,7 @@ class IndivSummaryBareReportDialog(Report.BareReportDialog): if self.new_person: self.person = self.new_person - self.options = ( self.person.getId(), self.max_gen, self.pg_brk ) + self.options = ( self.person.get_id(), self.max_gen, self.pg_brk ) self.style_name = self.selected_style.get_name() @@ -559,7 +559,7 @@ def write_book_item(database,person,doc,options,newpage=0): All user dialog has already been handled and the output file opened.""" try: if options[0]: - person = database.getPerson(options[0]) + person = database.get_person(options[0]) max_gen = int(options[1]) pg_brk = int(options[2]) return IndivSummary(database, person, None, doc, newpage) diff --git a/src/plugins/Merge.py b/src/plugins/Merge.py index 3b406c937..78d3ebd1e 100644 --- a/src/plugins/Merge.py +++ b/src/plugins/Merge.py @@ -75,10 +75,10 @@ def ancestors_of(p1,list): if p1 == None or p1 in list: return list.append(p1) - f1 = p1.getMainParents() + f1 = p1.get_main_parents_family_id() if f1 != None: - ancestors_of(f1.getFather(),list) - ancestors_of(f1.getMother(),list) + ancestors_of(f1.get_father_id(),list) + ancestors_of(f1.get_mother_id(),list) #------------------------------------------------------------------------- # @@ -98,8 +98,8 @@ class Merge: self.update = callback self.use_soundex = 1 - self.family_list = database.getFamilyMap().values()[:] - self.person_list = database.getPersonMap().values()[:] + self.family_list = database.get_family_id_map().values()[:] + self.person_list = database.get_person_id_map().values()[:] base = os.path.dirname(__file__) self.glade_file = "%s/%s" % (base,"merge.glade") @@ -156,29 +156,29 @@ class Merge: males = {} females = {} for p1 in self.person_list: - key = self.gen_key(p1.getPrimaryName().getSurname()) - if p1.getGender() == RelLib.Person.male: + key = self.gen_key(p1.get_primary_name().get_surname()) + if p1.get_gender() == RelLib.Person.male: if males.has_key(key): - males[key].append(p1.getId()) + males[key].append(p1.get_id()) else: - males[key] = [p1.getId()] + males[key] = [p1.get_id()] else: if females.has_key(key): - females[key].append(p1.getId()) + females[key].append(p1.get_id()) else: - females[key] = [p1.getId()] + females[key] = [p1.get_id()] length = len(self.person_list) num = 0 for p1 in self.person_list: - p1key = p1.getId() + p1key = p1.get_id() if num % 25 == 0: self.progress_update((float(num)/float(length))*100) num = num + 1 - key = self.gen_key(p1.getPrimaryName().getSurname()) - if p1.getGender() == RelLib.Person.male: + key = self.gen_key(p1.get_primary_name().get_surname()) + if p1.get_gender() == RelLib.Person.male: remaining = males[key] else: remaining = females[key] @@ -188,7 +188,7 @@ class Merge: index = index + 1 if p1key == p2key: continue - p2 = self.db.getPerson(p2key) + p2 = self.db.get_person(p2key) if self.map.has_key(p2key): (v,c) = self.map[p2key] if v == p1: @@ -235,19 +235,19 @@ class Merge: if self.dellist.has_key(p1): continue (p2,c) = self.map[p1] - p2key = p2.getId() + p2key = p2.get_id() if self.dellist.has_key(p2key): p2 = self.dellist[p2key] if p1 == p2: continue - list.append((c,p1,p2.getId())) + list.append((c,p1,p2.get_id())) self.list.clear() for (c,p1,p2) in list: c1 = "%5.2f" % c c2 = "%5.2f" % (100-c) - pn1 = self.db.getPerson(p1).getPrimaryName().getName() - pn2 = self.db.getPerson(p2).getPrimaryName().getName() + pn1 = self.db.get_person(p1).get_primary_name().get_name() + pn2 = self.db.get_person(p2).get_primary_name().get_name() self.list.add([c, pn1, pn2,c2],(p1,p2)) def on_do_merge_clicked(self,obj): @@ -256,15 +256,15 @@ class Merge: return (p1,p2) = self.list.get_object(iter) - pn1 = self.db.getPerson(p1) - pn2 = self.db.getPerson(p2) + pn1 = self.db.get_person(p1) + pn2 = self.db.get_person(p2) MergeData.MergePeople(self.db,pn1,pn2,self.on_update) def on_update(self,p1,p2,old_id): - self.dellist[p2.getId()] = p1.getId() + self.dellist[p2.get_id()] = p1.get_id() for key in self.dellist.keys(): - if self.dellist[key] == p2.getId(): - self.dellist[key] = p1.getId() + if self.dellist[key] == p2.get_id(): + self.dellist[key] = p1.get_id() self.redraw() def update_and_destroy(self,obj): @@ -311,9 +311,9 @@ class Merge: return s1 == s2 def date_match(self,date1,date2): - if date1.getDate() == "" or date2.getDate() == "": + if date1.get_date() == "" or date2.get_date() == "": return 0 - if date1.getDate() == date2.getDate(): + if date1.get_date() == date2.get_date(): return 1 if date1.isRange() or date2.isRange(): @@ -363,10 +363,10 @@ class Merge: if not name1 or not name: return 0 - srn1 = name.getSurname() - sfx1 = name.getSuffix() - srn2 = name1.getSurname() - sfx2 = name1.getSuffix() + srn1 = name.get_surname() + sfx1 = name.get_suffix() + srn2 = name1.get_surname() + sfx2 = name1.get_suffix() if not self.name_compare(srn1,srn2): return -1 @@ -374,11 +374,11 @@ class Merge: if sfx1 != "" and sfx2 != "": return -1 - if name.getFirstName() == name1.getFirstName(): + if name.get_first_name() == name1.get_first_name(): return 1 else: - list1 = string.split(name.getFirstName()) - list2 = string.split(name1.getFirstName()) + list1 = string.split(name.get_first_name()) + list2 = string.split(name1.get_first_name()) if len(list1) < len(list2): return self.list_reduce(list1,list2) @@ -423,34 +423,34 @@ class Merge: def compare_people(self,p1,p2): - name1 = p1.getPrimaryName() - name2 = p2.getPrimaryName() + name1 = p1.get_primary_name() + name2 = p2.get_primary_name() chance = self.name_match(name1,name2) if chance == -1 : return -1 - birth1 = p1.getBirth() - death1 = p1.getDeath() - birth2 = p2.getBirth() - death2 = p2.getDeath() + birth1 = p1.get_birth() + death1 = p1.get_death() + birth2 = p2.get_birth() + death2 = p2.get_death() - value = self.date_match(birth1.getDateObj(),birth2.getDateObj()) + value = self.date_match(birth1.get_date_object(),birth2.get_date_object()) if value == -1 : return -1 chance = chance + value - value = self.date_match(death1.getDateObj(),death2.getDateObj()) + value = self.date_match(death1.get_date_object(),death2.get_date_object()) if value == -1 : return -1 chance = chance + value - value = self.place_match(birth1.getPlace(),birth2.getPlace()) + value = self.place_match(birth1.get_place_id(),birth2.get_place_id()) if value == -1 : return -1 chance = chance + value - value = self.place_match(death1.getPlace(),death2.getPlace()) + value = self.place_match(death1.get_place_id(),death2.get_place_id()) if value == -1 : return -1 chance = chance + value @@ -465,12 +465,12 @@ class Merge: if p1 in ancestors: return -1 - f1 = p1.getMainParents() - f2 = p2.getMainParents() + f1 = p1.get_main_parents_family_id() + f2 = p2.get_main_parents_family_id() if f1 and f2: - dad1 = get_name_obj(f1.getFather()) - dad2 = get_name_obj(f2.getFather()) + dad1 = get_name_obj(f1.get_father_id()) + dad2 = get_name_obj(f2.get_father_id()) value = self.name_match(dad1,dad2) @@ -479,8 +479,8 @@ class Merge: chance = chance + value - mom1 = get_name_obj(f1.getMother()) - mom2 = get_name_obj(f2.getMother()) + mom1 = get_name_obj(f1.get_mother_id()) + mom2 = get_name_obj(f2.get_mother_id()) value = self.name_match(mom1,mom2) if value == -1: @@ -488,11 +488,11 @@ class Merge: chance = chance + value - for f1 in p1.getFamilyList(): - for f2 in p2.getFamilyList(): - if p1.getGender() == RelLib.Person.female: - father1 = f1.getFather() - father2 = f2.getFather() + for f1 in p1.get_family_id_list(): + for f2 in p2.get_family_id_list(): + if p1.get_gender() == RelLib.Person.female: + father1 = f1.get_father_id() + father2 = f2.get_father_id() if father1 and father2: if father1 == father2: chance = chance + 1 @@ -503,8 +503,8 @@ class Merge: if value != -1: chance = chance + value else: - mother1 = f1.getMother() - mother2 = f2.getMother() + mother1 = f1.get_mother_id() + mother2 = f2.get_mother_id() if mother1 and mother2: if mother1 == mother2: chance = chance + 1 @@ -521,11 +521,11 @@ class Merge: def name_of(p): if not p: return "" - return "%s (%s)" % ( GrampsCfg.nameof(p),p.getId()) + return "%s (%s)" % ( GrampsCfg.nameof(p),p.get_id()) def get_name_obj(person): if person: - return person.getPrimaryName() + return person.get_primary_name() else: return None @@ -547,7 +547,7 @@ def runTool(database,active_person,callback): # #------------------------------------------------------------------------- def by_id(p1,p2): - return cmp(p1.getId(),p2.getId()) + return cmp(p1.get_id(),p2.get_id()) #------------------------------------------------------------------------- # diff --git a/src/plugins/Partition.py b/src/plugins/Partition.py index d297be39c..e96d25c7b 100644 --- a/src/plugins/Partition.py +++ b/src/plugins/Partition.py @@ -61,34 +61,34 @@ prefix = "/tmp/test" def work_on_person( db, person ): global personSeen - if (len(person.getFamilyList()) + len(person.getParentList())) > 0: + if (len(person.get_family_id_list()) + len(person.get_parent_family_id_list())) > 0: database = db else: database = database_for_unlinked_persons - if( database.getPersonMap().has_key( person.getId() ) ): + if( database.get_person_id_map().has_key( person.get_id() ) ): return - database.addPersonNoMap( person, person.getId() ) + database.add_person_no_map( person, person.get_id() ) personSeen.append(person) - for source_ref in person.getPrimaryName().getSourceRefList(): + for source_ref in person.get_primary_name().get_source_references(): work_on_sourceref( database, source_ref) - for name in person.getAlternateNames(): - for source_ref in name.getSourceRefList(): + for name in person.get_alternate_names(): + for source_ref in name.get_source_references(): work_on_sourceref( database, source_ref) - work_on_event( database, person.getBirth() ) - work_on_event( database, person.getDeath() ) - for event in person.getEventList(): + work_on_event( database, person.get_birth() ) + work_on_event( database, person.get_death() ) + for event in person.get_event_list(): work_on_event(database, event) # recursion - for fam in person.getFamilyList(): + for fam in person.get_family_id_list(): work_on_family( database, fam ) - for fam in person.getParentList(): + for fam in person.get_parent_family_id_list(): work_on_family( database, fam[0] ) #------------------------------------------------------------------------- @@ -98,27 +98,27 @@ def work_on_person( db, person ): #------------------------------------------------------------------------- def work_on_family( database, family ): global familySeen - if database.getFamilyMap().has_key( family.getId() ): + if database.get_family_id_map().has_key( family.get_id() ): return - database.getFamilyMap()[family.getId()] = family + database.get_family_id_map()[family.get_id()] = family familySeen.append(family) - work_on_event( database, family.getMarriage() ) - for event in family.getEventList(): + work_on_event( database, family.get_marriage() ) + for event in family.get_event_list(): work_on_event(database, event) # recursion - father = family.getFather() + father = family.get_father_id() if( father != None ): work_on_person( database, father ) - mother = family.getMother() + mother = family.get_mother_id() if( mother != None ): work_on_person( database, mother ) - for person in family.getChildList(): + for person in family.get_child_id_list(): work_on_person( database, person ) #------------------------------------------------------------------------- @@ -130,14 +130,14 @@ def work_on_sourceref( database, source_ref ): if source_ref == None: return - source = source_ref.getBase() + source = source_ref.get_base_id() if source == None: return - if database.getSourceMap().has_key(source.getId()): + if database.get_source_map().has_key(source.get_id()): return - database.addSourceNoMap( source, source.getId() ); + database.add_source_no_map( source, source.get_id() ); #------------------------------------------------------------------------- @@ -149,10 +149,10 @@ def work_on_event( database, event ): if event == None: return - for source_ref in event.getSourceRefList(): + for source_ref in event.get_source_references(): work_on_sourceref( database, source_ref) - work_on_place( database, event.getPlace() ) + work_on_place( database, event.get_place_id() ) #------------------------------------------------------------------------- @@ -164,9 +164,9 @@ def work_on_place( database, place ): if place == None: return - if place in database.getPlaces(): + if place in database.get_place_ids(): return - database.addPlaceNoMap(place, place.getId()) + database.add_place_no_map(place, place.get_id()) #------------------------------------------------------------------------- # @@ -180,12 +180,12 @@ def report(db, person): text = "=== Partitions ===\n" count = 0 - for p in db.getPersonMap().values(): + for p in db.get_person_id_map().values(): if not p in personSeen: database = RelLib.GrampsDB() work_on_person( database, p ) - person_len = len(database.getPersonKeys()) + person_len = len(database.get_person_keys()) if person_len > 0: g = WriteXML.XmlWriter(database,None,0,0) g.write(prefix+str(count)+".xml") @@ -194,7 +194,7 @@ def report(db, person): g = WriteXML.XmlWriter(database_for_unlinked_persons,None,0,0) g.write(prefix+".xml") - text += "partition "+prefix+".xml written ( "+str(len(database_for_unlinked_persons.getPersonKeys()))+" persons)\n" + text += "partition "+prefix+".xml written ( "+str(len(database_for_unlinked_persons.get_person_keys()))+" persons)\n" base = os.path.dirname(__file__) glade_file = "%s/summary.glade" % base diff --git a/src/plugins/PatchNames.py b/src/plugins/PatchNames.py index 9f0459b09..fe5d67a2d 100644 --- a/src/plugins/PatchNames.py +++ b/src/plugins/PatchNames.py @@ -81,10 +81,10 @@ class PatchNames: self.title_list = [] self.nick_list = [] - for key in self.db.getPersonKeys(): + for key in self.db.get_person_keys(): - person = self.db.getPerson(key) - first = person.getPrimaryName().getFirstName() + person = self.db.get_person(key) + first = person.get_primary_name().get_first_name() match = _title_re.match(first) if match: groups = match.groups() @@ -151,23 +151,23 @@ class PatchNames: self.title_hash = {} for (id,name,nick) in self.nick_list: - p = self.db.getPerson(id) + p = self.db.get_person(id) iter = self.model.append() self.model.set_value(iter,0,1) self.model.set_value(iter,1,id) self.model.set_value(iter,2,_('Nickname')) self.model.set_value(iter,3,nick) - self.model.set_value(iter,4,p.getPrimaryName().getName()) + self.model.set_value(iter,4,p.get_primary_name().get_name()) self.nick_hash[id] = iter for (id,title,nick) in self.title_list: - p = self.db.getPerson(id) + p = self.db.get_person(id) iter = self.model.append() self.model.set_value(iter,0,1) self.model.set_value(iter,1,id) self.model.set_value(iter,2,_('Title')) self.model.set_value(iter,3,nick) - self.model.set_value(iter,4,p.getPrimaryName().getName()) + self.model.set_value(iter,4,p.get_primary_name().get_name()) self.title_hash[id] = iter def on_ok_clicked(self,obj): @@ -175,22 +175,22 @@ class PatchNames: iter = self.nick_hash[grp[0]] val = self.model.get_value(iter,0) if val: - p = self.db.getPerson(grp[0]) - name = p.getPrimaryName() - name.setFirstName(grp[1]) - p.setNickName(grp[2]) - self.db.buildPersonDisplay(grp[0]) + p = self.db.get_person(grp[0]) + name = p.get_primary_name() + name.set_first_name(grp[1]) + p.set_nick_name(grp[2]) + self.db.build_person_display(grp[0]) Utils.modified() for grp in self.title_list: iter = self.title_hash[grp[0]] val = self.model.get_value(iter,0) if val: - p = self.db.getPerson(grp[0]) - name = p.getPrimaryName() - name.setFirstName(grp[2]) - name.setTitle(grp[1]) - self.db.buildPersonDisplay(grp[0]) + p = self.db.get_person(grp[0]) + name = p.get_primary_name() + name.set_first_name(grp[2]) + name.set_title(grp[1]) + self.db.build_person_display(grp[0]) Utils.modified() Utils.destroy_passed_object(obj) diff --git a/src/plugins/ReadGedcom.py b/src/plugins/ReadGedcom.py index 267ce8f92..8e77c3677 100644 --- a/src/plugins/ReadGedcom.py +++ b/src/plugins/ReadGedcom.py @@ -433,38 +433,38 @@ class GedcomParser: self.ignore_sub_junk(1) def parse_source(self,name,level): - self.source = self.db.findSource(name,self.smap) + self.source = self.db.find_source(name,self.smap) note = "" while 1: matches = self.get_next() if int(matches[0]) < level: if note: - self.source.setNote(note) - if not self.source.getTitle(): - self.source.setTitle("No title - ID %s" % self.source.getId()) - self.db.buildSourceDisplay(self.source.getId()) + self.source.set_note(note) + if not self.source.get_title(): + self.source.set_title("No title - ID %s" % self.source.get_id()) + self.db.build_source_display(self.source.get_id()) self.backup() return elif matches[1] == "TITL": title = matches[2] + self.parse_continue_data(level+1) title = string.replace(title,'\n',' ') - self.source.setTitle(title) + self.source.set_title(title) elif matches[1] == "TAXT" or matches[1] == "PERI": # EasyTree Sierra On-Line - if self.source.getTitle() == "": + if self.source.get_title() == "": title = matches[2] + self.parse_continue_data(level+1) title = string.replace(title,'\n',' ') - self.source.setTitle(title) + self.source.set_title(title) elif matches[1] == "AUTH": - self.source.setAuthor(matches[2] + self.parse_continue_data(level+1)) + self.source.set_author(matches[2] + self.parse_continue_data(level+1)) elif matches[1] == "PUBL": - self.source.setPubInfo(matches[2] + self.parse_continue_data(level+1)) + self.source.set_publication_info(matches[2] + self.parse_continue_data(level+1)) elif matches[1] == "OBJE": self.ignore_sub_junk(2) elif matches[1] == "NOTE": note = self.parse_note(matches,self.source,level+1,note) elif matches[1] == "TEXT": - note = self.source.getNote() + note = self.source.get_note() d = self.parse_continue_data(level+1) if note: note = "%s\n%s %s%s" % (note,matches[1],matches[2],d) @@ -473,7 +473,7 @@ class GedcomParser: elif matches[1] == "ABBR": self.source.setAbbrev(matches[2] + self.parse_continue_data(level+1)) else: - note = self.source.getNote() + note = self.source.get_note() if note: note = "%s\n%s %s" % (note,matches[1],matches[2]) else: @@ -486,17 +486,17 @@ class GedcomParser: if self.fam_count % UPDATE == 0 and self.window: self.update(self.families_obj,str(self.fam_count)) self.fam_count = self.fam_count + 1 - self.family = self.db.findFamily(matches[1],self.fmap) + self.family = self.db.find_family_with_map(matches[1],self.fmap) self.parse_family() if self.addr != None: - father = self.family.getFather() + father = self.family.get_father_id() if father: - father.addAddress(self.addr) - mother = self.family.getMother() + father.add_address(self.addr) + mother = self.family.get_mother_id() if mother: - mother.addAddress(self.addr) - for child in self.family.getChildList(): - child.addAddress(self.addr) + mother.add_address(self.addr) + for child in self.family.get_child_id_list(): + child.add_address(self.addr) elif matches[2] == "INDI": if self.indi_count % UPDATE == 0 and self.window: self.update(self.people_obj,str(self.indi_count)) @@ -504,9 +504,9 @@ class GedcomParser: id = matches[1] id = id[1:-1] self.person = self.find_or_create_person(id) - self.added[self.person.getId()] = self.person + self.added[self.person.get_id()] = self.person self.parse_individual() - self.db.buildPersonDisplay(self.person.getId()) + self.db.build_person_display(self.person.get_id()) elif matches[2] in ["SUBM","SUBN","REPO"]: self.ignore_sub_junk(1) elif matches[1] in ["SUBM","SUBN","OBJE","_EVENT_DEFN"]: @@ -531,13 +531,13 @@ class GedcomParser: def find_or_create_person(self,id): if self.pmap.has_key(id): - person = self.db.findPersonNoMap(self.pmap[id]) - elif self.db.getPersonMap().has_key(id): + person = self.db.find_person_from_id(self.pmap[id]) + elif self.db.get_person_id_map().has_key(id): person = RelLib.Person() - self.pmap[id] = self.db.addPerson(person) + self.pmap[id] = self.db.add_person(person) else: person = RelLib.Person(id) - self.db.addPersonAs(person) + self.db.add_person_as(person) self.pmap[id] = id return person @@ -548,7 +548,7 @@ class GedcomParser: self.backup() return elif matches[1] == "SOUR": - event.addSourceRef(self.handle_source(matches,level+1)) + event.add_source_reference(self.handle_source(matches,level+1)) else: self.barf(1) @@ -607,42 +607,42 @@ class GedcomParser: elif matches[1] == "HUSB": id = matches[2] person = self.find_or_create_person(id[1:-1]) - self.family.setFather(person) + self.family.set_father_id(person) self.ignore_sub_junk(2) elif matches[1] == "WIFE": id = matches[2] person = self.find_or_create_person(id[1:-1]) - self.family.setMother(person) + self.family.set_mother_id(person) self.ignore_sub_junk(2) elif matches[1] == "SLGS": ord = RelLib.LdsOrd() - self.family.setLdsSeal(ord) + self.family.set_lds_sealing(ord) self.parse_ord(ord,2) elif matches[1] == "ADDR": self.addr = RelLib.Address() - self.addr.setStreet(matches[2] + self.parse_continue_data(1)) + self.addr.set_street(matches[2] + self.parse_continue_data(1)) self.parse_address(self.addr,2) elif matches[1] == "CHIL": mrel,frel = self.parse_ftw_relations(2) id = matches[2] child = self.find_or_create_person(id[1:-1]) - self.family.addChild(child) + self.family.add_child_id(child) - for f in child.getParentList(): + for f in child.get_parent_family_id_list(): if f[0] == self.family: break else: if (mrel=="Birth" or mrel=="") and (frel=="Birth" or frel==""): - child.setMainParents(self.family) + child.set_main_parent_family_id(self.family) else: - if child.getMainParents() == self.family: - child.setMainParents(None) - child.addAltFamily(self.family,mrel,frel) + if child.get_main_parents_family_id() == self.family: + child.set_main_parent_family_id(None) + child.add_parent_family_id(self.family,mrel,frel) elif matches[1] == "NCHI": a = RelLib.Attribute() - a.setType("Number of Children") - a.setValue(matches[2]) - self.family.addAttribute(a) + a.set_type("Number of Children") + a.set_value(matches[2]) + self.family.add_attribute(a) elif matches[1] in ["RIN", "SUBM", "REFN","CHAN","SOUR"]: self.ignore_sub_junk(2) elif matches[1] == "OBJE": @@ -652,19 +652,19 @@ class GedcomParser: self.parse_family_object(2) elif matches[1] == "_COMM": note = string.strip(matches[2]) + self.parse_continue_data(1) - self.family.setNote(note) + self.family.set_note(note) self.ignore_sub_junk(2) elif matches[1] == "NOTE": note = self.parse_note(matches,self.family,1,note) else: event = RelLib.Event() try: - event.setName(ged2fam[matches[1]]) + event.set_name(ged2fam[matches[1]]) except: - event.setName(matches[1]) - if event.getName() == "Marriage": - self.family.setRelationship("Married") - self.family.addEvent(event) + event.set_name(matches[1]) + if event.get_name() == "Marriage": + self.family.set_relationship("Married") + self.family.add_event(event) self.parse_family_event(event,2) def parse_note_base(self,matches,obj,level,old_note,task): @@ -672,12 +672,12 @@ class GedcomParser: if matches[2] and matches[2][0] == "@": if self.nmap.has_key(matches[2]): self.share_note.append(obj) - obj.setNoteObj(self.nmap[matches[2]]) + obj.set_note_object(self.nmap[matches[2]]) else: noteobj = RelLib.Note() self.nmap[matches[2]] = noteobj self.share_note.append(obj) - obj.setNoteObj(noteobj) + obj.set_note_object(noteobj) else: if old_note: note = "%s\n%s%s" % (old_note,matches[2],self.parse_continue_data(level)) @@ -688,10 +688,10 @@ class GedcomParser: return note def parse_note(self,matches,obj,level,old_note): - self.parse_note_base(matches,obj,level,old_note,obj.setNote) + self.parse_note_base(matches,obj,level,old_note,obj.set_note) def parse_comment(self,matches,obj,level,old_note): - self.parse_note_base(matches,obj,level,old_note,obj.setComments) + self.parse_note_base(matches,obj,level,old_note,obj.set_comments) def parse_individual(self): name_cnt = 0 @@ -715,20 +715,18 @@ class GedcomParser: except: names = (matches[2],"","","","") if names[0]: - name.setFirstName(names[0].strip()) + name.set_first_name(names[0].strip()) if names[2]: - name.setSurname(names[2].strip()) - self.db.addSurname(names[2].strip()) + name.set_surname(names[2].strip()) + self.db.add_surname(names[2].strip()) if names[4]: - name.setSuffix(names[4].strip()) + name.set_suffix(names[4].strip()) if name_cnt == 0: - self.person.setPrimaryName(name) + self.person.set_primary_name(name) else: - self.person.addAlternateName(name) + self.person.add_alternate_name(name) name_cnt = name_cnt + 1 self.parse_name(name,2) - elif matches[1] == "_UID": - self.person.setPafUid(matches[2]) elif matches[1] in ["ALIA","_ALIA"]: aka = RelLib.Name() try: @@ -736,13 +734,13 @@ class GedcomParser: except: names = (matches[2],"","","","") if names[0]: - aka.setFirstName(names[0]) + aka.set_first_name(names[0]) if names[2]: - aka.setSurname(names[2]) - self.db.addSurname(names[2]) + aka.set_surname(names[2]) + self.db.add_surname(names[2]) if names[4]: - aka.setSuffix(names[4]) - self.person.addAlternateName(aka) + aka.set_suffix(names[4]) + self.person.add_alternate_name(aka) elif matches[1] == "OBJE": if matches[2] and matches[2][0] == '@': self.barf(2) @@ -752,132 +750,132 @@ class GedcomParser: note = self.parse_note(matches,self.person,1,note) elif matches[1] == "SEX": if matches[2] == '': - self.person.setGender(RelLib.Person.unknown) + self.person.set_gender(RelLib.Person.unknown) elif matches[2][0] == "M": - self.person.setGender(RelLib.Person.male) + self.person.set_gender(RelLib.Person.male) else: - self.person.setGender(RelLib.Person.female) + self.person.set_gender(RelLib.Person.female) elif matches[1] in [ "BAPL", "ENDL", "SLGC" ]: ord = RelLib.LdsOrd() if matches[1] == "BAPL": - self.person.setLdsBaptism(ord) + self.person.set_lds_baptism(ord) elif matches[1] == "ENDL": - self.person.setLdsEndowment(ord) + self.person.set_lds_endowment(ord) else: - self.person.setLdsSeal(ord) + self.person.set_lds_sealing(ord) self.parse_ord(ord,2) elif matches[1] == "FAMS": - family = self.db.findFamily(matches[2],self.fmap) - self.person.addFamily(family) + family = self.db.find_family_with_map(matches[2],self.fmap) + self.person.add_family_id(family) if note == "": note = self.parse_optional_note(2) else: note = "%s\n\n%s" % (note,self.parse_optional_note(2)) elif matches[1] == "FAMC": type,note = self.parse_famc_type(2) - family = self.db.findFamily(matches[2],self.fmap) + family = self.db.find_family_with_map(matches[2],self.fmap) - for f in self.person.getParentList(): + for f in self.person.get_parent_family_id_list(): if f[0] == family: break else: if type == "" or type == "Birth": - if self.person.getMainParents() == None: - self.person.setMainParents(family) + if self.person.get_main_parents_family_id() == None: + self.person.set_main_parent_family_id(family) else: - self.person.addAltFamily(family,"Unknown","Unknown") + self.person.add_parent_family_id(family,"Unknown","Unknown") else: - if self.person.getMainParents() == family: - self.person.setMainParents(None) - self.person.addAltFamily(family,type,type) + if self.person.get_main_parents_family_id() == family: + self.person.set_main_parent_family_id(None) + self.person.add_parent_family_id(family,type,type) elif matches[1] == "RESI": addr = RelLib.Address() - self.person.addAddress(addr) + self.person.add_address(addr) self.parse_residence(addr,2) elif matches[1] == "ADDR": addr = RelLib.Address() - addr.setStreet(matches[2] + self.parse_continue_data(1)) + addr.set_street(matches[2] + self.parse_continue_data(1)) self.parse_address(addr,2) - self.person.addAddress(addr) + self.person.add_address(addr) elif matches[1] == "PHON": addr = RelLib.Address() - addr.setStreet("Unknown") - addr.setPhone(matches[2]) - self.person.addAddress(addr) + addr.set_street("Unknown") + addr.set_phone(matches[2]) + self.person.add_address(addr) elif matches[1] == "BIRT": event = RelLib.Event() - if self.person.getBirth().getDate() != "" or \ - self.person.getBirth().getPlace() != None: - event.setName("Alternate Birth") - self.person.addEvent(event) + if self.person.get_birth().get_date() != "" or \ + self.person.get_birth().get_place_id() != None: + event.set_name("Alternate Birth") + self.person.add_event(event) else: - event.setName("Birth") - self.person.setBirth(event) + event.set_name("Birth") + self.person.set_birth(event) self.parse_person_event(event,2) elif matches[1] == "ADOP": event = RelLib.Event() - event.setName("Adopted") - self.person.addEvent(event) + event.set_name("Adopted") + self.person.add_event(event) self.parse_adopt_event(event,2) elif matches[1] == "DEAT": event = RelLib.Event() - if self.person.getDeath().getDate() != "" or \ - self.person.getDeath().getPlace() != None: - event.setName("Alternate Death") - self.person.addEvent(event) + if self.person.get_death().get_date() != "" or \ + self.person.get_death().get_place_id() != None: + event.set_name("Alternate Death") + self.person.add_event(event) else: - event.setName("Death") - self.person.setDeath(event) + event.set_name("Death") + self.person.set_death(event) self.parse_person_event(event,2) elif matches[1] == "EVEN": event = RelLib.Event() if matches[2]: event.setDescription(matches[2]) self.parse_person_event(event,2) - n = string.strip(event.getName()) + n = string.strip(event.get_name()) if n in self.attrs: attr = RelLib.Attribute() - attr.setType(self.gedattr[n]) - attr.setValue(event.getDescription()) - self.person.addAttribute(attr) + attr.set_type(self.gedattr[n]) + attr.set_value(event.get_description()) + self.person.add_attribute(attr) else: - self.person.addEvent(event) + self.person.add_event(event) elif matches[1] == "SOUR": source_ref = self.handle_source(matches,2) - self.person.getPrimaryName().addSourceRef(source_ref) + self.person.get_primary_name().add_source_reference(source_ref) elif matches[1] == "REFN": if intRE.match(matches[2]): try: - self.refn[self.person.getId()] = int(matches[2]) + self.refn[self.person.get_id()] = int(matches[2]) except: pass elif matches[1] in ["AFN","CHAN","REFN","ASSO"]: self.ignore_sub_junk(2) - elif matches[1] in ["ANCI","DESI","RIN","RFN"]: + elif matches[1] in ["ANCI","DESI","RIN","RFN","_UID"]: pass else: event = RelLib.Event() n = string.strip(matches[1]) if ged2gramps.has_key(n): - event.setName(ged2gramps[n]) + event.set_name(ged2gramps[n]) elif self.gedattr.has_key(n): attr = RelLib.Attribute() - attr.setType(self.gedattr[n]) - attr.setValue(event.getDescription()) - self.person.addAttribute(attr) + attr.set_type(self.gedattr[n]) + attr.set_value(event.get_description()) + self.person.add_attribute(attr) self.parse_person_attr(attr,2) continue else: val = self.gedsource.tag2gramps(n) if val: - event.setName(val) + event.set_name(val) else: - event.setName(n) + event.set_name(n) self.parse_person_event(event,2) if matches[2]: - event.setDescription(matches[2]) - self.person.addEvent(event) + event.set_description(matches[2]) + self.person.add_event(event) def parse_optional_note(self,level): note = "" @@ -909,7 +907,7 @@ class GedcomParser: type = matches[2] elif matches[1] == "SOUR": source_ref = self.handle_source(matches,level+1) - self.person.getPrimaryName().addSourceRef(source_ref) + self.person.get_primary_name().add_source_reference(source_ref) elif matches[1] == "_PRIMARY": type = matches[1] elif matches[1] == "NOTE": @@ -948,7 +946,7 @@ class GedcomParser: url = RelLib.Url() url.set_path(file) url.set_description(title) - self.person.addUrl(url) + self.person.add_url(url) else: (ok,path) = self.find_file(file,self.dir_path) if not ok: @@ -958,13 +956,13 @@ class GedcomParser: self.warn('\n') else: photo = RelLib.Photo() - photo.setPath(path) - photo.setDescription(title) - photo.setMimeType(Utils.get_mime_type(path)) - self.db.addObject(photo) + photo.set_path(path) + photo.set_description(title) + photo.set_mime_type(Utils.get_mime_type(path)) + self.db.add_object(photo) oref = RelLib.ObjectRef() - oref.setReference(photo) - self.person.addPhoto(oref) + oref.set_reference(photo) + self.person.add_photo(oref) def parse_family_object(self,level): form = "" @@ -996,13 +994,13 @@ class GedcomParser: self.warn('\n') else: photo = RelLib.Photo() - photo.setPath(path) - photo.setDescription(title) - photo.setMimeType(Utils.get_mime_type(path)) - self.db.addObject(photo) + photo.set_path(path) + photo.set_description(title) + photo.set_mime_type(Utils.get_mime_type(path)) + self.db.add_object(photo) oref = RelLib.ObjectRef() - oref.setReference(photo) - self.family.addPhoto(photo) + oref.set_reference(photo) + self.family.add_photo(photo) def parse_residence(self,address,level): note = "" @@ -1013,20 +1011,20 @@ class GedcomParser: self.backup() return elif matches[1] == "DATE": - address.setDateObj(self.extract_date(matches[2])) + address.set_date_object(self.extract_date(matches[2])) elif matches[1] == "ADDR": - address.setStreet(matches[2] + self.parse_continue_data(level+1)) + address.set_street(matches[2] + self.parse_continue_data(level+1)) self.parse_address(address,level+1) elif matches[1] in ["AGE","AGNC","CAUS","STAT","TEMP","OBJE","TYPE","_DATE2"]: self.ignore_sub_junk(level+1) elif matches[1] == "SOUR": - address.addSourceRef(self.handle_source(matches,level+1)) + address.add_source_reference(self.handle_source(matches,level+1)) elif matches[1] == "PLAC": - address.setStreet(matches[2]) + address.set_street(matches[2]) self.parse_address(address,level+1) elif matches[1] == "PHON": - address.setStreet("Unknown") - address.setPhone(matches[2]) + address.set_street("Unknown") + address.set_phone(matches[2]) elif matches[1] == "NOTE": note = self.parse_note(matches,address,level+1,note) else: @@ -1039,25 +1037,25 @@ class GedcomParser: matches = self.get_next() if int(matches[0]) < level: if matches[1] == "PHON": - address.setPhone(matches[2]) + address.set_phone(matches[2]) else: self.backup() return elif matches[1] in [ "ADDR", "ADR1", "ADR2" ]: - val = address.getStreet() + val = address.get_street() data = self.parse_continue_data(level+1) if first == 0: val = "%s %s" % (matches[2],data) first = 1 else: val = "%s,%s %s" % (val,matches[2],data) - address.setStreet(val) + address.set_street(val) elif matches[1] == "CITY": - address.setCity(matches[2]) + address.set_city(matches[2]) elif matches[1] == "STAE": - address.setState(matches[2]) + address.set_state(matches[2]) elif matches[1] == "POST": - address.setPostal(matches[2]) + address.set_postal_code(matches[2]) elif matches[1] == "CTRY": address.setCountry(matches[2]) else: @@ -1071,11 +1069,11 @@ class GedcomParser: self.backup() break elif matches[1] == "TEMP": - ord.setTemple(matches[2]) + ord.set_temple(matches[2]) elif matches[1] == "DATE": - ord.setDateObj(self.extract_date(matches[2])) + ord.set_date_object(self.extract_date(matches[2])) elif matches[1] == "FAMC": - ord.setFamily(self.db.findFamily(matches[2],self.fmap)) + ord.set_family_id(self.db.find_family_with_map(matches[2],self.fmap)) elif matches[1] == "PLAC": try: val = matches[2] @@ -1084,19 +1082,19 @@ class GedcomParser: else: place = RelLib.Place() place.set_title(matches[2]) - self.db.addPlace(place) + self.db.add_place(place) self.placemap[val] = place - ord.setPlace(place) + ord.set_place_id(place) self.ignore_sub_junk(level+1) except NameError: pass elif matches[1] == "SOUR": - ord.addSourceRef(self.handle_source(matches,level+1)) + ord.add_source_reference(self.handle_source(matches,level+1)) elif matches[1] == "NOTE": note = self.parse_note(matches,ord,level+1,note) elif matches[1] == "STAT": if const.lds_status.has_key(matches[2]): - ord.setStatus(const.lds_status[matches[2]]) + ord.set_status(const.lds_status[matches[2]]) else: self.barf(level+1) @@ -1106,11 +1104,11 @@ class GedcomParser: matches = self.get_next() if int(matches[0]) < level: if note: - event.setNote(note) + event.set_note(note) self.backup() break elif matches[1] == "TYPE": - if event.getName() == "": + if event.get_name() == "": if ged2gramps.has_key(matches[2]): name = ged2gramps[matches[2]] else: @@ -1119,16 +1117,16 @@ class GedcomParser: name = val else: name = matches[2] - event.setName(name) + event.set_name(name) elif matches[1] == "DATE": - event.setDateObj(self.extract_date(matches[2])) + event.set_date_object(self.extract_date(matches[2])) elif matches[1] == "SOUR": - event.addSourceRef(self.handle_source(matches,level+1)) + event.add_source_reference(self.handle_source(matches,level+1)) elif matches[1] == "PLAC": val = matches[2] - n = string.strip(event.getName()) + n = string.strip(event.get_name()) if self.is_ftw and n in ["Occupation","Degree","SSN"]: - event.setDescription(val) + event.set_description(val) self.ignore_sub_junk(level+1) else: if self.placemap.has_key(val): @@ -1136,13 +1134,13 @@ class GedcomParser: else: place = RelLib.Place() place.set_title(matches[2]) - self.db.addPlace(place) + self.db.add_place(place) self.placemap[val] = place - event.setPlace(place) + event.set_place_id(place) self.ignore_sub_junk(level+1) elif matches[1] == "CAUS": info = matches[2] + self.parse_continue_data(level+1) - event.setCause(info) + event.set_cause(info) self.parse_cause(event,level+1) elif matches[1] == "NOTE" or matches[1] == 'OFFI': info = matches[2] + self.parse_continue_data(level+1) @@ -1151,13 +1149,13 @@ class GedcomParser: else: note = "\n%s" % info elif matches[1] == "CONC": - d = event.getDescription() + d = event.get_description() if self.broken_conc: - event.setDescription("%s %s" % (d, matches[2])) + event.set_description("%s %s" % (d, matches[2])) else: - event.setDescription("%s%s" % (d, matches[2])) + event.set_description("%s%s" % (d, matches[2])) elif matches[1] == "CONT": - event.setDescription("%s\n%s" % (event.getDescription(),matches[2])) + event.set_description("%s\n%s" % (event.get_description(),matches[2])) elif matches[1] in ["RELI", "TIME","ADDR","AGE","AGNC","STAT","TEMP","OBJE","_DATE2"]: self.ignore_sub_junk(level+1) else: @@ -1169,21 +1167,21 @@ class GedcomParser: matches = self.get_next() if int(matches[0]) < level: if note != "": - event.setNote(note) + event.set_note(note) self.backup() break elif matches[1] == "DATE": - event.setDateObj(self.extract_date(matches[2])) + event.set_date_object(self.extract_date(matches[2])) elif matches[1] in ["TIME","ADDR","AGE","AGNC","STAT","TEMP","OBJE"]: self.ignore_sub_junk(level+1) elif matches[1] == "SOUR": - event.addSourceRef(self.handle_source(matches,level+1)) + event.add_source_reference(self.handle_source(matches,level+1)) elif matches[1] == "FAMC": - family = self.db.findFamily(matches[2],self.fmap) + family = self.db.find_family_with_map(matches[2],self.fmap) mrel,frel = self.parse_adopt_famc(level+1); - if self.person.getMainParents() == family: - self.person.setMainParents(None) - self.person.addAltFamily(family,mrel,frel) + if self.person.get_main_parents_family_id() == family: + self.person.set_main_parent_family_id(None) + self.person.add_parent_family_id(family,mrel,frel) elif matches[1] == "PLAC": val = matches[2] if self.placemap.has_key(val): @@ -1191,16 +1189,16 @@ class GedcomParser: else: place = RelLib.Place() place.set_title(matches[2]) - self.db.addPlace(place) + self.db.add_place(place) self.placemap[val] = place - event.setPlace(place) + event.set_place_id(place) self.ignore_sub_junk(level+1) elif matches[1] == "TYPE": # eventually do something intelligent here pass elif matches[1] == "CAUS": info = matches[2] + self.parse_continue_data(level+1) - event.setCause(info) + event.set_cause(info) self.parse_cause(event,level+1) elif matches[1] == "NOTE": info = matches[2] + self.parse_continue_data(level+1) @@ -1209,14 +1207,14 @@ class GedcomParser: else: note = "\n%s" % info elif matches[1] == "CONC": - d = event.getDescription() + d = event.get_description() if self.broken_conc: - event.setDescription("%s %s" % (d,matches[2])) + event.set_description("%s %s" % (d,matches[2])) else: - event.setDescription("%s%s" % (d,matches[2])) + event.set_description("%s%s" % (d,matches[2])) elif matches[1] == "CONT": - d = event.getDescription() - event.setDescription("%s\n%s" % (d,matches[2])) + d = event.get_description() + event.set_description("%s\n%s" % (d,matches[2])) else: self.barf(level+1) @@ -1244,7 +1242,7 @@ class GedcomParser: self.backup() break elif matches[1] == "TYPE": - if attr.getType() == "": + if attr.get_type() == "": if ged2gramps.has_key(matches[2]): name = ged2gramps[matches[2]] else: @@ -1253,15 +1251,15 @@ class GedcomParser: name = val else: name = matches[2] - attr.setName(name) + attr.set_name(name) elif matches[1] in ["CAUS", "DATE","TIME","ADDR","AGE","AGNC","STAT","TEMP","OBJE"]: self.ignore_sub_junk(level+1) elif matches[1] == "SOUR": - attr.addSourceRef(self.handle_source(matches,level+1)) + attr.add_source_reference(self.handle_source(matches,level+1)) elif matches[1] == "PLAC": val = matches[2] - if attr.getValue() == "": - attr.setValue(val) + if attr.get_value() == "": + attr.set_value(val) self.ignore_sub_junk(level+1) elif matches[1] == "DATE": note = "%s\n\n" % ("Date : %s" % matches[2]) @@ -1273,15 +1271,15 @@ class GedcomParser: note = "%s\n\n%s" % (note,info) elif matches[1] == "CONC": if self.broken_conc: - attr.setValue("%s %s" % (attr.getValue(), matches[2])) + attr.set_value("%s %s" % (attr.get_value(), matches[2])) else: - attr.setValue("%s %s" % (attr.getValue(), matches[2])) + attr.set_value("%s %s" % (attr.get_value(), matches[2])) elif matches[1] == "CONT": - attr.setValue("%s\n%s" % (attr.getValue(),matches[2])) + attr.set_value("%s\n%s" % (attr.get_value(),matches[2])) else: self.barf(level+1) if note != "": - attr.setNote(note) + attr.set_note(note) def parse_family_event(self,event,level): note = "" @@ -1289,28 +1287,28 @@ class GedcomParser: matches = self.get_next() if int(matches[0]) < level: if note: - event.setNote(note) + event.set_note(note) self.backup() break elif matches[1] == "TYPE": - if event.getName() == "" or event.getName() == 'EVEN': + if event.get_name() == "" or event.get_name() == 'EVEN': try: - event.setName(ged2fam[matches[2]]) + event.set_name(ged2fam[matches[2]]) except: - event.setName(matches[2]) + event.set_name(matches[2]) else: note = 'Status = %s\n' % matches[2] elif matches[1] == "DATE": - event.setDateObj(self.extract_date(matches[2])) + event.set_date_object(self.extract_date(matches[2])) elif matches[1] == "CAUS": info = matches[2] + self.parse_continue_data(level+1) - event.setCause(info) + event.set_cause(info) self.parse_cause(event,level+1) elif matches[1] in ["TIME","AGE","AGNC","ADDR","STAT", "TEMP","HUSB","WIFE","OBJE","_CHUR"]: self.ignore_sub_junk(level+1) elif matches[1] == "SOUR": - event.addSourceRef(self.handle_source(matches,level+1)) + event.add_source_reference(self.handle_source(matches,level+1)) elif matches[1] == "PLAC": val = matches[2] if self.placemap.has_key(val): @@ -1318,9 +1316,9 @@ class GedcomParser: else: place = RelLib.Place() place.set_title(matches[2]) - self.db.addPlace(place) + self.db.add_place(place) self.placemap[val] = place - event.setPlace(place) + event.set_place_id(place) self.ignore_sub_junk(level+1) elif matches[1] == 'OFFI': if note == "": @@ -1342,21 +1340,21 @@ class GedcomParser: self.backup() return elif matches[1] == "PAGE": - source.setPage(matches[2] + self.parse_continue_data(level+1)) + source.set_page(matches[2] + self.parse_continue_data(level+1)) elif matches[1] == "DATA": date,text = self.parse_source_data(level+1) d = Date.Date() d.set(date) - source.setDate(d) - source.setText(text) + source.set_date(d) + source.set_text(text) elif matches[1] in ["OBJE","REFN","TEXT"]: self.ignore_sub_junk(level+1) elif matches[1] == "QUAY": val = int(matches[2]) if val > 1: - source.setConfidence(val+1) + source.set_confidence_level(val+1) else: - source.setConfidence(val) + source.set_confidence_level(val) elif matches[1] == "NOTE": note = self.parse_comment(matches,source,level+1,note) else: @@ -1393,44 +1391,44 @@ class GedcomParser: except: names = (matches[2],"","","","") if names[0]: - aka.setFirstName(names[0]) + aka.set_first_name(names[0]) if names[2]: - aka.setSurname(names[2]) - self.db.addSurname(names[2]) + aka.set_surname(names[2]) + self.db.add_surname(names[2]) if names[4]: - aka.setSuffix(names[4]) - self.person.addAlternateName(aka) + aka.set_suffix(names[4]) + self.person.add_alternate_name(aka) elif matches[1] == "NPFX": - name.setTitle(matches[2]) + name.set_title(matches[2]) elif matches[1] == "GIVN": - name.setFirstName(matches[2]) + name.set_first_name(matches[2]) elif matches[1] == "SPFX": - name.setSurnamePrefix(matches[2]) + name.set_surname_prefix(matches[2]) elif matches[1] == "SURN": - name.setSurname(matches[2]) - self.db.addSurname(matches[2]) + name.set_surname(matches[2]) + self.db.add_surname(matches[2]) elif matches[1] == "_MARNM": self.parse_marnm(self.person,matches[2].strip()) elif matches[1] == "TITL": - name.setSuffix(matches[2]) + name.set_suffix(matches[2]) elif matches[1] == "NSFX": - if name.getSuffix() == "": - name.setSuffix(matches[2]) + if name.get_suffix() == "": + name.set_suffix(matches[2]) elif matches[1] == "NICK": - self.person.setNickName(matches[2]) + self.person.set_nick_name(matches[2]) elif matches[1] == "_AKA": lname = string.split(matches[2]) l = len(lname) if l == 1: - self.person.setNickName(matches[2]) + self.person.set_nick_name(matches[2]) else: name = RelLib.Name() - name.setSurname(lname[-1]) - self.db.addSurname(lname[-1]) - name.setFirstName(string.join(lname[0:l-1])) - self.person.addAlternateName(name) + name.set_surname(lname[-1]) + self.db.add_surname(lname[-1]) + name.set_first_name(string.join(lname[0:l-1])) + self.person.add_alternate_name(name) elif matches[1] == "SOUR": - name.addSourceRef(self.handle_source(matches,level+1)) + name.add_source_reference(self.handle_source(matches,level+1)) elif matches[1][0:4] == "NOTE": note = self.parse_note(matches,name,level+1,note) else: @@ -1439,16 +1437,16 @@ class GedcomParser: def parse_marnm(self,person,text): data = text.split() if len(data) == 1: - name = RelLib.Name(person.getPrimaryName()) - name.setSurname(data[0]) - name.setType('Married Name') - person.addAlternateName(name) + name = RelLib.Name(person.get_primary_name()) + name.set_surname(data[0]) + name.set_type('Married Name') + person.add_alternate_name(name) elif len(data) > 1: name = RelLib.Name() - name.setSurname(data[-1]) - name.setFirstName(string.join(data[0:-1],' ')) - name.setType('Married Name') - person.addAlternateName(name) + name.set_surname(data[-1]) + name.set_first_name(string.join(data[0:-1],' ')) + name.set_type('Married Name') + person.add_alternate_name(name) def parse_header_head(self): """validiates that this is a valid GEDCOM file""" @@ -1681,14 +1679,14 @@ class GedcomParser: if matches[2] and matches[2][0] != "@": self.localref = self.localref + 1 ref = "gsr%d" % self.localref - s = self.db.findSource(ref,self.smap) - source_ref.setBase(s) - s.setTitle('Imported Source #%d' % self.localref) - s.setNote(matches[2] + self.parse_continue_data(level)) - self.db.buildSourceDisplay(s.getId()) + s = self.db.find_source(ref,self.smap) + source_ref.set_base_id(s) + s.set_title('Imported Source #%d' % self.localref) + s.set_note(matches[2] + self.parse_continue_data(level)) + self.db.build_source_display(s.get_id()) self.ignore_sub_junk(level+1) else: - source_ref.setBase(self.db.findSource(matches[2],self.smap)) + source_ref.set_base_id(self.db.find_source(matches[2],self.smap)) self.parse_source_reference(source_ref,level) return source_ref @@ -1696,7 +1694,7 @@ class GedcomParser: prefix = self.db.iprefix index = 0 new_pmax = self.db.pmapIndex - pmap = self.db.getPersonMap() + pmap = self.db.get_person_id_map() for pid, person in self.added.items(): index = index + 1 if self.refn.has_key(pid): @@ -1706,16 +1704,16 @@ class GedcomParser: # new ID is not used if not pmap.has_key(new_key): - self.db.removePerson(person.getId()) - person.setId(new_key) - self.db.addPersonAs(person) + self.db.remove_person_id(person.get_id()) + person.set_id(new_key) + self.db.add_person_as(person) else: tp = pmap[new_key] # same person, just change it if person == tp: - self.db.removePerson(person.getId()) - person.setId(new_key) - self.db.addPersonAs(person) + self.db.remove_person_id(person.get_id()) + person.set_id(new_key) + self.db.add_person_as(person) # give up trying to use the refn as a key else: pass diff --git a/src/plugins/RelCalc.py b/src/plugins/RelCalc.py index 5da341c12..cd7f30022 100644 --- a/src/plugins/RelCalc.py +++ b/src/plugins/RelCalc.py @@ -75,7 +75,7 @@ class RelCalc: glade_file = "%s/relcalc.glade" % base self.glade = gtk.glade.XML(glade_file,"relcalc","gramps") - name = self.person.getPrimaryName().getRegularName() + name = self.person.get_primary_name().get_regular_name() Utils.set_titles(self.glade.get_widget('relcalc'), self.glade.get_widget('title'), @@ -89,12 +89,12 @@ class RelCalc: ('',-1,0),('',-1,0)], self.on_apply_clicked) self.clist.new_model() - for key in self.db.getPersonKeys(): - p = self.db.getPerson(key) + for key in self.db.get_person_keys(): + p = self.db.get_person(key) if p == self.person: continue - val = self.db.getPersonDisplay(key) - self.clist.add([val[0],val[1],val[3],val[5],val[6]],p.getId()) + val = self.db.get_person_display(key) + self.clist.add([val[0],val[1],val[3],val[5],val[6]],p.get_id()) self.clist.connect_model() @@ -109,28 +109,28 @@ class RelCalc: return id = self.clist.get_object(iter) - other_person = self.db.getPerson(id) + other_person = self.db.get_person(id) (rel_string,common) = self.relationship(self.person,other_person) length = len(common) if length == 1: person = common[0] - name = person.getPrimaryName().getRegularName() + name = person.get_primary_name().get_regular_name() commontext = " " + _("Their common ancestor is %s.") % name elif length == 2: p1 = common[0] p2 = common[1] commontext = " " + _("Their common ancestors are %s and %s.") % \ - (p1.getPrimaryName().getRegularName(),\ - p2.getPrimaryName().getRegularName()) + (p1.get_primary_name().get_regular_name(),\ + p2.get_primary_name().get_regular_name()) elif length > 2: index = 0 commontext = " " + _("Their common ancestors are : ") for person in common: if index != 0: commontext = commontext + ", " - commontext = commontext + person.getPrimaryName().getRegularName() + commontext = commontext + person.get_primary_name().get_regular_name() index = index + 1 commontext = commontext + "." else: diff --git a/src/plugins/RelGraph.py b/src/plugins/RelGraph.py index 37e57ecbc..c736f5129 100644 --- a/src/plugins/RelGraph.py +++ b/src/plugins/RelGraph.py @@ -126,7 +126,7 @@ class RelGraphDialog(Report.ReportDialog): def get_report_filters(self): """Set up the list of possible content filters.""" - name = self.person.getPrimaryName().getName() + name = self.person.get_primary_name().get_name() all = GenericFilter.GenericFilter() all.set_name(_("Entire Database")) @@ -134,19 +134,19 @@ class RelGraphDialog(Report.ReportDialog): des = GenericFilter.GenericFilter() des.set_name(_("Descendants of %s") % name) - des.add_rule(GenericFilter.IsDescendantOf([self.person.getId()])) + des.add_rule(GenericFilter.IsDescendantOf([self.person.get_id()])) fam = GenericFilter.GenericFilter() fam.set_name(_("Descendant family members of %s") % name) - fam.add_rule(GenericFilter.IsDescendantFamilyOf([self.person.getId()])) + fam.add_rule(GenericFilter.IsDescendantFamilyOf([self.person.get_id()])) ans = GenericFilter.GenericFilter() ans.set_name(_("Ancestors of %s") % name) - ans.add_rule(GenericFilter.IsAncestorOf([self.person.getId()])) + ans.add_rule(GenericFilter.IsAncestorOf([self.person.get_id()])) com = GenericFilter.GenericFilter() com.set_name(_("People with common ancestor with %s") % name) - com.add_rule(GenericFilter.HasCommonAncestorWith([self.person.getId()])) + com.add_rule(GenericFilter.HasCommonAncestorWith([self.person.get_id()])) return [all, des, fam, ans, com] @@ -392,7 +392,7 @@ class RelGraphDialog(Report.ReportDialog): try: self.IndividualSet =\ - Set(self.filter.apply(self.db, self.db.getPersonMap().values())) + Set(self.filter.apply(self.db, self.db.get_person_id_map().values())) self.IndividualSet.add(self.person) except Errors.FilterError, msg: from QuestionDialog import ErrorDialog @@ -491,11 +491,11 @@ def _writeGraphBox (self): _writeNode(self.File, shape='ellipse', color='black', fontname=self.FontStyle) for individual in individualNodes: - for family in individual.getFamilyList(): + for family in individual.get_family_id_list(): if family not in familyNodes: familyNodes.add(family) - familyId = _getFamilyId(family) - label = _getFamilyLabel(self, family) + familyId = _get_family_idId(family) + label = _get_family_idLabel(self, family) _writeNode(self.File, familyId, label) # Links each individual to their parents/family self.File.write('\n// Individual edges\n') @@ -504,12 +504,12 @@ def _writeGraphBox (self): for individual in individualNodes: individualId = _getIndividualId(individual) for family, motherRelShip, fatherRelShip\ - in individual.getParentList(): - father = family.getFather() - mother = family.getMother() + in individual.get_parent_family_id_list(): + father = family.get_father_id() + mother = family.get_mother_id() if self.ShowFamilies and family in familyNodes: # edge from an individual to their family - familyId = _getFamilyId(family) + familyId = _get_family_idId(family) style = _getEdgeStyle(self, fatherRelShip, motherRelShip) _writeEdge(self.File, individualId, familyId, style) else: @@ -528,12 +528,12 @@ def _writeGraphBox (self): _writeEdge(self.File, style="solid", arrowHead=self.ArrowHeadStyle, arrowTail=self.ArrowTailStyle) for family in familyNodes: - familyId = _getFamilyId(family) - father = family.getFather() + familyId = _get_family_idId(family) + father = family.get_father_id() if father and father in individualNodes: fatherId = _getIndividualId(father) _writeEdge(self.File, familyId, fatherId) - mother = family.getMother() + mother = family.get_mother_id() if mother and mother in individualNodes: motherId = _getIndividualId(mother) _writeEdge(self.File, familyId, motherId) @@ -542,9 +542,9 @@ def _writeGraphBox (self): females = 0 unknowns = 0 for individual in individualNodes: - if individual.getGender() == individual.male: + if individual.get_gender() == individual.male: males = males + 1 - elif individual.getGender() == individual.female: + elif individual.get_gender() == individual.female: females = females + 1 else: unknowns = unknowns + 1 @@ -571,9 +571,9 @@ def _writeGraphRecord (self): # naturalRelatives (direct descendants) and its complementary # subset (in-law relatives). filter = GenericFilter.GenericFilter() - filter.add_rule(GenericFilter.IsDescendantOf([self.person.getId()])) + filter.add_rule(GenericFilter.IsDescendantOf([self.person.get_id()])) naturalRelatives =\ - Set(filter.apply(self.db, self.db.getPersonMap().values())) + Set(filter.apply(self.db, self.db.get_person_id_map().values())) naturalRelatives.add(self.person) else: naturalRelatives = self.IndividualSet @@ -584,13 +584,13 @@ def _writeGraphRecord (self): familyId = _getIndividualId(individual) # If both husband and wife are members of the IndividualSet, # only one record, with the husband first, is displayed. - if individual.getGender() == individual.female: + if individual.get_gender() == individual.female: # There are exactly three cases where a female node is added: family = None # no family husbands = [] # filtered-in husbands (naturalRelatives) unknownHusbands = 0 # filtered-out/unknown husbands - for family in individual.getFamilyList(): - husband = family.getFather() + for family in individual.get_family_id_list(): + husband = family.get_father_id() if husband and husband in self.IndividualSet: if husband not in naturalRelatives: husbands.append(husband) @@ -600,14 +600,14 @@ def _writeGraphRecord (self): familyNodes[familyId] = [individual] + husbands else: familyNodes[familyId] = [individual] - for family in individual.getFamilyList(): - wife = family.getMother() + for family in individual.get_family_id_list(): + wife = family.get_mother_id() if wife in self.IndividualSet: familyNodes[familyId].append(wife) # Writes out all family records for familyId, family in familyNodes.items(): (color, url) = _getIndividualData(self, familyNodes[familyId][0]) - label = _getFamilyRecordLabel(self, familyNodes[familyId]) + label = _get_family_idRecordLabel(self, familyNodes[familyId]) _writeNode(self.File, familyId, label, color, url) # Links individual's record to their parents' record # The arrow goes from the individual port of a family record @@ -619,9 +619,9 @@ def _writeGraphRecord (self): for individualFrom in familyFrom: individualFromId = _getIndividualId(individualFrom) for family, motherRelShip, fatherRelShip\ - in individualFrom.getParentList(): - father = family.getFather() - mother = family.getMother() + in individualFrom.get_parent_family_id_list(): + father = family.get_father_id() + mother = family.get_mother_id() # Things are complicated here because a parent may or # or may not exist. if father: @@ -658,13 +658,13 @@ def _writeGraphRecord (self): for familyId, family in familyNodes.items(): marriages = marriages + (len(family) - 1) for individual in family: - if individual.getGender() == individual.male\ + if individual.get_gender() == individual.male\ and individual not in males: males.add(individual) - elif individual.getGender() == individual.female\ + elif individual.get_gender() == individual.female\ and individual not in females: females.add(individual) - elif individual.getGender() == individual.unknown\ + elif individual.get_gender() == individual.unknown\ and individual not in unknowns: unknowns.add(individual) _writeStats(self.File, len(males), len(females), len(unknowns), marriages) @@ -676,7 +676,7 @@ def _writeGraphRecord (self): #------------------------------------------------------------------------ def _getIndividualId (individual): """Returns an individual id suitable for dot""" - return individual.getId() + return individual.get_id() #------------------------------------------------------------------------ # @@ -688,7 +688,7 @@ def _getIndividualData (self, individual): # color color = '' if self.Colorize: - gender = individual.getGender() + gender = individual.get_gender() if gender == individual.male: color = 'dodgerblue4' elif gender == individual.female: @@ -708,17 +708,17 @@ def _getIndividualData (self, individual): def _getEventLabel (self, event): """Returns a formatted string of event data suitable for a label""" if self.IncludeDates and event: - dateObj = event.getDateObj() + dateObj = event.get_date_object() if dateObj.getYearValid(): if self.JustYear: return "%i" % dateObj.getYear() else: - return dateObj.getDate() + return dateObj.get_date() elif self.PlaceCause: - if event.getPlaceName(): - return event.getPlaceName() + if event.get_place_name(): + return event.get_place_name() else: - return event.getCause() + return event.get_cause() return '' #------------------------------------------------------------------------ @@ -734,13 +734,13 @@ def _getIndividualLabel (self, individual, marriageEvent=None, family=None): individual's and family's IDs. """ # Get data ready - individualId = individual.getId() - name = individual.getPrimaryName().getName() + individualId = individual.get_id() + name = individual.get_primary_name().get_name() if self.IncludeDates: - birth = _getEventLabel(self, individual.getBirth()) - death = _getEventLabel(self, individual.getDeath()) + birth = _getEventLabel(self, individual.get_birth()) + death = _getEventLabel(self, individual.get_death()) if marriageEvent != None: - familyId = family.getId() + familyId = family.get_id() marriage = _getEventLabel(self, marriageEvent) # Id if self.IncludeId: @@ -773,32 +773,32 @@ def _getEdgeStyle (self, fatherRelShip, motherRelShip="Birth"): #------------------------------------------------------------------------ # -# _getFamilyId +# _get_family_idId # #------------------------------------------------------------------------ -def _getFamilyId (family): +def _get_family_idId (family): """Returns a family id suitable for dot""" - return family.getId() + return family.get_id() #------------------------------------------------------------------------ # -# _getFamilyLabel +# _get_family_idLabel # #------------------------------------------------------------------------ -def _getFamilyLabel (self, family): +def _get_family_idLabel (self, family): """Returns a formatted string of family data suitable for a label""" - marriage = _getEventLabel(self, family.getMarriage()) + marriage = _getEventLabel(self, family.get_marriage()) if self.IncludeId: - return "%s\\n%s" % (family.getId(), marriage) + return "%s\\n%s" % (family.get_id(), marriage) else: return marriage #------------------------------------------------------------------------ # -# _getFamilyRecordLabel +# _get_family_idRecordLabel # #------------------------------------------------------------------------ -def _getFamilyRecordLabel (self, record): +def _get_family_idRecordLabel (self, record): """Returns a formatted string of a family record suitable for a label""" labels = [] spouse = record[0] @@ -808,9 +808,9 @@ def _getFamilyRecordLabel (self, record): label = _getIndividualLabel(self, individual) else: marriageEvent = Event() - for individualFamily in individual.getFamilyList(): - if individualFamily in spouse.getFamilyList(): - marriageEvent = individualFamily.getMarriage() + for individualFamily in individual.get_family_id_list(): + if individualFamily in spouse.get_family_id_list(): + marriageEvent = individualFamily.get_marriage() if not marriageEvent: marriageEvent = Event() break diff --git a/src/plugins/ReorderIds.py b/src/plugins/ReorderIds.py index b6de2af04..77f6ada21 100644 --- a/src/plugins/ReorderIds.py +++ b/src/plugins/ReorderIds.py @@ -45,11 +45,11 @@ class ReorderIds: self.db = db - self.reorder(db.getPersonMap(),db.iprefix,db.buildPersonDisplay) - self.reorder(db.getFamilyMap(),db.fprefix,None) - self.reorder(db.getObjectMap(),db.oprefix,None) - self.reorder(db.getSourceMap(),db.sprefix,db.buildSourceDisplay) - self.reorder(db.getPlaceMap(),db.pprefix,db.buildPlaceDisplay) + self.reorder(db.get_person_id_map(),db.iprefix,db.build_person_display) + self.reorder(db.get_family_id_map(),db.fprefix,None) + self.reorder(db.get_object_map(),db.oprefix,None) + self.reorder(db.get_source_map(),db.sprefix,db.build_source_display) + self.reorder(db.get_place_id_map(),db.pprefix,db.build_place_display) Utils.modified() Utils.history_broken() callback(1) @@ -90,7 +90,7 @@ class ReorderIds: data = data_map[id] data_map[newid] = data newids[newid] = id - data.setId(newid) + data.set_id(newid) del data_map[id] if update: update(newid,id) @@ -111,7 +111,7 @@ class ReorderIds: index = index + 1 newids[newid] = newid data = data_map[id] - data.setId(newid) + data.set_id(newid) data_map[newid] = data if update: update(newid,id) diff --git a/src/plugins/SimpleBookTitle.py b/src/plugins/SimpleBookTitle.py index af67ca23b..57197d4fb 100644 --- a/src/plugins/SimpleBookTitle.py +++ b/src/plugins/SimpleBookTitle.py @@ -88,8 +88,8 @@ class SimpleBookTitle(Report.Report): self.doc.end_paragraph() if self.object_id: - object = self.database.getObject(self.object_id) - name = object.getPath() + object = self.database.get_object(self.object_id) + name = object.get_path() if self.image_size: image_size = self.image_size else: @@ -207,7 +207,7 @@ class SimpleBookTitleDialog(Report.BareReportDialog): self.options = opt self.db = database if self.options[0]: - self.person = self.db.getPerson(self.options[0]) + self.person = self.db.get_person(self.options[0]) else: self.person = person @@ -239,7 +239,7 @@ class SimpleBookTitleDialog(Report.BareReportDialog): else: import time dateinfo = time.localtime(time.time()) - name = self.db.getResearcher().getName() + name = self.db.get_researcher().get_name() self.footer_string = _('Copyright %d %s') % (dateinfo[0], name) self.title_entry.set_text(self.title_string) @@ -247,11 +247,11 @@ class SimpleBookTitleDialog(Report.BareReportDialog): self.footer_entry.set_text(self.footer_string) self.size_menu.set_history(self.size_index) if self.object_id: - object = self.db.getObject(self.object_id) - self.obj_title.set_text(object.getDescription()) - the_type = Utils.get_mime_description(object.getMimeType()) - path = object.getPath() - thumb_path = Utils.thumb_path(self.db.getSavePath(),object) + object = self.db.get_object(self.object_id) + self.obj_title.set_text(object.get_description()) + the_type = Utils.get_mime_description(object.get_mime_type()) + path = object.get_path() + thumb_path = Utils.thumb_path(self.db.get_save_path(),object) pexists = os.path.exists(path) if pexists and os.path.exists(thumb_path): self.preview.set_from_pixbuf(gtk.gdk.pixbuf_new_from_file(thumb_path)) @@ -361,13 +361,13 @@ class SimpleBookTitleDialog(Report.BareReportDialog): s_o = SelectObject.SelectObject(self.db,_("Select an Object")) object = s_o.run() if object: - self.object_id = object.getId() + self.object_id = object.get_id() else: return - self.obj_title.set_text(object.getDescription()) - the_type = Utils.get_mime_description(object.getMimeType()) - path = object.getPath() - thumb_path = Utils.thumb_path(self.db.getSavePath(),object) + self.obj_title.set_text(object.get_description()) + the_type = Utils.get_mime_description(object.get_mime_type()) + path = object.get_path() + thumb_path = Utils.thumb_path(self.db.get_save_path(),object) pexists = os.path.exists(path) if pexists and os.path.exists(thumb_path): self.preview.set_from_pixbuf(gtk.gdk.pixbuf_new_from_file(thumb_path)) @@ -381,13 +381,13 @@ class SimpleBookTitleDialog(Report.BareReportDialog): a_o = AddMedia.AddMediaObject(self.db) object = a_o.run() if object: - self.object_id = object.getId() + self.object_id = object.get_id() else: return - self.obj_title.set_text(object.getDescription()) - the_type = Utils.get_mime_description(object.getMimeType()) - path = object.getPath() - thumb_path = Utils.thumb_path(self.db.getSavePath(),object) + self.obj_title.set_text(object.get_description()) + the_type = Utils.get_mime_description(object.get_mime_type()) + path = object.get_path() + thumb_path = Utils.thumb_path(self.db.get_save_path(),object) pexists = os.path.exists(path) if pexists and os.path.exists(thumb_path): self.preview.set_from_pixbuf(gtk.gdk.pixbuf_new_from_file(thumb_path)) @@ -408,7 +408,7 @@ class SimpleBookTitleDialog(Report.BareReportDialog): if self.new_person: self.person = self.new_person - self.options = ( self.person.getId(), + self.options = ( self.person.get_id(), self.title_string, self.subtitle_string, self.object_id, self.size_index, self.footer_string ) self.style_name = self.selected_style.get_name() @@ -423,7 +423,7 @@ def write_book_item(database,person,doc,options,newpage=0): All user dialog has already been handled and the output file opened.""" try: if options[0]: - person = database.getPerson(options[0]) + person = database.get_person(options[0]) if options[1]: title_string = options[1] else: @@ -446,7 +446,7 @@ def write_book_item(database,person,doc,options,newpage=0): else: import time dateinfo = time.localtime(time.time()) - name = database.getResearcher().getName() + name = database.get_researcher().get_name() footer_string = _('Copyright %d %s') % (dateinfo[0], name) return SimpleBookTitle(database, person, title_string, subtitle_string, object_id, size, diff --git a/src/plugins/Summary.py b/src/plugins/Summary.py index 52fd315ce..59857299f 100644 --- a/src/plugins/Summary.py +++ b/src/plugins/Summary.py @@ -53,8 +53,8 @@ from gnome.ui import * #------------------------------------------------------------------------ def build_report(database,person): - personList = database.getPersonMap().values() - familyList = database.getFamilyMap().values() + personList = database.get_person_id_map().values() + familyList = database.get_family_id_map().values() with_photos = 0 total_photos = 0 @@ -67,32 +67,32 @@ def build_report(database,person): namelist = [] notfound = [] - pobjects = len(database.getObjectMap().values()) - for photo in database.getObjectMap().values(): + pobjects = len(database.get_object_map().values()) + for photo in database.get_object_map().values(): try: - bytes = bytes + posixpath.getsize(photo.getPath()) + bytes = bytes + posixpath.getsize(photo.get_path()) except: - notfound.append(photo.getPath()) + notfound.append(photo.get_path()) for person in personList: - length = len(person.getPhotoList()) + length = len(person.get_photo_list()) if length > 0: with_photos = with_photos + 1 total_photos = total_photos + length - name = person.getPrimaryName() - if name.getFirstName() == "" or name.getSurname() == "": + name = person.get_primary_name() + if name.get_first_name() == "" or name.get_surname() == "": incomp_names = incomp_names + 1 - if person.getMainParents() == None and len(person.getFamilyList()) == 0: + if person.get_main_parents_family_id() == None and len(person.get_family_id_list()) == 0: disconnected = disconnected + 1 - if person.getBirth().getDate() == "": + if person.get_birth().get_date() == "": missing_bday = missing_bday + 1 - if person.getGender() == RelLib.Person.female: + if person.get_gender() == RelLib.Person.female: females = females + 1 else: males = males + 1 - if name.getSurname() not in namelist: - namelist.append(name.getSurname()) + if name.get_surname() not in namelist: + namelist.append(name.get_surname()) text = _("Individuals") + "\n" text = text + "----------------------------\n" diff --git a/src/plugins/TimeLine.py b/src/plugins/TimeLine.py index 582acd4fe..27c044902 100644 --- a/src/plugins/TimeLine.py +++ b/src/plugins/TimeLine.py @@ -184,10 +184,10 @@ class TimeLine: self.plist.sort(self.sort_func) for p in self.plist: - b = p.getBirth().getDateObj().getYear() - d = p.getDeath().getDateObj().getYear() + b = p.get_birth().get_date_object().getYear() + d = p.get_death().get_date_object().getYear() - n = p.getPrimaryName().getName() + n = p.get_primary_name().get_name() self.d.draw_text('TLG-text',n,incr+pad,self.header + (incr+pad)*index) y1 = self.header + (pad+incr)*index @@ -269,11 +269,11 @@ class TimeLine: low = 999999 high = -999999 - self.plist = self.filter.apply(self.db,self.db.getPersonMap().values()) + self.plist = self.filter.apply(self.db,self.db.get_person_id_map().values()) for p in self.plist: - b = p.getBirth().getDateObj().getYear() - d = p.getDeath().getDateObj().getYear() + b = p.get_birth().get_date_object().getYear() + d = p.get_death().get_date_object().getYear() if b != Date.UNDEF: low = min(low,b) @@ -294,14 +294,14 @@ class TimeLine: return (low,high) def name_size(self): - self.plist = self.filter.apply(self.db,self.db.getPersonMap().values()) + self.plist = self.filter.apply(self.db,self.db.get_person_id_map().values()) style_name = self.d.draw_styles['TLG-text'].get_paragraph_style() font = self.d.style_list[style_name].get_font() size = 0 for p in self.plist: - n = p.getPrimaryName().getName() + n = p.get_primary_name().get_name() size = max(FontScale.string_width(font,n),size) return pt2cm(size) @@ -347,7 +347,7 @@ def _make_default_style(default_style): def _get_report_filters(person): """Set up the list of possible content filters.""" - name = person.getPrimaryName().getName() + name = person.get_primary_name().get_name() all = GenericFilter.GenericFilter() all.set_name(_("Entire Database")) @@ -355,15 +355,15 @@ def _get_report_filters(person): des = GenericFilter.GenericFilter() des.set_name(_("Descendants of %s") % name) - des.add_rule(GenericFilter.IsDescendantOf([person.getId()])) + des.add_rule(GenericFilter.IsDescendantOf([person.get_id()])) ans = GenericFilter.GenericFilter() ans.set_name(_("Ancestors of %s") % name) - ans.add_rule(GenericFilter.IsAncestorOf([person.getId()])) + ans.add_rule(GenericFilter.IsAncestorOf([person.get_id()])) com = GenericFilter.GenericFilter() com.set_name(_("People with common ancestor with %s") % name) - com.add_rule(GenericFilter.HasCommonAncestorWith([person.getId()])) + com.add_rule(GenericFilter.HasCommonAncestorWith([person.get_id()])) return [all,des,ans,com] @@ -432,7 +432,7 @@ class TimeLineDialog(Report.DrawReportDialog): self.add_option(_('Sort by'),self.sort_style) self.title_box = gtk.Entry() - self.title_box.set_text(self.get_header(self.person.getPrimaryName().getName())) + self.title_box.set_text(self.get_header(self.person.get_primary_name().get_name())) self.title_box.show() self.add_option(_('Title'),self.title_box) @@ -516,7 +516,7 @@ class TimeLineBareDialog(Report.BareReportDialog): self.options = opt self.db = database if self.options[0]: - self.person = self.db.getPerson(self.options[0]) + self.person = self.db.get_person(self.options[0]) else: self.person = person self.style_name = stl @@ -600,7 +600,7 @@ class TimeLineBareDialog(Report.BareReportDialog): self.sort_func_num = self.sort_style.get_history() self.title_str = unicode(self.title_box.get_text()) - self.options = ( self.person.getId(), self.filter_num, + self.options = ( self.person.get_id(), self.filter_num, self.sort_func_num, self.title_str ) self.style_name = self.selected_style.get_name() @@ -614,7 +614,7 @@ def write_book_item(database,person,doc,options,newpage=0): All user dialog has already been handled and the output file opened.""" try: if options[0]: - person = database.getPerson(options[0]) + person = database.get_person(options[0]) filter_num = int(options[1]) filters = _get_report_filters(person) afilter = filters[filter_num] diff --git a/src/plugins/Verify.py b/src/plugins/Verify.py index c3555b729..f6cf8aab1 100644 --- a/src/plugins/Verify.py +++ b/src/plugins/Verify.py @@ -62,7 +62,7 @@ verifySettings = None def get_year( event ): year = 0 if event != None: - dateObj = event.getDateObj() + dateObj = event.get_date_object() if dateObj != None: dateObj = Date.Date(dateObj) if dateObj.__class__ != Gregorian.Gregorian: @@ -95,7 +95,7 @@ def on_apply_clicked(obj): global db global verifySettings - personList = db.getPersonMap().values() + personList = db.get_person_id_map().values() oldage = int(verifySettings.get_widget("oldage").get_text()) yngmar = int(verifySettings.get_widget("yngmar").get_text()) @@ -114,70 +114,70 @@ def on_apply_clicked(obj): warn = cStringIO.StringIO() for person in personList: - idstr = person.getPrimaryName().getName() + " (" + person.getId() + ")" + idstr = person.get_primary_name().get_name() + " (" + person.get_id() + ")" # individual checks ageatdeath = 0 - byear = get_year( person.getBirth() ) + byear = get_year( person.get_birth() ) bapyear = 0 - dyear = get_year( person.getDeath() ) + dyear = get_year( person.get_death() ) buryear = 0 if byear>0 and bapyear>0: if byear > bapyear: - if person.getGender() == RelLib.Person.male: + if person.get_gender() == RelLib.Person.male: error.write( _("Baptized before birth: %(male_name)s born %(byear)d, baptized %(bapyear)d.\n") % { 'male_name' : idstr, 'byear' : byear, 'bapyear' : bapyear } ) - if person.getGender() == RelLib.Person.female: + if person.get_gender() == RelLib.Person.female: error.write( _("Baptized before birth: %(female_name)s born %(byear)d, baptized %(bapyear)d.\n") % { 'female_name' : idstr, 'byear' : byear, 'bapyear' : bapyear } ) if byear < bapyear: - if person.getGender() == RelLib.Person.male: + if person.get_gender() == RelLib.Person.male: warn.write( _("Baptized late: %(male_name)s born %(byear)d, baptized %(bapyear)d.\n") % { 'male_name' : idstr, 'byear' : byear, 'bapyear' : bapyear } ) - if person.getGender() == RelLib.Person.female: + if person.get_gender() == RelLib.Person.female: warn.write( _("Baptized late: %(female_name)s born %(byear)d, baptized %(bapyear)d.\n") % { 'female_name' : idstr, 'byear' : byear, 'bapyear' : bapyear } ) if dyear>0 and buryear>0: if dyear > buryear: - if person.getGender() == RelLib.Person.male: + if person.get_gender() == RelLib.Person.male: error.write( _("Buried before death: %(male_name)s died %(dyear)d, buried %(buryear)d.\n") % { 'male_name' : idstr, 'dyear' : dyear, 'buryear' : buryear } ) - if person.getGender() == RelLib.Person.female: + if person.get_gender() == RelLib.Person.female: error.write( _("Buried before death: %(female_name)s died %(dyear)d, buried %(buryear)d.\n") % { 'female_name' : idstr, 'dyear' : dyear, 'buryear' : buryear } ) if dyear < buryear: - if person.getGender() == RelLib.Person.male: + if person.get_gender() == RelLib.Person.male: warn.write( _("Buried late: %(male_name)s died %(dyear)d, buried %(buryear)d.\n") % { 'male_name' : idstr, 'dyear' : dyear, 'buryear' : buryear } ) - if person.getGender() == RelLib.Person.female: + if person.get_gender() == RelLib.Person.female: warn.write( _("Buried late: %(female_name)s died %(dyear)d, buried %(buryear)d.\n") % { 'female_name' : idstr, 'dyear' : dyear, 'buryear' : buryear } ) if dyear>0 and (byear>dyear): - if person.getGender() == RelLib.Person.male: + if person.get_gender() == RelLib.Person.male: error.write( _("Died before birth: %(male_name)s born %(byear)d, died %(dyear)d.\n") % { 'male_name' : idstr, 'byear' : byear, 'dyear' : dyear } ) - if person.getGender() == RelLib.Person.female: + if person.get_gender() == RelLib.Person.female: error.write( _("Died before birth: %(female_name)s born %(byear)d, died %(dyear)d.\n") % { 'female_name' : idstr, 'byear' : byear, 'dyear' : dyear } ) if dyear>0 and (bapyear>dyear): - if person.getGender() == RelLib.Person.male: + if person.get_gender() == RelLib.Person.male: error.write( _("Died before baptism: %(male_name)s baptized %(bapyear)d, died %(dyear)d.\n") % { 'male_name' : idstr, 'bapyear' : bapyear, 'dyear' : dyear } ) - if person.getGender() == RelLib.Person.female: + if person.get_gender() == RelLib.Person.female: error.write( _("Died before baptism: %(female_name)s baptized %(bapyear)d, died %(dyear)d.\n") % { 'female_name' : idstr, 'bapyear' : bapyear, 'dyear' : dyear } ) if buryear>0 and (byear>buryear): - if person.getGender() == RelLib.Person.male: + if person.get_gender() == RelLib.Person.male: error.write( _("Buried before birth: %(male_name)s born %(byear)d, buried %(buryear)d.\n") % { 'male_name' : idstr, 'byear' : byear, 'buryear' : buryear } ) - if person.getGender() == RelLib.Person.female: + if person.get_gender() == RelLib.Person.female: error.write( _("Buried before birth: %(female_name)s born %(byear)d, buried %(buryear)d.\n") % { 'female_name' : idstr, 'byear' : byear, 'buryear' : buryear } ) if buryear>0 and (bapyear>buryear): - if person.getGender() == RelLib.Person.male: + if person.get_gender() == RelLib.Person.male: error.write( _("Buried before baptism: %(male_name)s baptized %(bapyear)d, buried %(buryear)d.\n") % { 'male_name' : idstr, 'bapyear' : bapyear, 'buryear' : buryear } ) - if person.getGender() == RelLib.Person.female: + if person.get_gender() == RelLib.Person.female: error.write( _("Buried before baptism: %(female_name)s baptized %(bapyear)d, buried %(buryear)d.\n") % { 'female_name' : idstr, 'bapyear' : bapyear, 'buryear' : buryear } ) if byear == 0 and estimate_age: @@ -189,49 +189,49 @@ def on_apply_clicked(obj): else: ageatdeath = 0 if ageatdeath > oldage: - if person.getGender() == RelLib.Person.male: + if person.get_gender() == RelLib.Person.male: warn.write( _("Old age: %(male_name)s born %(byear)d, died %(dyear)d, at the age of %(ageatdeath)d.\n") % { 'male_name' : idstr, 'byear' : byear, 'dyear' : dyear, 'ageatdeath' : ageatdeath } ) - if person.getGender() == RelLib.Person.female: + if person.get_gender() == RelLib.Person.female: warn.write( _("Old age: %(female_name)s born %(byear)d, died %(dyear)d, at the age of %(ageatdeath)d.\n") % { 'female_name' : idstr, 'byear' : byear, 'dyear' : dyear, 'ageatdeath' : ageatdeath } ) # gender checks - if person.getGender() == RelLib.Person.female: + if person.get_gender() == RelLib.Person.female: oldpar = oldmom yngpar = yngmom - if person.getGender() == RelLib.Person.male: + if person.get_gender() == RelLib.Person.male: oldpar = olddad yngpar = yngdad - if (person.getGender() != RelLib.Person.female) and (person.getGender() != RelLib.Person.male): + if (person.get_gender() != RelLib.Person.female) and (person.get_gender() != RelLib.Person.male): warn.write( _("Unknown gender for %s.\n") % idstr ) oldpar = olddad yngpar = yngdad - if (person.getGender() == RelLib.Person.female) and (person.getGender() == RelLib.Person.male): + if (person.get_gender() == RelLib.Person.female) and (person.get_gender() == RelLib.Person.male): error.write( _("Ambiguous gender for %s.\n") % idstr ) oldpar = olddad yngpar = yngdad # multiple parentage check - if( len( person.getParentList() ) > 1 ): + if( len( person.get_parent_family_id_list() ) > 1 ): warn.write( _("Multiple parentage for %s.\n") % idstr ) # marriage checks nkids = 0 - nfam = len( person.getFamilyList() ) + nfam = len( person.get_family_id_list() ) if nfam > wedder: - if person.getGender() == RelLib.Person.male: + if person.get_gender() == RelLib.Person.male: warn.write( _("Married often: %(male_name)s married %(nfam)d times.\n") % { 'male_name' : idstr, 'nfam' : nfam } ) - if person.getGender() == RelLib.Person.female: + if person.get_gender() == RelLib.Person.female: warn.write( _("Married often: %(female_name)s married %(nfam)d times.\n") % { 'female_name' : idstr, 'nfam' : nfam } ) if ageatdeath>oldunm and nfam == 0: - if person.getGender() == RelLib.Person.male: + if person.get_gender() == RelLib.Person.male: warn.write( _("Old and unmarried: %(male_name)s died unmarried, at the age of %(ageatdeath)d years.\n") % { 'male_name' : idstr, 'ageatdeath' : ageatdeath } ) - if person.getGender() == RelLib.Person.female: + if person.get_gender() == RelLib.Person.female: warn.write( _("Old and unmarried: %(female_name)s died unmarried, at the age of %(ageatdeath)d years.\n") % { 'female_name' : idstr, 'ageatdeath' : ageatdeath } ) first_cbyear = 99999 @@ -240,37 +240,37 @@ def on_apply_clicked(obj): prev_maryear=0 prev_sdyear=0 fnum = 0 - for family in person.getFamilyList(): + for family in person.get_family_id_list(): fnum = fnum + 1 - mother = family.getMother() - father = family.getFather() + mother = family.get_mother_id() + father = family.get_father_id() if mother!=None and father!=None: - if ( mother.getGender() == father.getGender() ) and mother.getGender() != RelLib.Person.unknown: - warn.write( _("Homosexual marriage: %s in family %s.\n") % ( idstr, family.getId() ) ) - if family.getFather() == person and person.getGender() == RelLib.Person.female: - error.write( _("Female husband: %s in family %s.\n") % ( idstr, family.getId() ) ) - if family.getMother() == person and person.getGender() == RelLib.Person.male: - error.write( _("Male wife: %s in family %s.\n") % ( idstr, family.getId() ) ) - if family.getFather() == person: - spouse = family.getMother() + if ( mother.get_gender() == father.get_gender() ) and mother.get_gender() != RelLib.Person.unknown: + warn.write( _("Homosexual marriage: %s in family %s.\n") % ( idstr, family.get_id() ) ) + if family.get_father_id() == person and person.get_gender() == RelLib.Person.female: + error.write( _("Female husband: %s in family %s.\n") % ( idstr, family.get_id() ) ) + if family.get_mother_id() == person and person.get_gender() == RelLib.Person.male: + error.write( _("Male wife: %s in family %s.\n") % ( idstr, family.get_id() ) ) + if family.get_father_id() == person: + spouse = family.get_mother_id() else: - spouse = family.getFather() + spouse = family.get_father_id() if spouse != None: - if person.getGender() == RelLib.Person.male and \ - person.getPrimaryName().getSurname() == spouse.getPrimaryName().getSurname(): + if person.get_gender() == RelLib.Person.male and \ + person.get_primary_name().get_surname() == spouse.get_primary_name().get_surname(): warn.write( _("Husband and wife with the same surname: %s in family %s, and %s.\n") % ( - idstr,family.getId(), spouse.getPrimaryName().getName() ) ) - sdyear = get_year( spouse.getDeath() ) + idstr,family.get_id(), spouse.get_primary_name().get_name() ) ) + sdyear = get_year( spouse.get_death() ) if sdyear == 0: sdyear = 0 # burial year - maryear = get_year( family.getMarriage() ) + maryear = get_year( family.get_marriage() ) if maryear == 0 and estimate_age: # estimate marriage year cnum=0 - for child in family.getChildList(): + for child in family.get_child_id_list(): cnum = cnum + 1 if maryear == 0: - birthyear = get_year( child.getBirth() ) + birthyear = get_year( child.get_birth() ) if birthyear > 0: maryear = birthyear-cnum @@ -278,41 +278,41 @@ def on_apply_clicked(obj): if byear > 0: marage = maryear - byear if marage < 0: - if person.getGender() == RelLib.Person.male: + if person.get_gender() == RelLib.Person.male: error.write( _("Married before birth: %(male_name)s born %(byear)d, married %(maryear)d to %(spouse)s.\n") % { - 'male_name' : idstr, 'byear' : byear, 'maryear' : maryear, 'spouse' : spouse.getPrimaryName().getName() } ) - if person.getGender() == RelLib.Person.female: + 'male_name' : idstr, 'byear' : byear, 'maryear' : maryear, 'spouse' : spouse.get_primary_name().get_name() } ) + if person.get_gender() == RelLib.Person.female: error.write( _("Married before birth: %(female_name)s born %(byear)d, married %(maryear)d to %(spouse)s.\n") % { - 'female_name' : idstr, 'byear' : byear, 'maryear' : maryear, 'spouse' : spouse.getPrimaryName().getName() } ) + 'female_name' : idstr, 'byear' : byear, 'maryear' : maryear, 'spouse' : spouse.get_primary_name().get_name() } ) else: if marage < yngmar: - if person.getGender() == RelLib.Person.male: + if person.get_gender() == RelLib.Person.male: warn.write( _("Young marriage: %(male_name)s married at age %(marage)d to %(spouse)s.\n") % { - 'male_name' : idstr, 'marage' : marage, 'spouse' : spouse.getPrimaryName().getName() } ) - if person.getGender() == RelLib.Person.female: + 'male_name' : idstr, 'marage' : marage, 'spouse' : spouse.get_primary_name().get_name() } ) + if person.get_gender() == RelLib.Person.female: warn.write( _("Young marriage: %(female_name)s married at age %(marage)d to %(spouse)s.\n") % { - 'female_name' : idstr, 'marage' : marage, 'spouse' : spouse.getPrimaryName().getName() } ) + 'female_name' : idstr, 'marage' : marage, 'spouse' : spouse.get_primary_name().get_name() } ) if marage > oldmar: - if person.getGender() == RelLib.Person.male: + if person.get_gender() == RelLib.Person.male: warn.write( _("Old marriage: %(male_name)s married at age %(marage)d to %(spouse)s.\n") % { - 'male_name' : idstr, 'marage' : marage, 'spouse' : spouse.getPrimaryName().getName() } ) - if person.getGender() == RelLib.Person.female: + 'male_name' : idstr, 'marage' : marage, 'spouse' : spouse.get_primary_name().get_name() } ) + if person.get_gender() == RelLib.Person.female: warn.write( _("Old marriage: %(female_name)s married at age %(marage)d to %(spouse)s.\n") % { - 'female_name' : idstr, 'marage' : marage, 'spouse' : spouse.getPrimaryName().getName() } ) + 'female_name' : idstr, 'marage' : marage, 'spouse' : spouse.get_primary_name().get_name() } ) if dyear>0 and maryear > dyear: - if person.getGender() == RelLib.Person.male: + if person.get_gender() == RelLib.Person.male: error.write( _("Married after death: %(male_name)s died %(dyear)d, married %(maryear)d to %(spouse)s.\n") % { - 'male_name' : idstr, 'dyear' : dyear, 'maryear' : maryear, 'spouse' : spouse.getPrimaryName().getName() } ) - if person.getGender() == RelLib.Person.female: + 'male_name' : idstr, 'dyear' : dyear, 'maryear' : maryear, 'spouse' : spouse.get_primary_name().get_name() } ) + if person.get_gender() == RelLib.Person.female: error.write( _("Married after death: %(female_name)s died %(dyear)d, married %(maryear)d to %(spouse)s.\n") % { - 'female_name' : idstr, 'dyear' : dyear, 'maryear' : maryear, 'spouse' : spouse.getPrimaryName().getName() } ) + 'female_name' : idstr, 'dyear' : dyear, 'maryear' : maryear, 'spouse' : spouse.get_primary_name().get_name() } ) if prev_cbyear > maryear: - if person.getGender() == RelLib.Person.male: + if person.get_gender() == RelLib.Person.male: warn.write( _("Marriage before birth from previous family: %(male_name)s married %(maryear)d to %(spouse)s, previous birth %(prev_cbyear)d.\n") % { - 'male_name' : idstr, 'maryear' : maryear, 'spouse' : spouse.getPrimaryName().getName(), 'prev_cbyear' : prev_cbyear } ) - if person.getGender() == RelLib.Person.female: + 'male_name' : idstr, 'maryear' : maryear, 'spouse' : spouse.get_primary_name().get_name(), 'prev_cbyear' : prev_cbyear } ) + if person.get_gender() == RelLib.Person.female: warn.write( _("Marriage before birth from previous family: %(female_name)s married %(maryear)d to %(spouse)s, previous birth %(prev_cbyear)d.\n") % { - 'female_name' : idstr, 'maryear' : maryear, 'spouse' : spouse.getPrimaryName().getName(), 'prev_cbyear' : prev_cbyear } ) + 'female_name' : idstr, 'maryear' : maryear, 'spouse' : spouse.get_primary_name().get_name(), 'prev_cbyear' : prev_cbyear } ) prev_maryear = maryear else: maryear = prev_maryear @@ -320,23 +320,23 @@ def on_apply_clicked(obj): if maryear>0 and prev_sdyear > 0: wdwyear = maryear-prev_sdyear if wdwyear > lngwdw: - if person.getGender() == RelLib.Person.male: - warn.write( _("Long widowhood: %s was a widower %d years before, family %s.\n") % (idstr, wdwyear, family.getId() ) ) - if person.getGender() == RelLib.Person.female: - warn.write( _("Long widowhood: %s was a widow %d years before, family %s.\n") % (idstr, wdwyear, family.getId() ) ) + if person.get_gender() == RelLib.Person.male: + warn.write( _("Long widowhood: %s was a widower %d years before, family %s.\n") % (idstr, wdwyear, family.get_id() ) ) + if person.get_gender() == RelLib.Person.female: + warn.write( _("Long widowhood: %s was a widow %d years before, family %s.\n") % (idstr, wdwyear, family.get_id() ) ) if fnum==nfam and dyear>0 and sdyear>0: wdwyear = dyear - sdyear if wdwyear > lngwdw: - if person.getGender() == RelLib.Person.male: + if person.get_gender() == RelLib.Person.male: warn.write( _("Long widowhood: %s was a widower %d years.\n") % (idstr, wdwyear) ) - if person.getGender() == RelLib.Person.female: + if person.get_gender() == RelLib.Person.female: warn.write( _("Long widowhood: %s was a widow %d years.\n") % (idstr, wdwyear) ) nkids = 0 - for child in family.getChildList(): + for child in family.get_child_id_list(): nkids = nkids+1 - cbyear = get_year( child.getBirth() ) + cbyear = get_year( child.get_birth() ) if cbyear>0 and cbyear < first_cbyear: first_cbyear = cbyear if cbyear>last_cbyear: @@ -345,42 +345,42 @@ def on_apply_clicked(obj): if byear>0 and cbyear>0: bage = cbyear - byear if bage > oldpar: - if person.getGender() == RelLib.Person.male: + if person.get_gender() == RelLib.Person.male: warn.write( _("Old father: %(male_name)s at age of %(bage)d in family %(fam)s had a child %(child)s.\n") % { - 'male_name' : idstr, 'bage' : bage, 'fam' : family.getId(), 'child' : child.getPrimaryName().getName() } ) - if person.getGender() == RelLib.Person.female: + 'male_name' : idstr, 'bage' : bage, 'fam' : family.get_id(), 'child' : child.get_primary_name().get_name() } ) + if person.get_gender() == RelLib.Person.female: warn.write( _("Old mother: %(female_name)s at age of %(bage)d in family %(fam)s had a child %(child)s.\n") % { - 'female_name' : idstr, 'bage' : bage, 'fam' : family.getId(), 'child' : child.getPrimaryName().getName() } ) + 'female_name' : idstr, 'bage' : bage, 'fam' : family.get_id(), 'child' : child.get_primary_name().get_name() } ) if bage < 0: - if person.getGender() == RelLib.Person.male: + if person.get_gender() == RelLib.Person.male: error.write( _("Unborn father: %(male_name)s born %(byear)d, in family %(fam)s had a child %(child)s born %(cbyear)d.\n") % { - 'male_name' : idstr, 'byear' : byear, 'fam' : family.getId(), 'child' : child.getPrimaryName().getName(), 'cbyear' : cbyear } ) - if person.getGender() == RelLib.Person.female: + 'male_name' : idstr, 'byear' : byear, 'fam' : family.get_id(), 'child' : child.get_primary_name().get_name(), 'cbyear' : cbyear } ) + if person.get_gender() == RelLib.Person.female: error.write( _("Unborn mother: %(female_name)s born %(byear)d, in family %(fam)s had a child %(child)s born %(cbyear)d.\n") % { - 'female_name' : idstr, 'byear' : byear, 'fam' : family.getId(), 'child' : child.getPrimaryName().getName(), 'cbyear' : cbyear } ) + 'female_name' : idstr, 'byear' : byear, 'fam' : family.get_id(), 'child' : child.get_primary_name().get_name(), 'cbyear' : cbyear } ) else: if bage < yngpar: - if person.getGender() == RelLib.Person.male: + if person.get_gender() == RelLib.Person.male: warn.write( _("Young father: %(male_name)s at the age of %(bage)d in family %(fam)s had a child %(child)s.\n") % { - 'male_name' : idstr, 'bage' : bage, 'fam' : family.getId(), 'child' : child.getPrimaryName().getName() } ) - if person.getGender() == RelLib.Person.female: + 'male_name' : idstr, 'bage' : bage, 'fam' : family.get_id(), 'child' : child.get_primary_name().get_name() } ) + if person.get_gender() == RelLib.Person.female: warn.write( _("Young mother: %(female_name)s at the age of %(bage)d in family %(fam)s had a child %(child)s.\n") % { - 'female_name' : idstr, 'bage' : bage, 'fam' : family.getId(), 'child' : child.getPrimaryName().getName() } ) + 'female_name' : idstr, 'bage' : bage, 'fam' : family.get_id(), 'child' : child.get_primary_name().get_name() } ) if dyear>0 and cbyear>dyear: if cbyear-1>dyear: - if person.getGender() == RelLib.Person.male: + if person.get_gender() == RelLib.Person.male: error.write( _("Dead father: %(male_name)s died %(dyear)d, but in family %(fam)s had a child %(child)s born %(cbyear)d.\n") % { - 'male_name' : idstr, 'dyear' : dyear, 'fam' : family.getId(), 'child' : child.getPrimaryName().getName(), 'cbyear' : cbyear} ) - if person.getGender() == RelLib.Person.female: + 'male_name' : idstr, 'dyear' : dyear, 'fam' : family.get_id(), 'child' : child.get_primary_name().get_name(), 'cbyear' : cbyear} ) + if person.get_gender() == RelLib.Person.female: error.write( _("Dead mother: %(female_name)s died %(dyear)d, but in family %(fam)s had a child %(child)s born %(cbyear)d.\n") % { - 'female_name' : idstr, 'dyear' : dyear, 'fam' : family.getId(), 'child' : child.getPrimaryName().getName(), 'cbyear' : cbyear} ) + 'female_name' : idstr, 'dyear' : dyear, 'fam' : family.get_id(), 'child' : child.get_primary_name().get_name(), 'cbyear' : cbyear} ) else: - if person.getGender() == RelLib.Person.male: + if person.get_gender() == RelLib.Person.male: warn.write( _("Dead father: %(male_name)s died %(dyear)d, but in family %(fam)s had a child %(child)s born %(cbyear)d.\n") % { - 'male_name' : idstr, 'dyear' : dyear, 'fam' : family.getId(), 'child' : child.getPrimaryName().getName(), 'cbyear' : cbyear} ) - if person.getGender() == RelLib.Person.female: + 'male_name' : idstr, 'dyear' : dyear, 'fam' : family.get_id(), 'child' : child.get_primary_name().get_name(), 'cbyear' : cbyear} ) + if person.get_gender() == RelLib.Person.female: warn.write( _("Dead mother: %(female_name)s died %(dyear)d, but in family %(fam)s had a child %(child)s born %(cbyear)d.\n") % { - 'female_name' : idstr, 'dyear' : dyear, 'fam' : family.getId(), 'child' : child.getPrimaryName().getName(), 'cbyear' : cbyear} ) + 'female_name' : idstr, 'dyear' : dyear, 'fam' : family.get_id(), 'child' : child.get_primary_name().get_name(), 'cbyear' : cbyear} ) text = "" diff --git a/src/plugins/WebPage.py b/src/plugins/WebPage.py index b8c87504a..3fadff78b 100644 --- a/src/plugins/WebPage.py +++ b/src/plugins/WebPage.py @@ -75,7 +75,7 @@ _hline = " " # Everything is underlined, so use blank # #------------------------------------------------------------------------ def by_date(a,b): - return Date.compare_dates(a.getDateObj(),b.getDateObj()) + return Date.compare_dates(a.get_date_object(),b.get_date_object()) #------------------------------------------------------------------------ # @@ -108,16 +108,17 @@ class HtmlLinkDoc(HtmlDoc.HtmlDoc): #------------------------------------------------------------------------ class IndividualPage: - def __init__(self,person,photos,restrict,private,uc,link,mini_tree,map, + def __init__(self,db,person,photos,restrict,private,uc,link,mini_tree,map, dir_name,imgdir,doc,id,idlink,ext): self.person = person + self.db = db self.ext = ext self.doc = doc self.use_id = id self.id_link = idlink self.list = map self.private = private - self.alive = person.probablyAlive() and restrict + self.alive = person.probably_alive() and restrict self.photos = (photos == 2) or (photos == 1 and not self.alive) self.usecomments = not uc self.dir = dir_name @@ -127,7 +128,7 @@ class IndividualPage: self.scnt = 1 self.image_dir = imgdir - name = person.getPrimaryName().getRegularName() + name = person.get_primary_name().get_regular_name() self.doc.set_title(_("Summary of %s") % name) self.doc.fix_title() @@ -212,7 +213,7 @@ class IndividualPage: # # #-------------------------------------------------------------------- - def write_link_row(self,title,person): + def write_link_row(self,title,person_id): self.doc.start_row() self.doc.start_cell("NormalCell") self.doc.start_paragraph("Label") @@ -222,13 +223,14 @@ class IndividualPage: self.doc.start_cell("NormalCell") self.doc.start_paragraph("Data") - if person: - if self.list.has_key(person.getId()): - self.doc.start_link("%s.%s" % (person.getId(),self.ext)) - self.doc.write_text(person.getPrimaryName().getRegularName()) + if person_id: + person = self.db.find_person_from_id(person_id) + if self.list.has_key(person.get_id()): + self.doc.start_link("%s.%s" % (person.get_id(),self.ext)) + self.doc.write_text(person.get_primary_name().get_regular_name()) self.doc.end_link() else: - self.doc.write_text(person.getPrimaryName().getRegularName()) + self.doc.write_text(person.get_primary_name().get_regular_name()) self.doc.end_paragraph() self.doc.end_cell() @@ -245,14 +247,16 @@ class IndividualPage: self.doc.write_linktarget("s%d" % index) self.doc.write_text('%d. ' % index) index = index + 1 - self.write_info(sref.getBase().getTitle()) - self.write_info(sref.getBase().getAuthor()) - self.write_info(sref.getBase().getPubInfo()) - self.write_info(sref.getDate().getDate()) - self.write_info(sref.getPage()) + base_id = sref.get_base_id() + base = self.db.find_source_from_id(base_id) + self.write_info(base.get_title()) + self.write_info(base.get_author()) + self.write_info(base.get_publication_info()) + self.write_info(sref.get_date().get_date()) + self.write_info(sref.get_page()) if self.usecomments: - self.write_info(sref.getText()) - self.write_info(sref.getComments()) + self.write_info(sref.get_text()) + self.write_info(sref.get_comments()) self.doc.end_paragraph() def write_info(self,info): @@ -260,7 +264,7 @@ class IndividualPage: spaces. If the last character is not a period, the period is appended to produce a sentance""" - info = string.strip(info) + info = info.strip() if info != "": if info[-1] == '.': self.doc.write_text("%s " % info) @@ -268,14 +272,14 @@ class IndividualPage: self.doc.write_text("%s. " % info) def write_tree(self,ind_list): - if not self.mini_tree or not self.person.getMainParents(): + if not self.mini_tree or not self.person.get_main_parents_family_id(): return self.doc.start_paragraph("FamilyTitle") self.doc.end_paragraph() self.doc.start_paragraph("Data") self.doc.write_raw('
\n')
-        tree = MiniTree(self.person,self.doc,ind_list)
+        tree = MiniTree(self.db,self.person,self.doc,ind_list)
         for line in tree.lines:
             if line: self.doc.write_raw(line + '\n')
         self.doc.write_raw('
\n') @@ -284,12 +288,12 @@ class IndividualPage: def create_page(self,ind_list): """Generate the HTML page for the specific person""" - filebase = "%s.%s" % (self.person.getId(),self.ext) + filebase = "%s.%s" % (self.person.get_id(),self.ext) self.doc.open("%s/%s" % (self.dir,filebase)) - photo_list = self.person.getPhotoList() - name_obj = self.person.getPrimaryName() - name = name_obj.getRegularName() + photo_list = self.person.get_photo_list() + name_obj = self.person.get_primary_name() + name = name_obj.get_regular_name() # Write out the title line. @@ -307,9 +311,9 @@ class IndividualPage: # into the document. if self.photos and len(photo_list) > 0: - object = photo_list[0].getReference() - if object.getMimeType()[0:5] == "image": - file = object.getPath() + object = photo_list[0].get_reference() + if object.get_mime_type()[0:5] == "image": + file = object.get_path() if os.path.isfile(file): self.doc.start_paragraph("Data") self.doc.add_photo(file,"row",4.0,4.0) @@ -319,26 +323,27 @@ class IndividualPage: # name, gender, and parents self.doc.start_table("one","IndTable") - self.write_normal_row("%s:" % _("Name"), name, name_obj.getSourceRefList()) + self.write_normal_row("%s:" % _("Name"), name, name_obj.get_source_references()) if self.use_id: if self.id_link: - val = '%s' % (self.id_link,self.person.getId()) - val = string.replace(val,'*',self.person.getId()) + val = '%s' % (self.id_link,self.person.get_id()) + val = val.replace('*',self.person.get_id()) else: - val = self.person.getId() + val = self.person.get_id() self.write_id_row("%s:" % _("ID Number"),val) - if self.person.getGender() == RelLib.Person.male: + if self.person.get_gender() == RelLib.Person.male: self.write_normal_row("%s:" % _("Gender"), _("Male"),None) - elif self.person.getGender() == RelLib.Person.female: + elif self.person.get_gender() == RelLib.Person.female: self.write_normal_row("%s:" % _("Gender"), _("Female"),None) else: self.write_normal_row("%s:" % _("Gender"), _("Unknown"),None) - family = self.person.getMainParents() - if family: - self.write_link_row("%s:" % _("Father"), family.getFather()) - self.write_link_row("%s:" % _("Mother"), family.getMother()) + family_id = self.person.get_main_parents_family_id() + if family_id: + family = self.db.find_family_from_id(family_id) + self.write_link_row("%s:" % _("Father"), family.get_father_id()) + self.write_link_row("%s:" % _("Mother"), family.get_mother_id()) else: self.write_link_row("%s:" % _("Father"), None) self.write_link_row("%s:" % _("Mother"), None) @@ -388,9 +393,9 @@ class IndividualPage: my_list = [] index = 0 - for object in self.person.getPhotoList(): - if object.getReference().getMimeType()[0:5] == "image": - if object.getPrivacy() == 0 and index != 0: + for object in self.person.get_photo_list(): + if object.get_reference().get_mime_type()[0:5] == "image": + if object.get_privacy() == 0 and index != 0: my_list.append(object) index = 1 @@ -409,9 +414,9 @@ class IndividualPage: self.doc.start_table("gallery","IndTable") for obj in my_list: try: - src = obj.getReference().getPath() + src = obj.get_reference().get_path() junk,ext = os.path.splitext(src) - base = '%s%s' % (obj.getReference().getId(),ext) + base = '%s%s' % (obj.get_reference().get_id(),ext) if self.image_dir: shutil.copyfile(src,"%s/%s/%s" % (self.dir,self.image_dir,base)) @@ -439,15 +444,15 @@ class IndividualPage: self.doc.end_paragraph() self.doc.end_cell() self.doc.start_cell("NoteCell") - description = obj.getReference().getDescription() + description = obj.get_reference().get_description() if description != "": self.doc.start_paragraph("PhotoDescription") self.doc.write_text(description) self.doc.end_paragraph() - if obj.getNote() != "": - self.doc.write_note(obj.getNote(),obj.getNoteFormat(),"PhotoNote") - elif obj.getReference().getNote() != "": - self.doc.write_note(obj.getReference().getNote(),obj.getReference().getNoteFormat(),"PhotoNote") + if obj.get_note() != "": + self.doc.write_note(obj.get_note(),obj.get_note_format(),"PhotoNote") + elif obj.get_reference().get_note() != "": + self.doc.write_note(obj.get_reference().get_note(),obj.get_reference().get_note_format(),"PhotoNote") self.doc.end_cell() self.doc.end_row() except IOError: @@ -465,17 +470,21 @@ class IndividualPage: return count = 0 - event_list = [ self.person.getBirth(), self.person.getDeath() ] - event_list = event_list + self.person.getEventList() + event_list = [ self.person.get_birth(), self.person.get_death() ] + event_list = event_list + self.person.get_event_list() event_list.sort(by_date) for event in event_list: - if event.getPrivacy(): + if event.get_privacy(): continue - name = _(event.getName()) - date = event.getDate() - descr = event.getDescription() - place = event.getPlaceName() - srcref = event.getSourceRefList() + name = _(event.get_name()) + date = event.get_date() + descr = event.get_description() + place_id = event.get_place_id() + if place_id: + place = self.db.find_place_from_id(place_id).get_title() + else: + place = "" + srcref = event.get_source_references() if date == "" and descr == "" and place == "" and len(srcref) == 0: continue @@ -512,23 +521,27 @@ class IndividualPage: def write_notes(self): - if self.person.getNote() == "" or self.alive: + if self.person.get_note() == "" or self.alive: return self.doc.start_paragraph("NotesTitle") self.doc.write_text(_("Notes")) self.doc.end_paragraph() - self.doc.write_note(self.person.getNote(),self.person.getNoteFormat(),"NotesParagraph") + self.doc.write_note(self.person.get_note(),self.person.get_note_format(),"NotesParagraph") def write_fam_fact(self,event): if event == None: return - name = _(event.getName()) - date = event.getDate() - place = event.getPlaceName() - descr = event.getDescription() + name = _(event.get_name()) + date = event.get_date() + place_id = event.get_place_id() + if place_id: + place = self.db.find_place_from_id(place_id).get_title() + else: + place = "" + descr = event.get_description() if descr != "" and descr[-1] == ".": descr = descr[0:-1] if place != "" and place[-1] == ".": @@ -563,7 +576,7 @@ class IndividualPage: self.write_marriage_row([name, val]) def write_families(self): - if len(self.person.getFamilyList()) == 0: + if len(self.person.get_family_id_list()) == 0: return self.doc.start_paragraph("FamilyTitle") @@ -572,21 +585,23 @@ class IndividualPage: self.doc.start_table("three","IndTable") - for family in self.person.getFamilyList(): - if self.person == family.getFather(): - spouse = family.getMother() + for family_id in self.person.get_family_id_list(): + family = self.db.find_family_from_id(family_id) + if self.person.get_id() == family.get_father_id(): + spouse_id = family.get_mother_id() else: - spouse = family.getFather() + spouse_id = family.get_father_id() self.doc.start_row() self.doc.start_cell("NormalCell",2) self.doc.start_paragraph("Spouse") - if spouse: - if self.list.has_key(spouse.getId()): - self.doc.start_link("%s.%s" % (spouse.getId(),self.ext)) - self.doc.write_text(spouse.getPrimaryName().getRegularName()) + if spouse_id: + spouse = self.db.find_person_from_id(spouse_id) + if self.list.has_key(spouse_id): + self.doc.start_link("%s.%s" % (spouse_id,self.ext)) + self.doc.write_text(spouse.get_primary_name().get_regular_name()) self.doc.end_link() else: - self.doc.write_text(spouse.getPrimaryName().getRegularName()) + self.doc.write_text(spouse.get_primary_name().get_regular_name()) else: self.doc.write_text(_("unknown")) self.doc.end_paragraph() @@ -594,11 +609,11 @@ class IndividualPage: self.doc.end_row() if not self.alive: - for event in family.getEventList(): - if event.getPrivacy() == 0: + for event in family.get_event_list(): + if event.get_privacy() == 0: self.write_fam_fact(event) - child_list = family.getChildList() + child_list = family.get_child_id_list() if len(child_list) > 0: self.doc.start_row() @@ -612,14 +627,15 @@ class IndividualPage: self.doc.start_paragraph("Data") first = 1 - for child in family.getChildList(): - name = child.getPrimaryName().getRegularName() + for child_id in family.get_child_id_list(): + child = self.db.find_person_from_id(child_id) + name = child.get_primary_name().get_regular_name() if first == 1: first = 0 else: self.doc.write_text('\n') - if self.list.has_key(child.getId()): - self.doc.start_link("%s.%s" % (child.getId(),self.ext)) + if self.list.has_key(child_id): + self.doc.start_link("%s.%s" % (child_id,self.ext)) self.doc.write_text(name) self.doc.end_link() else: @@ -662,8 +678,8 @@ class WebReport(Report.Report): def make_date(self,date): start = date.get_start_date() - if date.isEmpty(): - val = date.getText() + if date.is_empty(): + val = date.get_text() elif date.isRange(): val = "FROM %s TO %s" % (self.subdate(start), self.subdate(date.get_stop_date())) @@ -719,22 +735,22 @@ class WebReport(Report.Report): except: return for p in person_list: - name = p.getPrimaryName() - firstName = name.getFirstName() - surName = name.getSurname() - suffix = name.getSuffix() + name = p.get_primary_name() + firstName = name.get_first_name() + surName = name.get_surname() + suffix = name.get_suffix() - f.write("%s.%s|" % (p.getId(),self.ext)) + f.write("%s.%s|" % (p.get_id(),self.ext)) f.write("%s|" % surName) if suffix == "": f.write("%s /%s/|" % (firstName,surName)) else: f.write("%s /%s/, %s|" % (firstName,surName, suffix)) - for e in [p.getBirth(),p.getDeath()]: + for e in [p.get_birth(),p.get_death()]: if e: - f.write("%s|" % self.make_date(e.getDateObj())) - if e.getPlace(): - f.write('%s|' % e.getPlace().get_title()) + f.write("%s|" % self.make_date(e.get_date_object())) + if e.get_place_id(): + f.write('%s|' % e.get_place_id().get_title()) else: f.write('|') else: @@ -758,7 +774,7 @@ class WebReport(Report.Report): a = {} for person in person_list: - n = person.getPrimaryName().getSurname() + n = person.get_primary_name().get_surname() if n: a[n[0]] = 1 else: @@ -772,14 +788,14 @@ class WebReport(Report.Report): last = '' end_col = 0 for person in person_list: - name = person.getPrimaryName().getName() + name = person.get_primary_name().get_name() if name and name[0] != last: last = name[0] doc.start_paragraph('IndexLabel') doc.write_text(name[0]) doc.end_paragraph() col_len = col_len - 1 - doc.start_link("%s.%s" % (person.getId(),self.ext)) + doc.start_link("%s.%s" % (person.get_id(),self.ext)) doc.write_text(name) doc.end_link() if col_len <= 0 and end_col == 0: @@ -832,7 +848,7 @@ class WebReport(Report.Report): image_dir_name) return - ind_list = self.filter.apply(self.db,self.db.getPersonMap().values()) + ind_list = self.filter.apply(self.db,self.db.get_person_id_map().values()) self.progress_bar_setup(float(len(ind_list))) doc = HtmlLinkDoc(self.selected_style,None,self.template_name,None) @@ -844,13 +860,13 @@ class WebReport(Report.Report): my_map = {} for l in ind_list: - my_map[l.getId()] = l + my_map[l.get_id()] = l for person in ind_list: tdoc = HtmlLinkDoc(self.selected_style,None,None,None,doc) tdoc.set_extension(self.ext) - tdoc.set_keywords([person.getPrimaryName().getSurname(), - person.getPrimaryName().getRegularName()]) - idoc = IndividualPage(person, self.photos, self.restrict, + tdoc.set_keywords([person.get_primary_name().get_surname(), + person.get_primary_name().get_regular_name()]) + idoc = IndividualPage(self.db,person, self.photos, self.restrict, self.private, self.srccomments, self.include_link, self.include_mini_tree, my_map, dir_name, self.image_dir, tdoc, @@ -979,7 +995,7 @@ class WebReportDialog(Report.ReportDialog): def get_report_filters(self): """Set up the list of possible content filters.""" - name = self.person.getPrimaryName().getName() + name = self.person.get_primary_name().get_name() all = GenericFilter.GenericFilter() all.set_name(_("Entire Database")) @@ -987,15 +1003,15 @@ class WebReportDialog(Report.ReportDialog): des = GenericFilter.GenericFilter() des.set_name(_("Direct Descendants of %s") % name) - des.add_rule(GenericFilter.IsDescendantOf([self.person.getId()])) + des.add_rule(GenericFilter.IsDescendantOf([self.person.get_id()])) df = GenericFilter.GenericFilter() df.set_name(_("Descendant Families of %s") % name) - df.add_rule(GenericFilter.IsDescendantFamilyOf([self.person.getId()])) + df.add_rule(GenericFilter.IsDescendantFamilyOf([self.person.get_id()])) ans = GenericFilter.GenericFilter() ans.set_name(_("Ancestors of %s") % name) - ans.add_rule(GenericFilter.IsAncestorOf([self.person.getId()])) + ans.add_rule(GenericFilter.IsAncestorOf([self.person.get_id()])) return [all,des,df,ans] @@ -1174,12 +1190,12 @@ class WebReportDialog(Report.ReportDialog): self.private = self.no_private.get_active() self.img_dir_text = unicode(self.imgdir.get_text()) - self.html_ext = string.strip(unicode(self.ext.entry.get_text())) + self.html_ext = unicode(self.ext.entry.get_text().strip()) if self.html_ext[0] == '.': self.html_ext = self.html_ext[1:] self.use_id = self.include_id.get_active() self.use_gendex = self.gendex.get_active() - self.id_link = string.strip(unicode(self.linkpath.get_text())) + self.id_link = unicode(self.linkpath.get_text().strip()) self.srccomments = self.no_comments.get_active() if self.no_images.get_active() == 1: self.photos = 0 @@ -1231,28 +1247,32 @@ class MiniTree: class. I'm sure that someone with more knowledge of GRAMPS can make it much cleaner. """ - def __init__(self,person,doc,map): + def __init__(self,db,person,doc,map): self.map = map + self.db = db self.doc = doc self.person = person self.lines = [ "" for i in range(9) ] - name = self.person.getPrimaryName().getRegularName() + name = self.person.get_primary_name().get_regular_name() self.lines[4] = name indent = (len(name) - 1) / 2 self.lines[3] = self.lines[5] = self.lines[6] = ' ' * indent + '|' self.draw_parents(person,2,6,indent,1) def draw_parents(self, person, father_line, mother_line, indent, recurse): - family = person.getMainParents() - if not family: return + family_id = person.get_main_parents_family_id() + if not family_id: return + family = self.db.find_family_from_id(family_id) father_name = mother_name = "" - father = family.getFather() - mother = family.getMother() - if father: - father_name = father.getPrimaryName().getRegularName() - if mother: - mother_name = mother.getPrimaryName().getRegularName() + father_id = family.get_father_id() + mother_id = family.get_mother_id() + if father_id: + father = self.db.find_person_from_id(father_id) + father_name = father.get_primary_name().get_regular_name() + if mother_id: + mother = self.db.find_person_from_id(mother_id) + mother_name = mother.get_primary_name().get_regular_name() pad = len(father_name) if pad < len(mother_name): pad = len(mother_name) @@ -1282,8 +1302,8 @@ class MiniTree: self.lines[line] += ' ' * (indent-len(self.lines[line])) + text def draw_link(self, line, person, name): - if person and person.getId() and self.map.has_key(person.getId()): - self.lines[line] += "%s" % (person.getId(), + if person and person.get_id() and self.map.has_key(person.get_id()): + self.lines[line] += "%s" % (person.get_id(), self.doc.ext, name) else: self.lines[line] += "%s" % name diff --git a/src/plugins/WriteCD.py b/src/plugins/WriteCD.py index da7ba4675..a93f46cbc 100644 --- a/src/plugins/WriteCD.py +++ b/src/plugins/WriteCD.py @@ -139,13 +139,13 @@ class PackageWriter: print msg os._exit(1) - for obj in self.db.getObjectMap().values(): - oldfile = obj.getPath() + for obj in self.db.get_object_map().values(): + oldfile = obj.get_path() root = os.path.basename(oldfile) if os.path.isfile(oldfile): self.copy_file(oldfile,'burn:///%s/%s' % (base,root)) - if obj.getMimeType()[0:5] == "image": - self.make_thumbnail(base,root,obj.getPath()) + if obj.get_mime_type()[0:5] == "image": + self.make_thumbnail(base,root,obj.get_path()) else: print "Warning: media file %s was not found," % root,\ "so it was ignored." @@ -164,7 +164,7 @@ class PackageWriter: Utils.destroy_passed_object(obj) missmedia_action = 0 - base = os.path.basename(self.db.getSavePath()) + base = os.path.basename(self.db.get_save_path()) try: uri = gnome.vfs.URI('burn:///%s' % base) @@ -181,35 +181,35 @@ class PackageWriter: #-------------------------------------------------------- def remove_clicked(): # File is lost => remove all references and the object itself - mobj = self.db.getObject(self.object_id) - for p in self.db.getFamilyMap().values(): - nl = p.getPhotoList() + mobj = self.db.get_object(self.object_id) + for p in self.db.get_family_id_map().values(): + nl = p.get_photo_list() for o in nl: - if o.getReference() == mobj: + if o.get_reference() == mobj: nl.remove(o) - p.setPhotoList(nl) - for key in self.db.getPersonKeys(): - p = self.db.getPerson(key) - nl = p.getPhotoList() + p.set_photo_list(nl) + for key in self.db.get_person_keys(): + p = self.db.get_person(key) + nl = p.get_photo_list() for o in nl: - if o.getReference() == mobj: + if o.get_reference() == mobj: nl.remove(o) - p.setPhotoList(nl) - for key in self.db.getSourceKeys(): - p = self.db.getSource(key) - nl = p.getPhotoList() + p.set_photo_list(nl) + for key in self.db.get_source_keys(): + p = self.db.get_source(key) + nl = p.get_photo_list() for o in nl: - if o.getReference() == mobj: + if o.get_reference() == mobj: nl.remove(o) - p.setPhotoList(nl) - for key in self.db.getPlaceKeys(): - p = self.db.getPlace(key) - nl = p.getPhotoList() + p.set_photo_list(nl) + for key in self.db.get_place_id_keys(): + p = self.db.get_place_id(key) + nl = p.get_photo_list() for o in nl: - if o.getReference() == mobj: + if o.get_reference() == mobj: nl.remove(o) - p.setPhotoList(nl) - self.db.removeObject(self.object_id) + p.set_photo_list(nl) + self.db.remove_object(self.object_id) Utils.modified() def leave_clicked(): @@ -241,16 +241,16 @@ class PackageWriter: # Write media files first, since the database may be modified # during the process (i.e. when removing object) - for obj in self.db.getObjectMap().values(): - oldfile = obj.getPath() + for obj in self.db.get_object_map().values(): + oldfile = obj.get_path() root = os.path.basename(oldfile) if os.path.isfile(oldfile): self.copy_file(oldfile,'burn:///%s/%s' % (base,root)) - if obj.getMimeType()[0:5] == "image": - self.make_thumbnail(base,root,obj.getPath()) + if obj.get_mime_type()[0:5] == "image": + self.make_thumbnail(base,root,obj.get_path()) else: # File is lost => ask what to do - self.object_id = obj.getId() + self.object_id = obj.get_id() if missmedia_action == 0: mmd = QuestionDialog.MissingMediaDialog(_("Media object could not be found"), _("%(file_name)s is referenced in the database, but no longer exists. " diff --git a/src/plugins/WriteFtree.py b/src/plugins/WriteFtree.py index 4fe2d24a0..2d5d91c00 100644 --- a/src/plugins/WriteFtree.py +++ b/src/plugins/WriteFtree.py @@ -108,17 +108,17 @@ class FtreeWriter: all.add_rule(GenericFilter.Everyone([])) des = GenericFilter.GenericFilter() - des.set_name(_("Descendants of %s") % person.getPrimaryName().getName()) - des.add_rule(GenericFilter.IsDescendantOf([person.getId()])) + des.set_name(_("Descendants of %s") % person.get_primary_name().get_name()) + des.add_rule(GenericFilter.IsDescendantOf([person.get_id()])) ans = GenericFilter.GenericFilter() - ans.set_name(_("Ancestors of %s") % person.getPrimaryName().getName()) - ans.add_rule(GenericFilter.IsAncestorOf([person.getId()])) + ans.set_name(_("Ancestors of %s") % person.get_primary_name().get_name()) + ans.add_rule(GenericFilter.IsAncestorOf([person.get_id()])) com = GenericFilter.GenericFilter() com.set_name(_("People with common ancestor with %s") % - person.getPrimaryName().getName()) - com.add_rule(GenericFilter.HasCommonAncestorWith([person.getId()])) + person.get_primary_name().get_name()) + com.add_rule(GenericFilter.HasCommonAncestorWith([person.get_id()])) self.filter_menu = GenericFilter.build_filter_menu([all,des,ans,com]) self.filter.set_menu(self.filter_menu) @@ -149,12 +149,12 @@ class FtreeWriter: def export(self, filename, cfilter, restrict ): if cfilter == None: - for p in self.db.getPersonKeys(): + for p in self.db.get_person_keys(): self.plist[p] = 1 else: try: - for p in cfilter.apply(self.db, self.db.getPersonMap().values()): - self.plist[p.getId()] = 1 + for p in cfilter.apply(self.db, self.db.get_person_id_map().values()): + self.plist[p.get_id()] = 1 except Errors.FilterError, msg: (m1,m2) = msg.messages() ErrorDialog(m1,m2) @@ -164,10 +164,10 @@ class FtreeWriter: id_map = {} id_name = {} for key in self.plist: - pn = self.db.getPerson(key).getPrimaryName() + pn = self.db.get_person(key).get_primary_name() fn = "" - sn = pn.getSurname() - items = pn.getFirstName().split() + sn = pn.get_surname() + items = pn.get_first_name().split() if len(items) > 0: n = "%s %s" % (items[0],sn) else: @@ -191,28 +191,28 @@ class FtreeWriter: f = open(filename,"w") for key in self.plist: - p = self.db.getPerson(key) + p = self.db.get_person(key) name = id_name[key] father = "" mother = "" email = "" web = "" - family = p.getMainParents() + family = p.get_main_parents_family_id() if family: - if family.getFather() and id_map.has_key(family.getFather().getId()): - father = id_map[family.getFather().getId()] - if family.getMother() and id_map.has_key(family.getMother().getId()): - mother = id_map[family.getMother().getId()] + if family.get_father_id() and id_map.has_key(family.get_father_id().get_id()): + father = id_map[family.get_father_id().get_id()] + if family.get_mother_id() and id_map.has_key(family.get_mother_id().get_id()): + mother = id_map[family.get_mother_id().get_id()] # # Calculate Date # - birth = p.getBirth().getDateObj() - death = p.getDeath().getDateObj() + birth = p.get_birth().get_date_object() + death = p.get_death().get_date_object() if restrict: - alive = p.probablyAlive() + alive = p.probably_alive() else: alive = 0 diff --git a/src/plugins/WriteGedcom.py b/src/plugins/WriteGedcom.py index cc7bd258c..a073cba76 100644 --- a/src/plugins/WriteGedcom.py +++ b/src/plugins/WriteGedcom.py @@ -113,20 +113,20 @@ _get_int = re.compile('([0-9]+)') # #------------------------------------------------------------------------- def add_familys_sources(family,slist,private): - for event in family.getEventList(): - if private and event.getPrivacy(): + for event in family.get_event_list(): + if private and event.get_privacy(): continue - for source_ref in event.getSourceRefList(): - sbase = source_ref.getBase() - if sbase != None and not slist.has_key(sbase.getId()): - slist[sbase.getId()] = 1 - for attr in family.getAttributeList(): - if private and attr.getPrivacy(): + for source_ref in event.get_source_references(): + sbase = source_ref.get_base_id() + if sbase != None and not slist.has_key(sbase.get_id()): + slist[sbase.get_id()] = 1 + for attr in family.get_attribute_list(): + if private and attr.get_privacy(): continue - for source_ref in attr.getSourceRefList(): - sbase = source_ref.getBase() - if sbase != None and not slist.has_key(sbase.getId()): - slist[sbase.getId()] = 1 + for source_ref in attr.get_source_references(): + sbase = source_ref.get_base_id() + if sbase != None and not slist.has_key(sbase.get_id()): + slist[sbase.get_id()] = 1 #------------------------------------------------------------------------- # @@ -134,41 +134,41 @@ def add_familys_sources(family,slist,private): # #------------------------------------------------------------------------- def add_persons_sources(person,slist,private): - elist = person.getEventList()[:] + elist = person.get_event_list()[:] - elist.append(person.getBirth()) - elist.append(person.getDeath()) + elist.append(person.get_birth()) + elist.append(person.get_death()) for event in elist: - if private and event.getPrivacy(): + if private and event.get_privacy(): continue - for source_ref in event.getSourceRefList(): - sbase = source_ref.getBase() - if sbase != None and not slist.has_key(sbase.getId()): - slist[sbase.getId()] = 1 + for source_ref in event.get_source_references(): + sbase = source_ref.get_base_id() + if sbase != None and not slist.has_key(sbase.get_id()): + slist[sbase.get_id()] = 1 - for event in person.getAddressList(): - if private and event.getPrivacy(): + for event in person.get_address_list(): + if private and event.get_privacy(): continue - for source_ref in event.getSourceRefList(): - sbase = source_ref.getBase() - if sbase != None and not slist.has_key(sbase.getId()): - slist[sbase.getId()] = 1 + for source_ref in event.get_source_references(): + sbase = source_ref.get_base_id() + if sbase != None and not slist.has_key(sbase.get_id()): + slist[sbase.get_id()] = 1 - for event in person.getAttributeList(): - if private and event.getPrivacy(): + for event in person.get_attribute_list(): + if private and event.get_privacy(): continue - for source_ref in event.getSourceRefList(): - sbase = source_ref.getBase() - if sbase != None and not slist.has_key(sbase.getId()): - slist[sbase.getId()] = 1 + for source_ref in event.get_source_references(): + sbase = source_ref.get_base_id() + if sbase != None and not slist.has_key(sbase.get_id()): + slist[sbase.get_id()] = 1 - for name in person.getAlternateNames() + [person.getPrimaryName()]: - if private and name.getPrivacy(): + for name in person.get_alternate_names() + [person.get_primary_name()]: + if private and name.get_privacy(): continue - for source_ref in name.getSourceRefList(): - sbase = source_ref.getBase() - if sbase != None and not slist.has_key(sbase.getId()): - slist[sbase.getId()] = 1 + for source_ref in name.get_source_references(): + sbase = source_ref.get_base_id() + if sbase != None and not slist.has_key(sbase.get_id()): + slist[sbase.get_id()] = 1 #------------------------------------------------------------------------- # @@ -187,8 +187,8 @@ def addr_append(text,data): # #------------------------------------------------------------------------- def sortById(first,second): - fid = first.getId() - sid = second.getId() + fid = first.get_id() + sid = second.get_id() if fid == sid: return 0 @@ -390,17 +390,17 @@ class GedcomWriter: all.add_rule(GenericFilter.Everyone([])) des = GenericFilter.GenericFilter() - des.set_name(_("Descendants of %s") % person.getPrimaryName().getName()) - des.add_rule(GenericFilter.IsDescendantOf([person.getId()])) + des.set_name(_("Descendants of %s") % person.get_primary_name().get_name()) + des.add_rule(GenericFilter.IsDescendantOf([person.get_id()])) ans = GenericFilter.GenericFilter() - ans.set_name(_("Ancestors of %s") % person.getPrimaryName().getName()) - ans.add_rule(GenericFilter.IsAncestorOf([person.getId()])) + ans.set_name(_("Ancestors of %s") % person.get_primary_name().get_name()) + ans.add_rule(GenericFilter.IsAncestorOf([person.get_id()])) com = GenericFilter.GenericFilter() com.set_name(_("People with common ancestor with %s") % - person.getPrimaryName().getName()) - com.add_rule(GenericFilter.HasCommonAncestorWith([person.getId()])) + person.get_primary_name().get_name()) + com.add_rule(GenericFilter.HasCommonAncestorWith([person.get_id()])) self.filter_menu = GenericFilter.build_filter_menu([all,des,ans,com]) filter_obj.set_menu(self.filter_menu) @@ -419,7 +419,7 @@ class GedcomWriter: target_obj.set_menu(myMenu) self.target_menu = myMenu - pathname = os.path.join (os.path.dirname(db.getSavePath()), + pathname = os.path.join (os.path.dirname(db.get_save_path()), "export.ged") filetgt = self.topDialog.get_widget('fileentry1') @@ -484,12 +484,12 @@ class GedcomWriter: name = unicode(self.topDialog.get_widget("filename").get_text()) if cfilter == None: - for p in self.db.getPersonKeys(): + for p in self.db.get_person_keys(): self.plist[p] = 1 else: try: - for p in cfilter.apply(self.db, self.db.getPersonMap().values()): - self.plist[p.getId()] = 1 + for p in cfilter.apply(self.db, self.db.get_person_id_map().values()): + self.plist[p.get_id()] = 1 except Errors.FilterError, msg: (m1,m2) = msg.messages() ErrorDialog(m1,m2) @@ -498,11 +498,11 @@ class GedcomWriter: self.flist = {} self.slist = {} for key in self.plist.keys(): - p = self.db.getPerson(key) + p = self.db.get_person(key) add_persons_sources(p,self.slist,self.private) - for family in p.getFamilyList(): + for family in p.get_family_id_list(): add_familys_sources(family,self.slist,self.private) - self.flist[family.getId()] = 1 + self.flist[family.get_id()] = 1 Utils.destroy_passed_object(obj) @@ -538,7 +538,7 @@ class GedcomWriter: self.private = 0 self.copy = 0 - for p in self.db.getPersonKeys(): + for p in self.db.get_person_keys(): self.plist[p] = 1 gedmap = GedcomInfo.GedcomInfoDB() @@ -561,11 +561,11 @@ class GedcomWriter: self.slist = {} for key in self.plist.keys(): - p = self.db.getPerson(key) + p = self.db.get_person(key) add_persons_sources(p,self.slist,self.private) - for family in p.getFamilyList(): + for family in p.get_family_id_list(): add_familys_sources(family,self.slist,self.private) - self.flist[family.getId()] = 1 + self.flist[family.get_id()] = 1 self.export_data(self.name) @@ -609,31 +609,31 @@ class GedcomWriter: self.writeln('2 FORM LINEAGE-LINKED') self.gnu_fdl() self.writeln("0 @SUBM@ SUBM") - owner = self.db.getResearcher() - if owner.getName(): - self.writeln("1 NAME %s" % self.cnvtxt(owner.getName())) + owner = self.db.get_researcher() + if owner.get_name(): + self.writeln("1 NAME %s" % self.cnvtxt(owner.get_name())) else: self.writeln('1 NAME Not Provided') - if owner.getAddress(): + if owner.get_address(): cnt = 0 - self.writeln("1 ADDR %s" % self.cnvtxt(owner.getAddress())) - if owner.getCity(): - self.writeln("2 CONT %s" % self.cnvtxt(owner.getCity())) + self.writeln("1 ADDR %s" % self.cnvtxt(owner.get_address())) + if owner.get_city(): + self.writeln("2 CONT %s" % self.cnvtxt(owner.get_city())) cnt = 1 - if owner.getState(): - self.writeln("2 CONT %s" % self.cnvtxt(owner.getState())) + if owner.get_state(): + self.writeln("2 CONT %s" % self.cnvtxt(owner.get_state())) cnt = 1 - if owner.getPostalCode(): - self.writeln("2 CONT %s" % self.cnvtxt(owner.getPostalCode())) + if owner.get_postal_code(): + self.writeln("2 CONT %s" % self.cnvtxt(owner.get_postal_code())) cnt = 1 - if owner.getCountry(): - self.writeln("2 CONT %s" % self.cnvtxt(owner.getCountry())) + if owner.get_country(): + self.writeln("2 CONT %s" % self.cnvtxt(owner.get_country())) cnt = 1 if cnt == 0: self.writeln('2 CONT Not Provided') - if owner.getPhone(): - self.writeln("1 PHON %s" % self.cnvtxt(owner.getPhone())) + if owner.get_phone(): + self.writeln("1 PHON %s" % self.cnvtxt(owner.get_phone())) else: self.writeln('1 ADDR Not Provided') self.writeln('2 CONT Not Provided') @@ -643,7 +643,7 @@ class GedcomWriter: nump = float(len(self.plist)) index = 0.0 for key in pkeys: - self.write_person(self.db.getPerson(key)) + self.write_person(self.db.get_person(key)) index = index + 1 if index%100 == 0 and not self.cl: self.pbar.set_fraction(index/nump) @@ -669,10 +669,10 @@ class GedcomWriter: y = t[0] if self.copy == 0: - o = self.db.getResearcher().getName() + o = self.db.get_researcher().get_name() self.writeln('1 COPR Copyright (c) %d %s.' % (y,o)) elif self.copy == 1: - o = self.db.getResearcher().getName() + o = self.db.get_researcher().get_name() self.writeln('1 COPR Copyright (c) %d %s. See additional copyright NOTE below.' % (y,o)) def gnu_fdl(self): @@ -683,7 +683,7 @@ class GedcomWriter: t = time.localtime(time.time()) y = t[0] - o = self.db.getResearcher().getName() + o = self.db.get_researcher().get_name() self.writeln('1 NOTE Copyright (c) %d %s.' % (y,o)) try: @@ -698,27 +698,27 @@ class GedcomWriter: nump = float(len(self.flist)) index = 0.0 for key in self.flist.keys(): - family = self.db.getFamily(key) + family = self.db.get_family_id(key) father_alive = mother_alive = 0 - self.writeln("0 @%s@ FAM" % self.fid(family.getId())) + self.writeln("0 @%s@ FAM" % self.fid(family.get_id())) self.frefn(family) - person = family.getFather() - if person != None and self.plist.has_key(person.getId()): - self.writeln("1 HUSB @%s@" % self.pid(person.getId())) - father_alive = person.probablyAlive() + person = family.get_father_id() + if person != None and self.plist.has_key(person.get_id()): + self.writeln("1 HUSB @%s@" % self.pid(person.get_id())) + father_alive = person.probably_alive() - person = family.getMother() - if person != None and self.plist.has_key(person.getId()): - self.writeln("1 WIFE @%s@" % self.pid(person.getId())) - mother_alive = person.probablyAlive() + person = family.get_mother_id() + if person != None and self.plist.has_key(person.get_id()): + self.writeln("1 WIFE @%s@" % self.pid(person.get_id())) + mother_alive = person.probably_alive() if not self.restrict or ( not father_alive and not mother_alive ): - self.write_ord("SLGS",family.getLdsSeal(),1,const.lds_ssealing) + self.write_ord("SLGS",family.get_lds_sealing(),1,const.lds_ssealing) - for event in family.getEventList(): - if self.private and event.getPrivacy(): + for event in family.get_event_list(): + if self.private and event.get_privacy(): continue - name = event.getName() + name = event.get_name() val = "" if const.familyConstantEvents.has_key(name): val = const.familyConstantEvents[name] @@ -727,23 +727,23 @@ class GedcomWriter: if val: self.writeln("1 %s %s" % (self.cnvtxt(val), - self.cnvtxt(event.getDescription()))) + self.cnvtxt(event.get_description()))) else: - self.writeln("1 EVEN %s" % self.cnvtxt(event.getDescription())) + self.writeln("1 EVEN %s" % self.cnvtxt(event.get_description())) self.writeln("2 TYPE %s" % self.cnvtxt(name)) self.dump_event_stats(event) - for person in family.getChildList(): - if not self.plist.has_key(person.getId()): + for person in family.get_child_id_list(): + if not self.plist.has_key(person.get_id()): continue - self.writeln("1 CHIL @%s@" % self.pid(person.getId())) + self.writeln("1 CHIL @%s@" % self.pid(person.get_id())) if self.adopt == GedcomInfo.ADOPT_FTW: - if person.getMainParents() == family: + if person.get_main_parents_family_id() == family: self.writeln('2 _FREL Natural') self.writeln('2 _MREL Natural') else: - for f in person.getParentList(): + for f in person.get_parent_family_id_list(): if f[0] == family: self.writeln('2 _FREL %s' % f[2]) self.writeln('2 _MREL %s' % f[1]) @@ -766,18 +766,18 @@ class GedcomWriter: nump = float(len(self.slist)) index = 0.0 for key in self.slist.keys(): - source = self.db.getSource(key) - self.writeln("0 @%s@ SOUR" % self.sid(source.getId())) - if source.getTitle(): - self.writeln("1 TITL %s" % fmtline(self.cnvtxt(source.getTitle()),248,1,self.nl)) - if source.getAuthor(): - self.writeln("1 AUTH %s" % self.cnvtxt(source.getAuthor())) - if source.getPubInfo(): - self.writeln("1 PUBL %s" % self.cnvtxt(source.getPubInfo())) + source = self.db.get_source(key) + self.writeln("0 @%s@ SOUR" % self.sid(source.get_id())) + if source.get_title(): + self.writeln("1 TITL %s" % fmtline(self.cnvtxt(source.get_title()),248,1,self.nl)) + if source.get_author(): + self.writeln("1 AUTH %s" % self.cnvtxt(source.get_author())) + if source.get_publication_info(): + self.writeln("1 PUBL %s" % self.cnvtxt(source.get_publication_info())) if source.getAbbrev(): self.writeln("1 ABBR %s" % self.cnvtxt(source.getAbbrev())) - if source.getNote(): - self.write_long_text("NOTE",1,self.cnvtxt(source.getNote())) + if source.get_note(): + self.write_long_text("NOTE",1,self.cnvtxt(source.get_note())) index = index + 1 if index % 100 == 0 and not self.cl: self.sbar.set_fraction(index/nump) @@ -787,66 +787,62 @@ class GedcomWriter: self.sbar.set_fraction(1.0) def write_person(self,person): - self.writeln("0 @%s@ INDI" % self.pid(person.getId())) - restricted = self.restrict and person.probablyAlive () + self.writeln("0 @%s@ INDI" % self.pid(person.get_id())) + restricted = self.restrict and person.probably_alive () self.prefn(person) - primaryname = person.getPrimaryName () + primaryname = person.get_primary_name () if restricted and self.living: primaryname = RelLib.Name (primaryname) - primaryname.setFirstName ("Living") + primaryname.set_first_name ("Living") nickname = "" else: - primaryname = person.getPrimaryName () - nickname = person.getNickName () + primaryname = person.get_primary_name () + nickname = person.get_nick_name () if restricted and self.exclnotes: primaryname = RelLib.Name (primaryname) - primaryname.setNote ('') + primaryname.set_note ('') if restricted and self.exclsrcs: primaryname = RelLib.Name (primaryname) - primaryname.setSourceRefList ([]) + primaryname.set_source_reference_list ([]) self.write_person_name(primaryname, nickname) if (self.altname == GedcomInfo.ALT_NAME_STD and not (restricted and self.living)): - for name in person.getAlternateNames(): + for name in person.get_alternate_names(): self.write_person_name(name,"") - if person.getGender() == RelLib.Person.male: + if person.get_gender() == RelLib.Person.male: self.writeln("1 SEX M") - elif person.getGender() == RelLib.Person.female: + elif person.get_gender() == RelLib.Person.female: self.writeln("1 SEX F") if not restricted: - birth = person.getBirth() - if not (self.private and birth.getPrivacy()): - if not birth.getDateObj().isEmpty() or birth.getPlaceName(): + birth = person.get_birth() + if not (self.private and birth.get_privacy()): + if not birth.get_date_object().is_empty() or birth.get_place_name(): self.writeln("1 BIRT") self.dump_event_stats(birth) - death = person.getDeath() - if not (self.private and death.getPrivacy()): - if not death.getDateObj().isEmpty() or death.getPlaceName(): + death = person.get_death() + if not (self.private and death.get_privacy()): + if not death.get_date_object().is_empty() or death.get_place_name(): self.writeln("1 DEAT") self.dump_event_stats(death) - uid = person.getPafUid() - if uid: - self.writeln("1 _UID %s" % uid) - ad = 0 - self.write_ord("BAPL",person.getLdsBaptism(),1,const.lds_baptism) - self.write_ord("ENDL",person.getLdsEndowment(),1,const.lds_baptism) - self.write_ord("SLGC",person.getLdsSeal(),1,const.lds_csealing) + self.write_ord("BAPL",person.get_lds_baptism(),1,const.lds_baptism) + self.write_ord("ENDL",person.get_lds_endowment(),1,const.lds_baptism) + self.write_ord("SLGC",person.get_lds_sealing(),1,const.lds_csealing) - for event in person.getEventList(): - if self.private and event.getPrivacy(): + for event in person.get_event_list(): + if self.private and event.get_privacy(): continue - name = event.getName() + name = event.get_name() val = "" if const.personalConstantEvents.has_key(name): val = const.personalConstantEvents[name] @@ -857,14 +853,14 @@ class GedcomWriter: ad = 1 self.writeln('1 ADOP') fam = None - for f in person.getParentList(): + for f in person.get_parent_family_id_list(): mrel = string.lower(f[1]) frel = string.lower(f[2]) if mrel=="adopted" or frel=="adopted": fam = f[0] break if fam: - self.writeln('2 FAMC @%s@' % self.fid(fam.getId())) + self.writeln('2 FAMC @%s@' % self.fid(fam.get_id())) if mrel == frel: self.writeln('3 ADOP BOTH') elif mrel == "adopted": @@ -873,24 +869,24 @@ class GedcomWriter: self.writeln('3 ADOP HUSB') elif val : self.writeln("1 %s %s" % (self.cnvtxt(val),\ - self.cnvtxt(event.getDescription()))) + self.cnvtxt(event.get_description()))) else: - self.writeln("1 EVEN %s" % self.cnvtxt(event.getDescription())) - self.writeln("2 TYPE %s" % self.cnvtxt(event.getName())) + self.writeln("1 EVEN %s" % self.cnvtxt(event.get_description())) + self.writeln("2 TYPE %s" % self.cnvtxt(event.get_name())) self.dump_event_stats(event) - if self.adopt == GedcomInfo.ADOPT_EVENT and ad == 0 and len(person.getParentList()) != 0: + if self.adopt == GedcomInfo.ADOPT_EVENT and ad == 0 and len(person.get_parent_family_id_list()) != 0: self.writeln('1 ADOP') fam = None - for f in person.getParentList(): + for f in person.get_parent_family_id_list(): mrel = string.lower(f[1]) frel = string.lower(f[2]) if mrel=="adopted" or frel=="adopted": fam = f[0] break if fam: - self.writeln('2 FAMC @%s@' % self.fid(fam.getId())) + self.writeln('2 FAMC @%s@' % self.fid(fam.get_id())) if mrel == frel: self.writeln('3 ADOP BOTH') elif mrel == "adopted": @@ -898,10 +894,10 @@ class GedcomWriter: else: self.writeln('3 ADOP HUSB') - for attr in person.getAttributeList(): - if self.private and attr.getPrivacy(): + for attr in person.get_attribute_list(): + if self.private and attr.get_privacy(): continue - name = attr.getType() + name = attr.get_type() if const.personalConstantAttributes.has_key(name): val = const.personalConstantAttributes[name] else: @@ -911,53 +907,53 @@ class GedcomWriter: else: self.writeln("1 EVEN") self.writeln("2 TYPE %s" % self.cnvtxt(name)) - self.writeln("2 PLAC %s" % string.replace(self.cnvtxt(attr.getValue()),'\r',' ')) - if attr.getNote(): - self.write_long_text("NOTE",2,self.cnvtxt(attr.getNote())) - for srcref in attr.getSourceRefList(): + self.writeln("2 PLAC %s" % string.replace(self.cnvtxt(attr.get_value()),'\r',' ')) + if attr.get_note(): + self.write_long_text("NOTE",2,self.cnvtxt(attr.get_note())) + for srcref in attr.get_source_references(): self.write_source_ref(2,srcref) - for addr in person.getAddressList(): - if self.private and addr.getPrivacy(): + for addr in person.get_address_list(): + if self.private and addr.get_privacy(): continue self.writeln("1 RESI") - self.print_date("2 DATE",addr.getDateObj()) + self.print_date("2 DATE",addr.get_date_object()) if self.resi == 0: - self.write_long_text("ADDR",2,self.cnvtxt(addr.getStreet())) - if addr.getCity(): - self.writeln("3 CITY %s" % self.cnvtxt(addr.getCity())) - if addr.getState(): - self.writeln("3 STAE %s" % self.cnvtxt(addr.getState())) - if addr.getPostal(): - self.writeln("3 POST %s" % self.cnvtxt(addr.getPostal())) - if addr.getCountry(): - self.writeln("3 CTRY %s" % self.cnvtxt(addr.getCountry())) - if addr.getPhone(): - self.writeln("2 PHON %s" % self.cnvtxt(addr.getPhone())) + self.write_long_text("ADDR",2,self.cnvtxt(addr.get_street())) + if addr.get_city(): + self.writeln("3 CITY %s" % self.cnvtxt(addr.get_city())) + if addr.get_state(): + self.writeln("3 STAE %s" % self.cnvtxt(addr.get_state())) + if addr.get_postal_code(): + self.writeln("3 POST %s" % self.cnvtxt(addr.get_postal_code())) + if addr.get_country(): + self.writeln("3 CTRY %s" % self.cnvtxt(addr.get_country())) + if addr.get_phone(): + self.writeln("2 PHON %s" % self.cnvtxt(addr.get_phone())) else: - text = addr.getStreet() - text = addr_append(text,addr.getCity()) - text = addr_append(text,addr.getState()) - text = addr_append(text,addr.getPostal()) - text = addr_append(text,addr.getCountry()) - text = addr_append(text,addr.getPhone()) + text = addr.get_street() + text = addr_append(text,addr.get_city()) + text = addr_append(text,addr.get_state()) + text = addr_append(text,addr.get_postal_code()) + text = addr_append(text,addr.get_country()) + text = addr_append(text,addr.get_phone()) if text: self.writeln("2 PLAC %s" % string.replace(self.cnvtxt(text),'\r',' ')) - if addr.getNote(): - self.write_long_text("NOTE",2,self.cnvtxt(addr.getNote())) - for srcref in addr.getSourceRefList(): + if addr.get_note(): + self.write_long_text("NOTE",2,self.cnvtxt(addr.get_note())) + for srcref in addr.get_source_references(): self.write_source_ref(2,srcref) if self.images: - photos = person.getPhotoList () + photos = person.get_photo_list () else: photos = [] for photo in photos: - if photo.ref.getMimeType() == "image/jpeg": + if photo.ref.get_mime_type() == "image/jpeg": self.writeln('1 OBJE') self.writeln('2 FORM jpeg') - path = photo.ref.getPath () + path = photo.ref.get_path () dirname = os.path.join (self.dirname, self.images_path) basename = os.path.basename (path) self.writeln('2 FILE %s' % os.path.join(self.images_path, @@ -974,20 +970,20 @@ class GedcomWriter: "wb").writelines (file (path, "rb").xreadlines ()) - for family in person.getParentList(): - if self.flist.has_key(family[0].getId()): - self.writeln("1 FAMC @%s@" % self.fid(family[0].getId())) + for family in person.get_parent_family_id_list(): + if self.flist.has_key(family[0].get_id()): + self.writeln("1 FAMC @%s@" % self.fid(family[0].get_id())) if self.adopt == GedcomInfo.ADOPT_PEDI: if string.lower(family[1]) == "adopted": self.writeln("2 PEDI Adopted") - for family in person.getFamilyList(): - if family != None and self.flist.has_key(family.getId()): - self.writeln("1 FAMS @%s@" % self.fid(family.getId())) + for family in person.get_family_id_list(): + if family != None and self.flist.has_key(family.get_id()): + self.writeln("1 FAMS @%s@" % self.fid(family.get_id())) if not restricted: if self.obje: - for url in person.getUrlList(): + for url in person.get_url_list(): self.writeln('1 OBJE') self.writeln('2 FORM URL') if url.get_description(): @@ -996,8 +992,8 @@ class GedcomWriter: self.writeln('2 FILE %s' % url.get_path()) if not restricted or not self.exclnotes: - if person.getNote(): - self.write_long_text("NOTE",1,self.cnvtxt(person.getNote())) + if person.get_note(): + self.write_long_text("NOTE",1,self.cnvtxt(person.get_note())) def write_long_text(self,tag,level,note): if self.conc == GedcomInfo.CONC_OK: @@ -1064,41 +1060,41 @@ class GedcomWriter: ll = len(line) def dump_event_stats(self,event): - dateobj = event.getDateObj() + dateobj = event.get_date_object() self.print_date("2 DATE",dateobj) - if event.getPlaceName(): - self.writeln("2 PLAC %s" % string.replace(self.cnvtxt(event.getPlaceName()),'\r',' ')) - if event.getCause(): - self.writeln("2 CAUS %s" % self.cnvtxt(event.getCause())) - if event.getNote(): - self.write_long_text("NOTE",2,self.cnvtxt(event.getNote())) - for srcref in event.getSourceRefList(): + if event.get_place_name(): + self.writeln("2 PLAC %s" % string.replace(self.cnvtxt(event.get_place_name()),'\r',' ')) + if event.get_cause(): + self.writeln("2 CAUS %s" % self.cnvtxt(event.get_cause())) + if event.get_note(): + self.write_long_text("NOTE",2,self.cnvtxt(event.get_note())) + for srcref in event.get_source_references(): self.write_source_ref(2,srcref) def write_ord(self,name,ord,index,statlist): if ord == None: return self.writeln('%d %s' % (index,name)) - self.print_date("%d DATE" % (index + 1), ord.getDateObj()) - if ord.getFamily(): - self.writeln('%d FAMC @%s@' % (index+1,self.fid(ord.getFamily().getId()))) - if ord.getTemple(): - self.writeln('%d TEMP %s' % (index+1,ord.getTemple())) - if ord.getPlaceName(): - self.writeln("2 PLAC %s" % string.replace(self.cnvtxt(ord.getPlaceName()),'\r',' ')) - if ord.getStatus() != 0: - self.writeln("2 STAT %s" % self.cnvtxt(statlist[ord.getStatus()])) - if ord.getNote(): - self.write_long_text("NOTE",index+1,self.cnvtxt(ord.getNote())) - for srcref in ord.getSourceRefList(): + self.print_date("%d DATE" % (index + 1), ord.get_date_object()) + if ord.get_family_id(): + self.writeln('%d FAMC @%s@' % (index+1,self.fid(ord.get_family_id().get_id()))) + if ord.get_temple(): + self.writeln('%d TEMP %s' % (index+1,ord.get_temple())) + if ord.get_place_name(): + self.writeln("2 PLAC %s" % string.replace(self.cnvtxt(ord.get_place_name()),'\r',' ')) + if ord.get_status() != 0: + self.writeln("2 STAT %s" % self.cnvtxt(statlist[ord.get_status()])) + if ord.get_note(): + self.write_long_text("NOTE",index+1,self.cnvtxt(ord.get_note())) + for srcref in ord.get_source_references(): self.write_source_ref(index+1,srcref) def print_date(self,prefix,date): start = date.get_start_date() - val = date.getText() + val = date.get_text() if val: self.writeln("%s %s" % (prefix,self.cnvtxt(val))) - elif not date.isEmpty (): + elif not date.is_empty (): if date.isRange(): val = "FROM %s TO %s" % (make_date(start), make_date(date.get_stop_date())) @@ -1107,13 +1103,13 @@ class GedcomWriter: self.writeln("%s %s" % (prefix,val)) def write_person_name(self,name,nick): - firstName = self.cnvtxt(name.getFirstName()) - surName = self.cnvtxt(name.getSurname()) + firstName = self.cnvtxt(name.get_first_name()) + surName = self.cnvtxt(name.get_surname()) surName = surName.replace('/','?') - surPref = self.cnvtxt(name.getSurnamePrefix()) + surPref = self.cnvtxt(name.get_surname_prefix()) surPref = surPref.replace('/','?') - suffix = self.cnvtxt(name.getSuffix()) - title = self.cnvtxt(name.getTitle()) + suffix = self.cnvtxt(name.get_suffix()) + title = self.cnvtxt(name.get_title()) if suffix == "": if not surPref: self.writeln("1 NAME %s /%s/" % (firstName,surName)) @@ -1125,7 +1121,7 @@ class GedcomWriter: else: self.writeln("1 NAME %s /%s/, %s" % (firstName,surName,suffix)) - if name.getFirstName(): + if name.get_first_name(): self.writeln("2 GIVN %s" % firstName) if self.prefix: if surPref: @@ -1138,68 +1134,68 @@ class GedcomWriter: elif surName: self.writeln("2 SURN %s" % surName) - if name.getSuffix(): + if name.get_suffix(): self.writeln("2 NSFX %s" % suffix) - if name.getTitle(): + if name.get_title(): self.writeln("2 NPFX %s" % title) if nick: self.writeln('2 NICK %s' % nick) - if name.getNote(): - self.write_long_text("NOTE",2,self.cnvtxt(name.getNote())) - for srcref in name.getSourceRefList(): + if name.get_note(): + self.write_long_text("NOTE",2,self.cnvtxt(name.get_note())) + for srcref in name.get_source_references(): self.write_source_ref(2,srcref) def write_source_ref(self,level,ref): - if ref.getBase() == None: + if ref.get_base_id() == None: return if self.source_refs: self.writeln("%d SOUR @%s@" % - (level,self.sid(ref.getBase().getId()))) - if ref.getPage() != "": - self.write_long_text("PAGE",level+1,self.cnvtxt(ref.getPage())) + (level,self.sid(ref.get_base_id().get_id()))) + if ref.get_page() != "": + self.write_long_text("PAGE",level+1,self.cnvtxt(ref.get_page())) - ref_text = ref.getText() - if ref_text != "" or not ref.getDate().isEmpty(): + ref_text = ref.get_text() + if ref_text != "" or not ref.get_date().is_empty(): self.writeln('%d DATA' % (level+1)) if ref_text != "": self.write_long_text("TEXT",level+2,self.cnvtxt(ref_text)) pfx = "%d DATE" % (level+2) - self.print_date(pfx,ref.getDate()) + self.print_date(pfx,ref.get_date()) else: # We put title, page, and date on the SOUR line. # Not using CONC and CONT because GeneWeb does not support these. # TEXT and NOTE will be ignored by GeneWeb, but we can't # output paragaphs in SOUR without CONT. - sbase = ref.getBase() - if sbase and sbase.getTitle(): - txt = sbase.getTitle() + ". " + sbase = ref.get_base_id() + if sbase and sbase.get_title(): + txt = sbase.get_title() + ". " else: txt = "" - if ref.getPage(): - txt = txt + ref.getPage() + ". " + if ref.get_page(): + txt = txt + ref.get_page() + ". " self.g.write("%d SOUR %s" % (level,self.cnvtxt(txt))) - if not ref.getDate().isEmpty(): - self.print_date("", ref.getDate()) + if not ref.get_date().is_empty(): + self.print_date("", ref.get_date()) else: self.writeln("") - if ref.getText(): - ref_text = ref.getText() + if ref.get_text(): + ref_text = ref.get_text() self.write_long_text("TEXT",level+1,self.cnvtxt(ref_text)) - if ref.getComments(): - self.write_long_text("NOTE",level+1,self.cnvtxt(ref.getComments())) + if ref.get_comments(): + self.write_long_text("NOTE",level+1,self.cnvtxt(ref.get_comments())) def fid(self,id): return id def prefn(self,person): - match = _get_int.search(person.getId()) + match = _get_int.search(person.get_id()) if match: self.writeln('1 REFN %d' % int(match.groups()[0])) def frefn(self,family): - match = _get_int.search(family.getId()) + match = _get_int.search(family.get_id()) if match: self.writeln('1 REFN %d' % int(match.groups()[0])) diff --git a/src/plugins/WritePkg.py b/src/plugins/WritePkg.py index 042c1e71f..cde9982b5 100644 --- a/src/plugins/WritePkg.py +++ b/src/plugins/WritePkg.py @@ -109,34 +109,34 @@ class PackageWriter: def remove_clicked(): # File is lost => remove all references and the object itself mobj = ObjectMap[ObjectId] - for p in self.db.getFamilyMap().values(): - nl = p.getPhotoList() + for p in self.db.get_family_id_map().values(): + nl = p.get_photo_list() for o in nl: - if o.getReference() == mobj: + if o.get_reference() == mobj: nl.remove(o) - p.setPhotoList(nl) - for key in self.db.getPersonKeys(): - p = self.db.getPerson(key) - nl = p.getPhotoList() + p.set_photo_list(nl) + for key in self.db.get_person_keys(): + p = self.db.get_person(key) + nl = p.get_photo_list() for o in nl: - if o.getReference() == mobj: + if o.get_reference() == mobj: nl.remove(o) - p.setPhotoList(nl) - for key in self.db.getSourceKeys(): - p = self.db.getSource(key) - nl = p.getPhotoList() + p.set_photo_list(nl) + for key in self.db.get_source_keys(): + p = self.db.get_source(key) + nl = p.get_photo_list() for o in nl: - if o.getReference() == mobj: + if o.get_reference() == mobj: nl.remove(o) - p.setPhotoList(nl) - for key in self.db.getPlaceKeys(): - p = self.db.getPlace(key) - nl = p.getPhotoList() + p.set_photo_list(nl) + for key in self.db.get_place_id_keys(): + p = self.db.get_place_id(key) + nl = p.get_photo_list() for o in nl: - if o.getReference() == mobj: + if o.get_reference() == mobj: nl.remove(o) - p.setPhotoList(nl) - self.db.removeObject(ObjectId) + p.set_photo_list(nl) + self.db.remove_object(ObjectId) Utils.modified() def leave_clicked(): @@ -169,9 +169,9 @@ class PackageWriter: # Write media files first, since the database may be modified # during the process (i.e. when removing object) - ObjectMap = self.db.getObjectMap() + ObjectMap = self.db.get_object_map() for ObjectId in ObjectMap.keys(): - oldfile = ObjectMap[ObjectId].getPath() + oldfile = ObjectMap[ObjectId].get_path() base = os.path.basename(oldfile) if os.path.isfile(oldfile): g = open(oldfile,"rb") diff --git a/src/plugins/count_anc.py b/src/plugins/count_anc.py index 306f3204d..e12a07ea3 100644 --- a/src/plugins/count_anc.py +++ b/src/plugins/count_anc.py @@ -48,7 +48,7 @@ class CountAncestors: thisgen = [] allgen = [] thisgen.append(person) - title = _("Number of ancestors of \"%s\" by generation") % person.getPrimaryName().getName() + title = _("Number of ancestors of \"%s\" by generation") % person.get_primary_name().get_name() text = text + title + ':\n' thisgensize=1 gen=1 @@ -64,10 +64,10 @@ class CountAncestors: temp = thisgen thisgen = [] for person in temp: - family = person.getMainParents() + family = person.get_main_parents_family_id() if family != None: - father = family.getFather() - mother = family.getMother() + father = family.get_father_id() + mother = family.get_mother_id() if father != None: thisgen.append(father) if mother != None: diff --git a/src/plugins/rel_de.py b/src/plugins/rel_de.py index 71d6ae750..06ce0c01e 100644 --- a/src/plugins/rel_de.py +++ b/src/plugins/rel_de.py @@ -307,8 +307,8 @@ def get_niece(level): return _niece_level[level] def is_spouse(orig,other): - for f in orig.getFamilyList(): - if other == f.getFather() or other == f.getMother(): + for f in orig.get_family_id_list(): + if other == f.get_father_id() or other == f.get_mother_id(): return 1 return 0 @@ -330,8 +330,8 @@ def get_relationship(orig_person,other_person): if orig_person == None: return ("undefined",[]) - firstName = orig_person.getPrimaryName().getRegularName() - secondName = other_person.getPrimaryName().getRegularName() + firstName = orig_person.get_primary_name().get_regular_name() + secondName = other_person.get_primary_name().get_regular_name() if orig_person == other_person: return ('', []) @@ -346,7 +346,7 @@ def get_relationship(orig_person,other_person): for person in firstList: if person in secondList: - new_rank = firstMap[person.getId()] + new_rank = firstMap[person.get_id()] if new_rank < rank: rank = new_rank common = [ person ] @@ -358,40 +358,40 @@ def get_relationship(orig_person,other_person): if common: person = common[0] - secondRel = firstMap[person.getId()] - firstRel = secondMap[person.getId()] + secondRel = firstMap[person.get_id()] + firstRel = secondMap[person.get_id()] if firstRel == -1: return ("",[]) elif firstRel == 0: if secondRel == 0: return ('',common) - elif other_person.getGender() == RelLib.Person.male: + elif other_person.get_gender() == RelLib.Person.male: return (get_father(secondRel),common) else: return (get_mother(secondRel),common) elif secondRel == 0: - if other_person.getGender() == RelLib.Person.male: + if other_person.get_gender() == RelLib.Person.male: return (get_son(firstRel),common) else: return (get_daughter(firstRel),common) elif firstRel == 1: - if other_person.getGender() == RelLib.Person.male: + if other_person.get_gender() == RelLib.Person.male: return (get_uncle(secondRel),common) else: return (get_aunt(secondRel),common) elif secondRel == 1: - if other_person.getGender() == RelLib.Person.male: + if other_person.get_gender() == RelLib.Person.male: return (get_nephew(firstRel-1),common) else: return (get_niece(firstRel-1),common) elif secondRel > firstRel: - if other_person.getGender() == RelLib.Person.male: + if other_person.get_gender() == RelLib.Person.male: return (get_senior_male_cousin(secondRel-firstRel+1,secondRel-1),common) else: return (get_senior_female_cousin(secondRel-firstRel+1,secondRel-1),common) else: - if other_person.getGender() == RelLib.Person.male: + if other_person.get_gender() == RelLib.Person.male: return (get_junior_male_cousin(secondRel-1,firstRel-1),common) else: return (get_junior_female_cousin(secondRel-1,firstRel-1),common) diff --git a/src/plugins/rel_hu.py b/src/plugins/rel_hu.py index b9cc835a6..10a8d3424 100644 --- a/src/plugins/rel_hu.py +++ b/src/plugins/rel_hu.py @@ -143,10 +143,10 @@ def get_female_cousin (level): def get_age_comp(orig_person,other_person): # 0=nothing, -1=other is younger 1=other is older - orig_birth_event = orig_person.getBirth() - orig_birth_date = orig_birth_event.getDateObj() - other_birth_event = other_person.getBirth() - other_birth_date = other_birth_event.getDateObj() + orig_birth_event = orig_person.get_birth() + orig_birth_date = orig_birth_event.get_date_object() + other_birth_event = other_person.get_birth() + other_birth_date = other_birth_event.get_date_object() if (orig_birth_date == "")or(other_birth_date == "") :return 0 else :return Date.compare_dates(orig_birth_date,other_birth_date) @@ -270,7 +270,7 @@ def get_relationship(orig_person,other_person): for person in firstList: if person in secondList: - new_rank = firstMap[person.getId()] + new_rank = firstMap[person.get_id()] if new_rank < rank: rank = new_rank common = [ person ] @@ -284,16 +284,16 @@ def get_relationship(orig_person,other_person): if length == 1: person = common[0] - secondRel = firstMap[person.getId()] - firstRel = secondMap[person.getId()] + secondRel = firstMap[person.get_id()] + firstRel = secondMap[person.get_id()] elif length == 2: p1 = common[0] - secondRel = firstMap[p1.getId()] - firstRel = secondMap[p1.getId()] + secondRel = firstMap[p1.get_id()] + firstRel = secondMap[p1.get_id()] elif length > 2: person = common[0] - secondRel = firstMap[person.getId()] - firstRel = secondMap[person.getId()] + secondRel = firstMap[person.get_id()] + firstRel = secondMap[person.get_id()] @@ -303,19 +303,19 @@ def get_relationship(orig_person,other_person): elif firstRel == 0: if secondRel == 0: return ('',common) - elif other_person.getGender() == RelLib.Person.male: + elif other_person.get_gender() == RelLib.Person.male: return (get_father(secondRel),common) else: return (get_mother(secondRel),common) elif secondRel == 0: - if other_person.getGender() == RelLib.Person.male: + if other_person.get_gender() == RelLib.Person.male: return (get_son(firstRel),common) else: return (get_daughter(firstRel),common) elif firstRel == 1: - if other_person.getGender() == RelLib.Person.male: + if other_person.get_gender() == RelLib.Person.male: if secondRel == 1: return (get_age_brother(get_age_comp(orig_person,other_person)),common) else :return (get_uncle(secondRel),common) @@ -325,13 +325,13 @@ def get_relationship(orig_person,other_person): else :return (get_aunt(secondRel),common) elif secondRel == 1: - if other_person.getGender() == RelLib.Person.male: + if other_person.get_gender() == RelLib.Person.male: return (get_nephew(firstRel-1),common) else: return (get_niece(firstRel-1),common) else: - if other_person.getGender() == RelLib.Person.male: + if other_person.get_gender() == RelLib.Person.male: return (get_male_cousin(firstRel-1), common) else: return (get_female_cousin(firstRel-1), common) diff --git a/src/plugins/rel_it.py b/src/plugins/rel_it.py index 22d372a0c..2601b6d9b 100644 --- a/src/plugins/rel_it.py +++ b/src/plugins/rel_it.py @@ -141,7 +141,7 @@ def get_relationship(orig_person,other_person): for person in firstList: if person in secondList: - new_rank = firstMap[person.getId()] + new_rank = firstMap[person.get_id()] if new_rank < rank: rank = new_rank common = [ person ] @@ -155,43 +155,43 @@ def get_relationship(orig_person,other_person): if length == 1: person = common[0] - secondRel = firstMap[person.getId()] - firstRel = secondMap[person.getId()] + secondRel = firstMap[person.get_id()] + firstRel = secondMap[person.get_id()] elif length == 2: p1 = common[0] - secondRel = firstMap[p1.getId()] - firstRel = secondMap[p1.getId()] + secondRel = firstMap[p1.get_id()] + firstRel = secondMap[p1.get_id()] elif length > 2: person = common[0] - secondRel = firstMap[person.getId()] - firstRel = secondMap[person.getId()] + secondRel = firstMap[person.get_id()] + firstRel = secondMap[person.get_id()] if firstRel == -1: return ("",[]) elif firstRel == 0: if secondRel == 0: return ('',common) - elif other_person.getGender() == RelLib.Person.male: + elif other_person.get_gender() == RelLib.Person.male: return (get_father(secondRel),common) else: return (get_mother(secondRel),common) elif secondRel == 0: - if other_person.getGender() == RelLib.Person.male: + if other_person.get_gender() == RelLib.Person.male: return (get_son(firstRel),common) else: return (get_daughter(firstRel),common) elif firstRel == 1: - if other_person.getGender() == RelLib.Person.male: + if other_person.get_gender() == RelLib.Person.male: return (get_uncle(secondRel),common) else: return (get_aunt(secondRel),common) elif secondRel == 1: - if other_person.getGender() == RelLib.Person.male: + if other_person.get_gender() == RelLib.Person.male: return (get_nephew(firstRel-1),common) else: return (get_niece(firstRel-1),common) else: - if other_person.getGender() == RelLib.Person.male: + if other_person.get_gender() == RelLib.Person.male: return (get_male_cousin(firstRel-1, secondRel-1), common) else: return (get_female_cousin(firstRel-1, secondRel-1), common) diff --git a/src/plugins/rel_ru.py b/src/plugins/rel_ru.py index 11b0765a6..9297acdb8 100644 --- a/src/plugins/rel_ru.py +++ b/src/plugins/rel_ru.py @@ -181,8 +181,8 @@ def get_niece(level): return _niece_level[level] def is_spouse(orig,other): - for f in orig.getFamilyList(): - if other == f.getFather() or other == f.getMother(): + for f in orig.get_family_id_list(): + if other == f.get_father_id() or other == f.get_mother_id(): return 1 return 0 @@ -204,8 +204,8 @@ def get_relationship(orig_person,other_person): if orig_person == None: return ("undefined",[]) - firstName = orig_person.getPrimaryName().getRegularName() - secondName = other_person.getPrimaryName().getRegularName() + firstName = orig_person.get_primary_name().get_regular_name() + secondName = other_person.get_primary_name().get_regular_name() if orig_person == other_person: return ('', []) @@ -217,7 +217,7 @@ def get_relationship(orig_person,other_person): for person in firstList: if person in secondList: - new_rank = firstMap[person.getId()] + new_rank = firstMap[person.get_id()] if new_rank < rank: rank = new_rank common = [ person ] @@ -231,48 +231,48 @@ def get_relationship(orig_person,other_person): if length == 1: person = common[0] - secondRel = firstMap[person.getId()] - firstRel = secondMap[person.getId()] + secondRel = firstMap[person.get_id()] + firstRel = secondMap[person.get_id()] elif length == 2: p1 = common[0] - secondRel = firstMap[p1.getId()] - firstRel = secondMap[p1.getId()] + secondRel = firstMap[p1.get_id()] + firstRel = secondMap[p1.get_id()] elif length > 2: person = common[0] - secondRel = firstMap[person.getId()] - firstRel = secondMap[person.getId()] + secondRel = firstMap[person.get_id()] + firstRel = secondMap[person.get_id()] if firstRel == -1: return ("",[]) elif firstRel == 0: if secondRel == 0: return ('',common) - elif other_person.getGender() == RelLib.Person.male: + elif other_person.get_gender() == RelLib.Person.male: return (get_father(secondRel),common) else: return (get_mother(secondRel),common) elif secondRel == 0: - if other_person.getGender() == RelLib.Person.male: + if other_person.get_gender() == RelLib.Person.male: return (get_son(firstRel),common) else: return (get_daughter(firstRel),common) elif firstRel == 1: - if other_person.getGender() == RelLib.Person.male: + if other_person.get_gender() == RelLib.Person.male: return (get_uncle(secondRel),common) else: return (get_aunt(secondRel),common) elif secondRel == 1: - if other_person.getGender() == RelLib.Person.male: + if other_person.get_gender() == RelLib.Person.male: return (get_nephew(firstRel-1),common) else: return (get_niece(firstRel-1),common) elif secondRel > firstRel: - if other_person.getGender() == RelLib.Person.male: + if other_person.get_gender() == RelLib.Person.male: return (get_senior_male_cousin(firstRel-1,secondRel-firstRel),common) else: return (get_senior_female_cousin(firstRel-1,secondRel-firstRel),common) else: - if other_person.getGender() == RelLib.Person.male: + if other_person.get_gender() == RelLib.Person.male: return (get_junior_male_cousin(secondRel-1,firstRel-secondRel),common) else: return (get_junior_female_cousin(secondRel-1,firstRel-secondRel),common) diff --git a/src/plugins/soundgen.py b/src/plugins/soundgen.py index 0bdd80fa4..1f08750fc 100644 --- a/src/plugins/soundgen.py +++ b/src/plugins/soundgen.py @@ -63,8 +63,8 @@ class SoundGen: self.name.connect('changed',self.on_apply_clicked) names = [] - for person in self.db.getPersonMap().values(): - lastname = person.getPrimaryName().getSurname() + for person in self.db.get_person_id_map().values(): + lastname = person.get_primary_name().get_surname() if lastname not in names: names.append(lastname) @@ -73,7 +73,7 @@ class SoundGen: names) if active_person: - n = active_person.getPrimaryName().getSurname() + n = active_person.get_primary_name().get_surname() self.name.set_text(n) try: se_text = soundex.soundex(n) diff --git a/src/sort.py b/src/sort.py index 96208f657..e85fcddb8 100644 --- a/src/sort.py +++ b/src/sort.py @@ -90,8 +90,8 @@ def by_last_name(first, second): def by_birthdate(first, second) : """Sort routine for comparing two people by birth dates. If the birth dates are equal, sorts by name""" - date1 = first.getBirth().getDateObj() - date2 = second.getBirth().getDateObj() + date1 = first.get_birth().get_date_object() + date2 = second.get_birth().get_date_object() val = Date.compare_dates(date1,date2) if val == 0: return by_last_name(first,second)