Remove set_save_path method

The path is already set in the database load method.
This commit is contained in:
Nick Hall 2017-09-30 21:35:41 +01:00
parent aed7560a46
commit b3b46c70b2
8 changed files with 3 additions and 29 deletions

View File

@ -174,7 +174,6 @@ class CLIDbLoader:
try: try:
self.dbstate.db.load(filename, self._pulse_progress, mode) self.dbstate.db.load(filename, self._pulse_progress, mode)
self.dbstate.db.set_save_path(filename)
except DbEnvironmentError as msg: except DbEnvironmentError as msg:
self.dbstate.no_database() self.dbstate.no_database()
self._errordialog(_("Cannot open database"), str(msg)) self._errordialog(_("Cannot open database"), str(msg))
@ -307,11 +306,6 @@ class CLIManager:
if title: if title:
name = title name = title
# This method is for UI stuff when the database has changed.
# Window title, recent files, etc related to new file.
self.dbstate.db.set_save_path(filename)
# apply preferred researcher if loaded file has none # apply preferred researcher if loaded file has none
res = self.dbstate.db.get_researcher() res = self.dbstate.db.get_researcher()
owner = get_researcher() owner = get_researcher()

View File

@ -1404,12 +1404,6 @@ class DbReadBase:
""" """
raise NotImplementedError raise NotImplementedError
def set_save_path(self, path):
"""
Set the save path for the database.
"""
raise NotImplementedError
def get_dbid(self): def get_dbid(self):
""" """
A unique ID for this database on this computer. A unique ID for this database on this computer.

View File

@ -1630,13 +1630,6 @@ class DummyDb(M_A_M_B("NewBaseClass", (DbReadBase, Callback, object,), {})):
if not self.db_is_open: if not self.db_is_open:
LOG.warning("database is closed") LOG.warning("database is closed")
def set_save_path(self, path):
"""
Set the save path for the database.
"""
if not self.db_is_open:
LOG.warning("database is closed")
def get_dbid(self): def get_dbid(self):
""" """
A unique ID for this database on this computer. A unique ID for this database on this computer.

View File

@ -528,7 +528,6 @@ class DbGeneric(DbWriteBase, DbReadBase, UpdateCallback, Callback):
"del_func": self.remove_tag, "del_func": self.remove_tag,
} }
} }
self.set_save_path(directory)
self.readonly = False self.readonly = False
self.db_is_open = False self.db_is_open = False
self.name_formats = [] self.name_formats = []
@ -636,7 +635,8 @@ class DbGeneric(DbWriteBase, DbReadBase, UpdateCallback, Callback):
# surname list # surname list
self.surname_list = self.get_surname_list() self.surname_list = self.get_surname_list()
self.set_save_path(directory) self._set_save_path(directory)
if self._directory: if self._directory:
self.undolog = os.path.join(self._directory, DBUNDOFN) self.undolog = os.path.join(self._directory, DBUNDOFN)
else: else:
@ -2371,7 +2371,7 @@ class DbGeneric(DbWriteBase, DbReadBase, UpdateCallback, Callback):
def get_save_path(self): def get_save_path(self):
return self._directory return self._directory
def set_save_path(self, directory): def _set_save_path(self, directory):
self._directory = directory self._directory = directory
if directory: if directory:
self.full_name = os.path.abspath(self._directory) self.full_name = os.path.abspath(self._directory)

View File

@ -195,7 +195,6 @@ class DbLoader(CLIDbLoader):
force_bsddb_upgrade, force_bsddb_upgrade,
force_bsddb_downgrade, force_bsddb_downgrade,
force_python_upgrade) force_python_upgrade)
db.set_save_path(filename)
if self.dbstate.is_open(): if self.dbstate.is_open():
self.dbstate.db.close( self.dbstate.db.close(
user=User(callback=self._pulse_progress, user=User(callback=self._pulse_progress,

View File

@ -933,7 +933,6 @@ class DbManager(CLIDbManager, ManagedWindow):
newdb.write_version(dirname) newdb.write_version(dirname)
dbase = make_database("bsddb") dbase = make_database("bsddb")
dbase.set_save_path(dirname)
dbase.load(dirname, None) dbase.load(dirname, None)
self.__start_cursor(_("Rebuilding database from backup files")) self.__start_cursor(_("Rebuilding database from backup files"))

View File

@ -1411,10 +1411,6 @@ class DbBsddbRead(DbReadBase, Callback):
"""Return the save path of the file, or "" if one does not exist.""" """Return the save path of the file, or "" if one does not exist."""
return self.path return self.path
def set_save_path(self, path):
"""Set the save path for the database."""
self.path = path
def get_event_attribute_types(self): def get_event_attribute_types(self):
""" """
Return a list of all Attribute types assocated with Event instances Return a list of all Attribute types assocated with Event instances

View File

@ -168,7 +168,6 @@ class DbTest(unittest.TestCase):
# Other set methods: # Other set methods:
"set_mediapath", "set_mediapath",
"set_researcher", "set_researcher",
"set_save_path",
"version_supported", "version_supported",
] ]