9386: Slow exit of Gramps GUI

This commit is contained in:
Doug Blank 2016-04-16 21:00:31 -04:00
parent f09c32181a
commit 12655fc22e
3 changed files with 6 additions and 4 deletions

View File

@ -2049,13 +2049,15 @@ class DbGeneric(DbWriteBase, DbReadBase, UpdateCallback, Callback):
def _order_by_tag_key(self, key): def _order_by_tag_key(self, key):
return glocale.sort_key(key) return glocale.sort_key(key)
def backup(self): def backup(self, user=None):
""" """
If you wish to support an optional backup routine, put it here. If you wish to support an optional backup routine, put it here.
""" """
from gramps.plugins.export.exportxml import XmlWriter from gramps.plugins.export.exportxml import XmlWriter
from gramps.cli.user import User from gramps.cli.user import User
writer = XmlWriter(self, User(), strip_photos=0, compress=1) if user is None:
user = User()
writer = XmlWriter(self, user, strip_photos=0, compress=1)
timestamp = '{0:%Y-%m-%d-%H-%M-%S}'.format(datetime.datetime.now()) timestamp = '{0:%Y-%m-%d-%H-%M-%S}'.format(datetime.datetime.now())
filename = os.path.join(self._directory, "backup-%s.gramps" % timestamp) filename = os.path.join(self._directory, "backup-%s.gramps" % timestamp)
writer.write(filename) writer.write(filename)

View File

@ -761,7 +761,7 @@ class ViewManager(CLIManager):
self.uistate.progress.show() self.uistate.progress.show()
self.uistate.push_message(self.dbstate, _("Autobackup...")) self.uistate.push_message(self.dbstate, _("Autobackup..."))
try: try:
self.dbstate.db.backup() self.dbstate.db.backup(user=self.user)
except DbException as msg: except DbException as msg:
ErrorDialog(_("Error saving backup data"), msg, ErrorDialog(_("Error saving backup data"), msg,
parent=self.uistate.window) parent=self.uistate.window)

View File

@ -2471,7 +2471,7 @@ class DbBsddb(DbBsddbRead, DbWriteBase, UpdateCallback):
""" """
return DbTxn return DbTxn
def backup(self): def backup(self, user=None):
""" """
Exports the database to a set of backup files. These files consist Exports the database to a set of backup files. These files consist
of the pickled database tables, one file for each table. of the pickled database tables, one file for each table.