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

View File

@ -12,12 +12,10 @@
<child internal-child="vbox"> <child internal-child="vbox">
<object class="GtkVBox" id="dialog-vbox1"> <object class="GtkVBox" id="dialog-vbox1">
<property name="visible">True</property> <property name="visible">True</property>
<property name="orientation">vertical</property>
<child> <child>
<object class="GtkVBox" id="vbox2"> <object class="GtkVBox" id="vbox2">
<property name="visible">True</property> <property name="visible">True</property>
<property name="border_width">6</property> <property name="border_width">6</property>
<property name="orientation">vertical</property>
<child> <child>
<object class="GtkLabel" id="title"> <object class="GtkLabel" id="title">
<property name="visible">True</property> <property name="visible">True</property>
@ -32,10 +30,18 @@
<child> <child>
<object class="GtkLabel" id="label3"> <object class="GtkLabel" id="label3">
<property name="visible">True</property> <property name="visible">True</property>
<property name="xalign">0</property>
<property name="ypad">10</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 <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.
current database. If you accept the changes, Gramps will modify the entries If you accept the changes, Gramps will modify the entries that have been selected.
that have been selected.</property>
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> </object>
<packing> <packing>
<property name="expand">False</property> <property name="expand">False</property>