3780: 'Gender contains' filter does not work as I expect

svn: r14985
This commit is contained in:
Doug Blank 2010-04-01 13:22:58 +00:00
parent 77feae36e2
commit 3e345733eb
3 changed files with 15 additions and 5 deletions

View File

@ -79,6 +79,10 @@ class SearchBar(object):
return self.filterbar
def setup_filter( self, column_data ):
"""
column_data is a list of tuples:
[(trans_col_name, index, use_exact), ...]
"""
self.filter_model.clear()
old_value = self.filter_list.get_active()
@ -88,11 +92,17 @@ class SearchBar(object):
self.filter_list.add_attribute(cell, 'text', 0)
maxval = 0
for col, index in column_data:
rule = _("%s contains") % col
for col, index, exact in column_data:
if exact:
rule = _("%s is") % col
else:
rule = _("%s contains") % col
self.filter_model.append(row=[rule, index, False])
maxval += 1
rule = _("%s does not contain") % col
if exact:
rule = _("%s is not") % col
else:
rule = _("%s does not contain") % col
self.filter_model.append(row=[rule, index, True])
maxval += 1

View File

@ -231,7 +231,7 @@ class BaseSelector(ManagedWindow.ManagedWindow):
"""
Builds the default filters and add them to the filter bar.
"""
cols = [(pair[3], pair[1])
cols = [(pair[3], pair[1], pair[0] in self.eaxct_search())
for pair in self.column_order()
if pair[0]
]

View File

@ -358,7 +358,7 @@ class ListView(NavigationView):
def setup_filter(self):
"""Build the default filters and add them to the filter menu."""
self.search_bar.setup_filter(
[(self.colinfo[pair[1]], pair[1])
[(self.colinfo[pair[1]], pair[1], pair[1] in self.exact_search())
for pair in self.column_order() if pair[0]])
####################################################################