doc update
svn: r7622
This commit is contained in:
		@@ -461,23 +461,34 @@ class ViewManager:
 | 
			
		||||
        gtk.main_quit()
 | 
			
		||||
 | 
			
		||||
    def backup(self):
 | 
			
		||||
        """
 | 
			
		||||
        Backup the current file as an XML file.
 | 
			
		||||
        """
 | 
			
		||||
        import GrampsDb
 | 
			
		||||
        
 | 
			
		||||
        if self.state.db.undoindex > 0:
 | 
			
		||||
 | 
			
		||||
            # build backup path name
 | 
			
		||||
            bpath = self.state.db.get_save_path()
 | 
			
		||||
            name = os.path.splitext(bpath)
 | 
			
		||||
 | 
			
		||||
            backup = name[0] + ".backup.gramps"
 | 
			
		||||
            backup = os.path.splitext(bpath)[0] + ".backup.gramps"
 | 
			
		||||
 | 
			
		||||
            # check to see if the old file exists
 | 
			
		||||
            if os.path.exists(backup):
 | 
			
		||||
                os.rename(backup,backup + ".old")
 | 
			
		||||
            self.uistate.set_busy_cursor(1)
 | 
			
		||||
            self.uistate.progress.show()
 | 
			
		||||
            self.uistate.push_message(self.state, _("Autobackup..."))
 | 
			
		||||
            writer = GrampsDb.XmlWriter(self.state.db, self.uistate.pulse_progressbar, 0, 1)
 | 
			
		||||
            writer.write(backup)
 | 
			
		||||
            self.uistate.set_busy_cursor(0)
 | 
			
		||||
            self.uistate.progress.hide()
 | 
			
		||||
 | 
			
		||||
            try:
 | 
			
		||||
                self.uistate.set_busy_cursor(1)
 | 
			
		||||
                self.uistate.progress.show()
 | 
			
		||||
                self.uistate.push_message(self.state, _("Autobackup..."))
 | 
			
		||||
                writer = GrampsDb.XmlWriter(self.state.db, self.uistate.pulse_progressbar, 0, 1)
 | 
			
		||||
                writer.write(backup)
 | 
			
		||||
                self.uistate.set_busy_cursor(0)
 | 
			
		||||
                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):
 | 
			
		||||
        """
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user