4779: Backup feedback and overwrite
svn: r17000
This commit is contained in:
parent
3db14905db
commit
a6a9005910
@ -1405,6 +1405,7 @@ class ViewManager(CLIManager):
|
|||||||
"""
|
"""
|
||||||
Make a quick XML back with or without media.
|
Make a quick XML back with or without media.
|
||||||
"""
|
"""
|
||||||
|
from QuestionDialog import QuestionDialog2
|
||||||
window = gtk.Dialog(_("Gramps XML Backup"),
|
window = gtk.Dialog(_("Gramps XML Backup"),
|
||||||
self.uistate.window,
|
self.uistate.window,
|
||||||
gtk.DIALOG_DESTROY_WITH_PARENT, None)
|
gtk.DIALOG_DESTROY_WITH_PARENT, None)
|
||||||
@ -1483,14 +1484,25 @@ class ViewManager(CLIManager):
|
|||||||
d = window.run()
|
d = window.run()
|
||||||
window.hide()
|
window.hide()
|
||||||
if d == gtk.RESPONSE_APPLY:
|
if d == gtk.RESPONSE_APPLY:
|
||||||
self.uistate.set_busy_cursor(1)
|
# if file exists, ask if overwrite; else abort
|
||||||
self.pulse_progressbar(0)
|
|
||||||
self.uistate.progress.show()
|
|
||||||
self.uistate.push_message(self.dbstate, _("Making backup..."))
|
|
||||||
basefile = file_entry.get_text()
|
basefile = file_entry.get_text()
|
||||||
basefile = basefile.replace("/", r"-")
|
basefile = basefile.replace("/", r"-")
|
||||||
filename = os.path.join(path_entry.get_text(), basefile)
|
filename = os.path.join(path_entry.get_text(), basefile)
|
||||||
filename = filename.encode(sys.getfilesystemencoding())
|
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():
|
if include.get_active():
|
||||||
from ExportPkg import PackageWriter
|
from ExportPkg import PackageWriter
|
||||||
writer = PackageWriter(self.dbstate.db, filename,
|
writer = PackageWriter(self.dbstate.db, filename,
|
||||||
|
Loading…
Reference in New Issue
Block a user