3780: 'Gender contains' filter does not work as I expect
svn: r14985
This commit is contained in:
parent
77feae36e2
commit
3e345733eb
@ -79,6 +79,10 @@ class SearchBar(object):
|
|||||||
return self.filterbar
|
return self.filterbar
|
||||||
|
|
||||||
def setup_filter( self, column_data ):
|
def setup_filter( self, column_data ):
|
||||||
|
"""
|
||||||
|
column_data is a list of tuples:
|
||||||
|
[(trans_col_name, index, use_exact), ...]
|
||||||
|
"""
|
||||||
self.filter_model.clear()
|
self.filter_model.clear()
|
||||||
old_value = self.filter_list.get_active()
|
old_value = self.filter_list.get_active()
|
||||||
|
|
||||||
@ -88,11 +92,17 @@ class SearchBar(object):
|
|||||||
self.filter_list.add_attribute(cell, 'text', 0)
|
self.filter_list.add_attribute(cell, 'text', 0)
|
||||||
|
|
||||||
maxval = 0
|
maxval = 0
|
||||||
for col, index in column_data:
|
for col, index, exact in column_data:
|
||||||
rule = _("%s contains") % col
|
if exact:
|
||||||
|
rule = _("%s is") % col
|
||||||
|
else:
|
||||||
|
rule = _("%s contains") % col
|
||||||
self.filter_model.append(row=[rule, index, False])
|
self.filter_model.append(row=[rule, index, False])
|
||||||
maxval += 1
|
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])
|
self.filter_model.append(row=[rule, index, True])
|
||||||
maxval += 1
|
maxval += 1
|
||||||
|
|
||||||
|
@ -231,7 +231,7 @@ class BaseSelector(ManagedWindow.ManagedWindow):
|
|||||||
"""
|
"""
|
||||||
Builds the default filters and add them to the filter bar.
|
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()
|
for pair in self.column_order()
|
||||||
if pair[0]
|
if pair[0]
|
||||||
]
|
]
|
||||||
|
@ -358,7 +358,7 @@ class ListView(NavigationView):
|
|||||||
def setup_filter(self):
|
def setup_filter(self):
|
||||||
"""Build the default filters and add them to the filter menu."""
|
"""Build the default filters and add them to the filter menu."""
|
||||||
self.search_bar.setup_filter(
|
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]])
|
for pair in self.column_order() if pair[0]])
|
||||||
|
|
||||||
####################################################################
|
####################################################################
|
||||||
|
Loading…
Reference in New Issue
Block a user