Added dbid and dbname to databases; id is the unique dir name, and name is the assigned name stored in text file
svn: r15786
This commit is contained in:
parent
1b884b129d
commit
fcef732f93
@ -1055,6 +1055,18 @@ class DbReadBase(object):
|
|||||||
"""
|
"""
|
||||||
raise NotImplementedError
|
raise NotImplementedError
|
||||||
|
|
||||||
|
def get_dbid(self):
|
||||||
|
"""
|
||||||
|
A unique ID for this database on this computer.
|
||||||
|
"""
|
||||||
|
raise NotImplementedError
|
||||||
|
|
||||||
|
def get_dbname(self):
|
||||||
|
"""
|
||||||
|
A name for this database on this computer.
|
||||||
|
"""
|
||||||
|
raise NotImplementedError
|
||||||
|
|
||||||
class DbWriteBase(object):
|
class DbWriteBase(object):
|
||||||
"""
|
"""
|
||||||
GRAMPS database object. This object is a base class for all
|
GRAMPS database object. This object is a base class for all
|
||||||
|
@ -1466,3 +1466,16 @@ class DbBsddbRead(DbReadBase, Callback):
|
|||||||
"""
|
"""
|
||||||
return self._bm_changes > 0
|
return self._bm_changes > 0
|
||||||
|
|
||||||
|
def get_dbid(self):
|
||||||
|
"""
|
||||||
|
In BSDDB, we use the file directory name as the unique ID for
|
||||||
|
this database on this computer.
|
||||||
|
"""
|
||||||
|
return None
|
||||||
|
|
||||||
|
def get_dbname(self):
|
||||||
|
"""
|
||||||
|
In BSDDB, a database's name is not known until after we open it.
|
||||||
|
"""
|
||||||
|
return None
|
||||||
|
|
||||||
|
@ -206,6 +206,8 @@ class DbBsddb(DbBsddbRead, DbWriteBase, UpdateCallback):
|
|||||||
#UpdateCallback.__init__(self)
|
#UpdateCallback.__init__(self)
|
||||||
self.secondary_connected = False
|
self.secondary_connected = False
|
||||||
self.has_changed = False
|
self.has_changed = False
|
||||||
|
self.brief_name = None
|
||||||
|
self.db_name = None
|
||||||
|
|
||||||
def catch_db_error(func):
|
def catch_db_error(func):
|
||||||
"""
|
"""
|
||||||
@ -1716,6 +1718,20 @@ class DbBsddb(DbBsddbRead, DbWriteBase, UpdateCallback):
|
|||||||
self.metadata.close()
|
self.metadata.close()
|
||||||
self.env.close()
|
self.env.close()
|
||||||
|
|
||||||
|
def get_dbid(self):
|
||||||
|
"""
|
||||||
|
In BSDDB, we use the file directory name as the unique ID for
|
||||||
|
this database on this computer.
|
||||||
|
"""
|
||||||
|
return self.brief_name
|
||||||
|
|
||||||
|
def get_dbname(self):
|
||||||
|
"""
|
||||||
|
In BSDDB, we use the file directory name as the unique ID for
|
||||||
|
this database on this computer.
|
||||||
|
"""
|
||||||
|
return self.db_name
|
||||||
|
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
# BdbTransaction
|
# BdbTransaction
|
||||||
|
@ -1209,7 +1209,7 @@ class ViewManager(CLIManager):
|
|||||||
if filename[-1] == os.path.sep:
|
if filename[-1] == os.path.sep:
|
||||||
filename = filename[:-1]
|
filename = filename[:-1]
|
||||||
name = os.path.basename(filename)
|
name = os.path.basename(filename)
|
||||||
self.db_name = title
|
self.dbstate.db.db_name = title
|
||||||
if title:
|
if title:
|
||||||
name = title
|
name = title
|
||||||
|
|
||||||
@ -1328,7 +1328,7 @@ class ViewManager(CLIManager):
|
|||||||
hbox.pack_start(label, False)
|
hbox.pack_start(label, False)
|
||||||
struct_time = time.localtime()
|
struct_time = time.localtime()
|
||||||
file_entry.set_text(config.get('paths.quick-backup-filename') %
|
file_entry.set_text(config.get('paths.quick-backup-filename') %
|
||||||
{"filename": self.db_name,
|
{"filename": self.dbstate.db.get_dbname(),
|
||||||
"year": struct_time.tm_year,
|
"year": struct_time.tm_year,
|
||||||
"month": struct_time.tm_mon,
|
"month": struct_time.tm_mon,
|
||||||
"day": struct_time.tm_mday,
|
"day": struct_time.tm_mday,
|
||||||
|
Loading…
Reference in New Issue
Block a user