diff --git a/src/plugins/gramplet/GivenNameGramplet.py b/src/plugins/gramplet/GivenNameGramplet.py index 94ba4b747..15c983617 100644 --- a/src/plugins/gramplet/GivenNameGramplet.py +++ b/src/plugins/gramplet/GivenNameGramplet.py @@ -62,9 +62,11 @@ class GivenNameCloudGramplet(Gramplet): givensubnames = {} representative_handle = {} - for cnt, person_handle in enumerate(people): + cnt = 0 + for person_handle in people: person = self.dbstate.db.get_person_from_handle(person_handle) if person: + cnt += 1 allnames = [person.get_primary_name()] + person.get_alternate_names() allnames = set([name.get_first_name().strip() for name in allnames]) for givenname in allnames: @@ -76,13 +78,14 @@ class GivenNameCloudGramplet(Gramplet): total_people = cnt givensubname_sort = [] - total = 0 - - for cnt, givensubname in enumerate(givensubnames): + + total = cnt = 0 + for givensubname in givensubnames: givensubname_sort.append( (givensubnames[givensubname], givensubname) ) total += givensubnames[givensubname] if not cnt % _YIELD_INTERVAL: yield True + cnt += 1 total_givensubnames = cnt givensubname_sort.sort(reverse=True) @@ -114,7 +117,8 @@ class GivenNameCloudGramplet(Gramplet): # Ok, now we can show those counts > include_greater_than: self.set_text("") - for showing, (count, givensubname) in enumerate(cloud_names): # givensubname_sort: + showing = 0 + for (count, givensubname) in cloud_names: # givensubname_sort: if count > include_greater_than: if len(givensubname) == 0: text = Config.get(Config.NO_SURNAME_TEXT) @@ -127,6 +131,7 @@ class GivenNameCloudGramplet(Gramplet): (float(count)/total_people) * 100, count)) self.append_text(" ") + showing += 1 self.append_text(("\n\n" + _("Total unique given names") + ": %d\n") % total_givensubnames) diff --git a/src/plugins/gramplet/SurnameCloudGramplet.py b/src/plugins/gramplet/SurnameCloudGramplet.py index 50eecfebd..ab8f67c89 100644 --- a/src/plugins/gramplet/SurnameCloudGramplet.py +++ b/src/plugins/gramplet/SurnameCloudGramplet.py @@ -81,7 +81,9 @@ class SurnameCloudGramplet(Gramplet): people = self.dbstate.db.iter_person_handles() surnames = {} representative_handle = {} - for cnt, person_handle in enumerate(people): + + cnt = 0 + for person_handle in people: person = self.dbstate.db.get_person_from_handle(person_handle) if person: allnames = [person.get_primary_name()] + person.get_alternate_names() @@ -91,21 +93,23 @@ class SurnameCloudGramplet(Gramplet): representative_handle[surname] = person_handle if not cnt % _YIELD_INTERVAL: yield True + cnt += 1 total_people = cnt surname_sort = [] - total = 0 - for cnt, surname in enumerate(surnames): + total = cnt = 0 + for surname in surnames: surname_sort.append( (surnames[surname], surname) ) total += surnames[surname] if not cnt % _YIELD_INTERVAL: yield True + cnt += 1 total_surnames = cnt surname_sort.sort(reverse=True) cloud_names = [] cloud_values = [] - for cnt, (count, surname) in enumerate(surname_sort): + for (count, surname) in surname_sort: cloud_names.append( (count, surname) ) cloud_values.append( count ) diff --git a/src/plugins/gramplet/TopSurnamesGramplet.py b/src/plugins/gramplet/TopSurnamesGramplet.py index ef6b8a2af..c37466944 100644 --- a/src/plugins/gramplet/TopSurnamesGramplet.py +++ b/src/plugins/gramplet/TopSurnamesGramplet.py @@ -66,9 +66,11 @@ class TopSurnamesGramplet(Gramplet): surnames = {} representative_handle = {} - for cnt, person_handle in enumerate(people): + cnt = 0 + for person_handle in people: person = self.dbstate.db.get_person_from_handle(person_handle) if person: + cnt += 1 allnames = [person.get_primary_name()] + person.get_alternate_names() allnames = set([name.get_group_name().strip() for name in allnames]) for surname in allnames: diff --git a/src/plugins/quickview/SameSurnames.py b/src/plugins/quickview/SameSurnames.py index da5b3005d..c5fd821ac 100644 --- a/src/plugins/quickview/SameSurnames.py +++ b/src/plugins/quickview/SameSurnames.py @@ -117,10 +117,12 @@ def run(database, document, person): people = filter.apply(database, database.iter_person_handles()) - for matches, person_handle in enumerate(people): + matches = 0 + for person_handle in people: person = database.get_person_from_handle(person_handle) stab.row(person, sdb.birth_date_obj(person), str(person.get_primary_name().get_type())) + matches += 1 sdoc.paragraph(ngettext("There is %d person with a matching name, or alternate name.\n" , @@ -155,10 +157,13 @@ def run_given(database, document, person): filter.add_rule(rule) people = filter.apply(database, database.iter_person_handles()) - for matches, person_handle in enumerate(people): + + matches = 0 + for person_handle in people: person = database.get_person_from_handle(person_handle) stab.row(person, sdb.birth_date_obj(person), str(person.get_primary_name().get_type())) + matches += 1 sdoc.paragraph(ngettext("There is %d person with a matching name, or alternate name.\n" , diff --git a/src/plugins/textreport/Summary.py b/src/plugins/textreport/Summary.py index ee020a695..b4ed7ff64 100644 --- a/src/plugins/textreport/Summary.py +++ b/src/plugins/textreport/Summary.py @@ -100,7 +100,8 @@ class SummaryReport(Report): self.doc.end_paragraph() person_list = self.__db.iter_person_handles() - for num_people, person_handle in enumerate(person_list): + num_people = 0 + for person_handle in person_list: person = self.__db.get_person_from_handle(person_handle) if not person: continue