diff --git a/src/ArgHandler.py b/src/ArgHandler.py index d2aced753..4a2882ba5 100644 --- a/src/ArgHandler.py +++ b/src/ArgHandler.py @@ -450,7 +450,7 @@ class ArgHandler: self.vm.read_recent_file(rf, filetype) elif os.path.isdir(rf): if os.path.isfile(os.path.join(rf, "name.txt")) and \ - not os.path.isfile(os.path.join(rf,"need_recover"): + not os.path.isfile(os.path.join(rf,"need_recover")): self.vm.read_recent_file(rf, 'x-directory/normal') #------------------------------------------------------------------------- diff --git a/src/DbLoader.py b/src/DbLoader.py index 8c5f59f63..16db27c23 100644 --- a/src/DbLoader.py +++ b/src/DbLoader.py @@ -31,8 +31,6 @@ Handling of loading new/existing databases. #------------------------------------------------------------------------- import os import sys -from bsddb.db import DBAccessError, DBRunRecoveryError, \ - DBPageNotFoundError, DBInvalidArgError from gettext import gettext as _ import logging @@ -63,6 +61,7 @@ import GrampsDbUtils import Utils from PluginUtils import import_list import QuestionDialog +import Errors #------------------------------------------------------------------------- # @@ -456,20 +455,9 @@ class DbLoader: except OSError, msg: QuestionDialog.ErrorDialog( _("Could not open file: %s") % filename, str(msg)) - except DBRunRecoveryError, msg: - QuestionDialog.ErrorDialog( - _("Low level database corruption detected"), - _("GRAMPS has detected a problem in the underlying " - "Berkeley database. Please exit the program, and GRAMPS " - "will attempt to run the recovery repair operation " - "the next time you open this database. If this " - "problem persists, create a new database, import " - "from a backup database, and report the problem to " - "gramps-bugs@lists.sourceforge.net.")) - except (DBAccessError, DBPageNotFoundError, DBInvalidArgError), msg: - QuestionDialog.ErrorDialog( - _("Could not open file: %s") % filename, - str(msg[1])) + except Errors.DbError, msg: + QuestionDialog.DBErrorDialog(str(msg.value)) + self.dbstate.db.close() except Exception: _LOG.error("Failed to open database.", exc_info=True) diff --git a/src/DbManager.py b/src/DbManager.py index 578c32fc3..2176aadd0 100644 --- a/src/DbManager.py +++ b/src/DbManager.py @@ -102,6 +102,7 @@ class DbManager: self.dblist = self.glade.get_widget('dblist') self.rename = self.glade.get_widget('rename') self.repair = self.glade.get_widget('repair') + self.msg = self.glade.get_widget('msg') self.model = None self.dbstate = dbstate self.column = None @@ -355,7 +356,11 @@ class DbManager: db = dbclass(Config.get(Config.TRANSACTIONS)) db.set_save_path(dirname) db.load(dirname, None) + self.msg.set_label(_("Rebuilding database from backup files")) + while (gtk.events_pending()): + gtk.main_iteration() GrampsDbUtils.Backup.restore(db) + self.msg.set_label("") db.close() self.dbstate.no_database() self.populate() diff --git a/src/GrampsDb/_GrampsDBCallback.py b/src/GrampsDb/_GrampsDBCallback.py index 4103a55a9..345bd3324 100644 --- a/src/GrampsDb/_GrampsDBCallback.py +++ b/src/GrampsDb/_GrampsDBCallback.py @@ -42,7 +42,7 @@ import traceback import inspect from gettext import gettext as _ -from bsddb import db +import Errors log = sys.stderr.write @@ -414,7 +414,7 @@ class GrampsDBCallback(object): type(fn) == types.MethodType: # call func try: fn(*args) - except db.DBRunRecoveryError: + except Errors.DbError: display_error() else: self._warn("Badly formed entry in callback map.\n") diff --git a/src/GrampsDb/_GrampsDbConst.py b/src/GrampsDb/_GrampsDbConst.py index 1a6635bff..d4c9cb4e9 100644 --- a/src/GrampsDb/_GrampsDbConst.py +++ b/src/GrampsDb/_GrampsDbConst.py @@ -40,7 +40,6 @@ else: user_home = os.environ['HOME'] home_dir = os.path.join(user_home,'.gramps') -bsddbenv_dir = os.path.join(home_dir,"bsddbenv") env_dir = os.path.join(home_dir,"env") diff --git a/src/GrampsDbUtils/_ReadGedcom.py b/src/GrampsDbUtils/_ReadGedcom.py index 51f092ab5..ee8f37fc9 100644 --- a/src/GrampsDbUtils/_ReadGedcom.py +++ b/src/GrampsDbUtils/_ReadGedcom.py @@ -27,9 +27,7 @@ import gtk import Errors from _GedcomParse import GedcomParser, StageOne -from QuestionDialog import ErrorDialog -from bsddb import db - +from QuestionDialog import ErrorDialog, DBErrorDialog #------------------------------------------------------------------------- # @@ -102,11 +100,8 @@ def import2(database, filename, callback, code_set, use_trans): msg = _("%s could not be opened\n") % filename ErrorDialog(msg, str(msg)) return - except db.DBSecondaryBadError, msg: - WarningDialog(_('Database corruption detected'), - _('A problem was detected with the database. Please ' - 'run the Check and Repair Database tool to fix the ' - 'problem.')) + except Errors.DbError, msg: + DBErrorDialog(str(msg.value)) return except Errors.GedcomError, msg: ErrorDialog(_('Error reading GEDCOM file'), str(msg)) @@ -142,7 +137,7 @@ def import_from_string(database, text, callback, code_set, use_trans): msg = _("%s could not be opened\n") % 'inline-string' ErrorDialog(msg, str(msg)) return - except db.DBSecondaryBadError, msg: + except Errors.DbError, msg: WarningDialog(_('Database corruption detected'), _('A problem was detected with the database. Please ' 'run the Check and Repair Database tool to fix the ' diff --git a/src/QuestionDialog.py b/src/QuestionDialog.py index 55ac6519d..9f5c69efa 100644 --- a/src/QuestionDialog.py +++ b/src/QuestionDialog.py @@ -189,6 +189,16 @@ class RunDatabaseRepair(ErrorDialog): 'tool, please file a bug report at ' 'http://bugs.gramps-project.org\n\n') + str(msg)) +class DBErrorDialog(ErrorDialog): + def __init__(self, msg, parent=None): + ErrorDialog.__init__( + self, + _("Low level database corruption detected"), + _("GRAMPS has detected a problem in the underlying " + "Berkeley database. This can be repaired by from " + "the Family Tree Manager. Select the database and " + 'click on the Repair button') + '\n\n' + str(msg)) + class WarningDialog(gtk.MessageDialog): def __init__(self,msg1,msg2="",parent=None): diff --git a/src/ViewManager.py b/src/ViewManager.py index 64a80033a..737853851 100644 --- a/src/ViewManager.py +++ b/src/ViewManager.py @@ -970,15 +970,7 @@ class ViewManager: except: print "could not change directory" except Errors.DbError, msg: - QuestionDialog.ErrorDialog( - _("Low level database corruption detected"), - _("GRAMPS has detected a problem in the underlying " - "Berkeley database. Please exit the program, and GRAMPS " - "will attempt to run the recovery repair operation " - "the next time you open this database. If this " - "problem persists, create a new database, import " - "from a backup database, and report the problem to " - "gramps-bugs@lists.sourceforge.net.") + "\n\n" + str(msg.value)) + QuestionDialog.DBErrorDialog(str(msg.value)) self.state.no_database() except Exception: LOG.error("Failed to open database.", exc_info=True) diff --git a/src/const.py.in b/src/const.py.in index 67a952bdf..215a4495b 100644 --- a/src/const.py.in +++ b/src/const.py.in @@ -100,7 +100,6 @@ custom_filters = os.path.join(home_dir,"custom_filters.xml") report_options = os.path.join(home_dir,"report_options.xml") tool_options = os.path.join(home_dir,"tool_options.xml") thumb_dir = os.path.join(home_dir,"thumb") -bsddbenv_dir = os.path.join(home_dir,"bsddbenv") env_dir = os.path.join(home_dir,"env") icon = os.path.join(root_dir,"images","gramps.png") diff --git a/src/glade/gramps.glade b/src/glade/gramps.glade index a11c6cfad..72ab5b4ab 100644 --- a/src/glade/gramps.glade +++ b/src/glade/gramps.glade @@ -15426,7 +15426,7 @@ Very High GTK_WIN_POS_CENTER_ON_PARENT False 500 - 250 + 300 True False True @@ -15608,32 +15608,133 @@ Very High - + True False - 0 + 6 - + True - True - GTK_POLICY_AUTOMATIC - GTK_POLICY_AUTOMATIC - GTK_SHADOW_IN - GTK_CORNER_TOP_LEFT + False + 0 - + True True - True - False - False - True - False - False - False + GTK_POLICY_AUTOMATIC + GTK_POLICY_AUTOMATIC + GTK_SHADOW_IN + GTK_CORNER_TOP_LEFT + + + + True + True + True + False + False + True + False + False + False + + + + 0 + True + True + + + + + + True + False + 0 + + + + True + 0.5 + 0.5 + 1 + 1 + 0 + 0 + 12 + 0 + + + + True + GTK_BUTTONBOX_SPREAD + 0 + + + + True + True + True + gtk-new + True + GTK_RELIEF_NORMAL + True + + + + + + True + True + True + gtk-delete + True + GTK_RELIEF_NORMAL + True + + + + + + True + True + True + Rename + True + GTK_RELIEF_NORMAL + True + + + + + + True + True + True + Repair + True + GTK_RELIEF_NORMAL + True + + + + + + + 0 + True + True + + + + + 6 + False + True + @@ -15644,90 +15745,27 @@ Very High - + True - False - 0 - - - - True - 0.5 - 0.5 - 1 - 1 - 0 - 0 - 12 - 0 - - - - True - GTK_BUTTONBOX_SPREAD - 0 - - - - True - True - True - gtk-new - True - GTK_RELIEF_NORMAL - True - - - - - - True - True - True - gtk-delete - True - GTK_RELIEF_NORMAL - True - - - - - - True - True - True - Rename - True - GTK_RELIEF_NORMAL - True - - - - - - True - True - True - Repair - True - GTK_RELIEF_NORMAL - True - - - - - - - 0 - True - True - - + + False + False + GTK_JUSTIFY_CENTER + False + False + 0.5 + 0.5 + 0 + 0 + PANGO_ELLIPSIZE_NONE + -1 + False + 0 - 6 + 0 False - True + False