From fc68033c3a45ec28ec73ae149d066388aaf3f852 Mon Sep 17 00:00:00 2001 From: Paul Franklin Date: Mon, 3 Oct 2011 22:51:19 +0000 Subject: [PATCH] =?UTF-8?q?3165:=20Fix=20printing=20of=20marriage=20string?= =?UTF-8?q?s=20in=20Det{Asc/Desc}Reports=20--=20original=20patch=20from=20?= =?UTF-8?q?Vlada=20Peri=C4=87=20(vlada.peric@gmail.com),=20then=20split=20?= =?UTF-8?q?in=20two=20by=20Matt=20Keenan=20(matt.keenan@gmail.com)=20--=20?= =?UTF-8?q?both=20were=20applied?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit svn: r18248 --- src/plugins/lib/libnarrate.py | 45 +++++++++++++++++++---------------- 1 file changed, 24 insertions(+), 21 deletions(-) diff --git a/src/plugins/lib/libnarrate.py b/src/plugins/lib/libnarrate.py index f387c00db..3760e2a6d 100644 --- a/src/plugins/lib/libnarrate.py +++ b/src/plugins/lib/libnarrate.py @@ -1,8 +1,11 @@ +# -*- coding: utf-8 -*- # # Gramps - a GTK+/GNOME based genealogy program # # Copyright (C) 2009 Brian G. Matherly # Copyright (C) 2010 Jakim Friant +# Copyright (C) 2011 Vlada Perić +# Copyright (C) 2011 Matt Keenan # # 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 @@ -2096,16 +2099,16 @@ class Narrator(object): spouse = self.__db.get_person_from_handle(spouse_handle) event = ReportUtils.find_marriage(self.__db, family) - # not all families have a spouse. - if not spouse: - return u"" - date = self.__empty_date place = self.__empty_place - if not name_display: - spouse_name = _nd.display(spouse) + if spouse: + if not name_display: + spouse_name = _nd.display(spouse) + else: + spouse_name = name_display.display(spouse) else: - spouse_name = name_display.display(spouse) + # not all families have a spouse. + spouse_name = _("Unknown") if event: if self.__use_fulldate : @@ -2129,6 +2132,8 @@ class Narrator(object): 'place' : place, } + date_full = 0 + if event: dobj = event.get_date_object() @@ -2136,8 +2141,6 @@ class Narrator(object): date_full = 2 elif dobj and dobj.get_day_valid(): date_full = 1 - else: - date_full = 0 gender = self.__person.get_gender() @@ -2155,42 +2158,42 @@ class Narrator(object): # describe type if is_first: - if event and date and place and self.__verbose: + if date and place and self.__verbose: if relationship == FamilyRelType.MARRIED: text = marriage_first_date_place[gender][date_full] elif relationship == FamilyRelType.UNMARRIED: text = unmarried_first_date_place[gender][date_full] else: text = relationship_first_date_place[gender][date_full] - elif event and date and place: + elif date and place: if relationship == FamilyRelType.MARRIED: text = marriage_first_date_place['succinct'][date_full] elif relationship == FamilyRelType.UNMARRIED: text = unmarried_first_date_place['succinct'][date_full] else: text = relationship_first_date_place['succinct'][date_full] - elif event and date and self.__verbose: + elif date and self.__verbose: if relationship == FamilyRelType.MARRIED: text = marriage_first_date[gender][date_full] elif relationship == FamilyRelType.UNMARRIED: text = unmarried_first_date[gender][date_full] else: text = relationship_first_date[gender][date_full] - elif event and date: + elif date: if relationship == FamilyRelType.MARRIED: text = marriage_first_date['succinct'][date_full] elif relationship == FamilyRelType.UNMARRIED: text = unmarried_first_date['succinct'][date_full] else: text = relationship_first_date['succinct'][date_full] - elif event and place and self.__verbose: + elif place and self.__verbose: if relationship == FamilyRelType.MARRIED: text = marriage_first_place[gender] elif relationship == FamilyRelType.UNMARRIED: text = unmarried_first_place[gender] else: text = relationship_first_place[gender] - elif event and place: + elif place: if relationship == FamilyRelType.MARRIED: text = marriage_first_place['succinct'] elif relationship == FamilyRelType.UNMARRIED: @@ -2212,42 +2215,42 @@ class Narrator(object): else: text = relationship_first_only['succinct'] else: - if event and date and place and self.__verbose: + if date and place and self.__verbose: if relationship == FamilyRelType.MARRIED: text = marriage_also_date_place[gender][date_full] elif relationship == FamilyRelType.UNMARRIED: text = unmarried_also_date_place[gender][date_full] else: text = relationship_also_date_place[gender][date_full] - if event and date and place: + if date and place: if relationship == FamilyRelType.MARRIED: text = marriage_also_date_place['succinct'][date_full] elif relationship == FamilyRelType.UNMARRIED: text = unmarried_also_date_place['succinct'][date_full] else: text = relationship_also_date_place['succinct'][date_full] - elif event and date and self.__verbose: + elif date and self.__verbose: if relationship == FamilyRelType.MARRIED: text = marriage_also_date[gender][date_full] elif relationship == FamilyRelType.UNMARRIED: text = unmarried_also_date[gender][date_full] else: text = relationship_also_date[gender][date_full] - elif event and date: + elif date: if relationship == FamilyRelType.MARRIED: text = marriage_also_date['succinct'][date_full] elif relationship == FamilyRelType.UNMARRIED: text = unmarried_also_date['succinct'][date_full] else: text = relationship_also_date['succinct'][date_full] - elif event and place and self.__verbose: + elif place and self.__verbose: if relationship == FamilyRelType.MARRIED: text = marriage_also_place[gender] elif relationship == FamilyRelType.UNMARRIED: text = unmarried_also_place[gender] else: text = relationship_also_place[gender] - elif event and place: + elif place: if relationship == FamilyRelType.MARRIED: text = marriage_also_place['succinct'] elif relationship == FamilyRelType.UNMARRIED: