5621: do not need to call gettext if strings are not used and displayed

svn: r19169
This commit is contained in:
Jérôme Rapinat 2012-03-29 07:13:06 +00:00
parent ac5875c38f
commit df071b9009
17 changed files with 82 additions and 195 deletions

View File

@ -20,13 +20,6 @@
# $Id$
#-------------------------------------------------------------------------
#
# Standard Python modules
#
#-------------------------------------------------------------------------
from gen.ggettext import gettext as _
#-------------------------------------------------------------------------
#
# GRAMPS modules
@ -42,9 +35,9 @@ from Filters.Rules import Rule
class Everything(Rule):
"""Match Everyone."""
name = _('Every object')
category = _('General filters')
description = _('Matches every object in the database')
name = 'Every object'
category = 'General filters'
description = 'Matches every object in the database'
def is_empty(self):
return True

View File

@ -20,13 +20,6 @@
# $Id$
#-------------------------------------------------------------------------
#
# Standard Python modules
#
#-------------------------------------------------------------------------
from gen.ggettext import gettext as _
#-------------------------------------------------------------------------
#
# GRAMPS modules
@ -45,11 +38,11 @@ class HasAttributeBase(Rule):
Rule that checks for an object with a particular attribute.
"""
labels = [ _('Attribute:'), _('Value:') ]
name = _('Objects with the <attribute>')
description = _("Matches objects with the given attribute "
"of a particular value")
category = _('General filters')
labels = [ 'Attribute:', 'Value:' ]
name = 'Objects with the <attribute>'
description = "Matches objects with the given attribute "
"of a particular value"
category = 'General filters'
def apply(self, db, obj):
if not self.list[0]:

View File

@ -21,13 +21,6 @@
# $Id$
#-------------------------------------------------------------------------
#
# Standard Python modules
#
#-------------------------------------------------------------------------
from gen.ggettext import gettext as _
#-------------------------------------------------------------------------
#
# GRAMPS modules
@ -48,12 +41,12 @@ class HasCitationBase(Rule):
"""
labels = [ _('Volume/Page:'),
_('Date:'),
_('Confidence:') ]
name = _('Citations matching parameters')
description = _("Matches citations with particular parameters")
category = _('Citation/source filters')
labels = [ 'Volume/Page:',
'Date:',
'Confidence:' ]
name = 'Citations matching parameters'
description = "Matches citations with particular parameters"
category = 'Citation/source filters'
def prepare(self, db):
self.date = None

View File

@ -20,13 +20,6 @@
# $Id$
#-------------------------------------------------------------------------
#
# Standard Python modules
#
#-------------------------------------------------------------------------
from gen.ggettext import gettext as _
#-------------------------------------------------------------------------
#
# GRAMPS modules
@ -46,14 +39,14 @@ class HasEventBase(Rule):
"""Rule that checks for an event with a particular value."""
labels = [ _('Event type:'),
_('Date:'),
_('Place:'),
_('Description:'),
_('Main Participants') ]
name = _('Events matching parameters')
description = _("Matches events with particular parameters")
category = _('Event filters')
labels = [ 'Event type:',
'Date:',
'Place:',
'Description:',
'Main Participants' ]
name = 'Events matching parameters'
description = "Matches events with particular parameters"
category = 'Event filters'
def prepare(self, db):
self.date = None

View File

@ -23,13 +23,6 @@
# $Id$
#
#-------------------------------------------------------------------------
#
# Standard Python modules
#
#-------------------------------------------------------------------------
from gen.ggettext import gettext as _
#-------------------------------------------------------------------------
#
# GRAMPS modules
@ -43,10 +36,10 @@ from Filters.Rules import Rule
class HasGalleryBase(Rule):
"""Objects who have Media Object"""
labels = [ _('Number of instances:'), _('Number must be:')]
name = _('Object with <count> Media references')
description = _("Matches objects with certain number of items in the gallery")
category = _('General filters')
labels = [ 'Number of instances:', 'Number must be:']
name = 'Object with <count> Media references'
description = "Matches objects with certain number of items in the gallery"
category = 'General filters'
def prepare(self, db):
# things we want to do just once, not for every handle

View File

