From 5171b3748d9277b7bc22a58d7b006e6e9875ba8a Mon Sep 17 00:00:00 2001 From: Doug Blank Date: Thu, 14 May 2015 23:15:30 -0400 Subject: [PATCH] Added missing bookmark count methods to djangodb and dictionarydb --- gramps/plugins/database/dictionarydb.py | 13 +++++++++++++ gramps/plugins/database/djangodb.py | 14 ++++++++++++++ 2 files changed, 27 insertions(+) diff --git a/gramps/plugins/database/dictionarydb.py b/gramps/plugins/database/dictionarydb.py index 09748295a..2a15c28b1 100644 --- a/gramps/plugins/database/dictionarydb.py +++ b/gramps/plugins/database/dictionarydb.py @@ -393,6 +393,7 @@ class DictionaryDb(DbWriteBase, DbReadBase, UpdateCallback, Callback): self.transaction = None self.undodb = DbUndo(self) self.abort_possible = False + self._bm_changes = 0 self._directory = directory if directory: self.load(directory) @@ -1689,3 +1690,15 @@ class DictionaryDb(DbWriteBase, DbReadBase, UpdateCallback, Callback): with open(versionpath, "w") as version_file: version_file.write("dictionarydb") + def report_bm_change(self): + """ + Add 1 to the number of bookmark changes during this session. + """ + self._bm_changes += 1 + + def db_has_bm_changes(self): + """ + Return whethere there were bookmark changes during the session. + """ + return self._bm_changes > 0 + diff --git a/gramps/plugins/database/djangodb.py b/gramps/plugins/database/djangodb.py index 305cde2a8..543243c99 100644 --- a/gramps/plugins/database/djangodb.py +++ b/gramps/plugins/database/djangodb.py @@ -338,6 +338,7 @@ class DbDjango(DbWriteBase, DbReadBase, UpdateCallback, Callback): self.use_db_cache = True self.undodb = DbUndo(self) self.abort_possible = False + self._bm_changes = 0 self._directory = directory if directory: self.load(directory) @@ -2088,3 +2089,16 @@ class DbDjango(DbWriteBase, DbReadBase, UpdateCallback, Callback): for filename in os.listdir(defaults): fullpath = os.path.abspath(os.path.join(defaults, filename)) shutil.copy2(fullpath, directory) + + def report_bm_change(self): + """ + Add 1 to the number of bookmark changes during this session. + """ + self._bm_changes += 1 + + def db_has_bm_changes(self): + """ + Return whethere there were bookmark changes during the session. + """ + return self._bm_changes > 0 +