From 1e0db5610df0c57afa1ddd77fd0aef3d42cd8db6 Mon Sep 17 00:00:00 2001 From: Don Allingham Date: Tue, 30 Aug 2005 04:15:07 +0000 Subject: [PATCH] * src/GenericFilter.py: fixed "only one" filter rule, and matching the descendents of a filter * src/SelectObject.py: Fix sorting order for title svn: r5145 --- gramps2/ChangeLog | 3 +++ gramps2/src/GenericFilter.py | 22 ++++++++++++++-------- gramps2/src/SelectObject.py | 2 +- 3 files changed, 18 insertions(+), 9 deletions(-) diff --git a/gramps2/ChangeLog b/gramps2/ChangeLog index cdd59c822..3e479c423 100644 --- a/gramps2/ChangeLog +++ b/gramps2/ChangeLog @@ -1,4 +1,7 @@ 2005-08-29 Don Allingham + * src/GenericFilter.py: fixed "only one" filter rule, and matching + the descendents of a filter + * src/SelectObject.py: Fix sorting order for title * src/plugins/WriteGeneWeb.py: use 'replace' for 'iso-8859-1' encoding * src/po/fr.po: fix named parameter * src/ImageSelect.py: fix note media object added from a gallery diff --git a/gramps2/src/GenericFilter.py b/gramps2/src/GenericFilter.py index cdaf18874..a793fd8a2 100644 --- a/gramps2/src/GenericFilter.py +++ b/gramps2/src/GenericFilter.py @@ -417,7 +417,7 @@ class IsDescendantOfFilterMatch(IsDescendantOf): """Rule that checks for a person that is a descendant of someone matched by a filter""" - labels = [ _('Filter name:'), _('Inclusive:') ] + labels = [ _('Filter name:') ] name = _('Descendants of match') category = _('Descendant filters') description = _("Matches people that are descendants of anybody matched by a filter") @@ -436,8 +436,8 @@ class IsDescendantOfFilterMatch(IsDescendantOf): first = 1 except IndexError: first = 1 - - filt = MatchesFilter(self.list) + + filt = MatchesFilter(self.list[0:1]) filt.prepare(db) for person_handle in db.get_person_handles(sort_handles=False): person = db.get_person_from_handle( person_handle) @@ -725,7 +725,7 @@ class IsAncestorOfFilterMatch(IsAncestorOf): """Rule that checks for a person that is an ancestor of someone matched by a filter""" - labels = [ _('Filter name:'), _('Inclusive:') ] + labels = [ _('Filter name:') ] name = _('Ancestors of match') category = _("Ancestral filters") description = _("Matches people that are ancestors " @@ -746,7 +746,7 @@ class IsAncestorOfFilterMatch(IsAncestorOf): except IndexError: first = 1 - filt = MatchesFilter(self.list) + filt = MatchesFilter(self.list[0:1]) filt.prepare(db) for person_handle in db.get_person_handles(sort_handles=False): person = db.get_person_from_handle( person_handle) @@ -1991,7 +1991,7 @@ class GenericFilter: if count: return False count += 1 - return count != 1 + return count == 1 def or_test(self,db,person): for rule in self.flist: @@ -2269,8 +2269,14 @@ class FilterParser(handler.ContentHandler): def endElement(self,tag): if tag == "rule" and self.r != None: - if len(self.r.labels) != len(self.a): - print "ERROR: Invalid number of arguments in filter '%s'!" %\ + if len(self.r.labels) < len(self.a): + print "WARNING: Invalid number of arguments in filter '%s'!" %\ + self.f.get_name() + nargs = len(self.r.labels) + rule = self.r(self.a[0:nargs]) + self.f.add_rule(rule) + elif len(self.r.labels) > len(self.a): + print "ERROR: Invalid number of arguments in filter '%s'!" %\ self.f.get_name() else: rule = self.r(self.a) diff --git a/gramps2/src/SelectObject.py b/gramps2/src/SelectObject.py index 10df0cd70..a16d64966 100644 --- a/gramps2/src/SelectObject.py +++ b/gramps2/src/SelectObject.py @@ -82,7 +82,7 @@ class SelectObject: Utils.set_titles(self.top,title_label,title) - titles = [(_('Title'),4,350), (_('ID'),1,50), + titles = [(_('Title'),0,350), (_('ID'),1,50), (_('Type'),2,70), ('Path',3,150), ('',4,0) ] self.ncols = len(titles)