@ -21,13 +21,6 @@
# $Id$
#-------------------------------------------------------------------------
#
# Standard Python modules
#
#-------------------------------------------------------------------------
from gen.ggettext import gettext as _
#-------------------------------------------------------------------------
#
# GRAMPS modules
@ -43,10 +36,10 @@ from Filters.Rules import Rule
class HasGrampsId(Rule):
"""Rule that checks for an object with a specific GRAMPS ID."""
labels = [ _('ID:') ]
name = _('Object with <Id>')
description = _("Matches objects with a specified Gramps ID")
category = _('General filters')
labels = [ 'ID:' ]
name = 'Object with <Id>'
description = "Matches objects with a specified Gramps ID"
category = 'General filters'
def apply(self, db, obj):
"""

View File

@ -21,13 +21,6 @@
# $Id$
#-------------------------------------------------------------------------
#
# Standard Python modules
#
#-------------------------------------------------------------------------
from gen.ggettext import gettext as _
#-------------------------------------------------------------------------
#
# GRAMPS modules
@ -44,13 +37,13 @@ class HasSourceBase(Rule):
"""Rule that checks for a source with a particular value"""
labels = [ _('Title:'),
_('Author:'),
_('Abbreviation:'),
_('Publication:') ]
name = _('Sources matching parameters')
description = _("Matches sources with particular parameters")
category = _('Citation/source filters')
labels = [ 'Title:',
'Author:',
'Abbreviation:',
'Publication:' ]
name = 'Sources matching parameters'
description = "Matches sources with particular parameters"
category = 'Citation/source filters'
def apply(self,db,source):
if not self.match_substring(0,source.get_title()):

View File

@ -23,13 +23,6 @@
# $Id$
#-------------------------------------------------------------------------
#
# Standard Python modules
#
#-------------------------------------------------------------------------
from gen.ggettext import gettext as _
#-------------------------------------------------------------------------
#
# GRAMPS modules
@ -43,11 +36,11 @@ from Filters.Rules._Rule import Rule
class HasSourceCountBase(Rule):
"""Objects having sources"""
labels = [ _('Number of instances:'), _('Number must be:')]
name = _('Objects with <count> sources')
description = _("Matches objects that have a certain number of sources "
"connected to it (actually citations are counted)")
category = _('Citation/source filters')
labels = [ 'Number of instances:', 'Number must be:']
name = 'Objects with <count> sources'
description = "Matches objects that have a certain number of sources "
"connected to it (actually citations are counted)"
category = 'Citation/source filters'
def prepare(self, db):
# things we want to do just once, not for every handle

View File

@ -22,13 +22,6 @@
Rule that checks for an object with a particular tag.
"""
#-------------------------------------------------------------------------
#
# Standard Python modules
#
#-------------------------------------------------------------------------
from gen.ggettext import gettext as _
#-------------------------------------------------------------------------
#
# GRAMPS modules
@ -46,10 +39,10 @@ class HasTagBase(Rule):
Rule that checks for an object with a particular tag.
"""
labels = [ _('Tag:') ]
name = _('Objects with the <tag>')
description = _("Matches objects with the given tag")
category = _('General filters')
labels = [ 'Tag:' ]
name = 'Objects with the <tag>'
description = "Matches objects with the given tag"
category = 'General filters'
def prepare(self, db):
"""

View File

@ -20,13 +20,6 @@
# $Id$
#-------------------------------------------------------------------------
#
# Standard Python modules
#
#-------------------------------------------------------------------------
from gen.ggettext import gettext as _
#-------------------------------------------------------------------------
#
# GRAMPS modules
@ -40,13 +33,13 @@ from Filters.Rules import Rule
class HasTextMatchingSubstringOf(Rule):
"""Rule that checks for string matches in any textual information."""
labels = [ _('Substring:'),
_('Case sensitive:'),
_('Regular-Expression matching:')]
name = _('Objects with records containing <substring>')
description = _("Matches objects whose records contain text "
"matching a substring")
category = _('General filters')
labels = [ 'Substring:',
'Case sensitive:',
'Regular-Expression matching:']
name = 'Objects with records containing <substring>'
description = "Matches objects whose records contain text "
"matching a substring"
category = 'General filters'
# FIXME: This needs to be written for an arbitrary object
# if possible

View File

@ -20,13 +20,6 @@
# $Id$
#-------------------------------------------------------------------------
#
# Standard Python modules
#
#-------------------------------------------------------------------------
from gen.ggettext import gettext as _
#-------------------------------------------------------------------------
#
# GRAMPS modules
@ -40,9 +33,9 @@ from Filters.Rules import Rule
class IsPrivate(Rule):
"""Objects marked private."""
name = _('Objects marked private')
description = _("Matches objects that are indicated as private")
category = _('General filters')
name = 'Objects marked private'
description = "Matches objects that are indicated as private"
category = 'General filters'
def apply(self, db, obj):
return obj.get_privacy()

View File

