5449: Pedigree view crashes ... : trailing space and replace list() by set()

This commit is contained in:
SNoiraud
2016-04-10 09:55:50 +02:00
parent 0650bd8643
commit 3fe0aaa88a

View File

@@ -134,7 +134,7 @@ class FindLoop(ManagedWindow) :
count += 1 count += 1
self.current = person self.current = person
self.parent = None self.parent = None
self.descendants(person_handle, []) self.descendants(person_handle, set())
self.progress.set_header("%d/%d" % (count, len(people))) self.progress.set_header("%d/%d" % (count, len(people)))
self.progress.step() self.progress.step()
@@ -145,10 +145,10 @@ class FindLoop(ManagedWindow) :
def descendants(self, person_handle, new_list): def descendants(self, person_handle, new_list):
person = self.db.get_person_from_handle(person_handle) person = self.db.get_person_from_handle(person_handle)
plist = [] pset = set()
for item in new_list: for item in new_list:
plist.append(item) pset.add(item)
if person in plist: if person.handle in pset:
# We found one loop # We found one loop
father_id = self.current.get_gramps_id() father_id = self.current.get_gramps_id()
father = _nd.display(self.current) father = _nd.display(self.current)
@@ -169,7 +169,7 @@ class FindLoop(ManagedWindow) :
if not found: if not found:
self.model.append(value) self.model.append(value)
return return
plist.append(person) pset.add(person.handle)
for family_handle in person.get_family_handle_list(): for family_handle in person.get_family_handle_list():
family = self.db.get_family_from_handle(family_handle) family = self.db.get_family_from_handle(family_handle)
self.curr_fam = family.get_gramps_id() self.curr_fam = family.get_gramps_id()
@@ -179,7 +179,7 @@ class FindLoop(ManagedWindow) :
for child_ref in family.get_child_ref_list(): for child_ref in family.get_child_ref_list():
child_handle = child_ref.ref child_handle = child_ref.ref
self.parent = person self.parent = person
self.descendants(child_handle, plist) self.descendants(child_handle, pset)
def rowActivated(self, treeView, path, column) : def rowActivated(self, treeView, path, column) :
# first we need to check that the row corresponds to a person # first we need to check that the row corresponds to a person