* src/PeopleModel.py (calculate_data): Fix invert of search result
* src/Date.py (is_equal): Only compare text value for TEXTONLY dates. * src/GenericFilter.py: Add new filters to search for notes svn: r4903
This commit is contained in:
parent
139ae5c305
commit
47922e7be9
@ -1,3 +1,8 @@
|
|||||||
|
2005-07-05 Martin Hawlisch <Martin.Hawlisch@gmx.de>
|
||||||
|
* src/PeopleModel.py (calculate_data): Fix invert of search result
|
||||||
|
* src/Date.py (is_equal): Only compare text value for TEXTONLY dates.
|
||||||
|
* src/GenericFilter.py: Add new filters to search for notes
|
||||||
|
|
||||||
2005-07-05 Alex Roitman <shura@gramps-project.org>
|
2005-07-05 Alex Roitman <shura@gramps-project.org>
|
||||||
* src/system_filters.xml: Remove testing contents.
|
* src/system_filters.xml: Remove testing contents.
|
||||||
* src/EditPerson.py (__init__): Refresh person object from handle,
|
* src/EditPerson.py (__init__): Refresh person object from handle,
|
||||||
|
@ -156,12 +156,12 @@ class Date:
|
|||||||
instance IN ALL REGARDS. Needed, because the __cmp__ only looks
|
instance IN ALL REGARDS. Needed, because the __cmp__ only looks
|
||||||
at the sorting value, and ignores the modifiers/comments.
|
at the sorting value, and ignores the modifiers/comments.
|
||||||
"""
|
"""
|
||||||
|
if self.modifier == other.modifier and self.modifier == MOD_TEXTONLY:
|
||||||
|
return self.text == other.text
|
||||||
return (self.calendar == other.calendar and
|
return (self.calendar == other.calendar and
|
||||||
self.modifier == other.modifier and
|
self.modifier == other.modifier and
|
||||||
self.quality == other.quality and
|
self.quality == other.quality and
|
||||||
self.dateval == other.dateval and
|
self.dateval == other.dateval and
|
||||||
self.text == other.text and
|
|
||||||
self.sortval == other.sortval)
|
self.sortval == other.sortval)
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
|
@ -1813,6 +1813,36 @@ class HasSourceOf(Rule):
|
|||||||
return False
|
return False
|
||||||
return person.has_source_reference( self.source_handle)
|
return person.has_source_reference( self.source_handle)
|
||||||
|
|
||||||
|
#-------------------------------------------------------------------------
|
||||||
|
# "People having notes"
|
||||||
|
#-------------------------------------------------------------------------
|
||||||
|
class HasNote(Rule):
|
||||||
|
"""People having notes"""
|
||||||
|
|
||||||
|
name = _('People having notes')
|
||||||
|
description = _("Matches people that have a note")
|
||||||
|
category = _('General filters')
|
||||||
|
|
||||||
|
def apply(self,db,person):
|
||||||
|
return bool(person.get_note())
|
||||||
|
|
||||||
|
#-------------------------------------------------------------------------
|
||||||
|
# "People having notes that contain a substring"
|
||||||
|
#-------------------------------------------------------------------------
|
||||||
|
class HasNoteMatchingSubstringOf(Rule):
|
||||||
|
"""People having notes containing <subtring>"""
|
||||||
|
|
||||||
|
labels = [ _('Substring:')]
|
||||||
|
name = _('People having notes containing <subtring>')
|
||||||
|
description = _("Matches people whose notes contain text matching a substring")
|
||||||
|
category = _('General filters')
|
||||||
|
|
||||||
|
def apply(self,db,person):
|
||||||
|
n = person.get_note()
|
||||||
|
if n:
|
||||||
|
return n.find(self.list[0]) != -1
|
||||||
|
return False
|
||||||
|
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
# GenericFilter
|
# GenericFilter
|
||||||
@ -2086,6 +2116,8 @@ editor_rule_list = [
|
|||||||
IsSiblingOfFilterMatch,
|
IsSiblingOfFilterMatch,
|
||||||
RelationshipPathBetween,
|
RelationshipPathBetween,
|
||||||
HasTextMatchingSubstringOf,
|
HasTextMatchingSubstringOf,
|
||||||
|
HasNote,
|
||||||
|
HasNoteMatchingSubstringOf
|
||||||
]
|
]
|
||||||
|
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
|
@ -107,7 +107,10 @@ class PeopleModel(gtk.GenericTreeModel):
|
|||||||
if data_filter:
|
if data_filter:
|
||||||
keys = data_filter.apply(self.db)
|
keys = data_filter.apply(self.db)
|
||||||
if self.invert_result:
|
if self.invert_result:
|
||||||
|
handle_list = self.db.get_person_handles(sort_handles=False)
|
||||||
|
#TODO: Could be optimized by using a cursor
|
||||||
keys = [k for k in handle_list if k not in keys]
|
keys = [k for k in handle_list if k not in keys]
|
||||||
|
del handle_list
|
||||||
else:
|
else:
|
||||||
keys = self.db.get_person_handles(sort_handles=False)
|
keys = self.db.get_person_handles(sort_handles=False)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user