@ -21,13 +21,6 @@
# $Id$
#-------------------------------------------------------------------------
#
# Standard Python modules
#
#-------------------------------------------------------------------------
from gen.ggettext import gettext as _
#-------------------------------------------------------------------------
#
# GRAMPS modules
@ -41,9 +34,9 @@ from Filters.Rules import Rule
class IsPublic(Rule):
"""Objects not marked private."""
name = _('Objects not marked private')
description = _("Matches objects that are not indicated as private")
category = _('General filters')
name = 'Objects not marked private'
description = "Matches objects that are not indicated as private"
category = 'General filters'
def apply(self, db, obj):
return not obj.get_privacy()

View File

@ -20,13 +20,6 @@
# $Id$
#-------------------------------------------------------------------------
#
# Standard Python modules
#
#-------------------------------------------------------------------------
from gen.ggettext import gettext as _
#-------------------------------------------------------------------------
#
# GRAMPS modules
@ -48,11 +41,11 @@ class MatchesEventFilterBase(MatchesFilterBase):
"""
labels = [_('Event filter name:')]
name = _('Objects with events matching the <event filter>')
description = _("Matches objects who have events that match a certain"
" event filter")
category = _('General filters')
labels = ['Event filter name:']
name = 'Objects with events matching the <event filter>'
description = "Matches objects who have events that match a certain"
" event filter"
category = 'General filters'
# we want to have this filter show event filters
namespace = 'Event'

View File

@ -20,13 +20,6 @@
# $Id$
#-------------------------------------------------------------------------
#
# Standard Python modules
#
#-------------------------------------------------------------------------
from gen.ggettext import gettext as _
#-------------------------------------------------------------------------
#
# GRAMPS modules
@ -49,10 +42,10 @@ class MatchesFilterBase(Rule):
"""
labels = [_('Filter name:')]
name = _('Objects matching the <filter>')
description = _("Matches objects matched by the specified filter name")
category = _('General filters')
labels = ['Filter name:']
name = 'Objects matching the <filter>'
description = "Matches objects matched by the specified filter name"
category = 'General filters'
def prepare(self, db):
if Filters.CustomFilters:

View File

@ -24,13 +24,6 @@
# $Id$
#
#-------------------------------------------------------------------------
#
# Standard Python modules
#
#-------------------------------------------------------------------------
from gen.ggettext import sgettext as _
#-------------------------------------------------------------------------
#
# GRAMPS modules
@ -45,10 +38,10 @@ from Filters.Rules._Rule import Rule
class MatchesSourceConfidenceBase(Rule):
"""Objects with a specific confidence level on 'direct' Source references"""
labels = [_('Confidence level:')]
name = _('Object with at least one direct source >= <confidence level>')
description = _("Matches objects with at least one direct source with confidence level(s)")
category = _('Citation/source filters')
labels = ['Confidence level:']
name = 'Object with at least one direct source >= <confidence level>'
description = "Matches objects with at least one direct source with confidence level(s)"
category = 'Citation/source filters'
def apply(self, db, obj):
required_conf = int(self.list[0])

View File

@ -21,13 +21,6 @@
# $Id$
#-------------------------------------------------------------------------
#
# Standard Python modules
#
#-------------------------------------------------------------------------
from gen.ggettext import gettext as _
#-------------------------------------------------------------------------
#
# GRAMPS modules
@ -45,11 +38,11 @@ class MatchesSourceFilterBase(MatchesFilterBase):
Rule that checks against another filter.
"""
labels = [_('Source filter name:')]
name = _('Objects with source matching the <source filter>')
description = _("Matches objects with sources that match the "
"specified source filter name")
category = _('Citation/source filters')
labels = ['Source filter name:']
name = 'Objects with source matching the <source filter>'
description = "Matches objects with sources that match the "
"specified source filter name"
category = 'Citation/source filters'
# we want to have this filter show source filters
namespace = 'Source'

View File

@ -25,7 +25,6 @@
# Standard Python modules
#
#-------------------------------------------------------------------------
from gen.ggettext import gettext as _
import re
#-------------------------------------------------------------------------
@ -45,11 +44,11 @@ class RegExpIdBase(Rule):
Rule that checks for an object whose GRAMPS ID matches regular expression.
"""
labels = [ _('Regular expression:') ]
name = _('Objects with <Id>')
description = _("Matches objects whose Gramps ID matches "
"the regular expression")
category = _('General filters')
labels = [ 'Regular expression:' ]
name = 'Objects with <Id>'
description = "Matches objects whose Gramps ID matches "
"the regular expression"
category = 'General filters'
def __init__(self, list):
Rule.__init__(self, list)