From 5814acc1e373d9dd80329965bc0525b9a4df0959 Mon Sep 17 00:00:00 2001 From: Zsolt Foldvari Date: Sat, 29 Jul 2006 20:56:11 +0000 Subject: [PATCH] 2006-07-29 Zsolt Foldvari * src/NameDisplay.py (display_given): Cleanup * src/Gramps.Cfg.py (NameFormatEditDlg.run): Verification of the returned values svn: r7088 --- ChangeLog | 5 +++++ src/GrampsCfg.py | 20 +++++++++++++++++--- src/NameDisplay.py | 5 +---- 3 files changed, 23 insertions(+), 7 deletions(-) diff --git a/ChangeLog b/ChangeLog index 24723536f..312aef2b8 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2006-07-29 Zsolt Foldvari + * src/NameDisplay.py (display_given): Cleanup + * src/Gramps.Cfg.py (NameFormatEditDlg.run): Verification of the + returned values + 2006-07-27 Alex Roitman * src/GrampsDb/_ReadGrdb.py: Re-map name formats on import. * src/GrampsDb/_GrampsBSDDB.py (_load_metadata): Upgrade custom diff --git a/src/GrampsCfg.py b/src/GrampsCfg.py index 8778bb84b..960e50c29 100644 --- a/src/GrampsCfg.py +++ b/src/GrampsCfg.py @@ -45,6 +45,7 @@ from NameDisplay import displayer as _nd from RelLib import Name import ManagedWindow from GrampsWidgets import * +import QuestionDialog #------------------------------------------------------------------------- # @@ -600,9 +601,22 @@ class NameFormatEditDlg: self.formatentry.set_text(self.fmt_str) def run(self): - self.response = self.dlg.run() - self.fmt_name = self.nameentry.get_text() - self.fmt_str = self.formatentry.get_text() + running = True + while running: + self.response = self.dlg.run() + + running = False + self.fmt_name = self.nameentry.get_text() + self.fmt_str = self.formatentry.get_text() + + if self.response == gtk.RESPONSE_OK: + if self.fmt_name == '' and self.fmt_str == '': + self.response = gtk.RESPONSE_CANCEL + elif (self.fmt_name == '') ^ (self.fmt_str == ''): + QuestionDialog.ErrorDialog( + _('Both Format name and definition have to be defined'), + parent=self.dlg) + running = True self.dlg.destroy() return (self.response, self.fmt_name, self.fmt_str) diff --git a/src/NameDisplay.py b/src/NameDisplay.py index 6142fb0d0..20a5f3ac0 100644 --- a/src/NameDisplay.py +++ b/src/NameDisplay.py @@ -450,10 +450,7 @@ class NameDisplay: def display_given(self,person): name = person.get_primary_name() - if name.patronymic: - return "%s %s" % (name.first_name, name.patronymic) - else: - return name.first_name + return self.format_str(person.get_primary_name(),'%f %y') def name_grouping(self,db,person): return self.name_grouping_name(db,person.primary_name)