diff --git a/gramps/gen/plug/report/stdoptions.py b/gramps/gen/plug/report/stdoptions.py index 2f00ae2ac..9b890990d 100644 --- a/gramps/gen/plug/report/stdoptions.py +++ b/gramps/gen/plug/report/stdoptions.py @@ -66,11 +66,11 @@ def add_name_format_option(menu, category): name_format.set_help(_("Select the format to display names")) menu.add_option(category, "name_format", name_format) -def run_name_format_option(self, menu): +def run_name_format_option(report, menu): """ Run the option for changing the report's name format to a report-specific format instead of the user's Edit=>Preferences choice """ name_format = menu.get_option_by_name("name_format").get_value() if name_format != 0: - self._name_display.set_default_format(name_format) + report._name_display.set_default_format(name_format) diff --git a/gramps/plugins/drawreport/timeline.py b/gramps/plugins/drawreport/timeline.py index 50057ce81..d55c6dc3f 100644 --- a/gramps/plugins/drawreport/timeline.py +++ b/gramps/plugins/drawreport/timeline.py @@ -95,6 +95,7 @@ class TimeLine(Report): The option class carries its number, and the function returning the list of filters. sortby - Sorting method to be used. + name_format - Preferred format to display names """ Report.__init__(self, database, options, user) self._user = user @@ -104,9 +105,7 @@ class TimeLine(Report): self._lang = options.menu.get_option_by_name('trans').get_value() self.set_locale(self._lang) - name_format = menu.get_option_by_name("name_format").get_value() - if name_format != 0: - self._name_display.set_default_format(name_format) + stdoptions.run_name_format_option(self, menu) sort_func_num = menu.get_option_by_name('sortby').get_value() sort_functions = _get_sort_functions(Sort(database)) diff --git a/gramps/plugins/graph/gvfamilylines.py b/gramps/plugins/graph/gvfamilylines.py index 6c6e7dde8..eccc50492 100644 --- a/gramps/plugins/graph/gvfamilylines.py +++ b/gramps/plugins/graph/gvfamilylines.py @@ -301,6 +301,7 @@ class FamilyLinesReport(Report): database - the GRAMPS database instance options - instance of the FamilyLinesOptions class for this report user - a gen.user.User() instance + name_format - Preferred format to display names """ Report.__init__(self, database, options, user) @@ -354,9 +355,7 @@ class FamilyLinesReport(Report): lang = menu.get_option_by_name('trans').get_value() self._locale = self.set_locale(lang) - name_format = menu.get_option_by_name("name_format").get_value() - if name_format != 0: - self._name_display.set_default_format(name_format) + stdoptions.run_name_format_option(self, menu) # convert the 'surnamecolors' string to a dictionary of names and colors self._surnamecolors = {} diff --git a/gramps/plugins/graph/gvhourglass.py b/gramps/plugins/graph/gvhourglass.py index 4ad1c6030..33f11ba5e 100644 --- a/gramps/plugins/graph/gvhourglass.py +++ b/gramps/plugins/graph/gvhourglass.py @@ -70,6 +70,8 @@ class HourGlassReport(Report): def __init__(self, database, options, user): """ Create HourGlass object that produces the report. + + name_format - Preferred format to display names """ Report.__init__(self, database, options, user) @@ -109,9 +111,7 @@ class HourGlassReport(Report): self.set_locale(menu.get_option_by_name('trans').get_value()) - name_format = menu.get_option_by_name("name_format").get_value() - if name_format != 0: - self._name_display.set_default_format(name_format) + stdoptions.run_name_format_option(self, menu) def write_report(self): """ diff --git a/gramps/plugins/graph/gvrelgraph.py b/gramps/plugins/graph/gvrelgraph.py index 921f9392b..de3e8eb07 100644 --- a/gramps/plugins/graph/gvrelgraph.py +++ b/gramps/plugins/graph/gvrelgraph.py @@ -115,6 +115,7 @@ class RelGraphReport(Report): color_families - Colour to apply to families dashed - Whether to use dashed lines for non-birth relationships use_roundedcorners - Whether to use rounded corners for females + name_format - Preferred format to display names """ Report.__init__(self, database, options, user) @@ -163,9 +164,7 @@ class RelGraphReport(Report): lang = menu.get_option_by_name('trans').get_value() self._locale = self.set_locale(lang) - name_format = menu.get_option_by_name("name_format").get_value() - if name_format != 0: - self._name_display.set_default_format(name_format) + stdoptions.run_name_format_option(self, menu) self.center_person = database.get_person_from_gramps_id( get_value('pid')) diff --git a/gramps/plugins/textreport/ancestorreport.py b/gramps/plugins/textreport/ancestorreport.py index 2e79d01c5..7882c156a 100644 --- a/gramps/plugins/textreport/ancestorreport.py +++ b/gramps/plugins/textreport/ancestorreport.py @@ -103,9 +103,7 @@ class AncestorReport(Report): lang = menu.get_option_by_name('trans').get_value() rlocale = self.set_locale(lang) - name_format = menu.get_option_by_name("name_format").get_value() - if name_format != 0: - self._name_display.set_default_format(name_format) + stdoptions.run_name_format_option(self, menu) self.__narrator = Narrator(self.database, use_fulldate=True, nlocale=rlocale) diff --git a/gramps/plugins/textreport/birthdayreport.py b/gramps/plugins/textreport/birthdayreport.py index 25f91ff27..6442c2b12 100644 --- a/gramps/plugins/textreport/birthdayreport.py +++ b/gramps/plugins/textreport/birthdayreport.py @@ -74,6 +74,8 @@ _TITLE2 = _T_("Produced with Gramps") class BirthdayReport(Report): """ Create the BirthdayReport object that produces the report. + + name_format - Preferred format to display names """ def __init__(self, database, options, user): Report.__init__(self, database, options, user) @@ -100,9 +102,7 @@ class BirthdayReport(Report): lang = menu.get_option_by_name('trans').get_value() self._locale = self.set_locale(lang) - name_format = menu.get_option_by_name("name_format").get_value() - if name_format != 0: - self._name_display.set_default_format(name_format) + stdoptions.run_name_format_option(self, menu) self.center_person = database.get_person_from_gramps_id(pid) if (self.center_person == None) : diff --git a/gramps/plugins/textreport/descendreport.py b/gramps/plugins/textreport/descendreport.py index 1c5e924ed..2d7b024e3 100644 --- a/gramps/plugins/textreport/descendreport.py +++ b/gramps/plugins/textreport/descendreport.py @@ -357,9 +357,7 @@ class DescendantReport(Report): marrs = menu.get_option_by_name('marrs').get_value() divs = menu.get_option_by_name('divs').get_value() - name_format = menu.get_option_by_name("name_format").get_value() - if name_format != 0: - self._name_display.set_default_format(name_format) + stdoptions.run_name_format_option(self, menu) self.objPrint = Printinfo(self.doc, database, obj, marrs, divs, self._name_display, self._locale) diff --git a/gramps/plugins/textreport/detancestralreport.py b/gramps/plugins/textreport/detancestralreport.py index 405d6981f..3ea2ac13e 100644 --- a/gramps/plugins/textreport/detancestralreport.py +++ b/gramps/plugins/textreport/detancestralreport.py @@ -140,9 +140,7 @@ class DetAncestorReport(Report): lang = menu.get_option_by_name('trans').get_value() self._locale = self.set_locale(lang) - name_format = menu.get_option_by_name("name_format").get_value() - if name_format != 0: - self._name_display.set_default_format(name_format) + stdoptions.run_name_format_option(self, menu) self.gen_handles = {} self.prev_gen_handles = {} diff --git a/gramps/plugins/textreport/detdescendantreport.py b/gramps/plugins/textreport/detdescendantreport.py index 316884366..96eb63297 100644 --- a/gramps/plugins/textreport/detdescendantreport.py +++ b/gramps/plugins/textreport/detdescendantreport.py @@ -177,9 +177,7 @@ class DetDescendantReport(Report): self._locale = self.set_locale(get_value('trans')) - name_format = menu.get_option_by_name("name_format").get_value() - if name_format != 0: - self._name_display.set_default_format(name_format) + stdoptions.run_name_format_option(self, menu) self.__narrator = Narrator(self.db, self.verbose, use_call, use_fulldate, diff --git a/gramps/plugins/textreport/endoflinereport.py b/gramps/plugins/textreport/endoflinereport.py index 3db78aafa..2813e840d 100644 --- a/gramps/plugins/textreport/endoflinereport.py +++ b/gramps/plugins/textreport/endoflinereport.py @@ -78,9 +78,7 @@ class EndOfLineReport(Report): self.set_locale(menu.get_option_by_name('trans').get_value()) - name_format = menu.get_option_by_name("name_format").get_value() - if name_format != 0: - self._name_display.set_default_format(name_format) + stdoptions.run_name_format_option(self, menu) # eol_map is a map whose: # keys are the generations of the people diff --git a/gramps/plugins/textreport/familygroup.py b/gramps/plugins/textreport/familygroup.py index 2532d8be0..e46a935d7 100644 --- a/gramps/plugins/textreport/familygroup.py +++ b/gramps/plugins/textreport/familygroup.py @@ -101,9 +101,7 @@ class FamilyGroup(Report): rlocale = self.set_locale(get_value('trans')) self._ = rlocale.translation.sgettext # needed for English - name_format = menu.get_option_by_name("name_format").get_value() - if name_format != 0: - self._name_display.set_default_format(name_format) + stdoptions.run_name_format_option(self, menu) def dump_parent_event(self, name,event): place = "" diff --git a/gramps/plugins/textreport/indivcomplete.py b/gramps/plugins/textreport/indivcomplete.py index 128f3b9a2..c1aff718f 100644 --- a/gramps/plugins/textreport/indivcomplete.py +++ b/gramps/plugins/textreport/indivcomplete.py @@ -131,9 +131,7 @@ class IndivCompleteReport(Report): lang = menu.get_option_by_name('trans').get_value() self._locale = self.set_locale(lang) - name_format = menu.get_option_by_name("name_format").get_value() - if name_format != 0: - self._name_display.set_default_format(name_format) + stdoptions.run_name_format_option(self, menu) def write_fact(self, event_ref, event, show_type=True): """ diff --git a/gramps/plugins/textreport/kinshipreport.py b/gramps/plugins/textreport/kinshipreport.py index 602f2789a..916aa0823 100644 --- a/gramps/plugins/textreport/kinshipreport.py +++ b/gramps/plugins/textreport/kinshipreport.py @@ -92,9 +92,7 @@ class KinshipReport(Report): rlocale = self.set_locale(menu.get_option_by_name('trans').get_value()) - name_format = menu.get_option_by_name("name_format").get_value() - if name_format != 0: - self._name_display.set_default_format(name_format) + stdoptions.run_name_format_option(self, menu) self.__db = database self.rel_calc = get_relationship_calculator(reinit=True, diff --git a/gramps/plugins/textreport/numberofancestorsreport.py b/gramps/plugins/textreport/numberofancestorsreport.py index 9e22fd256..cd8324ffa 100644 --- a/gramps/plugins/textreport/numberofancestorsreport.py +++ b/gramps/plugins/textreport/numberofancestorsreport.py @@ -81,9 +81,7 @@ class NumberOfAncestorsReport(Report): lang = options.menu.get_option_by_name('trans').get_value() self._locale = self.set_locale(lang) - name_format = options.menu.get_option_by_name("name_format").get_value() - if name_format != 0: - self._name_display.set_default_format(name_format) + stdoptions.run_name_format_option(self, options.menu) def write_report(self): """ diff --git a/gramps/plugins/textreport/placereport.py b/gramps/plugins/textreport/placereport.py index dad731d6c..07c01ef49 100644 --- a/gramps/plugins/textreport/placereport.py +++ b/gramps/plugins/textreport/placereport.py @@ -70,6 +70,7 @@ class PlaceReport(Report): places - List of places to report on. center - Center of report, person or event incpriv - Whether to include private data + name_format - Preferred format to display names """ @@ -83,9 +84,7 @@ class PlaceReport(Report): self.set_locale(menu.get_option_by_name('trans').get_value()) - name_format = menu.get_option_by_name("name_format").get_value() - if name_format != 0: - self._name_display.set_default_format(name_format) + stdoptions.run_name_format_option(self, menu) self._nd = self._name_display if self.incpriv: diff --git a/gramps/plugins/textreport/tagreport.py b/gramps/plugins/textreport/tagreport.py index c79eb6d5f..081d0010c 100644 --- a/gramps/plugins/textreport/tagreport.py +++ b/gramps/plugins/textreport/tagreport.py @@ -84,9 +84,7 @@ class TagReport(Report): self.set_locale(menu.get_option_by_name('trans').get_value()) - name_format = menu.get_option_by_name("name_format").get_value() - if name_format != 0: - self._name_display.set_default_format(name_format) + stdoptions.run_name_format_option(self, menu) def write_report(self): self.doc.start_paragraph("TR-Title")