doc update

svn: r7622
This commit is contained in:
Don Allingham 2006-11-13 05:22:48 +00:00
parent c4d56e5510
commit 87a6ea744b

View File

@ -461,16 +461,22 @@ class ViewManager:
gtk.main_quit() gtk.main_quit()
def backup(self): def backup(self):
"""
Backup the current file as an XML file.
"""
import GrampsDb import GrampsDb
if self.state.db.undoindex > 0: if self.state.db.undoindex > 0:
# build backup path name
bpath = self.state.db.get_save_path() bpath = self.state.db.get_save_path()
name = os.path.splitext(bpath) backup = os.path.splitext(bpath)[0] + ".backup.gramps"
backup = name[0] + ".backup.gramps"
# check to see if the old file exists
if os.path.exists(backup): if os.path.exists(backup):
os.rename(backup,backup + ".old") os.rename(backup,backup + ".old")
try:
self.uistate.set_busy_cursor(1) self.uistate.set_busy_cursor(1)
self.uistate.progress.show() self.uistate.progress.show()
self.uistate.push_message(self.state, _("Autobackup...")) self.uistate.push_message(self.state, _("Autobackup..."))
@ -478,6 +484,11 @@ class ViewManager:
writer.write(backup) writer.write(backup)
self.uistate.set_busy_cursor(0) self.uistate.set_busy_cursor(0)
self.uistate.progress.hide() self.uistate.progress.hide()
except:
# the backup failed, so we assume that the autobackup file was corrupted,
# so restore the old file
if os.path.exists(backup + ".old"):
os.rename(backup+".old",backup)
def abort(self,obj=None): def abort(self,obj=None):
""" """