From 3ad774be3dfe2c5eeba9609780b0bbdda966d953 Mon Sep 17 00:00:00 2001 From: Alex Roitman Date: Sun, 17 Jun 2007 07:53:45 +0000 Subject: [PATCH] 2007-06-17 Alex Roitman * src/GrampsCfg.py (NameFormatEditDlg.cb_format_changed): Catch exception when format string is invalid. svn: r8571 --- gramps2/ChangeLog | 4 ++++ gramps2/src/GrampsCfg.py | 10 +++++++--- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/gramps2/ChangeLog b/gramps2/ChangeLog index 7bf8b9b0b..a752296d6 100644 --- a/gramps2/ChangeLog +++ b/gramps2/ChangeLog @@ -1,3 +1,7 @@ +2007-06-17 Alex Roitman + * src/GrampsCfg.py (NameFormatEditDlg.cb_format_changed): Catch + exception when format string is invalid. + 2007-06-16 Alex Roitman * src/gramps.py (run): Catch SystemExit exception. * src/ArgHandler.py: Use sys.exit() for bailing out. diff --git a/gramps2/src/GrampsCfg.py b/gramps2/src/GrampsCfg.py index 885c0e60c..81f430d6a 100644 --- a/gramps2/src/GrampsCfg.py +++ b/gramps2/src/GrampsCfg.py @@ -1,7 +1,7 @@ # # Gramps - a GTK+/GNOME based genealogy program # -# Copyright (C) 2000-2006 Donald N. Allingham +# Copyright (C) 2000-2007 Donald N. Allingham # # 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 @@ -610,8 +610,12 @@ class NameFormatEditDlg: return (self.response, self.fmt_name, self.fmt_str) def cb_format_changed(self,obj): - t = (_nd.format_str(self.name,obj.get_text())) - self.examplelabel.set_text('%s' % t) + try: + t = (_nd.format_str(self.name,obj.get_text())) + except ValueError, msg: + t = _("Invalid format string: %s") % msg + self.examplelabel.set_text( + '%s' % t) self.examplelabel.set_use_markup(True)