diff --git a/src/plugins/tool/PatchNames.py b/src/plugins/tool/PatchNames.py index 706f8f87c..b55d67bef 100644 --- a/src/plugins/tool/PatchNames.py +++ b/src/plugins/tool/PatchNames.py @@ -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. diff --git a/src/plugins/tool/patchnames.glade b/src/plugins/tool/patchnames.glade index cdce7df16..5ceb4c38e 100644 --- a/src/plugins/tool/patchnames.glade +++ b/src/plugins/tool/patchnames.glade @@ -12,12 +12,10 @@ True - vertical True 6 - vertical True @@ -32,10 +30,18 @@ True + 0 10 - 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. + 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. + True + 100 False