Database API: expore name, full_name, and brief_name

This commit is contained in:
Doug Blank 2015-05-15 10:48:14 -04:00
parent 16c2843073
commit 1c05879f62
2 changed files with 18 additions and 0 deletions

View File

@ -404,6 +404,9 @@ class DictionaryDb(DbWriteBase, DbReadBase, UpdateCallback, Callback):
self.abort_possible = False
self._bm_changes = 0
self._directory = directory
self.full_name = None
self.path = None
self.brief_name = None
if directory:
self.load(directory)
@ -1671,6 +1674,9 @@ class DictionaryDb(DbWriteBase, DbReadBase, UpdateCallback, Callback):
from gramps.plugins.importer.importxml import importData
from gramps.cli.user import User
self._directory = directory
self.full_name = os.path.abspath(self._directory)
self.path = self.full_name
self.brief_name = os.path.basename(self._directory)
filename = os.path.join(directory, "data.gramps")
if os.path.isfile(filename):
importData(self, filename, User())
@ -1690,6 +1696,9 @@ class DictionaryDb(DbWriteBase, DbReadBase, UpdateCallback, Callback):
def set_save_path(self, directory):
self._directory = directory
self.full_name = os.path.abspath(self._directory)
self.path = self.full_name
self.brief_name = os.path.basename(self._directory)
def undo(self, update_history=True):
pass

View File

@ -349,6 +349,9 @@ class DbDjango(DbWriteBase, DbReadBase, UpdateCallback, Callback):
self.abort_possible = False
self._bm_changes = 0
self._directory = directory
self.full_name = None
self.path = None
self.brief_name = None
if directory:
self.load(directory)
@ -358,6 +361,9 @@ class DbDjango(DbWriteBase, DbReadBase, UpdateCallback, Callback):
force_bsddb_downgrade=False,
force_python_upgrade=False):
self._directory = directory
self.full_name = os.path.abspath(self._directory)
self.path = self.full_name
self.brief_name = os.path.basename(self._directory)
from django.conf import settings
default_settings = {"__file__":
os.path.join(directory, "default_settings.py")}
@ -1836,6 +1842,9 @@ class DbDjango(DbWriteBase, DbReadBase, UpdateCallback, Callback):
def set_save_path(self, directory):
self._directory = directory
self.full_name = os.path.abspath(self._directory)
self.path = self.full_name
self.brief_name = os.path.basename(self._directory)
## Get types:
def get_event_attribute_types(self):