5449: Pedigree view crashes ... : trailing space and replace list() by set()
This commit is contained in:
parent
0650bd8643
commit
3fe0aaa88a
@ -87,7 +87,7 @@ class FindLoop(ManagedWindow) :
|
|||||||
# start the progress indicator
|
# start the progress indicator
|
||||||
self.progress = ProgressMeter(self.title,_('Starting'),
|
self.progress = ProgressMeter(self.title,_('Starting'),
|
||||||
parent=self.window)
|
parent=self.window)
|
||||||
self.progress.set_pass(_('Looking for possible loop for each person'),
|
self.progress.set_pass(_('Looking for possible loop for each person'),
|
||||||
self.db.get_number_of_people())
|
self.db.get_number_of_people())
|
||||||
|
|
||||||
self.model = Gtk.ListStore(
|
self.model = Gtk.ListStore(
|
||||||
@ -95,7 +95,7 @@ class FindLoop(ManagedWindow) :
|
|||||||
GObject.TYPE_STRING, # 1==father
|
GObject.TYPE_STRING, # 1==father
|
||||||
GObject.TYPE_STRING, # 2==son id
|
GObject.TYPE_STRING, # 2==son id
|
||||||
GObject.TYPE_STRING, # 3==son
|
GObject.TYPE_STRING, # 3==son
|
||||||
GObject.TYPE_STRING) # 4==family gid
|
GObject.TYPE_STRING) # 4==family gid
|
||||||
|
|
||||||
self.treeView = topDialog.get_object("treeview")
|
self.treeView = topDialog.get_object("treeview")
|
||||||
self.treeView.set_model(self.model)
|
self.treeView.set_model(self.model)
|
||||||
@ -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)
|
||||||
@ -156,7 +156,7 @@ class FindLoop(ManagedWindow) :
|
|||||||
son = _nd.display(self.parent)
|
son = _nd.display(self.parent)
|
||||||
value = (father_id, father, son_id, son, self.curr_fam)
|
value = (father_id, father, son_id, son, self.curr_fam)
|
||||||
found = False
|
found = False
|
||||||
for pth in range(len(self.model)):
|
for pth in range(len(self.model)):
|
||||||
path = Gtk.TreePath(pth)
|
path = Gtk.TreePath(pth)
|
||||||
treeiter = self.model.get_iter(path)
|
treeiter = self.model.get_iter(path)
|
||||||
find = (self.model.get_value(treeiter, 0),
|
find = (self.model.get_value(treeiter, 0),
|
||||||
@ -169,17 +169,17 @@ 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()
|
||||||
if not family:
|
if not family:
|
||||||
# can happen with LivingProxyDb(PrivateProxyDb(db))
|
# can happen with LivingProxyDb(PrivateProxyDb(db))
|
||||||
continue
|
continue
|
||||||
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
|
||||||
|
Loading…
Reference in New Issue
Block a user