Tidy up database summary information
This commit is contained in:
parent
185d89c917
commit
c7249b5ca9
@ -171,12 +171,19 @@ class CLIDbManager:
|
||||
retval = {_("Unavailable"): "locked"}
|
||||
retval.update({_("Family Tree"): name,
|
||||
_("Path"): dirpath,
|
||||
_("Database"): dbid,
|
||||
_("Database"): self.get_backend_name_from_dbid(dbid),
|
||||
_("Last accessed"): time_val(dirpath)[1],
|
||||
_("Locked?"): self.is_locked(dirpath),
|
||||
})
|
||||
return retval
|
||||
|
||||
def get_backend_name_from_dbid(self, dbid):
|
||||
pmgr = BasePluginManager.get_instance()
|
||||
for plugin in pmgr.get_reg_databases():
|
||||
if plugin.id == dbid:
|
||||
return plugin._name
|
||||
return _("Unknown")
|
||||
|
||||
def print_family_tree_summaries(self, database_names=None):
|
||||
"""
|
||||
Prints a detailed list of the known family trees.
|
||||
|
@ -2466,7 +2466,7 @@ class DbGeneric(DbWriteBase, DbReadBase, UpdateCallback, Callback):
|
||||
_("Number of repositories"): self.get_number_of_repositories(),
|
||||
_("Number of notes"): self.get_number_of_notes(),
|
||||
_("Number of tags"): self.get_number_of_tags(),
|
||||
_("Data version"): ".".join([str(v) for v in self.VERSION]),
|
||||
_("Schema version"): ".".join([str(v) for v in self.VERSION]),
|
||||
}
|
||||
|
||||
def _order_by_person_key(self, person):
|
||||
|
@ -981,13 +981,6 @@ class DbManager(CLIDbManager, ManagedWindow):
|
||||
parent=self.top)
|
||||
self.new_btn.set_sensitive(True)
|
||||
|
||||
def get_backend_name_from_dbid(self, dbid):
|
||||
pmgr = GuiPluginManager.get_instance()
|
||||
for plugin in pmgr.get_reg_databases():
|
||||
if plugin.id == dbid:
|
||||
return plugin._name
|
||||
return _("Unknown")
|
||||
|
||||
def _create_new_db(self, title=None, create_db=True, dbid=None,
|
||||
edit_entry=True):
|
||||
"""
|
||||
|
@ -2290,7 +2290,6 @@ class DbBsddb(DbBsddbRead, DbWriteBase, UpdateCallback):
|
||||
else:
|
||||
bsddb_version = _("Unknown")
|
||||
return {
|
||||
_("DB-API version"): "n/a",
|
||||
_("Number of people"): self.get_number_of_people(),
|
||||
_("Number of families"): self.get_number_of_families(),
|
||||
_("Number of sources"): self.get_number_of_sources(),
|
||||
@ -2301,8 +2300,8 @@ class DbBsddb(DbBsddbRead, DbWriteBase, UpdateCallback):
|
||||
_("Number of repositories"): self.get_number_of_repositories(),
|
||||
_("Number of notes"): self.get_number_of_notes(),
|
||||
_("Number of tags"): self.get_number_of_tags(),
|
||||
_("Data version"): schema_version,
|
||||
_("Database db version"): bsddb_version,
|
||||
_("Schema version"): schema_version,
|
||||
_("Database version"): bsddb_version,
|
||||
}
|
||||
|
||||
def _mkname(path, name):
|
||||
|
@ -958,16 +958,3 @@ class DBAPI(DbGeneric):
|
||||
in the appropriate type.
|
||||
"""
|
||||
return [v if not isinstance(v, bool) else int(v) for v in values]
|
||||
|
||||
def get_summary(self):
|
||||
"""
|
||||
Returns dictionary of summary item.
|
||||
Should include, if possible:
|
||||
|
||||
_("Number of people")
|
||||
_("Version")
|
||||
_("Schema version")
|
||||
"""
|
||||
summary = super().get_summary()
|
||||
summary.update(self.dbapi.__class__.get_summary())
|
||||
return summary
|
||||
|
@ -41,6 +41,7 @@ from gramps.plugins.db.dbapi.dbapi import DBAPI
|
||||
from gramps.gen.utils.configmanager import ConfigManager
|
||||
from gramps.gen.db.dbconst import ARRAYSIZE
|
||||
from gramps.gen.const import GRAMPS_LOCALE as glocale
|
||||
_ = glocale.translation.gettext
|
||||
|
||||
psycopg2.paramstyle = 'format'
|
||||
|
||||
@ -51,6 +52,18 @@ psycopg2.paramstyle = 'format'
|
||||
#-------------------------------------------------------------------------
|
||||
class PostgreSQL(DBAPI):
|
||||
|
||||
def get_summary(self):
|
||||
"""
|
||||
Return a diction of information about this database
|
||||
backend.
|
||||
"""
|
||||
summary = super().get_summary()
|
||||
summary.update({
|
||||
_("Database version"): psycopg2.__version__,
|
||||
_("Database module location"): psycopg2.__file__,
|
||||
})
|
||||
return summary
|
||||
|
||||
def _initialize(self, directory):
|
||||
config_file = os.path.join(directory, 'settings.ini')
|
||||
config_mgr = ConfigManager(config_file)
|
||||
@ -74,20 +87,6 @@ class PostgreSQL(DBAPI):
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
class Connection:
|
||||
@classmethod
|
||||
def get_summary(cls):
|
||||
"""
|
||||
Return a diction of information about this database
|
||||
backend.
|
||||
"""
|
||||
summary = {
|
||||
"DB-API version": "2.0",
|
||||
"Database SQL type": cls.__name__,
|
||||
"Database SQL module": "psycopg2",
|
||||
"Database SQL module version": psycopg2.__version__,
|
||||
"Database SQL module location": psycopg2.__file__,
|
||||
}
|
||||
return summary
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
self.__connection = psycopg2.connect(*args, **kwargs)
|
||||
|
@ -41,6 +41,7 @@ import logging
|
||||
from gramps.plugins.db.dbapi.dbapi import DBAPI
|
||||
from gramps.gen.db.dbconst import ARRAYSIZE
|
||||
from gramps.gen.const import GRAMPS_LOCALE as glocale
|
||||
_ = glocale.translation.gettext
|
||||
|
||||
sqlite3.paramstyle = 'qmark'
|
||||
|
||||
@ -51,6 +52,18 @@ sqlite3.paramstyle = 'qmark'
|
||||
#-------------------------------------------------------------------------
|
||||
class SQLite(DBAPI):
|
||||
|
||||
def get_summary(self):
|
||||
"""
|
||||
Return a dictionary of information about this database backend.
|
||||
"""
|
||||
summary = super().get_summary()
|
||||
summary.update({
|
||||
_("Database version"): sqlite3.sqlite_version,
|
||||
_("Database module version"): sqlite3.version,
|
||||
_("Database module location"): sqlite3.__file__,
|
||||
})
|
||||
return summary
|
||||
|
||||
def _initialize(self, directory):
|
||||
if directory == ':memory:':
|
||||
path_to_db = ':memory:'
|
||||
@ -69,20 +82,6 @@ class Connection:
|
||||
The Sqlite class is an interface between the DBAPI class which is the Gramps
|
||||
backend for the DBAPI interface and the sqlite3 python module.
|
||||
"""
|
||||
@classmethod
|
||||
def get_summary(cls):
|
||||
"""
|
||||
Return a dictionary of information about this database backend.
|
||||
"""
|
||||
summary = {
|
||||
"DB-API version": "2.0",
|
||||
"Database SQL type": cls.__name__,
|
||||
"Database SQL module": "sqlite3",
|
||||
"Database SQL Python module version": sqlite3.version,
|
||||
"Database SQL module version": sqlite3.sqlite_version,
|
||||
"Database SQL module location": sqlite3.__file__,
|
||||
}
|
||||
return summary
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
"""
|
||||
|
Loading…
Reference in New Issue
Block a user