From df071b9009f0ef2a4208f2d67eb8c03606e69b24 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Rapinat?= Date: Thu, 29 Mar 2012 07:13:06 +0000 Subject: [PATCH] 5621: do not need to call gettext if strings are not used and displayed svn: r19169 --- src/Filters/Rules/_Everything.py | 13 +++-------- src/Filters/Rules/_HasAttributeBase.py | 17 ++++---------- src/Filters/Rules/_HasCitationBase.py | 19 +++++---------- src/Filters/Rules/_HasEventBase.py | 23 +++++++------------ src/Filters/Rules/_HasGalleryBase.py | 15 ++++-------- src/Filters/Rules/_HasGrampsId.py | 15 ++++-------- src/Filters/Rules/_HasSourceBase.py | 21 ++++++----------- src/Filters/Rules/_HasSourceCountBase.py | 17 ++++---------- src/Filters/Rules/_HasTagBase.py | 15 ++++-------- .../Rules/_HasTextMatchingSubstringOf.py | 21 ++++++----------- src/Filters/Rules/_IsPrivate.py | 13 +++-------- src/Filters/Rules/_IsPublic.py | 13 +++-------- src/Filters/Rules/_MatchesEventFilterBase.py | 17 ++++---------- src/Filters/Rules/_MatchesFilterBase.py | 15 ++++-------- .../Rules/_MatchesSourceConfidenceBase.py | 15 ++++-------- src/Filters/Rules/_MatchesSourceFilterBase.py | 17 ++++---------- src/Filters/Rules/_RegExpIdBase.py | 11 ++++----- 17 files changed, 82 insertions(+), 195 deletions(-) diff --git a/src/Filters/Rules/_Everything.py b/src/Filters/Rules/_Everything.py index 155abe1e2..44efb105f 100644 --- a/src/Filters/Rules/_Everything.py +++ b/src/Filters/Rules/_Everything.py @@ -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 diff --git a/src/Filters/Rules/_HasAttributeBase.py b/src/Filters/Rules/_HasAttributeBase.py index 51893d0a0..1b0e70615 100644 --- a/src/Filters/Rules/_HasAttributeBase.py +++ b/src/Filters/Rules/_HasAttributeBase.py @@ -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 ') - description = _("Matches objects with the given attribute " - "of a particular value") - category = _('General filters') + labels = [ 'Attribute:', 'Value:' ] + name = 'Objects with the ' + description = "Matches objects with the given attribute " + "of a particular value" + category = 'General filters' def apply(self, db, obj): if not self.list[0]: diff --git a/src/Filters/Rules/_HasCitationBase.py b/src/Filters/Rules/_HasCitationBase.py index 779984541..e850cbff5 100644 --- a/src/Filters/Rules/_HasCitationBase.py +++ b/src/Filters/Rules/_HasCitationBase.py @@ -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 diff --git a/src/Filters/Rules/_HasEventBase.py b/src/Filters/Rules/_HasEventBase.py index 624b71d77..7bf10101b 100644 --- a/src/Filters/Rules/_HasEventBase.py +++ b/src/Filters/Rules/_HasEventBase.py @@ -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 diff --git a/src/Filters/Rules/_HasGalleryBase.py b/src/Filters/Rules/_HasGalleryBase.py index 332f01eff..1901fd2da 100755 --- a/src/Filters/Rules/_HasGalleryBase.py +++ b/src/Filters/Rules/_HasGalleryBase.py @@ -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 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 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 diff --git a/src/Filters/Rules/_HasGrampsId.py b/src/Filters/Rules/_HasGrampsId.py index 7eed1ed3c..bb5935367 100644 --- a/src/Filters/Rules/_HasGrampsId.py +++ b/src/Filters/Rules/_HasGrampsId.py @@ -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 ') - description = _("Matches objects with a specified Gramps ID") - category = _('General filters') + labels = [ 'ID:' ] + name = 'Object with ' + description = "Matches objects with a specified Gramps ID" + category = 'General filters' def apply(self, db, obj): """ diff --git a/src/Filters/Rules/_HasSourceBase.py b/src/Filters/Rules/_HasSourceBase.py index aa663bd1e..4c9b2ce42 100644 --- a/src/Filters/Rules/_HasSourceBase.py +++ b/src/Filters/Rules/_HasSourceBase.py @@ -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()): diff --git a/src/Filters/Rules/_HasSourceCountBase.py b/src/Filters/Rules/_HasSourceCountBase.py index 2aecdb501..508103129 100755 --- a/src/Filters/Rules/_HasSourceCountBase.py +++ b/src/Filters/Rules/_HasSourceCountBase.py @@ -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 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 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 diff --git a/src/Filters/Rules/_HasTagBase.py b/src/Filters/Rules/_HasTagBase.py index 18ed9e569..cc91237b2 100644 --- a/src/Filters/Rules/_HasTagBase.py +++ b/src/Filters/Rules/_HasTagBase.py @@ -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 ') - description = _("Matches objects with the given tag") - category = _('General filters') + labels = [ 'Tag:' ] + name = 'Objects with the ' + description = "Matches objects with the given tag" + category = 'General filters' def prepare(self, db): """ diff --git a/src/Filters/Rules/_HasTextMatchingSubstringOf.py b/src/Filters/Rules/_HasTextMatchingSubstringOf.py index c34eabafb..d179f1356 100644 --- a/src/Filters/Rules/_HasTextMatchingSubstringOf.py +++ b/src/Filters/Rules/_HasTextMatchingSubstringOf.py @@ -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 ') - 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 ' + 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 diff --git a/src/Filters/Rules/_IsPrivate.py b/src/Filters/Rules/_IsPrivate.py index 345fe5c6a..846b20034 100644 --- a/src/Filters/Rules/_IsPrivate.py +++ b/src/Filters/Rules/_IsPrivate.py @@ -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() diff --git a/src/Filters/Rules/_IsPublic.py b/src/Filters/Rules/_IsPublic.py index 9ca9c24f8..625704864 100644 --- a/src/Filters/Rules/_IsPublic.py +++ b/src/Filters/Rules/_IsPublic.py @@ -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() diff --git a/src/Filters/Rules/_MatchesEventFilterBase.py b/src/Filters/Rules/_MatchesEventFilterBase.py index 0911a913b..c9c364feb 100644 --- a/src/Filters/Rules/_MatchesEventFilterBase.py +++ b/src/Filters/Rules/_MatchesEventFilterBase.py @@ -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 ') - 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 ' + 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' diff --git a/src/Filters/Rules/_MatchesFilterBase.py b/src/Filters/Rules/_MatchesFilterBase.py index 4c4c06d29..ca9207ddf 100644 --- a/src/Filters/Rules/_MatchesFilterBase.py +++ b/src/Filters/Rules/_MatchesFilterBase.py @@ -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 ') - description = _("Matches objects matched by the specified filter name") - category = _('General filters') + labels = ['Filter name:'] + name = 'Objects matching the ' + description = "Matches objects matched by the specified filter name" + category = 'General filters' def prepare(self, db): if Filters.CustomFilters: diff --git a/src/Filters/Rules/_MatchesSourceConfidenceBase.py b/src/Filters/Rules/_MatchesSourceConfidenceBase.py index 1673d6773..70d2b10da 100644 --- a/src/Filters/Rules/_MatchesSourceConfidenceBase.py +++ b/src/Filters/Rules/_MatchesSourceConfidenceBase.py @@ -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 >= ') - 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 >= ' + 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]) diff --git a/src/Filters/Rules/_MatchesSourceFilterBase.py b/src/Filters/Rules/_MatchesSourceFilterBase.py index 1f482b212..16d5d306c 100644 --- a/src/Filters/Rules/_MatchesSourceFilterBase.py +++ b/src/Filters/Rules/_MatchesSourceFilterBase.py @@ -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 ') - 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 ' + 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' diff --git a/src/Filters/Rules/_RegExpIdBase.py b/src/Filters/Rules/_RegExpIdBase.py index 9156dc7bf..50315fbc4 100644 --- a/src/Filters/Rules/_RegExpIdBase.py +++ b/src/Filters/Rules/_RegExpIdBase.py @@ -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 ') - description = _("Matches objects whose Gramps ID matches " - "the regular expression") - category = _('General filters') + labels = [ 'Regular expression:' ] + name = 'Objects with ' + description = "Matches objects whose Gramps ID matches " + "the regular expression" + category = 'General filters' def __init__(self, list): Rule.__init__(self, list)