Disable family tree manager features when a backend is unavailable

If the default backend is unavailable, then reset it to bsddb.
This commit is contained in:
Nick Hall 2018-03-22 23:02:00 +00:00
parent 9e668a528d
commit 04d6ca3a49
2 changed files with 13 additions and 2 deletions

View File

@ -70,6 +70,7 @@ DEFAULT_TITLE = _("Family Tree")
NAME_FILE = "name.txt"
BACKEND_FILE = "database.txt"
META_NAME = "meta_data.db"
UNAVAILABLE = _('Unavailable')
#-------------------------------------------------------------------------
#
@ -183,7 +184,7 @@ class CLIDbManager:
for plugin in pmgr.get_reg_databases():
if plugin.id == dbid:
return plugin._name
return _("Unknown")
return UNAVAILABLE
def print_family_tree_summaries(self, database_names=None):
"""

View File

@ -57,7 +57,7 @@ from gramps.gen.const import URL_WIKISTRING, URL_MANUAL_PAGE
from .user import User
from .dialog import ErrorDialog, QuestionDialog, QuestionDialog2, ICON
from .pluginmanager import GuiPluginManager
from gramps.cli.clidbman import CLIDbManager, NAME_FILE, time_val
from gramps.cli.clidbman import CLIDbManager, NAME_FILE, time_val, UNAVAILABLE
from .managedwindow import ManagedWindow
from .ddtargets import DdTargets
from gramps.gen.recentfiles import rename_filename, remove_filename
@ -313,6 +313,12 @@ class DbManager(CLIDbManager, ManagedWindow):
self.connect_btn.set_sensitive(False)
if _RCS_FOUND:
self.rcs_btn.set_sensitive(True)
elif store.get_value(node, BACKEND_COL) == UNAVAILABLE:
self.close_btn.set_sensitive(False)
self.convert_btn.set_sensitive(False)
self.connect_btn.set_sensitive(False)
self.rcs_btn.set_sensitive(False)
self.repair_btn.set_sensitive(False)
else:
self.close_btn.set_sensitive(False)
dbid = config.get('database.backend')
@ -361,6 +367,10 @@ class DbManager(CLIDbManager, ManagedWindow):
# Put some help on the buttons:
dbid = config.get('database.backend')
backend_type = self.get_backend_name_from_dbid(dbid)
if backend_type == UNAVAILABLE:
dbid = 'bsddb'
config.set('database.backend', dbid)
backend_type = self.get_backend_name_from_dbid(dbid)
self.new_btn.set_tooltip_text(backend_type)
# build the database name column