diff --git a/gramps/cli/arghandler.py b/gramps/cli/arghandler.py index f0795d4dc..407c4c605 100644 --- a/gramps/cli/arghandler.py +++ b/gramps/cli/arghandler.py @@ -229,7 +229,7 @@ class ArgHandler: return db_path elif create: # create the tree here, and continue - dbid = config.get('behavior.database-backend') + dbid = config.get('database.backend') db_path, title = self.dbman.create_new_db_cli(title=value, dbid=dbid) return db_path else: @@ -483,11 +483,11 @@ class ArgHandler: if not self.open: # Create empty dir for imported database(s) if self.gui: - dbid = config.get('behavior.database-backend') + dbid = config.get('database.backend') self.imp_db_path, title = self.dbman.create_new_db_cli(dbid=dbid) else: self.imp_db_path = get_empty_tempdir("import_dbdir") - dbid = config.get('behavior.database-backend') + dbid = config.get('database.backend') newdb = self.dbstate.make_database(dbid) newdb.write_version(self.imp_db_path) diff --git a/gramps/cli/clidbman.py b/gramps/cli/clidbman.py index b20724165..48f99a635 100644 --- a/gramps/cli/clidbman.py +++ b/gramps/cli/clidbman.py @@ -219,7 +219,7 @@ class CLIDbManager: Get the list of current names in the database dir """ # make the default directory if it does not exist - dbdir = os.path.expanduser(config.get('behavior.database-path')) + dbdir = os.path.expanduser(config.get('database.path')) db_ok = make_dbdir(dbdir) self.current_names = [] @@ -375,7 +375,7 @@ class CLIDbManager: self.__start_cursor(_("Importing data...")) ## Use bsddb, for now, because we assumed that above. - dbid = "bsddb" ## config.get('behavior.database-backend') + dbid = "bsddb" ## config.get('database.backend') dbase = self.dbstate.make_database(dbid) dbase.load(new_path, user.callback) @@ -410,7 +410,7 @@ class CLIDbManager: Deletes a database folder given a pattenr that matches its proper name. """ - dbdir = os.path.expanduser(config.get('behavior.database-path')) + dbdir = os.path.expanduser(config.get('database.path')) match_list = [] for dpath in os.listdir(dbdir): dirpath = os.path.join(dbdir, dpath) @@ -511,7 +511,7 @@ def find_next_db_dir(): """ while True: base = "%x" % int(time.time()) - dbdir = os.path.expanduser(config.get('behavior.database-path')) + dbdir = os.path.expanduser(config.get('database.path')) new_path = os.path.join(dbdir, base) if not os.path.isdir(new_path): break diff --git a/gramps/cli/test/cli_test.py b/gramps/cli/test/cli_test.py index b99a15208..59eb9cd70 100644 --- a/gramps/cli/test/cli_test.py +++ b/gramps/cli/test/cli_test.py @@ -135,8 +135,8 @@ class UnicodeTest(unittest.TestCase): '\u0393\u03c1\u03b1\u03bc\u03c3\u03c0') self.newtitle = 'Gr\u00e4mps T\u00e9st' os.makedirs(self.newpath) - self.old_path = getconfig('behavior.database-path') - setconfig('behavior.database-path', self.newpath) + self.old_path = getconfig('database.path') + setconfig('database.path', self.newpath) self.cli = CLIDbManager(DbState()) def tearDown(self): @@ -147,7 +147,7 @@ class UnicodeTest(unittest.TestCase): for adir in dirnames: os.rmdir(os.path.join(dirpath, adir)) os.rmdir(self.newpath) - setconfig('behavior.database-path', self.old_path) + setconfig('database.path', self.old_path) # Test that clidbman will open files in a path containing # arbitrary Unicode characters. diff --git a/gramps/gen/config.py b/gramps/gen/config.py index bd2426478..cbfa71b60 100644 --- a/gramps/gen/config.py +++ b/gramps/gen/config.py @@ -138,9 +138,6 @@ register('behavior.check-for-update-types', ["new"]) register('behavior.last-check-for-updates', "1970/01/01") register('behavior.previously-seen-updates', []) register('behavior.do-not-show-previously-seen-updates', True) -register('behavior.database-path', os.path.join(HOME_DIR, 'grampsdb')) -register('behavior.database-backend', 'bsddb') -register('behavior.database-backup-use-compression', True) register('behavior.date-about-range', 50) register('behavior.date-after-range', 50) register('behavior.date-before-range', 50) @@ -159,6 +156,10 @@ register('behavior.welcome', 100) register('behavior.web-search-url', 'http://google.com/#&q=%(text)s') register('behavior.addons-url', "https://raw.githubusercontent.com/gramps-project/addons/master/gramps50") +register('database.backend', 'bsddb') +register('database.compress-backup', True) +register('database.path', os.path.join(HOME_DIR, 'grampsdb')) + register('export.proxy-order', [["privacy", 0], ["living", 0], diff --git a/gramps/gen/db/generic.py b/gramps/gen/db/generic.py index b5855a658..7937fc261 100644 --- a/gramps/gen/db/generic.py +++ b/gramps/gen/db/generic.py @@ -2129,7 +2129,7 @@ class DbGeneric(DbWriteBase, DbReadBase, UpdateCallback, Callback): from gramps.cli.user import User if user is None: user = User() - compress = config.get('behavior.database-backup-use-compression') + compress = config.get('database.compress-backup') writer = XmlWriter(self, user, strip_photos=0, compress=compress) timestamp = '{0:%Y-%m-%d-%H-%M-%S}'.format(datetime.datetime.now()) filename = os.path.join(self._directory, "backup-%s.gramps" % timestamp) diff --git a/gramps/gen/dbstate.py b/gramps/gen/dbstate.py index 2e074f6cd..1b7785b45 100644 --- a/gramps/gen/dbstate.py +++ b/gramps/gen/dbstate.py @@ -211,7 +211,7 @@ class DbState(Callback): """ Find a Family Tree given its name, and return properties. """ - dbdir = os.path.expanduser(config.get('behavior.database-path')) + dbdir = os.path.expanduser(config.get('database.path')) for dpath in os.listdir(dbdir): dirpath = os.path.join(dbdir, dpath) path_name = os.path.join(dirpath, "name.txt") diff --git a/gramps/gui/configure.py b/gramps/gui/configure.py index ba4236c1b..0ab738135 100644 --- a/gramps/gui/configure.py +++ b/gramps/gui/configure.py @@ -1420,7 +1420,7 @@ class GrampsPreferences(ConfigureDialog): the_list = obj.get_model() the_iter = obj.get_active_iter() db_choice = the_list.get_value(the_iter, 2) - config.set('behavior.database-backend', db_choice) + config.set('database.backend', db_choice) def add_famtree_panel(self, configdialog): grid = Gtk.Grid() @@ -1440,7 +1440,7 @@ class GrampsPreferences(ConfigureDialog): GObject.TYPE_STRING) count = 0 active = 0 - default = config.get('behavior.database-backend') + default = config.get('database.backend') for plugin in sorted(backend_plugins, key=lambda plugin: plugin.name): if plugin.id == default: active = count @@ -1458,13 +1458,13 @@ class GrampsPreferences(ConfigureDialog): self.dbpath_entry = Gtk.Entry() self.add_path_box(grid, _('Family Tree Database path'), - current_line, self.dbpath_entry, config.get('behavior.database-path'), + current_line, self.dbpath_entry, config.get('database.path'), self.set_dbpath, self.select_dbpath) current_line += 1 #self.add_entry(grid, # _('Family Tree Database path'), - # 0, 'behavior.database-path') + # 0, 'database.path') self.add_checkbox(grid, _('Automatically load last Family Tree'), current_line, 'behavior.autoload') @@ -1499,7 +1499,7 @@ class GrampsPreferences(ConfigureDialog): def set_dbpath(self, *obj): path = self.dbpath_entry.get_text().strip() - config.set('behavior.database-path', path) + config.set('database.path', path) def select_dbpath(self, *obj): f = Gtk.FileChooserDialog(title=_("Select database directory"), @@ -1510,7 +1510,7 @@ class GrampsPreferences(ConfigureDialog): _('_Apply'), Gtk.ResponseType.OK) ) - dbpath = config.get('behavior.database-path') + dbpath = config.get('database.path') if not dbpath: dbpath = os.path.join(HOME_DIR,'grampsdb') f.set_current_folder(os.path.dirname(dbpath)) diff --git a/gramps/gui/dbman.py b/gramps/gui/dbman.py index 303ce9986..fae902868 100644 --- a/gramps/gui/dbman.py +++ b/gramps/gui/dbman.py @@ -351,7 +351,7 @@ class DbManager(CLIDbManager): The Backend Type column is a string based on database backend. """ # Put some help on the buttons: - dbid = config.get('behavior.database-backend') + dbid = config.get('database.backend') backend_type = self.get_backend_name_from_dbid(dbid) self.new.set_tooltip_text(backend_type) @@ -958,7 +958,7 @@ class DbManager(CLIDbManager): message. """ self.new.set_sensitive(False) - dbid = config.get('behavior.database-backend') + dbid = config.get('database.backend') if dbid: try: self._create_new_db(dbid=dbid) diff --git a/gramps/plugins/database/test/db_test.py b/gramps/plugins/database/test/db_test.py index 70ab1a62f..b92ab9665 100644 --- a/gramps/plugins/database/test/db_test.py +++ b/gramps/plugins/database/test/db_test.py @@ -35,7 +35,7 @@ class BSDDB: def __init__(self): self.gramps = Gramps() - self.call("--config=behavior.database-backend:" + self.backend, + self.call("--config=database.backend:" + self.backend, "-C", self.NAME, "--import", example) self.db = open_database(self.NAME, force_unlock=True)