7035: Request for new "Replace All Names" in Export Options dialog
This commit is contained in:
parent
96e56d1e56
commit
7f4bc4785f
@ -131,10 +131,14 @@ def add_living_people_option(menu, category,
|
|||||||
The method for handling living people.
|
The method for handling living people.
|
||||||
LivingProxyDb.MODE_EXCLUDE_ALL will remove living people altogether.
|
LivingProxyDb.MODE_EXCLUDE_ALL will remove living people altogether.
|
||||||
LivingProxyDb.MODE_INCLUDE_LAST_NAME_ONLY will remove all
|
LivingProxyDb.MODE_INCLUDE_LAST_NAME_ONLY will remove all
|
||||||
information and change their given name to "[Living]" or whatever
|
information and change their given name to "[Living]" or whatever
|
||||||
has been set in Preferences -> Text.
|
has been set in Preferences -> Text -> Private given name.
|
||||||
|
LivingProxyDb.MODE_REPLACE_COMPLETE_NAME will remove all
|
||||||
|
information and change their given name and surname to
|
||||||
|
"[Living]" or whatever has been set in Preferences -> Text
|
||||||
|
for Private surname and Private given name.
|
||||||
LivingProxyDb.MODE_INCLUDE_FULL_NAME_ONLY will remove all
|
LivingProxyDb.MODE_INCLUDE_FULL_NAME_ONLY will remove all
|
||||||
information but leave the entire name intact.
|
information but leave the entire name intact.
|
||||||
LivingProxyDb.MODE_INCLUDE_ALL will not invoke LivingProxyDb at all.
|
LivingProxyDb.MODE_INCLUDE_ALL will not invoke LivingProxyDb at all.
|
||||||
:type mode: int
|
:type mode: int
|
||||||
:param after_death_years:
|
:param after_death_years:
|
||||||
@ -160,6 +164,8 @@ def add_living_people_option(menu, category,
|
|||||||
_("Include full names but no data"))
|
_("Include full names but no data"))
|
||||||
living_people.add_item(LivingProxyDb.MODE_INCLUDE_LAST_NAME_ONLY,
|
living_people.add_item(LivingProxyDb.MODE_INCLUDE_LAST_NAME_ONLY,
|
||||||
_("Replace given names and include no data"))
|
_("Replace given names and include no data"))
|
||||||
|
living_people.add_item(LivingProxyDb.MODE_REPLACE_COMPLETE_NAME,
|
||||||
|
_("Replace complete names and include no data"))
|
||||||
living_people.add_item(LivingProxyDb.MODE_EXCLUDE_ALL,
|
living_people.add_item(LivingProxyDb.MODE_EXCLUDE_ALL,
|
||||||
_("Do not include living people"))
|
_("Do not include living people"))
|
||||||
living_people.set_help(_("How to handle living people"))
|
living_people.set_help(_("How to handle living people"))
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
# Gramps - a GTK+/GNOME based genealogy program
|
# Gramps - a GTK+/GNOME based genealogy program
|
||||||
#
|
#
|
||||||
# Copyright (C) 2007-2008 Brian G. Matherly
|
# Copyright (C) 2007-2008 Brian G. Matherly
|
||||||
|
# Copyright (C) 2016 Matt Keenan <matt.keenan@gmail.com>
|
||||||
#
|
#
|
||||||
# This program is free software; you can redistribute it and/or modify
|
# 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
|
# it under the terms of the GNU General Public License as published by
|
||||||
@ -47,6 +48,7 @@ class LivingProxyDb(ProxyDbBase):
|
|||||||
MODE_EXCLUDE_ALL = 0
|
MODE_EXCLUDE_ALL = 0
|
||||||
MODE_INCLUDE_LAST_NAME_ONLY = 1
|
MODE_INCLUDE_LAST_NAME_ONLY = 1
|
||||||
MODE_INCLUDE_FULL_NAME_ONLY = 2
|
MODE_INCLUDE_FULL_NAME_ONLY = 2
|
||||||
|
MODE_REPLACE_COMPLETE_NAME = 3
|
||||||
MODE_INCLUDE_ALL = 99 # usually this will be only tested for, not invoked
|
MODE_INCLUDE_ALL = 99 # usually this will be only tested for, not invoked
|
||||||
|
|
||||||
def __init__(self, dbase, mode, current_year=None, years_after_death=0):
|
def __init__(self, dbase, mode, current_year=None, years_after_death=0):
|
||||||
@ -57,12 +59,17 @@ class LivingProxyDb(ProxyDbBase):
|
|||||||
:type dbase: DbBase
|
:type dbase: DbBase
|
||||||
:param mode:
|
:param mode:
|
||||||
The method for handling living people.
|
The method for handling living people.
|
||||||
LivingProxyDb.MODE_EXCLUDE_ALL will remove living people altogether.
|
LivingProxyDb.MODE_EXCLUDE_ALL will remove living people
|
||||||
|
altogether.
|
||||||
LivingProxyDb.MODE_INCLUDE_LAST_NAME_ONLY will remove all
|
LivingProxyDb.MODE_INCLUDE_LAST_NAME_ONLY will remove all
|
||||||
information and change their given name to "[Living]" or what has
|
information and change their given name to "[Living]" or what
|
||||||
been set in Preferences -> Text.
|
has been set in Preferences -> Text -> Private given name.
|
||||||
|
LivingProxyDb.MODE_REPLACE_COMPLETE_NAME will remove all
|
||||||
|
information and change their given name and surname to
|
||||||
|
"[Living]" or whatever has been set in Preferences -> Text
|
||||||
|
for Private surname and Private given name.
|
||||||
LivingProxyDb.MODE_INCLUDE_FULL_NAME_ONLY will remove all
|
LivingProxyDb.MODE_INCLUDE_FULL_NAME_ONLY will remove all
|
||||||
information but leave the entire name intact.
|
information but leave the entire name intact.
|
||||||
:type mode: int
|
:type mode: int
|
||||||
:param current_year: The current year to use for living determination.
|
:param current_year: The current year to use for living determination.
|
||||||
If None is supplied, the current year will be found from the system.
|
If None is supplied, the current year will be found from the system.
|
||||||
@ -391,20 +398,31 @@ class LivingProxyDb(ProxyDbBase):
|
|||||||
new_name.set_sort_as(old_name.get_sort_as())
|
new_name.set_sort_as(old_name.get_sort_as())
|
||||||
new_name.set_display_as(old_name.get_display_as())
|
new_name.set_display_as(old_name.get_display_as())
|
||||||
new_name.set_type(old_name.get_type())
|
new_name.set_type(old_name.get_type())
|
||||||
if self.mode == self.MODE_INCLUDE_LAST_NAME_ONLY:
|
if (self.mode == self.MODE_INCLUDE_LAST_NAME_ONLY or
|
||||||
new_name.set_first_name(config.get('preferences.private-given-text'))
|
self.mode == self.MODE_REPLACE_COMPLETE_NAME):
|
||||||
|
new_name.set_first_name(
|
||||||
|
config.get('preferences.private-given-text'))
|
||||||
new_name.set_title("")
|
new_name.set_title("")
|
||||||
else: # self.mode == self.MODE_INCLUDE_FULL_NAME_ONLY
|
else: # self.mode == self.MODE_INCLUDE_FULL_NAME_ONLY
|
||||||
new_name.set_first_name(old_name.get_first_name())
|
new_name.set_first_name(old_name.get_first_name())
|
||||||
new_name.set_suffix(old_name.get_suffix())
|
new_name.set_suffix(old_name.get_suffix())
|
||||||
new_name.set_title(old_name.get_title())
|
new_name.set_title(old_name.get_title())
|
||||||
|
|
||||||
surnlst = []
|
surnlst = []
|
||||||
for surn in old_name.get_surname_list():
|
if self.mode == self.MODE_REPLACE_COMPLETE_NAME:
|
||||||
surname = Surname(source=surn)
|
surname = Surname(source=old_name.get_primary_surname())
|
||||||
if int(surname.origintype) in [NameOriginType.PATRONYMIC,
|
surname.set_surname(
|
||||||
NameOriginType.MATRONYMIC]:
|
config.get('preferences.private-surname-text'))
|
||||||
surname.set_surname(config.get('preferences.private-surname-text'))
|
|
||||||
surnlst.append(surname)
|
surnlst.append(surname)
|
||||||
|
else:
|
||||||
|
for surn in old_name.get_surname_list():
|
||||||
|
surname = Surname(source=surn)
|
||||||
|
if int(surname.origintype) in [NameOriginType.PATRONYMIC,
|
||||||
|
NameOriginType.MATRONYMIC]:
|
||||||
|
surname.set_surname(
|
||||||
|
config.get('preferences.private-surname-text'))
|
||||||
|
surnlst.append(surname)
|
||||||
|
|
||||||
new_name.set_surname_list(surnlst)
|
new_name.set_surname_list(surnlst)
|
||||||
new_person.set_primary_name(new_name)
|
new_person.set_primary_name(new_name)
|
||||||
new_person.set_privacy(person.get_privacy())
|
new_person.set_privacy(person.get_privacy())
|
||||||
|
@ -468,7 +468,7 @@ class WriterOptionBox(object):
|
|||||||
After this function is called, the following variables are defined:
|
After this function is called, the following variables are defined:
|
||||||
|
|
||||||
private = privacy requested
|
private = privacy requested
|
||||||
restrict = restrict information on living peoplel
|
restrict = restrict information on living people
|
||||||
cfitler = return the GenericFilter selected
|
cfitler = return the GenericFilter selected
|
||||||
nfilter = return the NoteFilter selected
|
nfilter = return the NoteFilter selected
|
||||||
reference = restrict referenced/orphaned records
|
reference = restrict referenced/orphaned records
|
||||||
@ -578,8 +578,9 @@ class WriterOptionBox(object):
|
|||||||
progress.update(progress.progress_cnt)
|
progress.update(progress.progress_cnt)
|
||||||
mode = [None, # include living
|
mode = [None, # include living
|
||||||
LivingProxyDb.MODE_INCLUDE_LAST_NAME_ONLY,
|
LivingProxyDb.MODE_INCLUDE_LAST_NAME_ONLY,
|
||||||
|
LivingProxyDb.MODE_REPLACE_COMPLETE_NAME,
|
||||||
LivingProxyDb.MODE_EXCLUDE_ALL,
|
LivingProxyDb.MODE_EXCLUDE_ALL,
|
||||||
][self.restrict_num]
|
][self.restrict_num]
|
||||||
dbase = LivingProxyDb(
|
dbase = LivingProxyDb(
|
||||||
dbase,
|
dbase,
|
||||||
mode) #
|
mode) #
|
||||||
@ -703,10 +704,11 @@ class WriterOptionBox(object):
|
|||||||
elif namespace == "living":
|
elif namespace == "living":
|
||||||
model = Gtk.ListStore(GObject.TYPE_STRING, int)
|
model = Gtk.ListStore(GObject.TYPE_STRING, int)
|
||||||
row = 0
|
row = 0
|
||||||
for item in [
|
for item in [_('Include all selected people'),
|
||||||
_('Include all selected people'),
|
_('Replace given names of living people'),
|
||||||
_('Replace given names of living people'),
|
_('Replace complete name of living people'),
|
||||||
_('Do not include living people')]:
|
_('Do not include living people'),
|
||||||
|
]:
|
||||||
model.append(row=[item, row])
|
model.append(row=[item, row])
|
||||||
row += 1
|
row += 1
|
||||||
|
|
||||||
|
@ -8383,6 +8383,8 @@ class NavWebOptions(MenuReportOptions):
|
|||||||
_("Include Last Name Only"))
|
_("Include Last Name Only"))
|
||||||
self.__living.add_item(LivingProxyDb.MODE_INCLUDE_FULL_NAME_ONLY,
|
self.__living.add_item(LivingProxyDb.MODE_INCLUDE_FULL_NAME_ONLY,
|
||||||
_("Include Full Name Only"))
|
_("Include Full Name Only"))
|
||||||
|
self.__living.add_item(LivingProxyDb.MODE_REPLACE_COMPLETE_NAME,
|
||||||
|
_("Replace Complete Name"))
|
||||||
self.__living.add_item(_INCLUDE_LIVING_VALUE,
|
self.__living.add_item(_INCLUDE_LIVING_VALUE,
|
||||||
_("Include"))
|
_("Include"))
|
||||||
self.__living.set_help(_("How to handle living people"))
|
self.__living.set_help(_("How to handle living people"))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user