From a6a90059104106be390583cdf394683b7065c7ff Mon Sep 17 00:00:00 2001 From: Doug Blank Date: Wed, 30 Mar 2011 23:43:27 +0000 Subject: [PATCH] 4779: Backup feedback and overwrite svn: r17000 --- src/gui/viewmanager.py | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/src/gui/viewmanager.py b/src/gui/viewmanager.py index 4eaf10369..621450dd9 100644 --- a/src/gui/viewmanager.py +++ b/src/gui/viewmanager.py @@ -1405,6 +1405,7 @@ class ViewManager(CLIManager): """ Make a quick XML back with or without media. """ + from QuestionDialog import QuestionDialog2 window = gtk.Dialog(_("Gramps XML Backup"), self.uistate.window, gtk.DIALOG_DESTROY_WITH_PARENT, None) @@ -1483,14 +1484,25 @@ class ViewManager(CLIManager): d = window.run() window.hide() if d == gtk.RESPONSE_APPLY: - self.uistate.set_busy_cursor(1) - self.pulse_progressbar(0) - self.uistate.progress.show() - self.uistate.push_message(self.dbstate, _("Making backup...")) + # if file exists, ask if overwrite; else abort basefile = file_entry.get_text() basefile = basefile.replace("/", r"-") filename = os.path.join(path_entry.get_text(), basefile) filename = filename.encode(sys.getfilesystemencoding()) + if os.path.exists(filename): + sfilename = Utils.get_unicode_path_from_env_var(filename) + question = QuestionDialog2( + _("Backup file already exists! Overwrite?"), + _("The file '%s' exists.") % sfilename, + _("Proceed and overwrite"), + _("Cancel the backup")) + yes_no = question.run() + if not yes_no: + return + self.uistate.set_busy_cursor(1) + self.pulse_progressbar(0) + self.uistate.progress.show() + self.uistate.push_message(self.dbstate, _("Making backup...")) if include.get_active(): from ExportPkg import PackageWriter writer = PackageWriter(self.dbstate.db, filename,