diff --git a/gramps2/src/plugins/DetDescendantReport.py b/gramps2/src/plugins/DetDescendantReport.py index 60969aa79..be15c8ed3 100644 --- a/gramps2/src/plugins/DetDescendantReport.py +++ b/gramps2/src/plugins/DetDescendantReport.py @@ -66,26 +66,20 @@ class DetDescendantReport(Report): # # #-------------------------------------------------------------------- - def filter(self,person,index, cur_gen): - #print "Filter index= ", index, cur_gen - if person == None or self.cur_gen > self.max_generations: - return index + def apply_filter(self,person,index,cur_gen=1): + if person == None or cur_gen > self.max_generations: + return self.map[index] = person - #print "Filter: ", index, person.getPrimaryName() + if len(self.genKeys) < cur_gen: self.genKeys.append([index]) - else: self.genKeys[cur_gen-1].append(index) - #print "genKeys: ", self.genKeys + else: + self.genKeys[cur_gen-1].append(index) - if person.getFamilyList() != None: - familyList= person.getFamilyList() - for family in familyList: - if family != None: - if len(family.getChildList()) > 0: - for child in family.getChildList(): - index= self.filter(child, index+1, cur_gen+1) - return index - return index + for family in person.getFamilyList(): + for child in family.getChildList(): + ix = max(self.map.keys()) + self.apply_filter(child, ix+1, cur_gen+1) def write_children(self, family, rptOptions): """ List children @@ -608,8 +602,7 @@ class DetDescendantReport(Report): def write_report(self, rptOpt): self.cur_gen= 1 - self.filter(self.start,1, 1) - #rptOpt= reportOptions() + self.apply_filter(self.start,1) name = self.start.getPrimaryName().getRegularName() diff --git a/gramps2/src/plugins/FtmStyleAncestors.py b/gramps2/src/plugins/FtmStyleAncestors.py index e332069fa..780db1060 100644 --- a/gramps2/src/plugins/FtmStyleAncestors.py +++ b/gramps2/src/plugins/FtmStyleAncestors.py @@ -58,7 +58,7 @@ class FtmAncestorReport(Report.Report): self.sref_index = 1 def apply_filter(self,person,index,generation=1): - if person == None or index >= (1 << 30): + if person == None or generation > self.max_generations: return self.map[index] = (person,generation) diff --git a/gramps2/src/plugins/FtmStyleDescendants.py b/gramps2/src/plugins/FtmStyleDescendants.py index e7b47c80d..8b34d937f 100644 --- a/gramps2/src/plugins/FtmStyleDescendants.py +++ b/gramps2/src/plugins/FtmStyleDescendants.py @@ -79,7 +79,7 @@ class FtmDescendantReport(Report.Report): def apply_filter(self,person,index,generation=1): - if person == None or generation >= self.max_generations: + if person == None or generation > self.max_generations: return self.anc_map[index] = person @@ -211,7 +211,8 @@ class FtmDescendantReport(Report.Report): self.print_notes(person) self.print_more_about(person) self.print_more_about_families(person) - self.print_children(person) + if generation < self.max_generations: + self.print_children(person) self.write_endnotes() self.doc.close() @@ -399,7 +400,8 @@ class FtmDescendantReport(Report.Report): for (ind,p) in self.anc_map.items(): if p == child: index = ind - if first: + + if first: first = 0 self.doc.start_paragraph('SubEntry') if spouse: