From 0e450f16848a610a0ef9ba51efb0a7df71a13bf9 Mon Sep 17 00:00:00 2001 From: Benny Malengier Date: Thu, 27 Sep 2007 13:28:54 +0000 Subject: [PATCH] 2007-09-27 Benny Malengier * src/FilterEditor/_EditRule.py: wrong filter selection, bug #807 Based on work Johan svn: r9015 --- ChangeLog | 4 ++++ src/FilterEditor/_EditRule.py | 27 +++++++++++++++++---------- 2 files changed, 21 insertions(+), 10 deletions(-) diff --git a/ChangeLog b/ChangeLog index 0712b1b12..87955c5a2 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2007-09-27 Benny Malengier + * src/FilterEditor/_EditRule.py: wrong filter selection, bug #807 + Based on work Johan + 2007-09-26 James G. Sack * src/plugins/Check.py: same sex marriage need not be CIVIL_UNION, bug #1245 This includes the 8374 commit which was not present in trunk (??) diff --git a/src/FilterEditor/_EditRule.py b/src/FilterEditor/_EditRule.py index a1423120f..b9b05bce2 100644 --- a/src/FilterEditor/_EditRule.py +++ b/src/FilterEditor/_EditRule.py @@ -139,20 +139,27 @@ class MyInteger(gtk.SpinButton): # #------------------------------------------------------------------------- class MyFilters(gtk.ComboBox): - - def __init__(self,filters,filter_name): + """Class to present a combobox of selectable filters + """ + def __init__(self, filters, filter_name=None): + """ Construct the combobox from the entries of + the filters list. + filter_name is name of calling filter + If filter_name is given, it will be excluded from the dropdown box + """ gtk.ComboBox.__init__(self) store = gtk.ListStore(str) self.set_model(store) cell = gtk.CellRendererText() self.pack_start(cell,True) self.add_attribute(cell,'text',0) - self.flist = [ f.get_name() for f in filters ] + #remove own name from the list if given. + self.flist = [ f.get_name() for f in filters if \ + (filter_name is None or f.get_name() != filter_name)] self.flist.sort() for fname in self.flist: - if fname != filter_name: - store.append(row=[fname]) + store.append(row=[fname]) self.set_active(0) self.show() @@ -469,13 +476,13 @@ class EditRule(ManagedWindow.ManagedWindow): elif v == _('Filter name:'): t = MyFilters(self.filterdb.get_filters(self.space), self.filter_name) - # filters of another namespace + # filters of another namespace, name may be same as caller! elif v == _('Person filter name:'): - t = MyFilters(self.filterdb.get_filters('Person'), - self.filter_name) + t = MyFilters(self.filterdb.get_filters('Person')) elif v == _('Event filter name:'): - t = MyFilters(self.filterdb.get_filters('Event'), - self.filter_name) + t = MyFilters(self.filterdb.get_filters('Event')) + elif v == _('Source filter name:'): + t = MyFilters(self.filterdb.get_filters('Source')) elif _name2typeclass.has_key(v): t = MySelect(_name2typeclass[v]) elif v == _('Inclusive:'):