2008-02-22 Raphael Ackermann <raphael.ackermann@gmail.com>
* src/FilterEditor/_EditRule.py
* src/Filters/Rules/_HasAttributeBase.py
* src/Filters/Rules/Family/_MatchesFilter.py
* src/Filters/Rules/Event/_MatchesFilter.py
* src/Filters/Rules/Event/_MatchesSourceFilter.py
* src/Filters/Rules/Event/_HasType.py
* src/Filters/Rules/Event/_MatchesPersonFilter.py
* src/Filters/Rules/_HasTextMatchingRegexpOf.py
* src/Filters/Rules/_HasReferenceCountBase.py
* src/Filters/Rules/_HasNoteSubstrBase.py
* src/Filters/Rules/__init__.py
* src/Filters/Rules/_HasGrampsId.py
* src/Filters/Rules/_RegExpIdBase.py
* src/Filters/Rules/_IsPrivate.py
* src/Filters/Rules/_Rule.py
* src/Filters/Rules/_HasMarkerBase.py
* src/Filters/Rules/_HasEventBase.py
* src/Filters/Rules/Note/_MatchesFilter.py
* src/Filters/Rules/Person/_MatchesFilter.py
* src/Filters/Rules/Person/_MatchesEventFilter.py
* src/Filters/Rules/MediaObject/_MatchesFilter.py
* src/Filters/Rules/_HasTextMatchingSubstringOf.py
* src/Filters/Rules/_Everything.py
* src/Filters/Rules/_MatchesFilterBase.py
* src/Filters/Rules/_HasNoteRegexBase.py
* src/DateHandler/_DateUtils.py
pylint and doc fixes.
svn: r10094
This commit is contained in:
30
ChangeLog
30
ChangeLog
@@ -1,3 +1,33 @@
|
|||||||
|
2008-02-22 Raphael Ackermann <raphael.ackermann@gmail.com>
|
||||||
|
* src/FilterEditor/_EditRule.py
|
||||||
|
* src/Filters/Rules/_HasAttributeBase.py
|
||||||
|
* src/Filters/Rules/Family/_MatchesFilter.py
|
||||||
|
* src/Filters/Rules/Event/_MatchesFilter.py
|
||||||
|
* src/Filters/Rules/Event/_MatchesSourceFilter.py
|
||||||
|
* src/Filters/Rules/Event/_HasType.py
|
||||||
|
* src/Filters/Rules/Event/_MatchesPersonFilter.py
|
||||||
|
* src/Filters/Rules/_HasTextMatchingRegexpOf.py
|
||||||
|
* src/Filters/Rules/_HasReferenceCountBase.py
|
||||||
|
* src/Filters/Rules/_HasNoteSubstrBase.py
|
||||||
|
* src/Filters/Rules/__init__.py
|
||||||
|
* src/Filters/Rules/_HasGrampsId.py
|
||||||
|
* src/Filters/Rules/_RegExpIdBase.py
|
||||||
|
* src/Filters/Rules/_IsPrivate.py
|
||||||
|
* src/Filters/Rules/_Rule.py
|
||||||
|
* src/Filters/Rules/_HasMarkerBase.py
|
||||||
|
* src/Filters/Rules/_HasEventBase.py
|
||||||
|
* src/Filters/Rules/Note/_MatchesFilter.py
|
||||||
|
* src/Filters/Rules/Person/_MatchesFilter.py
|
||||||
|
* src/Filters/Rules/Person/_MatchesEventFilter.py
|
||||||
|
* src/Filters/Rules/MediaObject/_MatchesFilter.py
|
||||||
|
* src/Filters/Rules/_HasTextMatchingSubstringOf.py
|
||||||
|
* src/Filters/Rules/_Everything.py
|
||||||
|
* src/Filters/Rules/_MatchesFilterBase.py
|
||||||
|
* src/Filters/Rules/_HasNoteRegexBase.py
|
||||||
|
* src/DateHandler/_DateUtils.py
|
||||||
|
pylint and doc fixes.
|
||||||
|
|
||||||
|
|
||||||
2008-02-20 Frederik De Richter <frederik.de.richter@pandora.be>
|
2008-02-20 Frederik De Richter <frederik.de.richter@pandora.be>
|
||||||
* src/Merge/_MergePerson.py
|
* src/Merge/_MergePerson.py
|
||||||
* src/Merge/_MergeSource.py
|
* src/Merge/_MergeSource.py
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ from DateHandler import LANG_TO_DISPLAY, LANG, parser, displayer
|
|||||||
#--------------------------------------------------------------
|
#--------------------------------------------------------------
|
||||||
def get_date_formats():
|
def get_date_formats():
|
||||||
"""
|
"""
|
||||||
Returns the lists supported formats for date parsers and displayers
|
Return the lists supported formats for date parsers and displayers.
|
||||||
"""
|
"""
|
||||||
try:
|
try:
|
||||||
return LANG_TO_DISPLAY[LANG].formats
|
return LANG_TO_DISPLAY[LANG].formats
|
||||||
@@ -53,7 +53,7 @@ def set_format(value):
|
|||||||
|
|
||||||
def set_date(date_base, text) :
|
def set_date(date_base, text) :
|
||||||
"""
|
"""
|
||||||
Sets the date of the DateBase instance.
|
Set the date of the DateBase instance.
|
||||||
|
|
||||||
The date is parsed into a Date instance.
|
The date is parsed into a Date instance.
|
||||||
|
|
||||||
@@ -61,23 +61,25 @@ def set_date(date_base, text) :
|
|||||||
@type date_base: DateBase
|
@type date_base: DateBase
|
||||||
@param text: The text to use for the text string in date
|
@param text: The text to use for the text string in date
|
||||||
@type text: str
|
@type text: str
|
||||||
|
|
||||||
"""
|
"""
|
||||||
parser.set_date(date_base.get_date_object(), text)
|
parser.set_date(date_base.get_date_object(), text)
|
||||||
|
|
||||||
def get_date(date_base) :
|
def get_date(date_base) :
|
||||||
"""
|
"""
|
||||||
Returns a string representation of the date of the DateBase instance.
|
Return a string representation of the date of the DateBase instance.
|
||||||
|
|
||||||
This representation is based off the default date display format
|
This representation is based off the default date display format
|
||||||
determined by the locale's DateDisplay instance.
|
determined by the locale's DateDisplay instance.
|
||||||
@return: Returns a string representing the DateBase date
|
@return: Returns a string representing the DateBase date
|
||||||
@rtype: str
|
@rtype: str
|
||||||
|
|
||||||
"""
|
"""
|
||||||
return displayer.display(date_base.get_date_object())
|
return displayer.display(date_base.get_date_object())
|
||||||
|
|
||||||
def get_quote_date(date_base):
|
def get_quote_date(date_base):
|
||||||
"""
|
"""
|
||||||
Returns a string representation of the date of the DateBase instance.
|
Return a string representation of the date of the DateBase instance.
|
||||||
|
|
||||||
This representation is based off the default date display format
|
This representation is based off the default date display format
|
||||||
determined by the locale's DateDisplay instance. The date is
|
determined by the locale's DateDisplay instance. The date is
|
||||||
@@ -85,5 +87,6 @@ def get_quote_date(date_base):
|
|||||||
|
|
||||||
@return: Returns a string representing the DateBase date
|
@return: Returns a string representing the DateBase date
|
||||||
@rtype: str
|
@rtype: str
|
||||||
|
|
||||||
"""
|
"""
|
||||||
return displayer.quote_display(date_base.get_date_object())
|
return displayer.quote_display(date_base.get_date_object())
|
||||||
|
|||||||
@@ -99,16 +99,19 @@ class MyBoolean(gtk.CheckButton):
|
|||||||
|
|
||||||
def get_text(self):
|
def get_text(self):
|
||||||
"""
|
"""
|
||||||
This method returns the text to save. It should be the same
|
Return the text to save.
|
||||||
no matter the present locale (English or numeric types).
|
|
||||||
|
It should be the same no matter the present locale (English or numeric
|
||||||
|
types).
|
||||||
This class sets this to get_display_text, but when localization
|
This class sets this to get_display_text, but when localization
|
||||||
is an issue (events/attr/etc types) then it has to be overridden.
|
is an issue (events/attr/etc types) then it has to be overridden.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
return str(int(self.get_active()))
|
return str(int(self.get_active()))
|
||||||
|
|
||||||
def set_text(self, val):
|
def set_text(self, val):
|
||||||
"""
|
"""
|
||||||
This method sets the selector state to display the passed value.
|
Set the selector state to display the passed value.
|
||||||
"""
|
"""
|
||||||
is_active = bool(int(val))
|
is_active = bool(int(val))
|
||||||
self.set_active(is_active)
|
self.set_active(is_active)
|
||||||
@@ -137,13 +140,16 @@ class MyInteger(gtk.SpinButton):
|
|||||||
#
|
#
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
class MyFilters(gtk.ComboBox):
|
class MyFilters(gtk.ComboBox):
|
||||||
"""Class to present a combobox of selectable filters
|
"""
|
||||||
|
Class to present a combobox of selectable filters.
|
||||||
"""
|
"""
|
||||||
def __init__(self, filters, filter_name=None):
|
def __init__(self, filters, filter_name=None):
|
||||||
""" Construct the combobox from the entries of
|
"""
|
||||||
the filters list.
|
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
|
Filter_name is name of calling filter.
|
||||||
|
If filter_name is given, it will be excluded from the dropdown box.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
gtk.ComboBox.__init__(self)
|
gtk.ComboBox.__init__(self)
|
||||||
store = gtk.ListStore(gobject.TYPE_STRING)
|
store = gtk.ListStore(gobject.TYPE_STRING)
|
||||||
@@ -468,7 +474,8 @@ class EditRule(ManagedWindow.ManagedWindow):
|
|||||||
elif v == _('Number of generations:'):
|
elif v == _('Number of generations:'):
|
||||||
t = MyInteger(1, 32)
|
t = MyInteger(1, 32)
|
||||||
elif v == _('ID:'):
|
elif v == _('ID:'):
|
||||||
t = MyID(self.dbstate,self.uistate,self.track,self.namespace)
|
t = MyID(self.dbstate, self.uistate, self.track,
|
||||||
|
self.namespace)
|
||||||
elif v == _('Source ID:'):
|
elif v == _('Source ID:'):
|
||||||
t = MySource(self.db)
|
t = MySource(self.db)
|
||||||
elif v == _('Filter name:'):
|
elif v == _('Filter name:'):
|
||||||
@@ -490,7 +497,8 @@ class EditRule(ManagedWindow.ManagedWindow):
|
|||||||
elif v == _('Regular-Expression matching:'):
|
elif v == _('Regular-Expression matching:'):
|
||||||
t = MyBoolean(_('Use regular expression'))
|
t = MyBoolean(_('Use regular expression'))
|
||||||
elif v == _('Include Family events:'):
|
elif v == _('Include Family events:'):
|
||||||
t = MyBoolean(_('Also family events where person is wife/husband'))
|
t = MyBoolean(_('Also family events where person is '
|
||||||
|
'wife/husband'))
|
||||||
else:
|
else:
|
||||||
t = MyEntry()
|
t = MyEntry()
|
||||||
tlist.append(t)
|
tlist.append(t)
|
||||||
@@ -503,7 +511,8 @@ class EditRule(ManagedWindow.ManagedWindow):
|
|||||||
self.page_num = 0
|
self.page_num = 0
|
||||||
self.store = gtk.TreeStore(gobject.TYPE_STRING, gobject.TYPE_PYOBJECT)
|
self.store = gtk.TreeStore(gobject.TYPE_STRING, gobject.TYPE_PYOBJECT)
|
||||||
self.selection = self.rname.get_selection()
|
self.selection = self.rname.get_selection()
|
||||||
col = gtk.TreeViewColumn(_('Rule Name'),gtk.CellRendererText(),text=0)
|
col = gtk.TreeViewColumn(_('Rule Name'), gtk.CellRendererText(),
|
||||||
|
text=0)
|
||||||
self.rname.append_column(col)
|
self.rname.append_column(col)
|
||||||
self.rname.set_model(self.store)
|
self.rname.set_model(self.store)
|
||||||
|
|
||||||
@@ -567,15 +576,19 @@ class EditRule(ManagedWindow.ManagedWindow):
|
|||||||
self.show()
|
self.show()
|
||||||
|
|
||||||
def on_help_clicked(self, obj):
|
def on_help_clicked(self, obj):
|
||||||
"""Display the relevant portion of GRAMPS manual"""
|
"""
|
||||||
|
Display the relevant portion of GRAMPS manual.
|
||||||
|
"""
|
||||||
GrampsDisplay.help('append-filtref')
|
GrampsDisplay.help('append-filtref')
|
||||||
|
|
||||||
def close_window(self, obj):
|
def close_window(self, obj):
|
||||||
self.close()
|
self.close()
|
||||||
|
|
||||||
def on_node_selected(self, obj):
|
def on_node_selected(self, obj):
|
||||||
"""Updates the informational display on the right hand side of
|
"""
|
||||||
the dialog box with the description of the selected report"""
|
Update the informational display on the right hand side of the dialog
|
||||||
|
box with the description of the selected report.
|
||||||
|
"""
|
||||||
|
|
||||||
store, node = self.selection.get_selected()
|
store, node = self.selection.get_selected()
|
||||||
if node:
|
if node:
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ from gettext import gettext as _
|
|||||||
#
|
#
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
from gen.lib import EventType
|
from gen.lib import EventType
|
||||||
from Filters.Rules._Rule import Rule
|
from Filters.Rules import Rule
|
||||||
|
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
@@ -41,7 +41,7 @@ from Filters.Rules._Rule import Rule
|
|||||||
#
|
#
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
class HasType(Rule):
|
class HasType(Rule):
|
||||||
"""Rule that checks for an event of a particular type"""
|
"""Rule that checks for an event of a particular type."""
|
||||||
|
|
||||||
labels = [ _('Event type:') ]
|
labels = [ _('Event type:') ]
|
||||||
name = _('Event with the particular type')
|
name = _('Event with the particular type')
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ from gettext import gettext as _
|
|||||||
# GRAMPS modules
|
# GRAMPS modules
|
||||||
#
|
#
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
from Filters.Rules._MatchesFilterBase import MatchesFilterBase
|
from Filters.Rules import MatchesFilterBase
|
||||||
|
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
@@ -40,7 +40,7 @@ from Filters.Rules._MatchesFilterBase import MatchesFilterBase
|
|||||||
#
|
#
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
class MatchesFilter(MatchesFilterBase):
|
class MatchesFilter(MatchesFilterBase):
|
||||||
"""Rule that checks against another filter"""
|
"""Rule that checks against another filter."""
|
||||||
|
|
||||||
name = _('Events matching the <filter>')
|
name = _('Events matching the <filter>')
|
||||||
description = _("Matches events matched by the specified filter name")
|
description = _("Matches events matched by the specified filter name")
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ from gettext import gettext as _
|
|||||||
# GRAMPS modules
|
# GRAMPS modules
|
||||||
#
|
#
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
from Filters.Rules._MatchesFilterBase import MatchesFilterBase
|
from Filters.Rules import MatchesFilterBase
|
||||||
|
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
@@ -45,6 +45,7 @@ class MatchesPersonFilter(MatchesFilterBase):
|
|||||||
|
|
||||||
This is a base rule for subclassing by specific objects.
|
This is a base rule for subclassing by specific objects.
|
||||||
Subclasses need to define the namespace class attribute.
|
Subclasses need to define the namespace class attribute.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
labels = [_('Person filter name:'), _('Include Family events:')]
|
labels = [_('Person filter name:'), _('Include Family events:')]
|
||||||
@@ -52,6 +53,7 @@ class MatchesPersonFilter(MatchesFilterBase):
|
|||||||
description = _("Matches events of persons matched by the specified "
|
description = _("Matches events of persons matched by the specified "
|
||||||
"person filter name")
|
"person filter name")
|
||||||
category = _('General filters')
|
category = _('General filters')
|
||||||
|
|
||||||
# we want to have this filter show person filters
|
# we want to have this filter show person filters
|
||||||
namespace = 'Person'
|
namespace = 'Person'
|
||||||
|
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ from gettext import gettext as _
|
|||||||
# GRAMPS modules
|
# GRAMPS modules
|
||||||
#
|
#
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
from Filters.Rules._MatchesFilterBase import MatchesFilterBase
|
from Filters.Rules import MatchesFilterBase
|
||||||
|
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
@@ -49,6 +49,7 @@ class MatchesSourceFilter(MatchesFilterBase):
|
|||||||
description = _("Matches events with sources that match the "
|
description = _("Matches events with sources that match the "
|
||||||
"specified source filter name")
|
"specified source filter name")
|
||||||
category = _('General filters')
|
category = _('General filters')
|
||||||
|
|
||||||
# we want to have this filter show source filters
|
# we want to have this filter show source filters
|
||||||
namespace = 'Source'
|
namespace = 'Source'
|
||||||
|
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ from gettext import gettext as _
|
|||||||
# GRAMPS modules
|
# GRAMPS modules
|
||||||
#
|
#
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
from Filters.Rules._MatchesFilterBase import MatchesFilterBase
|
from Filters.Rules import MatchesFilterBase
|
||||||
|
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
@@ -40,7 +40,7 @@ from Filters.Rules._MatchesFilterBase import MatchesFilterBase
|
|||||||
#
|
#
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
class MatchesFilter(MatchesFilterBase):
|
class MatchesFilter(MatchesFilterBase):
|
||||||
"""Rule that checks against another filter"""
|
"""Rule that checks against another filter."""
|
||||||
|
|
||||||
name = _('Families matching the <filter>')
|
name = _('Families matching the <filter>')
|
||||||
description = _("Matches families matched by the specified filter name")
|
description = _("Matches families matched by the specified filter name")
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ from gettext import gettext as _
|
|||||||
# GRAMPS modules
|
# GRAMPS modules
|
||||||
#
|
#
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
from Filters.Rules._MatchesFilterBase import MatchesFilterBase
|
from Filters.Rules import MatchesFilterBase
|
||||||
|
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
@@ -40,7 +40,7 @@ from Filters.Rules._MatchesFilterBase import MatchesFilterBase
|
|||||||
#
|
#
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
class MatchesFilter(MatchesFilterBase):
|
class MatchesFilter(MatchesFilterBase):
|
||||||
"""Rule that checks against another filter"""
|
"""Rule that checks against another filter."""
|
||||||
|
|
||||||
name = _('Media objects matching the <filter>')
|
name = _('Media objects matching the <filter>')
|
||||||
description = _("Matches media objects matched by the "
|
description = _("Matches media objects matched by the "
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ from gettext import gettext as _
|
|||||||
# GRAMPS modules
|
# GRAMPS modules
|
||||||
#
|
#
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
from Filters.Rules._MatchesFilterBase import MatchesFilterBase
|
from Filters.Rules import MatchesFilterBase
|
||||||
|
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
@@ -40,7 +40,7 @@ from Filters.Rules._MatchesFilterBase import MatchesFilterBase
|
|||||||
#
|
#
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
class MatchesFilter(MatchesFilterBase):
|
class MatchesFilter(MatchesFilterBase):
|
||||||
"""Rule that checks against another filter"""
|
"""Rule that checks against another filter."""
|
||||||
|
|
||||||
name = _('Notes matching the <filter>')
|
name = _('Notes matching the <filter>')
|
||||||
description = _("Matches notes matched "
|
description = _("Matches notes matched "
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ from gettext import gettext as _
|
|||||||
# GRAMPS modules
|
# GRAMPS modules
|
||||||
#
|
#
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
from Filters.Rules._MatchesFilterBase import MatchesFilterBase
|
from Filters.Rules import MatchesFilterBase
|
||||||
|
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
@@ -45,6 +45,7 @@ class MatchesEventFilter(MatchesFilterBase):
|
|||||||
|
|
||||||
This is a base rule for subclassing by specific objects.
|
This is a base rule for subclassing by specific objects.
|
||||||
Subclasses need to define the namespace class attribute.
|
Subclasses need to define the namespace class attribute.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
labels = [_('Event filter name:')]
|
labels = [_('Event filter name:')]
|
||||||
@@ -52,6 +53,7 @@ class MatchesEventFilter(MatchesFilterBase):
|
|||||||
description = _("Matches persons who have events that match a certain"
|
description = _("Matches persons who have events that match a certain"
|
||||||
" event filter")
|
" event filter")
|
||||||
category = _('General filters')
|
category = _('General filters')
|
||||||
|
|
||||||
# we want to have this filter show event filters
|
# we want to have this filter show event filters
|
||||||
namespace = 'Event'
|
namespace = 'Event'
|
||||||
|
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ from gettext import gettext as _
|
|||||||
# GRAMPS modules
|
# GRAMPS modules
|
||||||
#
|
#
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
from Filters.Rules._MatchesFilterBase import MatchesFilterBase
|
from Filters.Rules import MatchesFilterBase
|
||||||
|
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
@@ -40,7 +40,7 @@ from Filters.Rules._MatchesFilterBase import MatchesFilterBase
|
|||||||
#
|
#
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
class MatchesFilter(MatchesFilterBase):
|
class MatchesFilter(MatchesFilterBase):
|
||||||
"""Rule that checks against another filter"""
|
"""Rule that checks against another filter."""
|
||||||
|
|
||||||
name = _('People matching the <filter>')
|
name = _('People matching the <filter>')
|
||||||
description = _("Matches people matched by the specified filter name")
|
description = _("Matches people matched by the specified filter name")
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ from gettext import gettext as _
|
|||||||
# GRAMPS modules
|
# GRAMPS modules
|
||||||
#
|
#
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
from _Rule import Rule
|
from Filters.Rules import Rule
|
||||||
|
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
@@ -40,7 +40,7 @@ from _Rule import Rule
|
|||||||
#
|
#
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
class Everything(Rule):
|
class Everything(Rule):
|
||||||
"""Matches Everyone"""
|
"""Match Everyone."""
|
||||||
|
|
||||||
name = _('Every object')
|
name = _('Every object')
|
||||||
category = _('General filters')
|
category = _('General filters')
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ from gettext import gettext as _
|
|||||||
#
|
#
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
from gen.lib import AttributeType
|
from gen.lib import AttributeType
|
||||||
from Filters.Rules._Rule import Rule
|
from Filters.Rules import Rule
|
||||||
|
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
@@ -41,7 +41,9 @@ from Filters.Rules._Rule import Rule
|
|||||||
#
|
#
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
class HasAttributeBase(Rule):
|
class HasAttributeBase(Rule):
|
||||||
"""Rule that checks for an object with a particular attribute"""
|
"""
|
||||||
|
Rule that checks for an object with a particular attribute.
|
||||||
|
"""
|
||||||
|
|
||||||
labels = [ _('Attribute:'), _('Value:') ]
|
labels = [ _('Attribute:'), _('Value:') ]
|
||||||
name = _('Objects with the <attribute>')
|
name = _('Objects with the <attribute>')
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ from gettext import gettext as _
|
|||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
import DateHandler
|
import DateHandler
|
||||||
from gen.lib import EventType
|
from gen.lib import EventType
|
||||||
from Filters.Rules._Rule import Rule
|
from Filters.Rules import Rule
|
||||||
|
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
@@ -42,7 +42,7 @@ from Filters.Rules._Rule import Rule
|
|||||||
#
|
#
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
class HasEventBase(Rule):
|
class HasEventBase(Rule):
|
||||||
"""Rule that checks for an event with a particular value"""
|
"""Rule that checks for an event with a particular value."""
|
||||||
|
|
||||||
|
|
||||||
labels = [ _('Event type:'),
|
labels = [ _('Event type:'),
|
||||||
@@ -79,11 +79,11 @@ class HasEventBase(Rule):
|
|||||||
return False
|
return False
|
||||||
|
|
||||||
if self.list[2]:
|
if self.list[2]:
|
||||||
pl_id = event.get_place_handle()
|
place_id = event.get_place_handle()
|
||||||
if pl_id:
|
if place_id:
|
||||||
pl = db.get_place_from_handle(pl_id)
|
place = db.get_place_from_handle(place_id)
|
||||||
pn = pl.get_title()
|
place_name = place.get_title()
|
||||||
if pn.upper().find(self.list[2].upper()) == -1:
|
if place_name.upper().find(self.list[2].upper()) == -1:
|
||||||
return False
|
return False
|
||||||
else:
|
else:
|
||||||
return False
|
return False
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ from gettext import gettext as _
|
|||||||
# GRAMPS modules
|
# GRAMPS modules
|
||||||
#
|
#
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
from Filters.Rules._Rule import Rule
|
from Filters.Rules import Rule
|
||||||
|
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
@@ -40,7 +40,7 @@ from Filters.Rules._Rule import Rule
|
|||||||
#
|
#
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
class HasGrampsId(Rule):
|
class HasGrampsId(Rule):
|
||||||
"""Rule that checks for a person with a specific GRAMPS ID"""
|
"""Rule that checks for a person with a specific GRAMPS ID."""
|
||||||
|
|
||||||
labels = [ _('ID:') ]
|
labels = [ _('ID:') ]
|
||||||
name = _('Object with <Id>')
|
name = _('Object with <Id>')
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ from gettext import gettext as _
|
|||||||
#
|
#
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
from gen.lib import MarkerType
|
from gen.lib import MarkerType
|
||||||
from Filters.Rules._Rule import Rule
|
from Filters.Rules import Rule
|
||||||
|
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
@@ -41,7 +41,7 @@ from Filters.Rules._Rule import Rule
|
|||||||
#
|
#
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
class HasMarkerBase(Rule):
|
class HasMarkerBase(Rule):
|
||||||
"""Rule that checks for a person with a particular value"""
|
"""Rule that checks for a person with a particular value."""
|
||||||
|
|
||||||
|
|
||||||
labels = [ _('Marker type:')]
|
labels = [ _('Marker type:')]
|
||||||
|
|||||||
@@ -33,13 +33,13 @@ from gettext import gettext as _
|
|||||||
# GRAMPS modules
|
# GRAMPS modules
|
||||||
#
|
#
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
from _Rule import Rule
|
from Filters.Rules import Rule
|
||||||
|
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
# "People having notes that contain a substring"
|
# "People having notes that contain a substring"
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
class HasNoteRegexBase(Rule):
|
class HasNoteRegexBase(Rule):
|
||||||
"""People having notes containing <subtring>"""
|
"""People having notes containing <substring>."""
|
||||||
|
|
||||||
labels = [ _('Regular expression:')]
|
labels = [ _('Regular expression:')]
|
||||||
name = _('Objects having notes containing <regular expression>')
|
name = _('Objects having notes containing <regular expression>')
|
||||||
|
|||||||
@@ -32,17 +32,18 @@ from gettext import gettext as _
|
|||||||
# GRAMPS modules
|
# GRAMPS modules
|
||||||
#
|
#
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
from Filters.Rules._Rule import Rule
|
from Filters.Rules import Rule
|
||||||
|
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
# "People having notes that contain a substring"
|
# "People having notes that contain a substring"
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
class HasNoteSubstrBase(Rule):
|
class HasNoteSubstrBase(Rule):
|
||||||
"""People having notes containing <subtring>"""
|
"""People having notes containing <substring>."""
|
||||||
|
|
||||||
labels = [ _('Substring:')]
|
labels = [ _('Substring:')]
|
||||||
name = _('Objects having notes containing <substring>')
|
name = _('Objects having notes containing <substring>')
|
||||||
description = _("Matches objects whose notes contain text matching a substring")
|
description = _("Matches objects whose notes contain text matching a "
|
||||||
|
"substring")
|
||||||
category = _('General filters')
|
category = _('General filters')
|
||||||
|
|
||||||
def apply(self, db, person):
|
def apply(self, db, person):
|
||||||
|
|||||||
@@ -32,13 +32,13 @@ from gettext import gettext as _
|
|||||||
# GRAMPS modules
|
# GRAMPS modules
|
||||||
#
|
#
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
from Filters.Rules._Rule import Rule
|
from Filters.Rules import Rule
|
||||||
|
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
# "Objects with a certain reference count"
|
# "Objects with a certain reference count"
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
class HasReferenceCountBase(Rule):
|
class HasReferenceCountBase(Rule):
|
||||||
"""Objects with a reference count of <count>"""
|
"""Objects with a reference count of <count>."""
|
||||||
|
|
||||||
labels = [ _('Reference count must be:'), _('Reference count:')]
|
labels = [ _('Reference count must be:'), _('Reference count:')]
|
||||||
name = _('Objects with a reference count of <count>')
|
name = _('Objects with a reference count of <count>')
|
||||||
@@ -49,24 +49,24 @@ class HasReferenceCountBase(Rule):
|
|||||||
def prepare(self, db):
|
def prepare(self, db):
|
||||||
# things we want to do just once, not for every handle
|
# things we want to do just once, not for every handle
|
||||||
if self.list[0] == _('lesser than'):
|
if self.list[0] == _('lesser than'):
|
||||||
self.countType = 0
|
self.count_type = 0
|
||||||
elif self.list[0] == _('greater than'):
|
elif self.list[0] == _('greater than'):
|
||||||
self.countType = 2
|
self.count_type = 2
|
||||||
else:
|
else:
|
||||||
self.countType = 1 # "equal to"
|
self.count_type = 1 # "equal to"
|
||||||
|
|
||||||
self.userSelectedCount = int(self.list[1])
|
self.userSelectedCount = int(self.list[1])
|
||||||
|
|
||||||
|
|
||||||
def apply(self,db,object):
|
def apply(self, db, obj):
|
||||||
handle = object.get_handle()
|
handle = obj.get_handle()
|
||||||
count = 0
|
count = 0
|
||||||
for item in db.find_backlink_handles(handle):
|
for item in db.find_backlink_handles(handle):
|
||||||
count += 1
|
count += 1
|
||||||
|
|
||||||
if self.countType == 0: # "lesser than"
|
if self.count_type == 0: # "lesser than"
|
||||||
return count < self.userSelectedCount
|
return count < self.userSelectedCount
|
||||||
elif self.countType == 2: # "greater than"
|
elif self.count_type == 2: # "greater than"
|
||||||
return count > self.userSelectedCount
|
return count > self.userSelectedCount
|
||||||
# "equal to"
|
# "equal to"
|
||||||
return count == self.userSelectedCount
|
return count == self.userSelectedCount
|
||||||
|
|||||||
@@ -31,15 +31,14 @@
|
|||||||
# GRAMPS modules
|
# GRAMPS modules
|
||||||
#
|
#
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
from _HasTextMatchingSubstringOf import HasTextMatchingSubstringOf
|
from Filters.Rules import HasTextMatchingSubstringOf
|
||||||
|
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
# "HasTextMatchingRegexOf"
|
# "HasTextMatchingRegexOf"
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
class HasTextMatchingRegexpOf(HasTextMatchingSubstringOf):
|
class HasTextMatchingRegexpOf(HasTextMatchingSubstringOf):
|
||||||
"""This is wrapping HasTextMatchingSubstringOf to enable the regex_match
|
"""
|
||||||
parameter.
|
Wrap HasTextMatchingSubstringOf to enable the regex_match parameter.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
def __init__(self, list):
|
def __init__(self, list):
|
||||||
HasTextMatchingSubstringOf.__init__(self, list)
|
HasTextMatchingSubstringOf.__init__(self, list)
|
||||||
|
|||||||
@@ -32,13 +32,13 @@ from gettext import gettext as _
|
|||||||
# GRAMPS modules
|
# GRAMPS modules
|
||||||
#
|
#
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
from _Rule import Rule
|
from Filters.Rules import Rule
|
||||||
|
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
# "HasTextMatchingSubstringOf"
|
# "HasTextMatchingSubstringOf"
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
class HasTextMatchingSubstringOf(Rule):
|
class HasTextMatchingSubstringOf(Rule):
|
||||||
"""Rule that checks for string matches in any textual information"""
|
"""Rule that checks for string matches in any textual information."""
|
||||||
|
|
||||||
labels = [ _('Substring:'),
|
labels = [ _('Substring:'),
|
||||||
_('Case sensitive:'),
|
_('Case sensitive:'),
|
||||||
|
|||||||
@@ -32,13 +32,13 @@ from gettext import gettext as _
|
|||||||
# GRAMPS modules
|
# GRAMPS modules
|
||||||
#
|
#
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
from _Rule import Rule
|
from Filters.Rules import Rule
|
||||||
|
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
# "People marked private"
|
# "People marked private"
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
class IsPrivate(Rule):
|
class IsPrivate(Rule):
|
||||||
"""Objects marked private"""
|
"""Objects marked private."""
|
||||||
|
|
||||||
name = _('Objects marked private')
|
name = _('Objects marked private')
|
||||||
description = _("Matches objects that are indicated as private")
|
description = _("Matches objects that are indicated as private")
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ from gettext import gettext as _
|
|||||||
#
|
#
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
import Filters
|
import Filters
|
||||||
from _Rule import Rule
|
from Filters.Rules import Rule
|
||||||
|
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
@@ -46,6 +46,7 @@ class MatchesFilterBase(Rule):
|
|||||||
|
|
||||||
This is a base rule for subclassing by specific objects.
|
This is a base rule for subclassing by specific objects.
|
||||||
Subclasses need to define the namespace class attribute.
|
Subclasses need to define the namespace class attribute.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
labels = [_('Filter name:')]
|
labels = [_('Filter name:')]
|
||||||
@@ -89,8 +90,8 @@ class MatchesFilterBase(Rule):
|
|||||||
return False
|
return False
|
||||||
|
|
||||||
def find_filter(self):
|
def find_filter(self):
|
||||||
""" helper function that can be usefull, returning the filter
|
"""
|
||||||
selected or None
|
Return the selected filter or None.
|
||||||
"""
|
"""
|
||||||
if Filters.SystemFilters:
|
if Filters.SystemFilters:
|
||||||
for filt in Filters.SystemFilters.get_filters(self.namespace):
|
for filt in Filters.SystemFilters.get_filters(self.namespace):
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ import re
|
|||||||
# GRAMPS modules
|
# GRAMPS modules
|
||||||
#
|
#
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
from _Rule import Rule
|
from Filters.Rules import Rule
|
||||||
|
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
@@ -42,8 +42,7 @@ from _Rule import Rule
|
|||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
class RegExpIdBase(Rule):
|
class RegExpIdBase(Rule):
|
||||||
"""
|
"""
|
||||||
Rule that checks for an object whose GRAMPS ID
|
Rule that checks for an object whose GRAMPS ID matches regular expression.
|
||||||
matches regular expression.
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
labels = [ _('Regular expression:') ]
|
labels = [ _('Regular expression:') ]
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ from gettext import gettext as _
|
|||||||
#
|
#
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
class Rule:
|
class Rule:
|
||||||
"""Base rule class"""
|
"""Base rule class."""
|
||||||
|
|
||||||
labels = []
|
labels = []
|
||||||
name = ''
|
name = ''
|
||||||
|
|||||||
@@ -26,19 +26,14 @@ Package providing filter rules for GRAMPS.
|
|||||||
|
|
||||||
# Need to expose this to be available for filter plugins:
|
# Need to expose this to be available for filter plugins:
|
||||||
# the plugins should say: from Filters.Rules import Rule
|
# the plugins should say: from Filters.Rules import Rule
|
||||||
from _Rule import Rule
|
from Filters.Rules._Rule import Rule
|
||||||
|
|
||||||
from _Everything import Everything
|
from Filters.Rules._Everything import Everything
|
||||||
from _HasGrampsId import HasGrampsId
|
from Filters.Rules._HasGrampsId import HasGrampsId
|
||||||
from _IsPrivate import IsPrivate
|
from Filters.Rules._IsPrivate import IsPrivate
|
||||||
from _HasTextMatchingSubstringOf import HasTextMatchingSubstringOf
|
from Filters.Rules._HasTextMatchingSubstringOf import HasTextMatchingSubstringOf
|
||||||
from _HasTextMatchingRegexpOf import HasTextMatchingRegexpOf
|
from Filters.Rules._HasTextMatchingRegexpOf import HasTextMatchingRegexpOf
|
||||||
|
from Filters.Rules._MatchesFilterBase import MatchesFilterBase
|
||||||
|
|
||||||
import Person
|
from Filters.Rules import (Person, Family, Event, Source, Place, MediaObject,
|
||||||
import Family
|
Repository, Note)
|
||||||
import Event
|
|
||||||
import Source
|
|
||||||
import Place
|
|
||||||
import MediaObject
|
|
||||||
import Repository
|
|
||||||
import Note
|
|
||||||
|
|||||||
Reference in New Issue
Block a user