From b023868cfc1cdad0d5783655f0a32ecaa5f0e6b5 Mon Sep 17 00:00:00 2001 From: Don Allingham Date: Sat, 15 Jun 2002 21:46:42 +0000 Subject: [PATCH] Better looping control svn: r1028 --- gramps/src/ImageSelect.py | 9 ++++++--- gramps/src/MediaView.py | 9 ++++++--- gramps/src/MergeData.py | 3 ++- gramps/src/SelectChild.py | 3 ++- gramps/src/SourceView.py | 6 ++++-- 5 files changed, 20 insertions(+), 10 deletions(-) diff --git a/gramps/src/ImageSelect.py b/gramps/src/ImageSelect.py index 1382c8702..b471225b7 100644 --- a/gramps/src/ImageSelect.py +++ b/gramps/src/ImageSelect.py @@ -728,7 +728,8 @@ class DeleteMediaQuery: del self.db.getObjectMap()[self.media.getId()] Utils.modified() - for p in self.db.getPersonMap().values(): + for key in self.db.getPersonKeys(): + key = self.db.getPerson(key) nl = [] change = 0 for photo in p.getPhotoList(): @@ -750,7 +751,8 @@ class DeleteMediaQuery: if change: p.setPhotoList(nl) - for p in self.db.getSourceMap().values(): + for key in self.db.getSourceKeys(): + p = self.db.getSource(key) nl = [] change = 0 for photo in p.getPhotoList(): @@ -761,7 +763,8 @@ class DeleteMediaQuery: if change: p.setPhotoList(nl) - for p in self.db.getPlaceMap().values(): + for key in self.db.getPlaceKeys(): + p = self.db.getPlace(key) nl = [] change = 0 for photo in p.getPhotoList(): diff --git a/gramps/src/MediaView.py b/gramps/src/MediaView.py index b607e2174..f88cb65c1 100644 --- a/gramps/src/MediaView.py +++ b/gramps/src/MediaView.py @@ -234,15 +234,18 @@ class MediaView: for o in p.getPhotoList(): if o.getReference() == mobj: return 1 - 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() == mobj: return 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() == mobj: return 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() == mobj: return 1 diff --git a/gramps/src/MergeData.py b/gramps/src/MergeData.py index bd58daaaa..5f53616d7 100644 --- a/gramps/src/MergeData.py +++ b/gramps/src/MergeData.py @@ -840,7 +840,8 @@ class MergePlaces: self.p1.add_alternate_locations(l) - 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.p2: event.setPlace(self.p1) diff --git a/gramps/src/SelectChild.py b/gramps/src/SelectChild.py index a60629352..13a5deedf 100644 --- a/gramps/src/SelectChild.py +++ b/gramps/src/SelectChild.py @@ -123,7 +123,8 @@ class SelectChild: slist.append(c) person_list = [] - for person in self.db.getPersonMap().values(): + for key in self.db.getPersonKeys(): + person = self.db.getPerson(key) if filter: if person in slist or person.getMainParents(): continue diff --git a/gramps/src/SourceView.py b/gramps/src/SourceView.py index eb8fe56d2..2777de1e0 100644 --- a/gramps/src/SourceView.py +++ b/gramps/src/SourceView.py @@ -134,11 +134,13 @@ class SourceView: self.update(0) def is_source_used(self,source): - for p in self.db.getPlaceMap().values(): + for key in self.db.getPlaceKeys(): + p = self.db.getPlace(key) for sref in p.getSourceRefList(): if sref.getBase() == source: return 1 - for p in self.db.getPersonMap().values(): + 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: