From 6054b03ea813234d4a7e99bb78e7e6a330591ac0 Mon Sep 17 00:00:00 2001 From: Don Allingham Date: Tue, 29 Jul 2003 04:36:13 +0000 Subject: [PATCH] * src/gramps_main.py: handle autosave more gracefully svn: r1940 --- gramps2/src/gramps_main.py | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/gramps2/src/gramps_main.py b/gramps2/src/gramps_main.py index 3584672a0..7f4d363e9 100755 --- a/gramps2/src/gramps_main.py +++ b/gramps2/src/gramps_main.py @@ -674,12 +674,16 @@ class Gramps: """Catch the reponse to the save on exit question""" self.delete_abandoned_photos() self.db.close() + if GrampsCfg.lastfile: + self.delete_autosave(GrampsCfg.lastfile) gtk.mainquit() def close_noquit(self): """Close database and delete abandoned photos, no quit""" self.delete_abandoned_photos() self.db.close() + if GrampsCfg.lastfile: + self.delete_autosave(GrampsCfg.lastfile) Utils.clearModified() def delete_abandoned_photos(self): @@ -758,6 +762,11 @@ class Gramps: self.model_used = {} self.default_list.clear() + + for page in self.pl_page[0:-1]: + page.cleanup() + del page + self.pl_page = [ self.default_list ] @@ -1204,8 +1213,6 @@ class Gramps: path = filename filename = os.path.normpath(os.path.abspath(filename)) - autosave = "%s/autosave.gramps" % filename - self.status_text(_("Saving %s ...") % filename) Utils.clearModified() @@ -1256,6 +1263,10 @@ class Gramps: self.status_text("") self.statusbar.set_progress_percentage(0.0) self.statusbar.set_pulse_step(0.02) + self.delete_autosave(old_file) + + def delete_autosave(self,filename): + autosave = "%s/autosave.gramps" % filename if os.path.exists(autosave): try: os.remove(autosave)