From 469766b97278618e85c0b2b8106b6eaee669d3ea Mon Sep 17 00:00:00 2001 From: Don Allingham Date: Tue, 11 Jun 2002 17:56:14 +0000 Subject: [PATCH] Added DisplayTrace class to warn on tracebacks svn: r1024 --- gramps/src/DisplayTrace.py | 73 ++++++++++++++++++++++++++++++++ gramps/src/plugins/ReadGedcom.py | 9 +++- 2 files changed, 81 insertions(+), 1 deletion(-) create mode 100644 gramps/src/DisplayTrace.py diff --git a/gramps/src/DisplayTrace.py b/gramps/src/DisplayTrace.py new file mode 100644 index 000000000..85e5a89d2 --- /dev/null +++ b/gramps/src/DisplayTrace.py @@ -0,0 +1,73 @@ +# +# Gramps - a GTK+/GNOME based genealogy program +# +# Copyright (C) 2002 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 +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# + +#------------------------------------------------------------------------- +# +# Standard python modules +# +#------------------------------------------------------------------------- +import cStringIO +import traceback +import sys + +#------------------------------------------------------------------------- +# +# GTK/GNOME modules +# +#------------------------------------------------------------------------- +import libglade + +#------------------------------------------------------------------------- +# +# GRAMPS modules +# +#------------------------------------------------------------------------- +import const +import intl + +_ = intl.gettext + +#------------------------------------------------------------------------- +# +# DisplayTrace +# +#------------------------------------------------------------------------- +class DisplayTrace: + + def __init__(self): + data = sys.exc_info() + msg = cStringIO.StringIO() + msg.write(_('GRAMPS has encountered an internal error.\n' + 'Please copy the message below and post a bug report ' + 'at http://sourceforge.net/projects/gramps or send an ' + 'email message to gramps-users@lists.sourceforge.net\n\n')) + + traceback.print_exception(data[0],data[1],data[2],None,msg) + + self.glade = libglade.GladeXML(const.pluginsFile,"plugstat") + self.top = self.glade.get_widget("plugstat") + window = self.glade.get_widget("text") + self.top.set_title(_('Internal Error - GRAMPS')) + + window.show_string(msg.getvalue()) + self.top.run_and_close() + + + diff --git a/gramps/src/plugins/ReadGedcom.py b/gramps/src/plugins/ReadGedcom.py index 7d7718270..2239dbffb 100644 --- a/gramps/src/plugins/ReadGedcom.py +++ b/gramps/src/plugins/ReadGedcom.py @@ -1093,7 +1093,7 @@ class GedcomParser: info = matches[2] + self.parse_continue_data(level+1) event.setCause(info) self.parse_cause(event,level+1) - elif matches[1] == "NOTE": + elif matches[1] == "NOTE" or matches[1] == 'OFFI': info = matches[2] + self.parse_continue_data(level+1) if note == "": note = info @@ -1236,6 +1236,8 @@ class GedcomParser: while 1: matches = self.get_next() if int(matches[0]) < level: + if note: + event.setNote(note) self.backup() break elif matches[1] == "TYPE": @@ -1265,6 +1267,11 @@ class GedcomParser: self.placemap[val] = place event.setPlace(place) self.ignore_sub_junk(level+1) + elif matches[1] == 'OFFI': + if note == "": + note = matches[2] + else: + note = note + "\n" + matches[2] elif matches[1] == "NOTE": if not string.strip(matches[2]) or matches[2] and matches[2][0] != "@": note = matches[2] + self.parse_continue_data(level+1)