From 62e29dcaf0783339b52f0e28d8c788935b0e4b11 Mon Sep 17 00:00:00 2001 From: Don Allingham Date: Tue, 25 Mar 2003 05:26:05 +0000 Subject: [PATCH] Filter editor fixes svn: r1396 --- src/GenericFilter.py | 7 +- src/plugins/FilterEditor.py | 23 ++- src/rule.glade | 396 +++++++++++++++++++++--------------- 3 files changed, 258 insertions(+), 168 deletions(-) diff --git a/src/GenericFilter.py b/src/GenericFilter.py index 450d81b9b..256d9838d 100644 --- a/src/GenericFilter.py +++ b/src/GenericFilter.py @@ -580,6 +580,11 @@ class HasNameOf(Rule): return 0 +#------------------------------------------------------------------------- +# +# MatchesFilter +# +#------------------------------------------------------------------------- class MatchesFilter(Rule): """Rule that checks against another filter""" @@ -594,7 +599,7 @@ class MatchesFilter(Rule): return filter.check(p) for filter in CustomFilters.get_filters(): if filter.get_name() == self.list[0]: - return filter.check(p) + return filter.check(db,p) return 0 #------------------------------------------------------------------------- diff --git a/src/plugins/FilterEditor.py b/src/plugins/FilterEditor.py index 7b1402df6..4041d017e 100644 --- a/src/plugins/FilterEditor.py +++ b/src/plugins/FilterEditor.py @@ -35,11 +35,11 @@ import Utils from intl import gettext as _ _name2list = { - _('Personal Event') : const.personalEvents, - _('Family Event') : const.marriageEvents, - _('Personal Attribute') : const.personalAttributes, - _('Family Attribute') : const.familyAttributes, - _('Relationship Type') : const.familyRelations, + _('Personal event:') : const.personalEvents, + _('Family event:') : const.marriageEvents, + _('Personal attribute:') : const.personalAttributes, + _('Family attribute:') : const.familyAttributes, + _('Relationship type:') : const.familyRelations, } class FilterEditor: @@ -47,7 +47,7 @@ class FilterEditor: self.db = db self.filterdb = GenericFilter.GenericFilterList(filterdb) self.filterdb.load() - + self.editor = gtk.glade.XML(const.filterFile,'filter_list') self.editor_top = self.editor.get_widget('filter_list') self.filter_list = self.editor.get_widget('filters') @@ -265,9 +265,18 @@ class FilterEditor: l = gtk.Label(v1) l.set_alignment(1,0.5) l.show() - if v == 'Place': + if v == 'Place:': t = gtk.Combo() AutoComp.AutoCombo(t,self.pmap.keys()) + tlist.append(t.entry) + elif v == 'Filter name:': + t = gtk.Combo() + flist = [] + for f in self.filterdb.get_filters(): + flist.append(f.get_name()) + flist.sort() + AutoComp.AutoCombo(t,flist) + tlist.append(t.entry) elif _name2list.has_key(v1): t = gtk.Combo() _name2list[v1].sort() diff --git a/src/rule.glade b/src/rule.glade index 51e39aefc..c47159c73 100644 --- a/src/rule.glade +++ b/src/rule.glade @@ -93,12 +93,171 @@ 12 True - 6 - 2 + 12 + 3 False 6 12 + + + True + <b>Definition</b> + False + True + GTK_JUSTIFY_LEFT + False + False + 0 + 0.5 + 0 + 0 + + + 0 + 3 + 0 + 1 + fill + + + + + + + True + <b>Rule List</b> + False + True + GTK_JUSTIFY_LEFT + False + False + 0 + 0.5 + 0 + 0 + + + 0 + 3 + 10 + 11 + fill + + + + + + + True + False + 6 + + + + True + GTK_POLICY_AUTOMATIC + GTK_POLICY_AUTOMATIC + GTK_SHADOW_IN + GTK_CORNER_TOP_LEFT + + + + True + True + True + False + False + True + + + + + 0 + True + True + + + + + + True + False + 6 + + + + True + True + True + _Add... + True + GTK_RELIEF_NORMAL + + + + 0 + False + False + + + + + + True + False + True + True + _Edit... + True + GTK_RELIEF_NORMAL + + + + 0 + False + False + + + + + + True + False + True + True + _Delete + True + GTK_RELIEF_NORMAL + + + + 0 + False + False + + + + + + + + + 0 + False + True + + + + + 1 + 3 + 11 + 12 + fill + + + True @@ -115,12 +274,10 @@ filter_name - 0 - 1 - 0 - 1 - 5 - 5 + 1 + 2 + 1 + 2 fill @@ -142,12 +299,10 @@ comment - 0 - 1 - 1 - 2 - 5 - 5 + 1 + 2 + 2 + 3 fill @@ -167,12 +322,10 @@ - 1 - 2 - 0 - 1 - 5 - 5 + 2 + 3 + 1 + 2 @@ -190,32 +343,30 @@ False - 1 - 2 - 1 - 2 - 5 - 5 + 2 + 3 + 2 + 3 - + True True - E_xactly one rule must apply + All _rules must apply True GTK_RELIEF_NORMAL - False + True False True - 1 - 2 - 5 - 6 + 2 + 3 + 3 + 4 fill @@ -231,11 +382,11 @@ False False True - logical_one + logical_and - 1 - 2 + 2 + 3 4 5 fill @@ -244,16 +395,40 @@ - + True True - All _rules must apply + E_xactly one rule must apply True GTK_RELIEF_NORMAL - True + False False True - logical_one + logical_and + + + 2 + 3 + 5 + 6 + fill + + + + + + + True + Rule operations: + False + False + GTK_JUSTIFY_LEFT + False + False + 0 + 0.5 + 0 + 0 1 @@ -269,7 +444,7 @@ True True - _Invert + _Return values that do not match the filter rules (invert) True GTK_RELIEF_NORMAL False @@ -278,136 +453,37 @@ 1 - 2 - 2 - 3 + 3 + 8 + 9 fill - - - 0 - False - True - - - - - - 12 - True - False - 6 - + True - GTK_POLICY_AUTOMATIC - GTK_POLICY_AUTOMATIC - GTK_SHADOW_IN - GTK_CORNER_TOP_LEFT - - - - True - True - True - False - False - True - - + <b>Rule Modifiers</b> + False + True + GTK_JUSTIFY_LEFT + False + False + 0 + 0.5 + 0 + 0 - 0 - True - True + 0 + 3 + 7 + 8 + fill + - - - - True - False - 6 - - - - True - True - True - _Add... - True - GTK_RELIEF_NORMAL - - - - 0 - False - False - - - - - - True - False - True - True - _Edit... - True - GTK_RELIEF_NORMAL - - - - 0 - False - False - - - - - - True - False - True - True - _Delete - True - GTK_RELIEF_NORMAL - - - - 0 - False - False - - - - - - - - - 0 - False - True - - - - - 0 - True - True - - - - - - True - GTK_BUTTONBOX_SPREAD - 30 0