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

View File

@ -20,13 +20,6 @@
# $Id$ # $Id$
#-------------------------------------------------------------------------
#
# Standard Python modules
#
#-------------------------------------------------------------------------
from gen.ggettext import gettext as _
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
# #
# GRAMPS modules # GRAMPS modules
@ -45,11 +38,11 @@ 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>'
description = _("Matches objects with the given attribute " description = "Matches objects with the given attribute "
"of a particular value") "of a particular value"
category = _('General filters') category = 'General filters'
def apply(self, db, obj): def apply(self, db, obj):
if not self.list[0]: if not self.list[0]:

View File

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

View File

@ -20,13 +20,6 @@
# $Id$ # $Id$
#-------------------------------------------------------------------------
#
# Standard Python modules
#
#-------------------------------------------------------------------------
from gen.ggettext import gettext as _
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
# #
# GRAMPS modules # GRAMPS modules
@ -46,14 +39,14 @@ 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:',
_('Date:'), 'Date:',
_('Place:'), 'Place:',
_('Description:'), 'Description:',
_('Main Participants') ] 'Main Participants' ]
name = _('Events matching parameters') name = 'Events matching parameters'
description = _("Matches events with particular parameters") description = "Matches events with particular parameters"
category = _('Event filters') category = 'Event filters'
def prepare(self, db): def prepare(self, db):
self.date = None self.date = None

View File

@ -23,13 +23,6 @@
# $Id$ # $Id$
# #
#-------------------------------------------------------------------------
#
# Standard Python modules
#
#-------------------------------------------------------------------------
from gen.ggettext import gettext as _
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
# #
# GRAMPS modules # GRAMPS modules
@ -43,10 +36,10 @@ from Filters.Rules import Rule
class HasGalleryBase(Rule): class HasGalleryBase(Rule):
"""Objects who have Media Object""" """Objects who have Media Object"""
labels = [ _('Number of instances:'), _('Number must be:')] labels = [ 'Number of instances:', 'Number must be:']
name = _('Object with <count> Media references') name = 'Object with <count> Media references'
description = _("Matches objects with certain number of items in the gallery") description = "Matches objects with certain number of items in the gallery"
category = _('General filters') category = 'General filters'
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

View File

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

View File

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

View File

@ -23,13 +23,6 @@
# $Id$ # $Id$
#-------------------------------------------------------------------------
#
# Standard Python modules
#
#-------------------------------------------------------------------------
from gen.ggettext import gettext as _
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
# #
# GRAMPS modules # GRAMPS modules
@ -43,11 +36,11 @@ from Filters.Rules._Rule import Rule
class HasSourceCountBase(Rule): class HasSourceCountBase(Rule):
"""Objects having sources""" """Objects having sources"""
labels = [ _('Number of instances:'), _('Number must be:')] labels = [ 'Number of instances:', 'Number must be:']
name = _('Objects with <count> sources') name = 'Objects with <count> sources'
description = _("Matches objects that have a certain number of sources " description = "Matches objects that have a certain number of sources "
"connected to it (actually citations are counted)") "connected to it (actually citations are counted)"
category = _('Citation/source filters') category = 'Citation/source filters'
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

View File

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

View File

@ -20,13 +20,6 @@
# $Id$ # $Id$
#-------------------------------------------------------------------------
#
# Standard Python modules
#
#-------------------------------------------------------------------------
from gen.ggettext import gettext as _
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
# #
# GRAMPS modules # GRAMPS modules
@ -40,13 +33,13 @@ from Filters.Rules import Rule
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:',
_('Regular-Expression matching:')] 'Regular-Expression matching:']
name = _('Objects with records containing <substring>') name = 'Objects with records containing <substring>'
description = _("Matches objects whose records contain text " description = "Matches objects whose records contain text "
"matching a substring") "matching a substring"
category = _('General filters') category = 'General filters'
# FIXME: This needs to be written for an arbitrary object # FIXME: This needs to be written for an arbitrary object
# if possible # if possible

View File

@ -20,13 +20,6 @@
# $Id$ # $Id$
#-------------------------------------------------------------------------
#
# Standard Python modules
#
#-------------------------------------------------------------------------
from gen.ggettext import gettext as _
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
# #
# GRAMPS modules # GRAMPS modules
@ -40,9 +33,9 @@ from Filters.Rules import Rule
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"
category = _('General filters') category = 'General filters'
def apply(self, db, obj): def apply(self, db, obj):
return obj.get_privacy() return obj.get_privacy()

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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