* src/gramps_main.py: handle autosave more gracefully

svn: r1940
This commit is contained in:
Don Allingham 2003-07-29 04:36:13 +00:00
parent 5ce10796a2
commit 80e6b47bfb

View File

@ -674,12 +674,16 @@ class Gramps:
"""Catch the reponse to the save on exit question""" """Catch the reponse to the save on exit question"""
self.delete_abandoned_photos() self.delete_abandoned_photos()
self.db.close() self.db.close()
if GrampsCfg.lastfile:
self.delete_autosave(GrampsCfg.lastfile)
gtk.mainquit() gtk.mainquit()
def close_noquit(self): def close_noquit(self):
"""Close database and delete abandoned photos, no quit""" """Close database and delete abandoned photos, no quit"""
self.delete_abandoned_photos() self.delete_abandoned_photos()
self.db.close() self.db.close()
if GrampsCfg.lastfile:
self.delete_autosave(GrampsCfg.lastfile)
Utils.clearModified() Utils.clearModified()
def delete_abandoned_photos(self): def delete_abandoned_photos(self):
@ -758,6 +762,11 @@ class Gramps:
self.model_used = {} self.model_used = {}
self.default_list.clear() self.default_list.clear()
for page in self.pl_page[0:-1]:
page.cleanup()
del page
self.pl_page = [ self.pl_page = [
self.default_list self.default_list
] ]
@ -1204,8 +1213,6 @@ class Gramps:
path = filename path = filename
filename = os.path.normpath(os.path.abspath(filename)) filename = os.path.normpath(os.path.abspath(filename))
autosave = "%s/autosave.gramps" % filename
self.status_text(_("Saving %s ...") % filename) self.status_text(_("Saving %s ...") % filename)
Utils.clearModified() Utils.clearModified()
@ -1256,6 +1263,10 @@ class Gramps:
self.status_text("") self.status_text("")
self.statusbar.set_progress_percentage(0.0) self.statusbar.set_progress_percentage(0.0)
self.statusbar.set_pulse_step(0.02) 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): if os.path.exists(autosave):
try: try:
os.remove(autosave) os.remove(autosave)