Finish patchname tool

svn: r16033
This commit is contained in:
Benny Malengier 2010-10-24 13:06:55 +00:00
parent d7178e96d7
commit cf943afcd5
2 changed files with 27 additions and 15 deletions

View File

@ -132,7 +132,7 @@ class PatchNames(tool.BatchTool, ManagedWindow.ManagedWindow):
hboxcon.pack_start(self.conbox)
winprefix.vbox.pack_start(hboxcon)
hboxconns = gtk.HBox()
hboxconns.pack_start(gtk.Label(_('Connectors non-splitting surnames:')),
hboxconns.pack_start(gtk.Label(_('Connectors not splitting surnames:')),
expand=False, padding=5)
self.connsbox = gtk.Entry()
self.connsbox.set_text(', '.join(CONNECTOR_LIST_NONSPLIT))
@ -269,16 +269,23 @@ class PatchNames(tool.BatchTool, ManagedWindow.ManagedWindow):
cont = True
for pref, surn, con, prim, orig in zip(old_prefix, old_surn,
old_con, old_prim, old_orig):
surnval = surn.split()
if surnval == []:
new_prefix_list.append(pref)
new_surname_list.append('')
new_connector_list.append(con)
new_prim_list.append(prim)
new_orig_list.append(orig)
cont = False
continue
val = surnval.pop(0)
while cont:
new_prefix_list.append(pref)
new_surname_list.append('')
new_connector_list.append(con)
new_prim_list.append(prim)
new_orig_list.append(orig)
surnval = surn.split()
if surnval == []:
continue
val = surnval.pop(0)
while cont and (val.lower() in self.prefix_list):
found = True
if new_prefix_list[-1]:
@ -299,8 +306,7 @@ class PatchNames(tool.BatchTool, ManagedWindow.ManagedWindow):
val = ''
cont = False
#if value after surname indicates continue, then continue
if cont and ((val.lower() in self.connector_list_nonsplit) or
(new_surname_list[-1].lower() in self.connector_list_nonsplit)):
while cont and (val.lower() in self.connector_list_nonsplit):
#add this val to the current surname
new_surname_list[-1] += ' ' + val
try:
@ -310,7 +316,8 @@ class PatchNames(tool.BatchTool, ManagedWindow.ManagedWindow):
cont = False
# if previous is non-splitting connector, then add new val to
# current surname
if cont and (new_surname_list[-1].lower() in self.connector_list_nonsplit):
if cont and (new_surname_list[-1].split()[-1].lower() \
in self.connector_list_nonsplit):
new_surname_list[-1] += ' ' + val
try:
val = surnval.pop(0)
@ -323,7 +330,7 @@ class PatchNames(tool.BatchTool, ManagedWindow.ManagedWindow):
if new_connector_list[-1]:
new_connector_list[-1] = ' ' + val
else:
new_prefix_list[-1] = val
new_connector_list[-1] = val
try:
val = surnval.pop(0)
except IndexError:
@ -536,7 +543,6 @@ class PatchNames(tool.BatchTool, ManagedWindow.ManagedWindow):
self.close()
self.cb()
class PatchNamesOptions(tool.ToolOptions):
"""
Defines options and provides handling interface.

View File

@ -12,12 +12,10 @@
<child internal-child="vbox">
<object class="GtkVBox" id="dialog-vbox1">
<property name="visible">True</property>
<property name="orientation">vertical</property>
<child>
<object class="GtkVBox" id="vbox2">
<property name="visible">True</property>
<property name="border_width">6</property>
<property name="orientation">vertical</property>
<child>
<object class="GtkLabel" id="title">
<property name="visible">True</property>
@ -32,10 +30,18 @@
<child>
<object class="GtkLabel" id="label3">
<property name="visible">True</property>
<property name="xalign">0</property>
<property name="ypad">10</property>
<property name="label" translatable="yes">Below is a list of the nicknames, titles and family name prefixes that Gramps can extract from the
current database. If you accept the changes, Gramps will modify the entries
that have been selected.</property>
<property name="label" translatable="yes">Below is a list of the nicknames, titles, prefixes and compound surnames that Gramps can extract from the family tree.
If you accept the changes, Gramps will modify the entries that have been selected.
Compound surnames are shown as lists of [prefix, surname, connector].
For example, with the defaults, the name "de Mascarenhas da Silva e Lencastre" shows as:
[de, Mascarenhas]-[da, Silva, e]-[,Lencastre]
Run this tool several times to correct names that have multiple information that can be extracted.</property>
<property name="wrap">True</property>
<property name="max_width_chars">100</property>
</object>
<packing>
<property name="expand">False</property>