* src/DataViews/_PersonView.py: exact search for gender (bug #633)
* src/DisplayModels/_PeopleModel.py: exact search for gender (bug #633) * src/Filters/_SearchFilter.py: exact search for gender (bug #633) * src/Filters/__init__.py: export ExactSearchFilter svn: r7817
This commit is contained in:
parent
3c73746665
commit
6183354ba4
@ -1,4 +1,8 @@
|
||||
2006-12-18 Don Allingham <don@gramps-project.org>
|
||||
* src/DataViews/_PersonView.py: exact search for gender (bug #633)
|
||||
* src/DisplayModels/_PeopleModel.py: exact search for gender (bug #633)
|
||||
* src/Filters/_SearchFilter.py: exact search for gender (bug #633)
|
||||
* src/Filters/__init__.py: export ExactSearchFilter
|
||||
* src/DataViews/_EventView.py: disable items with readonly db (bug #771)
|
||||
* src/DataViews/_PersonView.py: disable items with readonly db (bug #771)
|
||||
* src/DataViews/_RelationView.py: disable items with readonly db (bug #771)
|
||||
|
@ -721,7 +721,12 @@ class PersonView(PageView.PersonNavView):
|
||||
else:
|
||||
col,text,inv = self.search_bar.get_value()
|
||||
func = lambda x: self.model.on_get_value(x, col) or u""
|
||||
data_filter = SearchFilter(func, text, inv)
|
||||
print col, PeopleModel.PeopleModel._GENDER_COL
|
||||
if col == PeopleModel.PeopleModel._GENDER_COL:
|
||||
data_filter = ExactSearchFilter(func, text, inv)
|
||||
else:
|
||||
data_filter = SearchFilter(func, text, inv)
|
||||
print data_filter
|
||||
|
||||
self.model.clear_cache()
|
||||
for node in handle_list:
|
||||
|
@ -65,7 +65,7 @@ import DateHandler
|
||||
import ToolTips
|
||||
import GrampsLocale
|
||||
import Config
|
||||
from Filters import SearchFilter
|
||||
from Filters import SearchFilter, ExactSearchFilter
|
||||
from Lru import LRU
|
||||
|
||||
_CACHE_SIZE = 250
|
||||
@ -169,7 +169,12 @@ class PeopleModel(gtk.GenericTreeModel):
|
||||
text = filter_info[1][1]
|
||||
inv = filter_info[1][2]
|
||||
func = lambda x: self.on_get_value(x, col) or u""
|
||||
data_filter = SearchFilter(func, text, inv)
|
||||
|
||||
if col == self._GENDER_COL:
|
||||
data_filter = ExactSearchFilter(func, text, inv)
|
||||
else:
|
||||
data_filter = SearchFilter(func, text, inv)
|
||||
|
||||
self._build_data = self._build_search_sub
|
||||
else:
|
||||
data_filter = filter_info[1]
|
||||
|
@ -18,7 +18,7 @@
|
||||
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
#
|
||||
|
||||
# $Id:$
|
||||
# $Id$
|
||||
|
||||
"""
|
||||
Package providing filtering framework for GRAMPS.
|
||||
@ -32,4 +32,13 @@ class SearchFilter:
|
||||
|
||||
def match(self, handle):
|
||||
return self.invert ^ (self.func(handle).upper().find(self.text) != -1)
|
||||
|
||||
class ExactSearchFilter(SearchFilter):
|
||||
def __init__(self, func, text, invert):
|
||||
self.func = func
|
||||
self.text = text.upper()
|
||||
self.invert = invert
|
||||
|
||||
def match(self, handle):
|
||||
return self.invert ^ (self.func(handle).upper() == self.text.strip())
|
||||
|
||||
|
@ -54,4 +54,4 @@ from _FilterComboBox import FilterComboBox
|
||||
from _FilterMenu import build_filter_menu, build_filter_model
|
||||
from _FilterStore import FilterStore
|
||||
from _SearchBar import SearchBar
|
||||
from _SearchFilter import SearchFilter
|
||||
from _SearchFilter import SearchFilter, ExactSearchFilter
|
||||
|
Loading…
Reference in New Issue
Block a user