Added DisplayTrace class to warn on tracebacks
svn: r1024
This commit is contained in:
parent
fb1052623d
commit
469766b972
73
gramps/src/DisplayTrace.py
Normal file
73
gramps/src/DisplayTrace.py
Normal file
@ -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()
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -1093,7 +1093,7 @@ class GedcomParser:
|
|||||||
info = matches[2] + self.parse_continue_data(level+1)
|
info = matches[2] + self.parse_continue_data(level+1)
|
||||||
event.setCause(info)
|
event.setCause(info)
|
||||||
self.parse_cause(event,level+1)
|
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)
|
info = matches[2] + self.parse_continue_data(level+1)
|
||||||
if note == "":
|
if note == "":
|
||||||
note = info
|
note = info
|
||||||
@ -1236,6 +1236,8 @@ class GedcomParser:
|
|||||||
while 1:
|
while 1:
|
||||||
matches = self.get_next()
|
matches = self.get_next()
|
||||||
if int(matches[0]) < level:
|
if int(matches[0]) < level:
|
||||||
|
if note:
|
||||||
|
event.setNote(note)
|
||||||
self.backup()
|
self.backup()
|
||||||
break
|
break
|
||||||
elif matches[1] == "TYPE":
|
elif matches[1] == "TYPE":
|
||||||
@ -1265,6 +1267,11 @@ class GedcomParser:
|
|||||||
self.placemap[val] = place
|
self.placemap[val] = place
|
||||||
event.setPlace(place)
|
event.setPlace(place)
|
||||||
self.ignore_sub_junk(level+1)
|
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":
|
elif matches[1] == "NOTE":
|
||||||
if not string.strip(matches[2]) or matches[2] and matches[2][0] != "@":
|
if not string.strip(matches[2]) or matches[2] and matches[2][0] != "@":
|
||||||
note = matches[2] + self.parse_continue_data(level+1)
|
note = matches[2] + self.parse_continue_data(level+1)
|
||||||
|
Loading…
Reference in New Issue
Block a user