2006-08-03 Alex Roitman <shura@gramps-project.org>
* src/Filters/Rules/Person/_HasIdOf.py: Cleanup. * src/Filters/Rules/Person/__init__.py (editor_rule_list): Add RegExpIdOf. * src/Filters/Rules/Person/_RegExpIdOf.py: Cleanup. * src/Filters/Rules/_RegExpIdBase.py: Cleanup. * src/Filters/Rules/Person/_HasRelationship.py: Cleanup. * src/Filters/Rules/Family/_HasIdOf.py: Cleanup. * src/Filters/Rules/Family/_RegExpIdOf.py: Cleanup. * src/FilterEditor/_EditRule.py: Clean, localization fixes, ID selection fixes. * src/NameDisplay.py: Import gettext. * src/Filters/Rules/Family/_HasRelType.py (labels): Use lowercase. * src/FilterEditor/_EditFilter.py (on_add_clicked, on_edit_clicked): Catch exception. svn: r7115
This commit is contained in:
16
ChangeLog
16
ChangeLog
@@ -1,3 +1,19 @@
|
|||||||
|
2006-08-03 Alex Roitman <shura@gramps-project.org>
|
||||||
|
* src/Filters/Rules/Person/_HasIdOf.py: Cleanup.
|
||||||
|
* src/Filters/Rules/Person/__init__.py (editor_rule_list): Add
|
||||||
|
RegExpIdOf.
|
||||||
|
* src/Filters/Rules/Person/_RegExpIdOf.py: Cleanup.
|
||||||
|
* src/Filters/Rules/_RegExpIdBase.py: Cleanup.
|
||||||
|
* src/Filters/Rules/Person/_HasRelationship.py: Cleanup.
|
||||||
|
* src/Filters/Rules/Family/_HasIdOf.py: Cleanup.
|
||||||
|
* src/Filters/Rules/Family/_RegExpIdOf.py: Cleanup.
|
||||||
|
* src/FilterEditor/_EditRule.py: Clean, localization fixes, ID
|
||||||
|
selection fixes.
|
||||||
|
* src/NameDisplay.py: Import gettext.
|
||||||
|
* src/Filters/Rules/Family/_HasRelType.py (labels): Use lowercase.
|
||||||
|
* src/FilterEditor/_EditFilter.py (on_add_clicked,
|
||||||
|
on_edit_clicked): Catch exception.
|
||||||
|
|
||||||
2006-08-03 Zsolt Foldvari <zfoldvar@users.sourceforge.net>
|
2006-08-03 Zsolt Foldvari <zfoldvar@users.sourceforge.net>
|
||||||
* src/plugins/Check.py (cleanup_deleted_name_formats): Change hardcoded
|
* src/plugins/Check.py (cleanup_deleted_name_formats): Change hardcoded
|
||||||
values with constants.
|
values with constants.
|
||||||
|
@@ -50,6 +50,7 @@ import const
|
|||||||
import ListModel
|
import ListModel
|
||||||
import ManagedWindow
|
import ManagedWindow
|
||||||
import GrampsDisplay
|
import GrampsDisplay
|
||||||
|
import Errors
|
||||||
|
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
@@ -165,8 +166,11 @@ class EditFilter(ManagedWindow.ManagedWindow):
|
|||||||
def on_add_clicked(self,obj):
|
def on_add_clicked(self,obj):
|
||||||
from _EditRule import EditRule
|
from _EditRule import EditRule
|
||||||
|
|
||||||
EditRule(self.space, self.dbstate, self.uistate, self.track,
|
try:
|
||||||
self.filterdb, None, _('Add Rule'), self.update_rule)
|
EditRule(self.space, self.dbstate, self.uistate, self.track,
|
||||||
|
self.filterdb, None, _('Add Rule'), self.update_rule)
|
||||||
|
except Errors.WindowActiveError:
|
||||||
|
pass
|
||||||
|
|
||||||
def on_edit_clicked(self,obj):
|
def on_edit_clicked(self,obj):
|
||||||
store, node = self.rlist.get_selected()
|
store, node = self.rlist.get_selected()
|
||||||
@@ -175,8 +179,11 @@ class EditFilter(ManagedWindow.ManagedWindow):
|
|||||||
|
|
||||||
d = self.rlist.get_object(node)
|
d = self.rlist.get_object(node)
|
||||||
|
|
||||||
EditRule(self.space, self.dbstate, self.uistate, self.track,
|
try:
|
||||||
self.filterdb, d, _('Edit Rule'), self.update_rule)
|
EditRule(self.space, self.dbstate, self.uistate, self.track,
|
||||||
|
self.filterdb, d, _('Edit Rule'), self.update_rule)
|
||||||
|
except Errors.WindowActiveError:
|
||||||
|
pass
|
||||||
|
|
||||||
def update_rule(self, old_rule, new_rule):
|
def update_rule(self, old_rule, new_rule):
|
||||||
if old_rule:
|
if old_rule:
|
||||||
|
@@ -48,19 +48,20 @@ log = logging.getLogger(".FilterEdit")
|
|||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
import gtk
|
import gtk
|
||||||
import gobject
|
import gobject
|
||||||
import GrampsDisplay
|
|
||||||
|
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
# GRAMPS modules
|
# GRAMPS modules
|
||||||
#
|
#
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
|
import GrampsDisplay
|
||||||
import const
|
import const
|
||||||
import RelLib
|
import RelLib
|
||||||
from Filters import Rules
|
from Filters import Rules
|
||||||
import AutoComp
|
import AutoComp
|
||||||
from Selectors import selector_factory
|
from Selectors import selector_factory
|
||||||
SelectPerson = selector_factory('Person')
|
from NameDisplay import displayer as _nd
|
||||||
|
import Utils
|
||||||
import ManagedWindow
|
import ManagedWindow
|
||||||
|
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
@@ -76,17 +77,14 @@ def by_rule_name(f,s):
|
|||||||
# Constants
|
# Constants
|
||||||
#
|
#
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
_name2list = {
|
_name2typeclass = {
|
||||||
_('Personal event:') : RelLib.EventType().get_map(),
|
_('Personal event:') : RelLib.EventType,
|
||||||
_('Family event:') : RelLib.EventType().get_map(),
|
_('Family event:') : RelLib.EventType,
|
||||||
_('Personal attribute:') : RelLib.AttributeType().get_map(),
|
_('Personal attribute:') : RelLib.AttributeType,
|
||||||
_('Family attribute:') : RelLib.AttributeType().get_map(),
|
_('Family attribute:') : RelLib.AttributeType,
|
||||||
|
_('Relationship type:') : RelLib.FamilyRelType,
|
||||||
}
|
}
|
||||||
|
|
||||||
_menulist = {
|
|
||||||
_('Relationship type:') : RelLib.FamilyRelType().get_map(),
|
|
||||||
}
|
|
||||||
|
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
# MyBoolean - check button with standard interface
|
# MyBoolean - check button with standard interface
|
||||||
@@ -99,10 +97,19 @@ class MyBoolean(gtk.CheckButton):
|
|||||||
self.show()
|
self.show()
|
||||||
|
|
||||||
def get_text(self):
|
def get_text(self):
|
||||||
|
"""
|
||||||
|
This method returns the text to save. 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
|
||||||
|
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):
|
||||||
is_active = not not int(val)
|
"""
|
||||||
|
This method sets the selector state to display the passed value.
|
||||||
|
"""
|
||||||
|
is_active = bool(int(val))
|
||||||
self.set_active(is_active)
|
self.set_active(is_active)
|
||||||
|
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
@@ -210,14 +217,25 @@ class MyPlaces(gtk.Entry):
|
|||||||
#
|
#
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
class MyID(gtk.HBox):
|
class MyID(gtk.HBox):
|
||||||
|
|
||||||
|
obj_name = {
|
||||||
|
'Person' : _('Person'),
|
||||||
|
'Family' : _('Family'),
|
||||||
|
'Event' : _('Event'),
|
||||||
|
'Place' : _('Place'),
|
||||||
|
'Source' : _('Source'),
|
||||||
|
'MediaObject' : _('Media Object'),
|
||||||
|
'Repository' : _('Repository'),
|
||||||
|
}
|
||||||
|
|
||||||
def __init__(self, dbstate, uistate, track):
|
def __init__(self, dbstate, uistate, track, obj_class='Person'):
|
||||||
gtk.HBox.__init__(self,False,6)
|
gtk.HBox.__init__(self,False,6)
|
||||||
self.dbstate = dbstate
|
self.dbstate = dbstate
|
||||||
self.db = dbstate.db
|
self.db = dbstate.db
|
||||||
self.uistate = uistate
|
self.uistate = uistate
|
||||||
self.track = track
|
self.track = track
|
||||||
|
|
||||||
|
self.obj_class = obj_class
|
||||||
self.entry = gtk.Entry()
|
self.entry = gtk.Entry()
|
||||||
self.entry.show()
|
self.entry.show()
|
||||||
self.button = gtk.Button()
|
self.button = gtk.Button()
|
||||||
@@ -227,14 +245,15 @@ class MyID(gtk.HBox):
|
|||||||
self.pack_start(self.entry)
|
self.pack_start(self.entry)
|
||||||
self.add(self.button)
|
self.add(self.button)
|
||||||
self.tooltips = gtk.Tooltips()
|
self.tooltips = gtk.Tooltips()
|
||||||
self.tooltips.set_tip(self.button,_('Select person from a list'))
|
self.tooltips.set_tip(self.button,_('Select %s from a list')
|
||||||
|
% self.obj_name[obj_class])
|
||||||
self.tooltips.enable()
|
self.tooltips.enable()
|
||||||
self.show()
|
self.show()
|
||||||
self.set_text('')
|
self.set_text('')
|
||||||
|
|
||||||
def button_press(self,obj):
|
def button_press(self,obj):
|
||||||
inst = SelectPerson(self.dbstate, self.uistate, self.track,
|
selector = selector_factory(self.obj_class)
|
||||||
_('Select Person'))
|
inst = selector(self.dbstate, self.uistate, self.track)
|
||||||
val = inst.run()
|
val = inst.run()
|
||||||
if val == None:
|
if val == None:
|
||||||
self.set_text('')
|
self.set_text('')
|
||||||
@@ -244,13 +263,37 @@ class MyID(gtk.HBox):
|
|||||||
def get_text(self):
|
def get_text(self):
|
||||||
return unicode(self.entry.get_text())
|
return unicode(self.entry.get_text())
|
||||||
|
|
||||||
|
def name_from_gramps_id(self,gramps_id):
|
||||||
|
if self.obj_class == 'Person':
|
||||||
|
person = self.db.get_person_from_gramps_id(gramps_id)
|
||||||
|
print gramps_id
|
||||||
|
name = _nd.display_name(person.get_primary_name())
|
||||||
|
elif self.obj_class == 'Family':
|
||||||
|
family = self.db.get_family_from_gramps_id(gramps_id)
|
||||||
|
name = Utils.family_name(family, self.db)
|
||||||
|
elif self.obj_class == 'Event':
|
||||||
|
event = self.db.get_event_from_gramps_id(gramps_id)
|
||||||
|
name = str(event.get_type)
|
||||||
|
elif self.obj_class == 'Place':
|
||||||
|
place = self.db.get_place_from_gramps_id(gramps_id)
|
||||||
|
name = place.get_title()
|
||||||
|
elif self.obj_class == 'Source':
|
||||||
|
source = self.db.get_source_from_gramps_id(gramps_id)
|
||||||
|
name = source.get_title()
|
||||||
|
elif self.obj_class == 'MediaObject':
|
||||||
|
obj = self.db.get_object_from_gramps_id(gramps_id)
|
||||||
|
name = obj.get_path()
|
||||||
|
elif self.obj_class == 'Repository':
|
||||||
|
repo = self.db.get_repository_from_gramps_id(gramps_id)
|
||||||
|
name = repo.get_name()
|
||||||
|
return name
|
||||||
|
|
||||||
def set_text(self,val):
|
def set_text(self,val):
|
||||||
try:
|
try:
|
||||||
p = self.db.get_person_from_handle(val)
|
name = self.name_from_gramps_id(val)
|
||||||
n = p.get_primary_name().get_name()
|
self.tooltips.set_tip(self.entry,name)
|
||||||
self.tooltips.set_tip(self.entry,n)
|
except AttributeError:
|
||||||
except:
|
self.tooltips.set_tip(self.entry,_('Not a valid ID'))
|
||||||
self.tooltips.set_tip(self.entry,_('Not a valid person'))
|
|
||||||
self.entry.set_text(val)
|
self.entry.set_text(val)
|
||||||
|
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
@@ -260,48 +303,21 @@ class MyID(gtk.HBox):
|
|||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
class MySelect(gtk.ComboBoxEntry):
|
class MySelect(gtk.ComboBoxEntry):
|
||||||
|
|
||||||
def __init__(self, values):
|
def __init__(self, type_class):
|
||||||
gtk.ComboBoxEntry.__init__(self)
|
gtk.ComboBoxEntry.__init__(self)
|
||||||
AutoComp.fill_combo(self, values)
|
self.type_class = type_class
|
||||||
|
self.sel = AutoComp.StandardCustomSelector(type_class._I2SMAP, self,
|
||||||
|
type_class._CUSTOM,
|
||||||
|
type_class._DEFAULT)
|
||||||
self.show()
|
self.show()
|
||||||
|
|
||||||
def get_text(self):
|
def get_text(self):
|
||||||
return unicode(self.child.get_text())
|
return self.type_class(self.sel.get_values()).xml_str()
|
||||||
|
|
||||||
def set_text(self,val):
|
def set_text(self,val):
|
||||||
self.child.set_text(_(val))
|
tc = self.type_class()
|
||||||
|
tc.set_from_xml_str(val)
|
||||||
#-------------------------------------------------------------------------
|
self.sel.set_values((tc.val,tc.string))
|
||||||
#
|
|
||||||
#
|
|
||||||
#
|
|
||||||
#-------------------------------------------------------------------------
|
|
||||||
class MyListSelect(gtk.ComboBox):
|
|
||||||
|
|
||||||
def __init__(self,data_list):
|
|
||||||
gtk.ComboBox.__init__(self)
|
|
||||||
store = gtk.ListStore(str)
|
|
||||||
self.set_model(store)
|
|
||||||
cell = gtk.CellRendererText()
|
|
||||||
self.pack_start(cell,True)
|
|
||||||
self.add_attribute(cell,'text',0)
|
|
||||||
self.data_list = data_list
|
|
||||||
|
|
||||||
for item in data_list:
|
|
||||||
store.append(row=[item])
|
|
||||||
self.set_active(0)
|
|
||||||
self.show()
|
|
||||||
|
|
||||||
def get_text(self):
|
|
||||||
active = self.get_active()
|
|
||||||
if active < 0:
|
|
||||||
return str(-1)
|
|
||||||
return str(active)
|
|
||||||
|
|
||||||
def set_text(self,val):
|
|
||||||
active = int(val)
|
|
||||||
if active >=0:
|
|
||||||
self.set_active(active)
|
|
||||||
|
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
@@ -379,26 +395,23 @@ class EditRule(ManagedWindow.ManagedWindow):
|
|||||||
table.set_row_spacings(6)
|
table.set_row_spacings(6)
|
||||||
table.show()
|
table.show()
|
||||||
for v in arglist:
|
for v in arglist:
|
||||||
v1 = _(v)
|
l = gtk.Label(v)
|
||||||
l = gtk.Label(v1)
|
|
||||||
l.set_alignment(1,0.5)
|
l.set_alignment(1,0.5)
|
||||||
l.show()
|
l.show()
|
||||||
if v == _('Place:'):
|
if v == _('Place:'):
|
||||||
t = MyPlaces([])
|
t = MyPlaces([])
|
||||||
elif v == _('Number of generations:'):
|
elif v == _('Number of generations:'):
|
||||||
t = MyInteger(1,32)
|
t = MyInteger(1,32)
|
||||||
elif v == _('ID:'):
|
elif v == _('Person ID:'):
|
||||||
t = MyID(self.dbstate, self.uistate, self.track)
|
t = MyID(self.dbstate, self.uistate, self.track, 'Person')
|
||||||
|
elif v == _('Family ID:'):
|
||||||
|
t = MyID(self.dbstate, self.uistate, self.track, 'Family')
|
||||||
elif v == _('Source ID:'):
|
elif v == _('Source ID:'):
|
||||||
t = MySource(self.db)
|
t = MySource(self.db)
|
||||||
elif v == _('Filter name:'):
|
elif v == _('Filter name:'):
|
||||||
t = MyFilters(self.filterdb.get_filters(self.space))
|
t = MyFilters(self.filterdb.get_filters(self.space))
|
||||||
elif _name2list.has_key(v1):
|
elif _name2typeclass.has_key(v):
|
||||||
data =_name2list[v1]
|
t = MySelect(_name2typeclass[v])
|
||||||
t = MySelect(data.values())
|
|
||||||
elif _menulist.has_key(v1):
|
|
||||||
data =_menulist[v1]
|
|
||||||
t = MyListSelect(data.values())
|
|
||||||
elif v == _('Inclusive:'):
|
elif v == _('Inclusive:'):
|
||||||
t = MyBoolean(_('Include original person'))
|
t = MyBoolean(_('Include original person'))
|
||||||
elif v == _('Case sensitive:'):
|
elif v == _('Case sensitive:'):
|
||||||
@@ -516,8 +529,8 @@ class EditRule(ManagedWindow.ManagedWindow):
|
|||||||
page = self.notebook.get_current_page()
|
page = self.notebook.get_current_page()
|
||||||
(class_obj,vallist,tlist) = self.page[page]
|
(class_obj,vallist,tlist) = self.page[page]
|
||||||
value_list = []
|
value_list = []
|
||||||
for x in tlist:
|
for selector_class in tlist:
|
||||||
value_list.append(unicode(x.get_text()))
|
value_list.append(unicode(selector_class.get_text()))
|
||||||
new_rule = class_obj(value_list)
|
new_rule = class_obj(value_list)
|
||||||
|
|
||||||
self.update_rule(self.active_rule, new_rule)
|
self.update_rule(self.active_rule, new_rule)
|
||||||
|
@@ -40,10 +40,8 @@ from Filters.Rules import HasGrampsId
|
|||||||
#
|
#
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
class HasIdOf(HasGrampsId):
|
class HasIdOf(HasGrampsId):
|
||||||
"""Rule that checks for a person with a specific GRAMPS ID"""
|
"""Rule that checks for a family with a specific GRAMPS ID"""
|
||||||
|
|
||||||
labels = [ _('ID:') ]
|
labels = [ _('Family ID:') ]
|
||||||
name = _('Family with <Id>')
|
name = _('Family with <Id>')
|
||||||
description = _("Matches a family with a specified GRAMPS ID")
|
description = _("Matches a family with a specified GRAMPS ID")
|
||||||
category = _('General filters')
|
|
||||||
|
|
||||||
|
@@ -42,7 +42,7 @@ from Filters.Rules._Rule import Rule
|
|||||||
class HasRelType(Rule):
|
class HasRelType(Rule):
|
||||||
"""Rule that checks for a person with a particular personal attribute"""
|
"""Rule that checks for a person with a particular personal attribute"""
|
||||||
|
|
||||||
labels = [ _('Relationship Type:') ]
|
labels = [ _('Relationship type:') ]
|
||||||
name = _('Family with the relationship type')
|
name = _('Family with the relationship type')
|
||||||
description = _("Matches family with the relationship type "
|
description = _("Matches family with the relationship type "
|
||||||
"of a particular value")
|
"of a particular value")
|
||||||
|
@@ -26,7 +26,6 @@
|
|||||||
#
|
#
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
from gettext import gettext as _
|
from gettext import gettext as _
|
||||||
import re
|
|
||||||
|
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
@@ -41,8 +40,11 @@ from Filters.Rules._RegExpIdBase import RegExpIdBase
|
|||||||
#
|
#
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
class RegExpIdOf(RegExpIdBase):
|
class RegExpIdOf(RegExpIdBase):
|
||||||
"""Rule that checks for a person with a specific GRAMPS ID"""
|
"""
|
||||||
|
Rule that checks for a family whose GRAMPS ID
|
||||||
name = _('Families with <Id>')
|
matches regular expression.
|
||||||
description = _("Matches families with a GRAMPS ID that contains the regular expression")
|
"""
|
||||||
|
|
||||||
|
name = _('Families with <Id> matching regular expression')
|
||||||
|
description = _("Matches families whose GRAMPS ID matches "
|
||||||
|
"the regular expression")
|
||||||
|
@@ -42,8 +42,6 @@ from Filters.Rules import HasGrampsId
|
|||||||
class HasIdOf(HasGrampsId):
|
class HasIdOf(HasGrampsId):
|
||||||
"""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 = [ _('Person ID:') ]
|
||||||
name = _('People with <Id>')
|
name = _('People with <Id>')
|
||||||
description = _("Matches people with a specified GRAMPS ID")
|
description = _("Matches people with a specified GRAMPS ID")
|
||||||
category = _('General filters')
|
|
||||||
|
|
||||||
|
@@ -26,35 +26,24 @@
|
|||||||
#
|
#
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
from gettext import gettext as _
|
from gettext import gettext as _
|
||||||
import re
|
|
||||||
|
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
# GRAMPS modules
|
# GRAMPS modules
|
||||||
#
|
#
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
from Filters.Rules._Rule import Rule
|
from Filters.Rules._RegExpIdBase import RegExpIdBase
|
||||||
|
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
# HasIdOf
|
# HasIdOf
|
||||||
#
|
#
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
class RegExpIdOf(Rule):
|
class RegExpIdOf(RegExpIdBase):
|
||||||
"""Rule that checks for a person with a specific GRAMPS ID"""
|
"""Rule that checks for a person whose GRAMPS ID
|
||||||
|
matches regular expression.
|
||||||
|
"""
|
||||||
|
|
||||||
labels = [ _('ID:') ]
|
name = _('People with <Id> matching regular expression')
|
||||||
name = _('People with <Id>')
|
description = _("Matches people whose GRAMPS ID matches "
|
||||||
description = _("Matches people with a GRAMPS ID that contains the regular expression")
|
"the regular expression")
|
||||||
category = _('General filters')
|
|
||||||
|
|
||||||
def __init__(self, list):
|
|
||||||
Rule.__init__(self, list)
|
|
||||||
|
|
||||||
try:
|
|
||||||
self.match = re.compile(list[0],re.I|re.U|re.L)
|
|
||||||
except:
|
|
||||||
self.match = re.compile('')
|
|
||||||
|
|
||||||
def apply(self,db,person):
|
|
||||||
return self.match.match(person.gramps_id) != None
|
|
||||||
|
@@ -151,6 +151,7 @@ editor_rule_list = [
|
|||||||
HasTextMatchingSubstringOf,
|
HasTextMatchingSubstringOf,
|
||||||
HasNote,
|
HasNote,
|
||||||
HasNoteRegexp,
|
HasNoteRegexp,
|
||||||
|
RegExpIdOf,
|
||||||
]
|
]
|
||||||
|
|
||||||
def register(rule):
|
def register(rule):
|
||||||
|
@@ -41,11 +41,15 @@ from _Rule import Rule
|
|||||||
#
|
#
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
class RegExpIdBase(Rule):
|
class RegExpIdBase(Rule):
|
||||||
"""Rule that checks for a person with a specific GRAMPS ID"""
|
"""
|
||||||
|
Rule that checks for an object whose GRAMPS ID
|
||||||
|
matches regular expression.
|
||||||
|
"""
|
||||||
|
|
||||||
labels = [ _('ID:') ]
|
labels = [ _('Regular expression:') ]
|
||||||
name = _('Families with <Id>')
|
name = _('Objects with <Id>')
|
||||||
description = _("Matches families with a GRAMPS ID that contains the regular expression")
|
description = _("Matches objects whose GRAMPS ID matches "
|
||||||
|
"the regular expression")
|
||||||
category = _('General filters')
|
category = _('General filters')
|
||||||
|
|
||||||
def __init__(self, list):
|
def __init__(self, list):
|
||||||
@@ -56,5 +60,5 @@ class RegExpIdBase(Rule):
|
|||||||
except:
|
except:
|
||||||
self.match = re.compile('')
|
self.match = re.compile('')
|
||||||
|
|
||||||
def apply(self,db,person):
|
def apply(self,db,obj):
|
||||||
return self.match.match(person.gramps_id) != None
|
return self.match.match(obj.gramps_id) != None
|
||||||
|
@@ -24,6 +24,13 @@
|
|||||||
Class handling language-specific displaying of names.
|
Class handling language-specific displaying of names.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
#-------------------------------------------------------------------------
|
||||||
|
#
|
||||||
|
# Python modules
|
||||||
|
#
|
||||||
|
#-------------------------------------------------------------------------
|
||||||
|
from gettext import gettext as _
|
||||||
|
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
# GRAMPS modules
|
# GRAMPS modules
|
||||||
|
Reference in New Issue
Block a user