From 5ad32042c6f808918cbbf540091e52e4ac4a9b28 Mon Sep 17 00:00:00 2001 From: Paul Franklin Date: Wed, 21 Dec 2016 22:24:48 -0800 Subject: [PATCH] move two methods down slightly (to better check a forthcoming change) --- gramps/gui/viewmanager.py | 62 +++++++++++++++++++-------------------- 1 file changed, 31 insertions(+), 31 deletions(-) diff --git a/gramps/gui/viewmanager.py b/gramps/gui/viewmanager.py index 4c449ec83..5a63fce9a 100644 --- a/gramps/gui/viewmanager.py +++ b/gramps/gui/viewmanager.py @@ -1409,37 +1409,6 @@ class ViewManager(CLIManager): self.uistate.push_message(self.dbstate, _("Backup aborted")) window.destroy() - def autobackup(self): - """ - Backup the current family tree. - """ - if self.dbstate.db.is_open() and self.dbstate.db.has_changed: - self.uistate.set_busy_cursor(True) - self.uistate.progress.show() - self.uistate.push_message(self.dbstate, _("Autobackup...")) - try: - self.__backup() - except DbWriteFailure as msg: - self.uistate.push_message(self.dbstate, - _("Error saving backup data")) - self.uistate.set_busy_cursor(False) - self.uistate.progress.hide() - - def __backup(self): - """ - Backup database to a Gramps XML file. - """ - from gramps.plugins.export.exportxml import XmlWriter - backup_path = config.get('database.backup-path') - compress = config.get('database.compress-backup') - writer = XmlWriter(self.dbstate.db, self.user, strip_photos=0, - compress=compress) - timestamp = '{0:%Y-%m-%d-%H-%M-%S}'.format(datetime.datetime.now()) - backup_name = "%s-%s.gramps" % (self.dbstate.db.get_dbname(), - timestamp) - filename = os.path.join(backup_path, backup_name) - writer.write(filename) - def select_backup_path(self, widget, path_entry): """ Choose a backup folder. Make sure there is one highlighted in @@ -1480,6 +1449,37 @@ class ViewManager(CLIManager): else: file_entry.set_text("%s.%s" % (filename, extension)) + def autobackup(self): + """ + Backup the current family tree. + """ + if self.dbstate.db.is_open() and self.dbstate.db.has_changed: + self.uistate.set_busy_cursor(True) + self.uistate.progress.show() + self.uistate.push_message(self.dbstate, _("Autobackup...")) + try: + self.__backup() + except DbWriteFailure as msg: + self.uistate.push_message(self.dbstate, + _("Error saving backup data")) + self.uistate.set_busy_cursor(False) + self.uistate.progress.hide() + + def __backup(self): + """ + Backup database to a Gramps XML file. + """ + from gramps.plugins.export.exportxml import XmlWriter + backup_path = config.get('database.backup-path') + compress = config.get('database.compress-backup') + writer = XmlWriter(self.dbstate.db, self.user, strip_photos=0, + compress=compress) + timestamp = '{0:%Y-%m-%d-%H-%M-%S}'.format(datetime.datetime.now()) + backup_name = "%s-%s.gramps" % (self.dbstate.db.get_dbname(), + timestamp) + filename = os.path.join(backup_path, backup_name) + writer.write(filename) + def reports_clicked(self, obj): """ Displays the Reports dialog