svn: r8540
This commit is contained in:
@ -450,7 +450,7 @@ class ArgHandler:
|
|||||||
self.vm.read_recent_file(rf, filetype)
|
self.vm.read_recent_file(rf, filetype)
|
||||||
elif os.path.isdir(rf):
|
elif os.path.isdir(rf):
|
||||||
if os.path.isfile(os.path.join(rf, "name.txt")) and \
|
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')
|
self.vm.read_recent_file(rf, 'x-directory/normal')
|
||||||
|
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
|
@ -31,8 +31,6 @@ Handling of loading new/existing databases.
|
|||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
from bsddb.db import DBAccessError, DBRunRecoveryError, \
|
|
||||||
DBPageNotFoundError, DBInvalidArgError
|
|
||||||
from gettext import gettext as _
|
from gettext import gettext as _
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
@ -63,6 +61,7 @@ import GrampsDbUtils
|
|||||||
import Utils
|
import Utils
|
||||||
from PluginUtils import import_list
|
from PluginUtils import import_list
|
||||||
import QuestionDialog
|
import QuestionDialog
|
||||||
|
import Errors
|
||||||
|
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
@ -456,20 +455,9 @@ class DbLoader:
|
|||||||
except OSError, msg:
|
except OSError, msg:
|
||||||
QuestionDialog.ErrorDialog(
|
QuestionDialog.ErrorDialog(
|
||||||
_("Could not open file: %s") % filename, str(msg))
|
_("Could not open file: %s") % filename, str(msg))
|
||||||
except DBRunRecoveryError, msg:
|
except Errors.DbError, msg:
|
||||||
QuestionDialog.ErrorDialog(
|
QuestionDialog.DBErrorDialog(str(msg.value))
|
||||||
_("Low level database corruption detected"),
|
self.dbstate.db.close()
|
||||||
_("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 Exception:
|
except Exception:
|
||||||
_LOG.error("Failed to open database.", exc_info=True)
|
_LOG.error("Failed to open database.", exc_info=True)
|
||||||
|
|
||||||
|
@ -102,6 +102,7 @@ class DbManager:
|
|||||||
self.dblist = self.glade.get_widget('dblist')
|
self.dblist = self.glade.get_widget('dblist')
|
||||||
self.rename = self.glade.get_widget('rename')
|
self.rename = self.glade.get_widget('rename')
|
||||||
self.repair = self.glade.get_widget('repair')
|
self.repair = self.glade.get_widget('repair')
|
||||||
|
self.msg = self.glade.get_widget('msg')
|
||||||
self.model = None
|
self.model = None
|
||||||
self.dbstate = dbstate
|
self.dbstate = dbstate
|
||||||
self.column = None
|
self.column = None
|
||||||
@ -355,7 +356,11 @@ class DbManager:
|
|||||||
db = dbclass(Config.get(Config.TRANSACTIONS))
|
db = dbclass(Config.get(Config.TRANSACTIONS))
|
||||||
db.set_save_path(dirname)
|
db.set_save_path(dirname)
|
||||||
db.load(dirname, None)
|
db.load(dirname, None)
|
||||||
|
self.msg.set_label(_("Rebuilding database from backup files"))
|
||||||
|
while (gtk.events_pending()):
|
||||||
|
gtk.main_iteration()
|
||||||
GrampsDbUtils.Backup.restore(db)
|
GrampsDbUtils.Backup.restore(db)
|
||||||
|
self.msg.set_label("")
|
||||||
db.close()
|
db.close()
|
||||||
self.dbstate.no_database()
|
self.dbstate.no_database()
|
||||||
self.populate()
|
self.populate()
|
||||||
|
@ -42,7 +42,7 @@ import traceback
|
|||||||
import inspect
|
import inspect
|
||||||
from gettext import gettext as _
|
from gettext import gettext as _
|
||||||
|
|
||||||
from bsddb import db
|
import Errors
|
||||||
|
|
||||||
log = sys.stderr.write
|
log = sys.stderr.write
|
||||||
|
|
||||||
@ -414,7 +414,7 @@ class GrampsDBCallback(object):
|
|||||||
type(fn) == types.MethodType: # call func
|
type(fn) == types.MethodType: # call func
|
||||||
try:
|
try:
|
||||||
fn(*args)
|
fn(*args)
|
||||||
except db.DBRunRecoveryError:
|
except Errors.DbError:
|
||||||
display_error()
|
display_error()
|
||||||
else:
|
else:
|
||||||
self._warn("Badly formed entry in callback map.\n")
|
self._warn("Badly formed entry in callback map.\n")
|
||||||
|
@ -40,7 +40,6 @@ else:
|
|||||||
user_home = os.environ['HOME']
|
user_home = os.environ['HOME']
|
||||||
home_dir = os.path.join(user_home,'.gramps')
|
home_dir = os.path.join(user_home,'.gramps')
|
||||||
|
|
||||||
bsddbenv_dir = os.path.join(home_dir,"bsddbenv")
|
|
||||||
env_dir = os.path.join(home_dir,"env")
|
env_dir = os.path.join(home_dir,"env")
|
||||||
|
|
||||||
|
|
||||||
|
@ -27,9 +27,7 @@ import gtk
|
|||||||
|
|
||||||
import Errors
|
import Errors
|
||||||
from _GedcomParse import GedcomParser, StageOne
|
from _GedcomParse import GedcomParser, StageOne
|
||||||
from QuestionDialog import ErrorDialog
|
from QuestionDialog import ErrorDialog, DBErrorDialog
|
||||||
from bsddb import db
|
|
||||||
|
|
||||||
|
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
@ -102,11 +100,8 @@ def import2(database, filename, callback, code_set, use_trans):
|
|||||||
msg = _("%s could not be opened\n") % filename
|
msg = _("%s could not be opened\n") % filename
|
||||||
ErrorDialog(msg, str(msg))
|
ErrorDialog(msg, str(msg))
|
||||||
return
|
return
|
||||||
except db.DBSecondaryBadError, msg:
|
except Errors.DbError, msg:
|
||||||
WarningDialog(_('Database corruption detected'),
|
DBErrorDialog(str(msg.value))
|
||||||
_('A problem was detected with the database. Please '
|
|
||||||
'run the Check and Repair Database tool to fix the '
|
|
||||||
'problem.'))
|
|
||||||
return
|
return
|
||||||
except Errors.GedcomError, msg:
|
except Errors.GedcomError, msg:
|
||||||
ErrorDialog(_('Error reading GEDCOM file'), str(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'
|
msg = _("%s could not be opened\n") % 'inline-string'
|
||||||
ErrorDialog(msg, str(msg))
|
ErrorDialog(msg, str(msg))
|
||||||
return
|
return
|
||||||
except db.DBSecondaryBadError, msg:
|
except Errors.DbError, msg:
|
||||||
WarningDialog(_('Database corruption detected'),
|
WarningDialog(_('Database corruption detected'),
|
||||||
_('A problem was detected with the database. Please '
|
_('A problem was detected with the database. Please '
|
||||||
'run the Check and Repair Database tool to fix the '
|
'run the Check and Repair Database tool to fix the '
|
||||||
|
@ -189,6 +189,16 @@ class RunDatabaseRepair(ErrorDialog):
|
|||||||
'tool, please file a bug report at '
|
'tool, please file a bug report at '
|
||||||
'http://bugs.gramps-project.org\n\n') + str(msg))
|
'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):
|
class WarningDialog(gtk.MessageDialog):
|
||||||
def __init__(self,msg1,msg2="",parent=None):
|
def __init__(self,msg1,msg2="",parent=None):
|
||||||
|
|
||||||
|
@ -970,15 +970,7 @@ class ViewManager:
|
|||||||
except:
|
except:
|
||||||
print "could not change directory"
|
print "could not change directory"
|
||||||
except Errors.DbError, msg:
|
except Errors.DbError, msg:
|
||||||
QuestionDialog.ErrorDialog(
|
QuestionDialog.DBErrorDialog(str(msg.value))
|
||||||
_("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))
|
|
||||||
self.state.no_database()
|
self.state.no_database()
|
||||||
except Exception:
|
except Exception:
|
||||||
LOG.error("Failed to open database.", exc_info=True)
|
LOG.error("Failed to open database.", exc_info=True)
|
||||||
|
@ -100,7 +100,6 @@ custom_filters = os.path.join(home_dir,"custom_filters.xml")
|
|||||||
report_options = os.path.join(home_dir,"report_options.xml")
|
report_options = os.path.join(home_dir,"report_options.xml")
|
||||||
tool_options = os.path.join(home_dir,"tool_options.xml")
|
tool_options = os.path.join(home_dir,"tool_options.xml")
|
||||||
thumb_dir = os.path.join(home_dir,"thumb")
|
thumb_dir = os.path.join(home_dir,"thumb")
|
||||||
bsddbenv_dir = os.path.join(home_dir,"bsddbenv")
|
|
||||||
env_dir = os.path.join(home_dir,"env")
|
env_dir = os.path.join(home_dir,"env")
|
||||||
|
|
||||||
icon = os.path.join(root_dir,"images","gramps.png")
|
icon = os.path.join(root_dir,"images","gramps.png")
|
||||||
|
@ -15426,7 +15426,7 @@ Very High</property>
|
|||||||
<property name="window_position">GTK_WIN_POS_CENTER_ON_PARENT</property>
|
<property name="window_position">GTK_WIN_POS_CENTER_ON_PARENT</property>
|
||||||
<property name="modal">False</property>
|
<property name="modal">False</property>
|
||||||
<property name="default_width">500</property>
|
<property name="default_width">500</property>
|
||||||
<property name="default_height">250</property>
|
<property name="default_height">300</property>
|
||||||
<property name="resizable">True</property>
|
<property name="resizable">True</property>
|
||||||
<property name="destroy_with_parent">False</property>
|
<property name="destroy_with_parent">False</property>
|
||||||
<property name="decorated">True</property>
|
<property name="decorated">True</property>
|
||||||
@ -15607,6 +15607,12 @@ Very High</property>
|
|||||||
</packing>
|
</packing>
|
||||||
</child>
|
</child>
|
||||||
|
|
||||||
|
<child>
|
||||||
|
<widget class="GtkVBox" id="vbox132">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="homogeneous">False</property>
|
||||||
|
<property name="spacing">6</property>
|
||||||
|
|
||||||
<child>
|
<child>
|
||||||
<widget class="GtkHBox" id="hbox138">
|
<widget class="GtkHBox" id="hbox138">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
@ -15737,6 +15743,38 @@ Very High</property>
|
|||||||
<property name="fill">True</property>
|
<property name="fill">True</property>
|
||||||
</packing>
|
</packing>
|
||||||
</child>
|
</child>
|
||||||
|
|
||||||
|
<child>
|
||||||
|
<widget class="GtkLabel" id="msg">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="label" translatable="yes"></property>
|
||||||
|
<property name="use_underline">False</property>
|
||||||
|
<property name="use_markup">False</property>
|
||||||
|
<property name="justify">GTK_JUSTIFY_CENTER</property>
|
||||||
|
<property name="wrap">False</property>
|
||||||
|
<property name="selectable">False</property>
|
||||||
|
<property name="xalign">0.5</property>
|
||||||
|
<property name="yalign">0.5</property>
|
||||||
|
<property name="xpad">0</property>
|
||||||
|
<property name="ypad">0</property>
|
||||||
|
<property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
|
||||||
|
<property name="width_chars">-1</property>
|
||||||
|
<property name="single_line_mode">False</property>
|
||||||
|
<property name="angle">0</property>
|
||||||
|
</widget>
|
||||||
|
<packing>
|
||||||
|
<property name="padding">0</property>
|
||||||
|
<property name="expand">False</property>
|
||||||
|
<property name="fill">False</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
</widget>
|
||||||
|
<packing>
|
||||||
|
<property name="padding">0</property>
|
||||||
|
<property name="expand">True</property>
|
||||||
|
<property name="fill">True</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
</widget>
|
</widget>
|
||||||
</child>
|
</child>
|
||||||
</widget>
|
</widget>
|
||||||
|
Reference in New Issue
Block a user