2002-10-20 19:55:16 +05:30
|
|
|
#
|
|
|
|
# Gramps - a GTK+/GNOME based genealogy program
|
|
|
|
#
|
* src/gramps_main.py (tool_callback): Typo.
* src/QuestionDialog.py: Use gramps icon.
* src/plugins/EventCmp.py: HIG; single instance; help.
* src/plugins/eventcmp.glade: HIG; help.
* src/plugins/Desbrowser.py: HIG, help, rebuild model after edit.
* src/plugins/desbrowse.glade: help, info label.
* src/plugins/PatchNames.py: HIG, help, single instance.
* src/plugins/patchnames.glade: HIG, help.
* src/plugins/Merge.py: HIG, help, single instance.
* src/plugins/merge.glade: HIG, help.
* src/plugins/ChangeNames.py: HIG, help, single instance.
svn: r4230
2005-03-24 11:52:25 +05:30
|
|
|
# Copyright (C) 2000-2005 Donald N. Allingham
|
2002-10-20 19:55:16 +05:30
|
|
|
#
|
|
|
|
# This program is free software; you can redistribute it and/or modify
|
|
|
|
# it under the terms of the GNU General Public License as published by
|
|
|
|
# the Free Software Foundation; either version 2 of the License, or
|
|
|
|
# (at your option) any later version.
|
|
|
|
#
|
|
|
|
# This program is distributed in the hope that it will be useful,
|
|
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
# GNU General Public License for more details.
|
|
|
|
#
|
|
|
|
# You should have received a copy of the GNU General Public License
|
|
|
|
# along with this program; if not, write to the Free Software
|
|
|
|
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
|
|
#
|
|
|
|
|
2004-05-09 22:02:13 +05:30
|
|
|
# $Id$
|
|
|
|
|
2002-10-20 19:55:16 +05:30
|
|
|
"Database Processing/Extract information from names"
|
|
|
|
|
2003-01-15 10:55:50 +05:30
|
|
|
#-------------------------------------------------------------------------
|
|
|
|
#
|
|
|
|
# python modules
|
|
|
|
#
|
|
|
|
#-------------------------------------------------------------------------
|
2002-10-20 19:55:16 +05:30
|
|
|
import os
|
|
|
|
import re
|
* src/gramps_main.py (tool_callback): Typo.
* src/QuestionDialog.py: Use gramps icon.
* src/plugins/EventCmp.py: HIG; single instance; help.
* src/plugins/eventcmp.glade: HIG; help.
* src/plugins/Desbrowser.py: HIG, help, rebuild model after edit.
* src/plugins/desbrowse.glade: help, info label.
* src/plugins/PatchNames.py: HIG, help, single instance.
* src/plugins/patchnames.glade: HIG, help.
* src/plugins/Merge.py: HIG, help, single instance.
* src/plugins/merge.glade: HIG, help.
* src/plugins/ChangeNames.py: HIG, help, single instance.
svn: r4230
2005-03-24 11:52:25 +05:30
|
|
|
from gettext import gettext as _
|
2002-10-20 19:55:16 +05:30
|
|
|
|
2003-01-15 10:55:50 +05:30
|
|
|
#-------------------------------------------------------------------------
|
|
|
|
#
|
|
|
|
# gnome/gtk
|
|
|
|
#
|
|
|
|
#-------------------------------------------------------------------------
|
2003-04-16 11:55:38 +05:30
|
|
|
import gobject
|
2002-10-20 19:55:16 +05:30
|
|
|
import gtk
|
|
|
|
import gtk.glade
|
* src/gramps_main.py (tool_callback): Typo.
* src/QuestionDialog.py: Use gramps icon.
* src/plugins/EventCmp.py: HIG; single instance; help.
* src/plugins/eventcmp.glade: HIG; help.
* src/plugins/Desbrowser.py: HIG, help, rebuild model after edit.
* src/plugins/desbrowse.glade: help, info label.
* src/plugins/PatchNames.py: HIG, help, single instance.
* src/plugins/patchnames.glade: HIG, help.
* src/plugins/Merge.py: HIG, help, single instance.
* src/plugins/merge.glade: HIG, help.
* src/plugins/ChangeNames.py: HIG, help, single instance.
svn: r4230
2005-03-24 11:52:25 +05:30
|
|
|
from gnome import help_display
|
2002-10-20 19:55:16 +05:30
|
|
|
|
2003-01-15 10:55:50 +05:30
|
|
|
#-------------------------------------------------------------------------
|
|
|
|
#
|
|
|
|
# gramps modules
|
|
|
|
#
|
|
|
|
#-------------------------------------------------------------------------
|
|
|
|
import Utils
|
2005-12-06 12:08:09 +05:30
|
|
|
import Tool
|
2003-01-15 10:55:50 +05:30
|
|
|
from QuestionDialog import OkDialog
|
|
|
|
|
|
|
|
#-------------------------------------------------------------------------
|
|
|
|
#
|
|
|
|
# constants
|
|
|
|
#
|
|
|
|
#-------------------------------------------------------------------------
|
2004-11-28 10:33:29 +05:30
|
|
|
|
|
|
|
prefix_list = [
|
|
|
|
"de", "van", "von", "di", "le", "du", "dela", "della",
|
|
|
|
"des", "vande", "ten", "da", "af", "den", "das", "dello",
|
|
|
|
"del", "en", "ein", "el" "et", "les", "lo", "los", "un",
|
|
|
|
"um", "una", "uno",
|
|
|
|
]
|
|
|
|
|
|
|
|
|
2002-10-20 19:55:16 +05:30
|
|
|
_title_re = re.compile(r"^([A-Za-z][A-Za-z]+\.)\s+(.*)$")
|
2004-05-14 05:18:40 +05:30
|
|
|
_nick_re = re.compile(r"(.+)\s*[(\"](.*)[)\"]")
|
2004-11-28 10:33:29 +05:30
|
|
|
_fn_prefix_re = re.compile("(.*)\s+(%s)\s*$" % '|'.join(prefix_list),re.IGNORECASE)
|
|
|
|
_sn_prefix_re = re.compile("^\s*(%s)\s+(.*)" % '|'.join(prefix_list),re.IGNORECASE)
|
|
|
|
|
2002-10-20 19:55:16 +05:30
|
|
|
#-------------------------------------------------------------------------
|
|
|
|
#
|
|
|
|
# Search each name in the database, and compare the firstname against the
|
|
|
|
# form of "Name (Nickname)". If it matches, change the first name entry
|
|
|
|
# to "Name" and add "Nickname" into the nickname field.
|
|
|
|
#
|
|
|
|
#-------------------------------------------------------------------------
|
|
|
|
|
2003-01-15 10:55:50 +05:30
|
|
|
#-------------------------------------------------------------------------
|
|
|
|
#
|
|
|
|
# PatchNames
|
|
|
|
#
|
|
|
|
#-------------------------------------------------------------------------
|
2005-12-06 12:08:09 +05:30
|
|
|
class PatchNames(Tool.Tool):
|
|
|
|
def __init__(self,db,person,options_class,name,callback=None,parent=None):
|
|
|
|
Tool.Tool.__init__(self,db,person,options_class,name)
|
2002-10-20 19:55:16 +05:30
|
|
|
|
|
|
|
self.cb = callback
|
|
|
|
self.db = db
|
2004-05-10 10:24:10 +05:30
|
|
|
self.parent = parent
|
* src/gramps_main.py (tool_callback): Typo.
* src/QuestionDialog.py: Use gramps icon.
* src/plugins/EventCmp.py: HIG; single instance; help.
* src/plugins/eventcmp.glade: HIG; help.
* src/plugins/Desbrowser.py: HIG, help, rebuild model after edit.
* src/plugins/desbrowse.glade: help, info label.
* src/plugins/PatchNames.py: HIG, help, single instance.
* src/plugins/patchnames.glade: HIG, help.
* src/plugins/Merge.py: HIG, help, single instance.
* src/plugins/merge.glade: HIG, help.
* src/plugins/ChangeNames.py: HIG, help, single instance.
svn: r4230
2005-03-24 11:52:25 +05:30
|
|
|
if self.parent.child_windows.has_key(self.__class__):
|
|
|
|
self.parent.child_windows[self.__class__].present(None)
|
|
|
|
return
|
|
|
|
self.win_key = self.__class__
|
2004-08-13 10:04:07 +05:30
|
|
|
self.trans = db.transaction_begin()
|
2002-10-20 19:55:16 +05:30
|
|
|
self.title_list = []
|
|
|
|
self.nick_list = []
|
2004-11-28 10:33:29 +05:30
|
|
|
self.prefix1_list = []
|
|
|
|
self.prefix2_list = []
|
2002-11-04 09:35:47 +05:30
|
|
|
|
2005-08-18 11:28:28 +05:30
|
|
|
self.progress = Utils.ProgressMeter(
|
|
|
|
_('Extracting information from names'),'')
|
|
|
|
self.progress.set_pass(_('Analyzing names'),
|
|
|
|
self.db.get_number_of_people())
|
|
|
|
|
2004-08-13 10:04:07 +05:30
|
|
|
for key in self.db.get_person_handles(sort_handles=False):
|
2002-10-20 19:55:16 +05:30
|
|
|
|
2004-08-07 10:46:57 +05:30
|
|
|
person = self.db.get_person_from_handle(key)
|
2005-05-11 19:34:47 +05:30
|
|
|
name = person.get_primary_name()
|
|
|
|
first = name.get_first_name()
|
|
|
|
sname = name.get_surname()
|
|
|
|
|
2002-10-20 19:55:16 +05:30
|
|
|
match = _title_re.match(first)
|
2005-05-11 19:34:47 +05:30
|
|
|
if name.get_title():
|
|
|
|
current_title = [name.get_title()]
|
|
|
|
else:
|
|
|
|
current_title = []
|
|
|
|
while match:
|
2002-10-20 19:55:16 +05:30
|
|
|
groups = match.groups()
|
2005-05-11 19:34:47 +05:30
|
|
|
first = groups[1]
|
|
|
|
current_title.append(groups[0])
|
|
|
|
match = _title_re.match(first)
|
|
|
|
|
|
|
|
if current_title:
|
|
|
|
self.title_list.append((key," ".join(current_title),first))
|
2004-11-28 10:33:29 +05:30
|
|
|
continue
|
2005-05-11 19:34:47 +05:30
|
|
|
|
2002-10-20 19:55:16 +05:30
|
|
|
match = _nick_re.match(first)
|
|
|
|
if match:
|
|
|
|
groups = match.groups()
|
|
|
|
self.nick_list.append((key,groups[0],groups[1]))
|
2004-11-28 10:33:29 +05:30
|
|
|
continue
|
|
|
|
match = _fn_prefix_re.match(first)
|
|
|
|
if match:
|
|
|
|
groups = match.groups()
|
|
|
|
self.prefix1_list.append((key,groups[0],groups[1]))
|
|
|
|
continue
|
|
|
|
match = _sn_prefix_re.match(sname)
|
|
|
|
if match:
|
|
|
|
groups = match.groups()
|
|
|
|
self.prefix2_list.append((key,groups[1],groups[0]))
|
2005-08-18 11:28:28 +05:30
|
|
|
self.progress.step()
|
2002-10-20 19:55:16 +05:30
|
|
|
|
2004-11-28 10:33:29 +05:30
|
|
|
if self.nick_list or self.title_list or self.prefix1_list or self.prefix2_list:
|
2003-04-16 11:55:38 +05:30
|
|
|
self.display()
|
2002-10-20 19:55:16 +05:30
|
|
|
else:
|
2005-08-18 11:28:28 +05:30
|
|
|
self.progress.close()
|
2003-03-19 09:57:34 +05:30
|
|
|
OkDialog(_('No modifications made'),
|
|
|
|
_("No titles or nicknames were found"))
|
2002-10-20 19:55:16 +05:30
|
|
|
|
2003-04-16 11:55:38 +05:30
|
|
|
def toggled(self,cell,path_string):
|
|
|
|
path = tuple([int (i) for i in path_string.split(':')])
|
|
|
|
row = self.model[path]
|
|
|
|
row[0] = not row[0]
|
|
|
|
self.model.row_changed(path,row.iter)
|
|
|
|
|
|
|
|
def display(self):
|
2004-05-10 10:24:10 +05:30
|
|
|
|
2003-04-16 11:55:38 +05:30
|
|
|
base = os.path.dirname(__file__)
|
|
|
|
glade_file = base + os.sep + "patchnames.glade"
|
|
|
|
|
2003-08-17 07:44:33 +05:30
|
|
|
self.top = gtk.glade.XML(glade_file,"top","gramps")
|
2004-05-10 10:24:10 +05:30
|
|
|
self.window = self.top.get_widget('top')
|
* src/gramps_main.py (tool_callback): Typo.
* src/QuestionDialog.py: Use gramps icon.
* src/plugins/EventCmp.py: HIG; single instance; help.
* src/plugins/eventcmp.glade: HIG; help.
* src/plugins/Desbrowser.py: HIG, help, rebuild model after edit.
* src/plugins/desbrowse.glade: help, info label.
* src/plugins/PatchNames.py: HIG, help, single instance.
* src/plugins/patchnames.glade: HIG, help.
* src/plugins/Merge.py: HIG, help, single instance.
* src/plugins/merge.glade: HIG, help.
* src/plugins/ChangeNames.py: HIG, help, single instance.
svn: r4230
2005-03-24 11:52:25 +05:30
|
|
|
self.window.set_icon(self.parent.topWindow.get_icon())
|
2003-04-16 11:55:38 +05:30
|
|
|
self.top.signal_autoconnect({
|
2004-05-10 10:24:10 +05:30
|
|
|
"destroy_passed_object" : self.close,
|
|
|
|
"on_ok_clicked" : self.on_ok_clicked,
|
* src/gramps_main.py (tool_callback): Typo.
* src/QuestionDialog.py: Use gramps icon.
* src/plugins/EventCmp.py: HIG; single instance; help.
* src/plugins/eventcmp.glade: HIG; help.
* src/plugins/Desbrowser.py: HIG, help, rebuild model after edit.
* src/plugins/desbrowse.glade: help, info label.
* src/plugins/PatchNames.py: HIG, help, single instance.
* src/plugins/patchnames.glade: HIG, help.
* src/plugins/Merge.py: HIG, help, single instance.
* src/plugins/merge.glade: HIG, help.
* src/plugins/ChangeNames.py: HIG, help, single instance.
svn: r4230
2005-03-24 11:52:25 +05:30
|
|
|
"on_help_clicked" : self.on_help_clicked,
|
2004-05-10 10:24:10 +05:30
|
|
|
"on_delete_event" : self.on_delete_event
|
2003-04-16 11:55:38 +05:30
|
|
|
})
|
|
|
|
self.list = self.top.get_widget("list")
|
2004-05-10 10:24:10 +05:30
|
|
|
self.label = _('Name and title extraction tool')
|
|
|
|
Utils.set_titles(self.window,self.top.get_widget('title'),self.label)
|
2003-04-16 11:55:38 +05:30
|
|
|
|
|
|
|
self.model = gtk.ListStore(gobject.TYPE_BOOLEAN, gobject.TYPE_STRING,
|
|
|
|
gobject.TYPE_STRING, gobject.TYPE_STRING,
|
|
|
|
gobject.TYPE_STRING)
|
|
|
|
|
|
|
|
r = gtk.CellRendererToggle()
|
|
|
|
r.connect('toggled',self.toggled)
|
|
|
|
c = gtk.TreeViewColumn(_('Select'),r,active=0)
|
|
|
|
self.list.append_column(c)
|
|
|
|
|
|
|
|
c = gtk.TreeViewColumn(_('ID'),gtk.CellRendererText(),text=1)
|
|
|
|
self.list.append_column(c)
|
|
|
|
|
|
|
|
c = gtk.TreeViewColumn(_('Type'),gtk.CellRendererText(),text=2)
|
|
|
|
self.list.append_column(c)
|
|
|
|
|
|
|
|
c = gtk.TreeViewColumn(_('Value'),gtk.CellRendererText(),text=3)
|
|
|
|
self.list.append_column(c)
|
|
|
|
|
|
|
|
c = gtk.TreeViewColumn(_('Name'),gtk.CellRendererText(),text=4)
|
|
|
|
self.list.append_column(c)
|
|
|
|
|
|
|
|
self.list.set_model(self.model)
|
|
|
|
|
|
|
|
self.nick_hash = {}
|
|
|
|
self.title_hash = {}
|
2004-11-28 10:33:29 +05:30
|
|
|
self.prefix1_hash = {}
|
|
|
|
self.prefix2_hash = {}
|
2005-08-18 11:28:28 +05:30
|
|
|
|
|
|
|
self.progress.set_pass(_('Bulding display'),
|
|
|
|
len(self.nick_list)+len(self.title_list)
|
|
|
|
+len(self.prefix1_list)+len(self.prefix2_list))
|
|
|
|
|
2003-04-16 11:55:38 +05:30
|
|
|
for (id,name,nick) in self.nick_list:
|
2004-08-07 10:46:57 +05:30
|
|
|
p = self.db.get_person_from_handle(id)
|
2004-11-21 06:00:52 +05:30
|
|
|
gid = p.get_gramps_id()
|
2004-10-26 08:50:38 +05:30
|
|
|
handle = self.model.append()
|
|
|
|
self.model.set_value(handle,0,1)
|
2004-11-21 06:00:52 +05:30
|
|
|
self.model.set_value(handle,1,gid)
|
2004-10-26 08:50:38 +05:30
|
|
|
self.model.set_value(handle,2,_('Nickname'))
|
|
|
|
self.model.set_value(handle,3,nick)
|
|
|
|
self.model.set_value(handle,4,p.get_primary_name().get_name())
|
|
|
|
self.nick_hash[id] = handle
|
2005-08-18 11:28:28 +05:30
|
|
|
self.progress.step()
|
2003-04-16 11:55:38 +05:30
|
|
|
|
|
|
|
for (id,title,nick) in self.title_list:
|
2004-08-07 10:46:57 +05:30
|
|
|
p = self.db.get_person_from_handle(id)
|
2004-11-21 06:00:52 +05:30
|
|
|
gid = p.get_gramps_id()
|
2004-10-26 08:50:38 +05:30
|
|
|
handle = self.model.append()
|
|
|
|
self.model.set_value(handle,0,1)
|
2004-11-21 06:00:52 +05:30
|
|
|
self.model.set_value(handle,1,gid)
|
2004-10-26 08:50:38 +05:30
|
|
|
self.model.set_value(handle,2,_('Title'))
|
|
|
|
self.model.set_value(handle,3,nick)
|
|
|
|
self.model.set_value(handle,4,p.get_primary_name().get_name())
|
|
|
|
self.title_hash[id] = handle
|
2005-08-18 11:28:28 +05:30
|
|
|
self.progress.step()
|
2004-05-10 10:24:10 +05:30
|
|
|
|
2004-11-28 10:33:29 +05:30
|
|
|
for (id,prefix,fname) in self.prefix1_list:
|
|
|
|
p = self.db.get_person_from_handle(id)
|
|
|
|
gid = p.get_gramps_id()
|
|
|
|
handle = self.model.append()
|
|
|
|
self.model.set_value(handle,0,1)
|
|
|
|
self.model.set_value(handle,1,gid)
|
|
|
|
self.model.set_value(handle,2,_('Prefix'))
|
|
|
|
self.model.set_value(handle,3,fname)
|
|
|
|
self.model.set_value(handle,4,p.get_primary_name().get_name())
|
|
|
|
self.prefix1_hash[id] = handle
|
2005-08-18 11:28:28 +05:30
|
|
|
self.progress.step()
|
2004-11-28 10:33:29 +05:30
|
|
|
|
|
|
|
for (id,prefix,fname) in self.prefix2_list:
|
|
|
|
p = self.db.get_person_from_handle(id)
|
|
|
|
gid = p.get_gramps_id()
|
|
|
|
handle = self.model.append()
|
|
|
|
self.model.set_value(handle,0,1)
|
|
|
|
self.model.set_value(handle,1,gid)
|
|
|
|
self.model.set_value(handle,2,_('Prefix'))
|
|
|
|
self.model.set_value(handle,3,fname)
|
|
|
|
self.model.set_value(handle,4,p.get_primary_name().get_name())
|
|
|
|
self.prefix2_hash[id] = handle
|
2005-08-18 11:28:28 +05:30
|
|
|
self.progress.step()
|
2004-11-28 10:33:29 +05:30
|
|
|
|
2005-08-18 11:28:28 +05:30
|
|
|
self.progress.close()
|
2004-05-10 10:24:10 +05:30
|
|
|
self.add_itself_to_menu()
|
|
|
|
self.window.show()
|
|
|
|
|
* src/gramps_main.py (tool_callback): Typo.
* src/QuestionDialog.py: Use gramps icon.
* src/plugins/EventCmp.py: HIG; single instance; help.
* src/plugins/eventcmp.glade: HIG; help.
* src/plugins/Desbrowser.py: HIG, help, rebuild model after edit.
* src/plugins/desbrowse.glade: help, info label.
* src/plugins/PatchNames.py: HIG, help, single instance.
* src/plugins/patchnames.glade: HIG, help.
* src/plugins/Merge.py: HIG, help, single instance.
* src/plugins/merge.glade: HIG, help.
* src/plugins/ChangeNames.py: HIG, help, single instance.
svn: r4230
2005-03-24 11:52:25 +05:30
|
|
|
def on_help_clicked(self,obj):
|
|
|
|
"""Display the relevant portion of GRAMPS manual"""
|
|
|
|
help_display('gramps-manual','tools-db')
|
|
|
|
|
2004-05-10 10:24:10 +05:30
|
|
|
def on_delete_event(self,obj,b):
|
|
|
|
self.remove_itself_from_menu()
|
|
|
|
|
|
|
|
def close(self,obj):
|
|
|
|
self.remove_itself_from_menu()
|
|
|
|
self.window.destroy()
|
|
|
|
|
|
|
|
def add_itself_to_menu(self):
|
|
|
|
self.parent.child_windows[self.win_key] = self
|
|
|
|
self.parent_menu_item = gtk.MenuItem(self.label)
|
|
|
|
self.parent_menu_item.connect("activate",self.present)
|
|
|
|
self.parent_menu_item.show()
|
|
|
|
self.parent.winsmenu.append(self.parent_menu_item)
|
|
|
|
|
|
|
|
def remove_itself_from_menu(self):
|
|
|
|
del self.parent.child_windows[self.win_key]
|
|
|
|
self.parent_menu_item.destroy()
|
|
|
|
|
|
|
|
def present(self,obj):
|
|
|
|
self.window.present()
|
2003-04-16 11:55:38 +05:30
|
|
|
|
2002-10-20 19:55:16 +05:30
|
|
|
def on_ok_clicked(self,obj):
|
|
|
|
for grp in self.nick_list:
|
2004-10-26 08:50:38 +05:30
|
|
|
handle = self.nick_hash[grp[0]]
|
|
|
|
val = self.model.get_value(handle,0)
|
2003-04-16 11:55:38 +05:30
|
|
|
if val:
|
2004-08-07 10:46:57 +05:30
|
|
|
p = self.db.get_person_from_handle(grp[0])
|
2004-02-14 11:10:30 +05:30
|
|
|
name = p.get_primary_name()
|
2004-05-14 05:18:40 +05:30
|
|
|
name.set_first_name(grp[1].strip())
|
|
|
|
p.set_nick_name(grp[2].strip())
|
2004-05-13 09:48:47 +05:30
|
|
|
self.db.commit_person(p,self.trans)
|
2002-10-20 19:55:16 +05:30
|
|
|
|
|
|
|
for grp in self.title_list:
|
2004-10-26 08:50:38 +05:30
|
|
|
handle = self.title_hash[grp[0]]
|
|
|
|
val = self.model.get_value(handle,0)
|
2003-04-16 11:55:38 +05:30
|
|
|
if val:
|
2004-08-07 10:46:57 +05:30
|
|
|
p = self.db.get_person_from_handle(grp[0])
|
2004-02-14 11:10:30 +05:30
|
|
|
name = p.get_primary_name()
|
2004-05-14 05:18:40 +05:30
|
|
|
name.set_first_name(grp[2].strip())
|
|
|
|
name.set_title(grp[1].strip())
|
2004-05-13 09:48:47 +05:30
|
|
|
self.db.commit_person(p,self.trans)
|
2002-10-20 19:55:16 +05:30
|
|
|
|
2004-11-28 10:33:29 +05:30
|
|
|
for grp in self.prefix1_list:
|
|
|
|
handle = self.prefix1_hash[grp[0]]
|
|
|
|
val = self.model.get_value(handle,0)
|
|
|
|
if val:
|
|
|
|
p = self.db.get_person_from_handle(grp[0])
|
|
|
|
name = p.get_primary_name()
|
|
|
|
name.set_first_name(grp[1].strip())
|
|
|
|
name.set_surname_prefix(grp[2].strip())
|
|
|
|
self.db.commit_person(p,self.trans)
|
|
|
|
|
|
|
|
for grp in self.prefix2_list:
|
|
|
|
handle = self.prefix2_hash[grp[0]]
|
|
|
|
val = self.model.get_value(handle,0)
|
|
|
|
if val:
|
|
|
|
p = self.db.get_person_from_handle(grp[0])
|
|
|
|
name = p.get_primary_name()
|
|
|
|
name.set_surname(grp[1].strip())
|
|
|
|
name.set_surname_prefix(grp[2].strip())
|
|
|
|
self.db.commit_person(p,self.trans)
|
|
|
|
|
2004-08-13 10:04:07 +05:30
|
|
|
self.db.transaction_commit(self.trans,_("Extract information from names"))
|
2004-05-10 10:24:10 +05:30
|
|
|
self.close(obj)
|
* src/gramps_main.py (tool_callback): Typo.
* src/QuestionDialog.py: Use gramps icon.
* src/plugins/EventCmp.py: HIG; single instance; help.
* src/plugins/eventcmp.glade: HIG; help.
* src/plugins/Desbrowser.py: HIG, help, rebuild model after edit.
* src/plugins/desbrowse.glade: help, info label.
* src/plugins/PatchNames.py: HIG, help, single instance.
* src/plugins/patchnames.glade: HIG, help.
* src/plugins/Merge.py: HIG, help, single instance.
* src/plugins/merge.glade: HIG, help.
* src/plugins/ChangeNames.py: HIG, help, single instance.
svn: r4230
2005-03-24 11:52:25 +05:30
|
|
|
self.cb(None,1)
|
2002-10-20 19:55:16 +05:30
|
|
|
|
|
|
|
#------------------------------------------------------------------------
|
|
|
|
#
|
|
|
|
#
|
|
|
|
#
|
|
|
|
#------------------------------------------------------------------------
|
2005-12-06 12:08:09 +05:30
|
|
|
class PatchNamesOptions(Tool.ToolOptions):
|
|
|
|
"""
|
|
|
|
Defines options and provides handling interface.
|
|
|
|
"""
|
|
|
|
|
|
|
|
def __init__(self,name,person_id=None):
|
|
|
|
Tool.ToolOptions.__init__(self,name,person_id)
|
|
|
|
|
|
|
|
#-------------------------------------------------------------------------
|
|
|
|
#
|
|
|
|
#
|
|
|
|
#
|
|
|
|
#-------------------------------------------------------------------------
|
2005-01-05 10:32:19 +05:30
|
|
|
from PluginMgr import register_tool
|
2002-10-20 19:55:16 +05:30
|
|
|
|
|
|
|
register_tool(
|
2005-12-06 12:08:09 +05:30
|
|
|
name = 'patchnames',
|
|
|
|
category = Tool.TOOL_DBPROC,
|
|
|
|
tool_class = PatchNames,
|
|
|
|
options_class = PatchNamesOptions,
|
|
|
|
modes = Tool.MODE_GUI,
|
|
|
|
translated_name = _("Extract information from names"),
|
|
|
|
status=(_("Stable")),
|
|
|
|
author_name = "Donald N. Allingham",
|
|
|
|
author_email = "don@gramps-project.org",
|
2004-05-14 05:18:40 +05:30
|
|
|
description=_("Searches the entire database and attempts to "
|
2004-11-29 09:21:42 +05:30
|
|
|
"extract titles, nicknames and surname prefixes "
|
2004-11-28 10:33:29 +05:30
|
|
|
"that may be embedded in a person's given name field.")
|
2002-10-20 19:55:16 +05:30
|
|
|
)
|