start using stdoptions.py's run_name_format_option

This commit is contained in:
Paul Franklin 2014-07-21 20:53:34 -07:00
parent aaecb02187
commit 0aac5469ca
17 changed files with 26 additions and 50 deletions

View File

@ -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)

View File

@ -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))

View File

@ -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 = {}

View File

@ -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):
"""

View File

@ -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'))

View File

@ -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)

View File

@ -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) :

View File

@ -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)

View File

@ -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 = {}

View File

@ -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,

View File

@ -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

View File

@ -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 = ""

View File

@ -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):
"""

View File

@ -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,

View File

@ -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):
"""

View File

@ -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:

View File

@ -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")