svn: r8540
This commit is contained in:
parent
c730a8f5c4
commit
150a0fc05d
@ -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')
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
|
@ -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)
|
||||
|
||||
|
@ -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()
|
||||
|
@ -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")
|
||||
|
@ -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")
|
||||
|
||||
|
||||
|
@ -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 '
|
||||
|
@ -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):
|
||||
|
||||
|
@ -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)
|
||||
|
@ -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")
|
||||
|
@ -15426,7 +15426,7 @@ Very High</property>
|
||||
<property name="window_position">GTK_WIN_POS_CENTER_ON_PARENT</property>
|
||||
<property name="modal">False</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="destroy_with_parent">False</property>
|
||||
<property name="decorated">True</property>
|
||||
@ -15608,32 +15608,133 @@ Very High</property>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkHBox" id="hbox138">
|
||||
<widget class="GtkVBox" id="vbox132">
|
||||
<property name="visible">True</property>
|
||||
<property name="homogeneous">False</property>
|
||||
<property name="spacing">0</property>
|
||||
<property name="spacing">6</property>
|
||||
|
||||
<child>
|
||||
<widget class="GtkScrolledWindow" id="scrolledwindow88">
|
||||
<widget class="GtkHBox" id="hbox138">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="hscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
|
||||
<property name="vscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
|
||||
<property name="shadow_type">GTK_SHADOW_IN</property>
|
||||
<property name="window_placement">GTK_CORNER_TOP_LEFT</property>
|
||||
<property name="homogeneous">False</property>
|
||||
<property name="spacing">0</property>
|
||||
|
||||
<child>
|
||||
<widget class="GtkTreeView" id="dblist">
|
||||
<widget class="GtkScrolledWindow" id="scrolledwindow88">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="headers_visible">True</property>
|
||||
<property name="rules_hint">False</property>
|
||||
<property name="reorderable">False</property>
|
||||
<property name="enable_search">True</property>
|
||||
<property name="fixed_height_mode">False</property>
|
||||
<property name="hover_selection">False</property>
|
||||
<property name="hover_expand">False</property>
|
||||
<property name="hscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
|
||||
<property name="vscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
|
||||
<property name="shadow_type">GTK_SHADOW_IN</property>
|
||||
<property name="window_placement">GTK_CORNER_TOP_LEFT</property>
|
||||
|
||||
<child>
|
||||
<widget class="GtkTreeView" id="dblist">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="headers_visible">True</property>
|
||||
<property name="rules_hint">False</property>
|
||||
<property name="reorderable">False</property>
|
||||
<property name="enable_search">True</property>
|
||||
<property name="fixed_height_mode">False</property>
|
||||
<property name="hover_selection">False</property>
|
||||
<property name="hover_expand">False</property>
|
||||
</widget>
|
||||
</child>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="padding">0</property>
|
||||
<property name="expand">True</property>
|
||||
<property name="fill">True</property>
|
||||
</packing>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkVBox" id="vbox132">
|
||||
<property name="visible">True</property>
|
||||
<property name="homogeneous">False</property>
|
||||
<property name="spacing">0</property>
|
||||
|
||||
<child>
|
||||
<widget class="GtkAlignment" id="alignment7">
|
||||
<property name="visible">True</property>
|
||||
<property name="xalign">0.5</property>
|
||||
<property name="yalign">0.5</property>
|
||||
<property name="xscale">1</property>
|
||||
<property name="yscale">1</property>
|
||||
<property name="top_padding">0</property>
|
||||
<property name="bottom_padding">0</property>
|
||||
<property name="left_padding">12</property>
|
||||
<property name="right_padding">0</property>
|
||||
|
||||
<child>
|
||||
<widget class="GtkVButtonBox" id="vbuttonbox2">
|
||||
<property name="visible">True</property>
|
||||
<property name="layout_style">GTK_BUTTONBOX_SPREAD</property>
|
||||
<property name="spacing">0</property>
|
||||
|
||||
<child>
|
||||
<widget class="GtkButton" id="new">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_default">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="label">gtk-new</property>
|
||||
<property name="use_stock">True</property>
|
||||
<property name="relief">GTK_RELIEF_NORMAL</property>
|
||||
<property name="focus_on_click">True</property>
|
||||
</widget>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkButton" id="remove">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_default">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="label">gtk-delete</property>
|
||||
<property name="use_stock">True</property>
|
||||
<property name="relief">GTK_RELIEF_NORMAL</property>
|
||||
<property name="focus_on_click">True</property>
|
||||
</widget>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkButton" id="rename">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_default">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="label" translatable="yes">Rename</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="relief">GTK_RELIEF_NORMAL</property>
|
||||
<property name="focus_on_click">True</property>
|
||||
</widget>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkButton" id="repair">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_default">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="label" translatable="yes">Repair</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="relief">GTK_RELIEF_NORMAL</property>
|
||||
<property name="focus_on_click">True</property>
|
||||
</widget>
|
||||
</child>
|
||||
</widget>
|
||||
</child>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="padding">0</property>
|
||||
<property name="expand">True</property>
|
||||
<property name="fill">True</property>
|
||||
</packing>
|
||||
</child>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="padding">6</property>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
</packing>
|
||||
</child>
|
||||
</widget>
|
||||
<packing>
|
||||
@ -15644,90 +15745,27 @@ Very High</property>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkVBox" id="vbox132">
|
||||
<widget class="GtkLabel" id="msg">
|
||||
<property name="visible">True</property>
|
||||
<property name="homogeneous">False</property>
|
||||
<property name="spacing">0</property>
|
||||
|
||||
<child>
|
||||
<widget class="GtkAlignment" id="alignment7">
|
||||
<property name="visible">True</property>
|
||||
<property name="xalign">0.5</property>
|
||||
<property name="yalign">0.5</property>
|
||||
<property name="xscale">1</property>
|
||||
<property name="yscale">1</property>
|
||||
<property name="top_padding">0</property>
|
||||
<property name="bottom_padding">0</property>
|
||||
<property name="left_padding">12</property>
|
||||
<property name="right_padding">0</property>
|
||||
|
||||
<child>
|
||||
<widget class="GtkVButtonBox" id="vbuttonbox2">
|
||||
<property name="visible">True</property>
|
||||
<property name="layout_style">GTK_BUTTONBOX_SPREAD</property>
|
||||
<property name="spacing">0</property>
|
||||
|
||||
<child>
|
||||
<widget class="GtkButton" id="new">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_default">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="label">gtk-new</property>
|
||||
<property name="use_stock">True</property>
|
||||
<property name="relief">GTK_RELIEF_NORMAL</property>
|
||||
<property name="focus_on_click">True</property>
|
||||
</widget>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkButton" id="remove">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_default">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="label">gtk-delete</property>
|
||||
<property name="use_stock">True</property>
|
||||
<property name="relief">GTK_RELIEF_NORMAL</property>
|
||||
<property name="focus_on_click">True</property>
|
||||
</widget>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkButton" id="rename">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_default">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="label" translatable="yes">Rename</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="relief">GTK_RELIEF_NORMAL</property>
|
||||
<property name="focus_on_click">True</property>
|
||||
</widget>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkButton" id="repair">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_default">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="label" translatable="yes">Repair</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="relief">GTK_RELIEF_NORMAL</property>
|
||||
<property name="focus_on_click">True</property>
|
||||
</widget>
|
||||
</child>
|
||||
</widget>
|
||||
</child>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="padding">0</property>
|
||||
<property name="expand">True</property>
|
||||
<property name="fill">True</property>
|
||||
</packing>
|
||||
</child>
|
||||
<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">6</property>
|
||||
<property name="padding">0</property>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="fill">False</property>
|
||||
</packing>
|
||||
</child>
|
||||
</widget>
|
||||
|
Loading…
Reference in New Issue
Block a user