From fa8085031bdd049de4b95bb97690d9b47fb8f570 Mon Sep 17 00:00:00 2001 From: Don Allingham Date: Mon, 11 Dec 2006 04:10:46 +0000 Subject: [PATCH] 2006-12-10 Don Allingham * src/DataViews/_RelationView.py: RunDatabaseRepair integration * src/GrampsDb/_WriteGedcom.py: RunDatabaseRepair integration * src/QuestionDialog.py: RunDatabaseRepair dialog to warn users to run database checks svn: r7777 --- ChangeLog | 6 ++++++ src/DataViews/_RelationView.py | 7 +++++++ src/GrampsDb/_WriteGedcom.py | 6 ++++-- src/QuestionDialog.py | 11 +++++++++++ 4 files changed, 28 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 75862ef19..45f4d8c7a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2006-12-10 Don Allingham + * src/DataViews/_RelationView.py: RunDatabaseRepair integration + * src/GrampsDb/_WriteGedcom.py: RunDatabaseRepair integration + * src/QuestionDialog.py: RunDatabaseRepair dialog to warn users to run + database checks + 2006-12-10 Martin Hawlisch * src/DisplayModels/_PeopleModel.py: Fix birth date fallback diff --git a/src/DataViews/_RelationView.py b/src/DataViews/_RelationView.py index c0d28a0da..8103006ab 100644 --- a/src/DataViews/_RelationView.py +++ b/src/DataViews/_RelationView.py @@ -372,6 +372,13 @@ class RelationshipView(PageView.PersonNavView): self.change_person(None) def change_person(self, obj): + try: + self._change_person(obj) + except AttributeError, msg: + from QuestionDialog import RunDatabaseRepair + RunDatabaseRepair(msg) + + def _change_person(self, obj): if self.redrawing: return False self.redrawing = True diff --git a/src/GrampsDb/_WriteGedcom.py b/src/GrampsDb/_WriteGedcom.py index 2e324eed3..360af1da1 100644 --- a/src/GrampsDb/_WriteGedcom.py +++ b/src/GrampsDb/_WriteGedcom.py @@ -60,7 +60,7 @@ import Errors import ansel_utf8 import Utils import NameDisplay -from QuestionDialog import ErrorDialog, WarningDialog, MessageHideDialog +from QuestionDialog import * from BasicUtils import UpdateCallback #------------------------------------------------------------------------ @@ -1490,7 +1490,9 @@ def exportData(database,filename,person,option_box,callback=None): try: gw = GedcomWriter(database,person,0,filename,option_box,callback) ret = gw.export_data(filename) - except Errors.DatabaseError,msg: + except AttributeError, msg: + RunDatabaseRepair(msg) + except Errors.DatabaseError, msg: ErrorDialog(_("Export failed"),str(msg)) return ret diff --git a/src/QuestionDialog.py b/src/QuestionDialog.py index 4675490ee..597af2c54 100644 --- a/src/QuestionDialog.py +++ b/src/QuestionDialog.py @@ -178,6 +178,17 @@ class ErrorDialog(gtk.MessageDialog): self.run() self.destroy() +class RunDatabaseRepair(ErrorDialog): + def __init__(self, msg, parent=None): + ErrorDialog.__init__( + self, + _('Error detected in database'), + _('GRAMPS has detected an error in the database. This can ' + 'usually be resolved by running the "Check and Repair Database" ' + 'tool.\n\nIf this problem continues to exist after running this ' + 'tool, please file a bug report at ' + 'http://bugs.gramps-project.org\n\n') + str(msg)) + class WarningDialog(gtk.MessageDialog): def __init__(self,msg1,msg2="",parent=None):