From 08581e7ca83217792b0f142c4fe02f76807d292d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Rapinat?= Date: Sun, 1 Apr 2012 06:58:00 +0000 Subject: [PATCH] 5621: do not need to call gettext if strings are not used and displayed (TODO: check strings used on sidebar filters) svn: r19193 --- src/Filters/Rules/_ChangedSinceBase.py | 13 ++++++------- src/Filters/Rules/_HasLDSBase.py | 15 ++++----------- src/Filters/Rules/_HasNoteBase.py | 15 ++++----------- src/Filters/Rules/_HasNoteRegexBase.py | 11 +++++------ src/Filters/Rules/_HasNoteSubstrBase.py | 17 +++++------------ src/Filters/Rules/_HasReferenceCountBase.py | 15 ++++----------- 6 files changed, 28 insertions(+), 58 deletions(-) diff --git a/src/Filters/Rules/_ChangedSinceBase.py b/src/Filters/Rules/_ChangedSinceBase.py index 78251df13..05ce6dec3 100644 --- a/src/Filters/Rules/_ChangedSinceBase.py +++ b/src/Filters/Rules/_ChangedSinceBase.py @@ -26,7 +26,6 @@ # Standard Python modules # #------------------------------------------------------------------------- -from gen.ggettext import gettext as _ import re import time @@ -47,12 +46,12 @@ class ChangedSinceBase(Rule): Rule that checks for primary objects changed since a specific time. """ - labels = [ _('Changed after:'), _('but before:') ] - name = _('Objects changed after ') - description = _("Matches object records changed after a specified " - "date/time (yyyy-mm-dd hh:mm:ss) or in range, if a second " - "date/time is given.") - category = _('General filters') + labels = [ 'Changed after:', 'but before:' ] + name = 'Objects changed after ' + description = "Matches object records changed after a specified " \ + "date/time (yyyy-mm-dd hh:mm:ss) or in range, if a second " \ + "date/time is given." + category = 'General filters' def add_time(self, date): if re.search("\d.*\s+\d{1,2}:\d{2}:\d{2}", date): diff --git a/src/Filters/Rules/_HasLDSBase.py b/src/Filters/Rules/_HasLDSBase.py index e827290a6..38c324b78 100755 --- a/src/Filters/Rules/_HasLDSBase.py +++ b/src/Filters/Rules/_HasLDSBase.py @@ -23,13 +23,6 @@ # $Id$ # -#------------------------------------------------------------------------- -# -# Standard Python modules -# -#------------------------------------------------------------------------- -from gen.ggettext import gettext as _ - #------------------------------------------------------------------------- # # GRAMPS modules @@ -46,10 +39,10 @@ from Filters.Rules import Rule class HasLDSBase(Rule): """Rule that checks for object with a LDS event""" - labels = [ _('Number of instances:'), _('Number must be:')] - name = _('Objects with LDS events') - description = _("Matches objects with LDS events") - category = _('General filters') + labels = [ 'Number of instances:', 'Number must be:'] + name = 'Objects with LDS events' + description = "Matches objects with LDS events" + category = 'General filters' def prepare(self, db): # things we want to do just once, not for every handle diff --git a/src/Filters/Rules/_HasNoteBase.py b/src/Filters/Rules/_HasNoteBase.py index a7a7353fe..6c9a9f99a 100755 --- a/src/Filters/Rules/_HasNoteBase.py +++ b/src/Filters/Rules/_HasNoteBase.py @@ -24,13 +24,6 @@ # $Id$ # -#------------------------------------------------------------------------- -# -# Standard Python modules -# -#------------------------------------------------------------------------- -from gen.ggettext import gettext as _ - #------------------------------------------------------------------------- # # GRAMPS modules @@ -44,10 +37,10 @@ from Filters.Rules._Rule import Rule class HasNoteBase(Rule): """Objects having notes""" - labels = [ _('Number of instances:'), _('Number must be:')] - name = _('Object with notes') - description = _("Matches objects that have a certain number of notes") - category = _('General filters') + labels = [ 'Number of instances:', 'Number must be:'] + name = 'Object with notes' + description = "Matches objects that have a certain number of notes" + category = 'General filters' def __init__(self, arg): # Upgrade from pre 3.1 HasNote filter, use defaults that correspond diff --git a/src/Filters/Rules/_HasNoteRegexBase.py b/src/Filters/Rules/_HasNoteRegexBase.py index 3f19b05df..a3d1b2fc8 100644 --- a/src/Filters/Rules/_HasNoteRegexBase.py +++ b/src/Filters/Rules/_HasNoteRegexBase.py @@ -26,7 +26,6 @@ # #------------------------------------------------------------------------- import re -from gen.ggettext import gettext as _ #------------------------------------------------------------------------- # @@ -41,11 +40,11 @@ from Filters.Rules import Rule class HasNoteRegexBase(Rule): """People having notes containing .""" - labels = [ _('Regular expression:')] - name = _('Objects having notes containing ') - description = _("Matches objects whose notes contain text " - "matching a regular expression") - category = _('General filters') + labels = [ 'Regular expression:'] + name = 'Objects having notes containing ' + description = "Matches objects whose notes contain text " \ + "matching a regular expression" + category = 'General filters' def __init__(self, list): Rule.__init__(self, list) diff --git a/src/Filters/Rules/_HasNoteSubstrBase.py b/src/Filters/Rules/_HasNoteSubstrBase.py index 603d17e65..678258868 100644 --- a/src/Filters/Rules/_HasNoteSubstrBase.py +++ b/src/Filters/Rules/_HasNoteSubstrBase.py @@ -20,13 +20,6 @@ # $Id$ -#------------------------------------------------------------------------- -# -# Standard Python modules -# -#------------------------------------------------------------------------- -from gen.ggettext import gettext as _ - #------------------------------------------------------------------------- # # GRAMPS modules @@ -40,11 +33,11 @@ from Filters.Rules import Rule class HasNoteSubstrBase(Rule): """People having notes containing .""" - labels = [ _('Substring:')] - name = _('Objects having notes containing ') - description = _("Matches objects whose notes contain text matching a " - "substring") - category = _('General filters') + labels = [ 'Substring:'] + name = 'Objects having notes containing ' + description = "Matches objects whose notes contain text matching a " \ + "substring" + category = 'General filters' def apply(self, db, person): notelist = person.get_note_list() diff --git a/src/Filters/Rules/_HasReferenceCountBase.py b/src/Filters/Rules/_HasReferenceCountBase.py index 1553dc747..99a60a10c 100644 --- a/src/Filters/Rules/_HasReferenceCountBase.py +++ b/src/Filters/Rules/_HasReferenceCountBase.py @@ -20,13 +20,6 @@ # $Id$ -#------------------------------------------------------------------------- -# -# Standard Python modules -# -#------------------------------------------------------------------------- -from gen.ggettext import gettext as _ - #------------------------------------------------------------------------- # # GRAMPS modules @@ -40,10 +33,10 @@ from Filters.Rules import Rule class HasReferenceCountBase(Rule): """Objects with a reference count of .""" - labels = [ _('Reference count must be:'), _('Reference count:')] - name = _('Objects with a reference count of ') - description = _("Matches objects with a certain reference count") - category = _('General filters') + labels = [ 'Reference count must be:', 'Reference count:'] + name = 'Objects with a reference count of ' + description = "Matches objects with a certain reference count" + category = 'General filters' def prepare(self, db):