diff --git a/gramps/src/ChooseParents.py b/gramps/src/ChooseParents.py index 0917dcbd9..dad17902b 100644 --- a/gramps/src/ChooseParents.py +++ b/gramps/src/ChooseParents.py @@ -131,12 +131,12 @@ class ChooseParents: self.mother_list.append(["Unknown","",""]) self.mother_list.set_row_data(0,None) - people = self.db.getPersonMap().values() father_index = 1 mother_index = 1 fsel = 0 msel = 0 - for person in people: + for key in self.db.getPersonKeys(): + person = self.db.getPerson(key) if person == self.person: continue if person.getGender() == RelLib.Person.unknown: @@ -180,7 +180,6 @@ class ChooseParents: self.mlabel.set_label(_("Mother")) self.flabel.set_label(_("Father")) - def parent_relation_changed(self,obj): self.old_type = self.type self.type = const.save_frel(obj.get_text()) diff --git a/gramps/src/EditPlace.py b/gramps/src/EditPlace.py index e702835f1..44d90d6ee 100644 --- a/gramps/src/EditPlace.py +++ b/gramps/src/EditPlace.py @@ -324,7 +324,8 @@ class EditPlace: def display_references(self): pevent = [] fevent = [] - for p in self.db.getPersonMap().values(): + 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: pevent.append((p,event)) @@ -403,7 +404,8 @@ class DeletePlaceQuery: del self.db.getPlaceMap()[self.place.getId()] Utils.modified() - for p in self.db.getPersonMap().values(): + 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) diff --git a/gramps/src/EditSource.py b/gramps/src/EditSource.py index 8ea1f19a1..c6cd3d719 100644 --- a/gramps/src/EditSource.py +++ b/gramps/src/EditSource.py @@ -103,12 +103,14 @@ class EditSource: f_event_list = [] f_attr_list = [] p_list = [] - for p in self.db.getPlaceMap().values(): + for key in self.db.getPlaceKeys(): + p = self.db.getPlace(key) name = p.get_title() for sref in p.getSourceRefList(): if sref.getBase() == self.source: p_list.append(name) - for p in self.db.getPersonMap().values(): + for key in self.db.getPersonKeys(): + p = self.db.getPerson(key) name = GrampsCfg.nameof(p) for v in p.getEventList() + [p.getBirth(), p.getDeath()]: for sref in v.getSourceRefList(): @@ -235,7 +237,8 @@ class DelSrcQuery: del self.db.getSourceMap()[self.source.getId()] Utils.modified() - for p in self.db.getPersonMap().values(): + for key in self.db.getPersonKeys(): + p = self.getPerson(key) for v in p.getEventList() + [p.getBirth(), p.getDeath()]: self.delete_source(v) @@ -258,8 +261,8 @@ class DelSrcQuery: for p in self.db.getObjectMap().values(): self.delete_source(p) - for p in self.db.getPlaceMap().values(): - self.delete_source(p) + for key in self.db.getPlaceKeys(): + self.delete_source(self.db.getPlace(key)) self.update(0) diff --git a/gramps/src/ImageSelect.py b/gramps/src/ImageSelect.py index aebe7d705..1382c8702 100644 --- a/gramps/src/ImageSelect.py +++ b/gramps/src/ImageSelect.py @@ -632,7 +632,8 @@ class GlobalMediaProperties: index = 0 ref = self.change_dialog.get_widget("refinfo") ref.connect('button-press-event',self.button_press) - for p in self.db.getPersonMap().values(): + for key in self.db.getPersonKeys(): + p = self.db.getPerson(key) for o in p.getPhotoList(): if o.getReference() == self.object: ref.append([_("Person"),p.getId(),GrampsCfg.nameof(p)]) @@ -644,13 +645,15 @@ class GlobalMediaProperties: ref.append([_("Family"),p.getId(),Utils.family_name(p)]) ref.set_row_data(index,(Marriage.Marriage,p,self.db)) index = index + 1 - for p in self.db.getSourceMap().values(): + for key in self.db.getSourceKeys(): + p = self.db.getSource(key) for o in p.getPhotoList(): if o.getReference() == self.object: ref.append([_("Source"),p.getId(),p.getTitle()]) ref.set_row_data(index,(EditSource.EditSource,p,self.db)) index = index + 1 - for p in self.db.getPlaceMap().values(): + for key in self.db.getPlaceKeys(): + p = self.db.getPlace(key) for o in p.getPhotoList(): if o.getReference() == self.object: ref.append([_("Place"),p.getId(),p.get_title()]) diff --git a/gramps/src/RelLib.py b/gramps/src/RelLib.py index f4dec5f32..2af69fbca 100644 --- a/gramps/src/RelLib.py +++ b/gramps/src/RelLib.py @@ -2024,7 +2024,8 @@ class GrampsDB(Persistent): """returns a list of all Attribute types assocated with Person instances in the database""" map = {} - for person in self.personMap.values(): + for key in self.personTable.keys(): + person = self.personMap[key] for attr in person.getAttributeList(): map[attr.getType()] = 1 return map.keys() @@ -2290,7 +2291,10 @@ class GrampsDB(Persistent): def getPlaceKeys(self): return self.placeTable.keys() - + + def getPlace(self,key): + return self.placeMap[key] + def getPlaceDisplay(self,key): return self.placeTable[key] @@ -2300,6 +2304,9 @@ class GrampsDB(Persistent): def getSourceDisplay(self,key): return self.sourceTable[key] + def getSource(self,key): + return self.sourceMap[key] + def buildSourceDisplay(self,nkey,okey=None): if nkey != okey and okey != None: del self.sourceTable[okey] diff --git a/gramps/src/WriteXML.py b/gramps/src/WriteXML.py index 10fbd7285..b7b0e4643 100644 --- a/gramps/src/WriteXML.py +++ b/gramps/src/WriteXML.py @@ -72,15 +72,9 @@ def exportData(database, filename, callback): g.write(filename) except: from gnome.ui import GnomeErrorDialog - import traceback - - traceback.print_exc() - - fname = os.path.expanduser("~/gramps.err") - errfile = open(fname,"w") - traceback.print_exc(file=errfile) - errfile.close() + import DisplayTrace + DisplayTrace.DisplayTrace() GnomeErrorDialog(_("Failure writing %s, original file restored") % filename) shutil.copy(filename + ".bak", filename) @@ -156,17 +150,14 @@ class XmlWriter: date = string.split(time.ctime(time.time())) owner = self.db.getResearcher() - personList = self.db.getPersonMap().values() - #personList.sort(sortById) familyList = self.db.getFamilyMap().values() - #familyList.sort(sortById) - sourceList = self.db.getSourceMap().values() - placeList = self.db.getPlaceMap().values() - #placeList.sort(sortById) + person_len = len(self.db.getPersonKeys()) + family_len = len(familyList) + source_len = len(self.db.getSourceKeys()) + place_len = len(self.db.getPlaceKeys()) objList = self.db.getObjectMap().values() - #objList.sort(sortById) - total = len(personList) + len(familyList) + len(placeList) + len(sourceList) + total = person_len + family_len + place_len + source_len self.g.write('\n') self.g.write('\n') @@ -174,10 +165,10 @@ class XmlWriter: self.g.write("
\n") self.g.write(" \n" % len(self.db.getPlaceMap().values())) + self.g.write(" people=\"%d\"" % person_len) + self.g.write(" families=\"%d\"" % family_len) + 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) @@ -190,7 +181,7 @@ class XmlWriter: self.g.write(" \n") self.g.write("
\n") - if len(personList) > 0: + if person_len > 0: self.g.write(" \n") self.g.write(" \n") - if len(familyList) > 0: + if family_len > 0: self.g.write(" \n") for family in familyList: @@ -299,9 +291,10 @@ class XmlWriter: self.g.write(" \n") self.g.write(" \n") - if len(sourceList) > 0: + if source_len > 0: self.g.write(" \n") - for source in sourceList: + for key in self.db.getSourceKeys(): + source = self.db.getSource(key) if self.callback and count % delta == 0: self.callback(float(count)/float(total)) count = count + 1 @@ -316,9 +309,10 @@ class XmlWriter: self.g.write(" \n") self.g.write(" \n") - if len(placeList) > 0: + if place_len > 0: self.g.write(" \n") - for place in placeList: + for key in self.db.getPlaceKeys(): + place = self.db.getPlace(key) if self.callback and count % delta == 0: self.callback(float(count)/float(total)) count = count + 1 diff --git a/gramps/src/plugins/ReadGedcom.py b/gramps/src/plugins/ReadGedcom.py index e7fb3c96d..0b5ec561b 100644 --- a/gramps/src/plugins/ReadGedcom.py +++ b/gramps/src/plugins/ReadGedcom.py @@ -560,14 +560,15 @@ class GedcomParser: self.parse_family_event(event,2) def parse_note(self,matches,obj,level,old_note): + note = old_note if matches[2] and matches[2][0] == "@": if self.nmap.has_key(matches[2]): self.share_note.append(obj) - self.family.setNoteObj(self.nmap[matches[2]]) + obj.setNoteObj(self.nmap[matches[2]]) else: noteobj = Note() self.nmap[matches[2]] = noteobj - self.share_note.append(self.family) + self.share_note.append(obj) obj.setNoteObj(noteobj) else: if old_note: