From 9fc5ce16db7e1a3ee9dddfc9767864582b131dbc Mon Sep 17 00:00:00 2001 From: Alex Roitman Date: Sun, 18 Jan 2004 01:59:30 +0000 Subject: [PATCH] * src/gramps_main.py (save_media): Add support for default action. * src/plugins/Check.py (cleanup_missing_photos): Add support for default action. * src/plugins/WriteCD.py (on_ok_clicked): Add support for default action. * src/plugins/WritePkg.py (export): Add support for default action. * src/plugins/WriteFtree.py: Do not import unused dialog. svn: r2652 --- ChangeLog | 6 ++++++ src/gramps_main.py | 25 +++++++++++++++++-------- src/plugins/Check.py | 17 ++++++++++++++--- src/plugins/WriteCD.py | 26 +++++++++++++++++--------- src/plugins/WriteFtree.py | 4 ++-- src/plugins/WritePkg.py | 25 +++++++++++++++++-------- 6 files changed, 73 insertions(+), 30 deletions(-) diff --git a/ChangeLog b/ChangeLog index 982d22bfe..b466ba352 100644 --- a/ChangeLog +++ b/ChangeLog @@ -10,6 +10,12 @@ * src/plugins/WebPage.py (write_gallery): Use object ID as a file name - prevents collision between identical names coming from different dirs. + * src/gramps_main.py (save_media): Add support for default action. + * src/plugins/Check.py (cleanup_missing_photos): Add support for default action. + * src/plugins/WriteCD.py (on_ok_clicked): Add support for default action. + * src/plugins/WritePkg.py (export): Add support for default action. + * src/plugins/WriteFtree.py: Do not import unused dialog. + 2004-01-16 Don Allingham * src/plugins/AncestorChart2.py: first pass at multipage output diff --git a/src/gramps_main.py b/src/gramps_main.py index 02ad32932..29c4a20fd 100755 --- a/src/gramps_main.py +++ b/src/gramps_main.py @@ -1,7 +1,7 @@ # # Gramps - a GTK+/GNOME based genealogy program # -# Copyright (C) 2000-2003 Donald N. Allingham +# Copyright (C) 2000-2004 Donald N. Allingham # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -1073,6 +1073,7 @@ class Gramps: def save_media(self,filename): import RelImage + missmedia_action = 0 #------------------------------------------------------------------------- def remove_clicked(): # File is lost => remove all references and the object itself @@ -1145,13 +1146,21 @@ class Gramps: % os.path.basename(oldfile), "so it was ignored." else: # File is lost => ask what to do - MissingMediaDialog(_("Media object could not be found"), - _("%(file_name)s is referenced in the database, but no longer exists. " - "The file may have been deleted or moved to a different location. " - "You may choose to either remove the reference from the database, " - "keep the reference to the missing file, or select a new file." - ) % { 'file_name' : oldfile }, - remove_clicked, leave_clicked, select_clicked) + if missmedia_action == 0: + mmd = MissingMediaDialog(_("Media object could not be found"), + _("%(file_name)s is referenced in the database, but no longer exists. " + "The file may have been deleted or moved to a different location. " + "You may choose to either remove the reference from the database, " + "keep the reference to the missing file, or select a new file." + ) % { 'file_name' : oldfile }, + remove_clicked, leave_clicked, select_clicked) + missmedia_action = mmd.default_action + elif missmedia_action == 1: + remove_clicked() + elif missmedia_action == 2: + leave_clicked() + elif missmedia_action == 3: + select_clicked() def save_file(self,filename,comment): diff --git a/src/plugins/Check.py b/src/plugins/Check.py index a4e76befa..0941953b6 100644 --- a/src/plugins/Check.py +++ b/src/plugins/Check.py @@ -1,7 +1,7 @@ # # Gramps - a GTK+/GNOME based genealogy program # -# Copyright (C) 2000-2003 Donald N. Allingham +# Copyright (C) 2000-2004 Donald N. Allingham # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -18,6 +18,8 @@ # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # +# $Id$ + "Database Processing/Check and repair database" #------------------------------------------------------------------------- @@ -112,6 +114,7 @@ class CheckIntegrity: self.broken_links.append((child,family)) def cleanup_missing_photos(self,cl=0): + missmedia_action = 0 #------------------------------------------------------------------------- def remove_clicked(): # File is lost => remove all references and the object itself @@ -185,13 +188,21 @@ class CheckIntegrity: % os.path.basename(photo_name) self.bad_photo.append(ObjectMap[ObjectId]) else: - MissingMediaDialog(_("Media object could not be found"), + if missmedia_action == 0: + mmd = MissingMediaDialog(_("Media object could not be found"), _("%(file_name)s is referenced in the database, but no longer exists. " "The file may have been deleted or moved to a different location. " "You may choose to either remove the reference from the database, " "keep the reference to the missing file, or select a new file." ) % { 'file_name' : photo_name }, - remove_clicked, leave_clicked, select_clicked) + remove_clicked, leave_clicked, select_clicked) + missmedia_action = mmd.default_action + elif missmedia_action == 1: + remove_clicked() + elif missmedia_action == 2: + leave_clicked() + elif missmedia_action == 3: + select_clicked() def cleanup_empty_families(self,automatic): for key in self.db.getFamilyMap().keys(): diff --git a/src/plugins/WriteCD.py b/src/plugins/WriteCD.py index a924ead68..69514db71 100644 --- a/src/plugins/WriteCD.py +++ b/src/plugins/WriteCD.py @@ -1,7 +1,7 @@ # # Gramps - a GTK+/GNOME based genealogy program # -# Copyright (C) 2000-2003 Donald N. Allingham +# Copyright (C) 2000-2004 Donald N. Allingham # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -162,6 +162,7 @@ class PackageWriter: def on_ok_clicked(self,obj): Utils.destroy_passed_object(obj) + missmedia_action = 0 base = os.path.basename(self.db.getSavePath()) @@ -250,14 +251,21 @@ class PackageWriter: else: # File is lost => ask what to do self.object_id = obj.getId() - QuestionDialog.MissingMediaDialog(_("Media object could not be found"), - _("%(file_name)s is referenced in the database, but no longer exists. " - "The file may have been deleted or moved to a different location. " - "You may choose to either remove the reference from the database, " - "keep the reference to the missing file, or select a new file." - ) % { 'file_name' : oldfile }, - remove_clicked, leave_clicked, select_clicked) - + if missmedia_action == 0: + mmd = QuestionDialog.MissingMediaDialog(_("Media object could not be found"), + _("%(file_name)s is referenced in the database, but no longer exists. " + "The file may have been deleted or moved to a different location. " + "You may choose to either remove the reference from the database, " + "keep the reference to the missing file, or select a new file." + ) % { 'file_name' : oldfile }, + remove_clicked, leave_clicked, select_clicked) + missmedia_action = mmd.default_action + elif missmedia_action == 1: + remove_clicked() + elif missmedia_action == 2: + leave_clicked() + elif missmedia_action == 3: + select_clicked() # Write XML now g = gnome.vfs.create('burn:///%s/data.gramps' % base,gnome.vfs.OPEN_WRITE ) diff --git a/src/plugins/WriteFtree.py b/src/plugins/WriteFtree.py index 03673e97e..4fe2d24a0 100644 --- a/src/plugins/WriteFtree.py +++ b/src/plugins/WriteFtree.py @@ -1,7 +1,7 @@ # # Gramps - a GTK+/GNOME based genealogy program # -# Copyright (C) 2003 Donald N. Allingham +# Copyright (C) 2003-2004 Donald N. Allingham # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -48,7 +48,7 @@ import Utils import GenericFilter import Errors -from QuestionDialog import MissingMediaDialog, ErrorDialog +from QuestionDialog import ErrorDialog from gettext import gettext as _ diff --git a/src/plugins/WritePkg.py b/src/plugins/WritePkg.py index edd58fefa..042c1e71f 100644 --- a/src/plugins/WritePkg.py +++ b/src/plugins/WritePkg.py @@ -1,7 +1,7 @@ # # Gramps - a GTK+/GNOME based genealogy program # -# Copyright (C) 2000-2003 Donald N. Allingham +# Copyright (C) 2000-2004 Donald N. Allingham # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -104,6 +104,7 @@ class PackageWriter: gnome.help_display('gramps-manual','export-data') def export(self, filename): + missmedia_action = 0 #-------------------------------------------------------------- def remove_clicked(): # File is lost => remove all references and the object itself @@ -178,13 +179,21 @@ class PackageWriter: g.close() else: # File is lost => ask what to do - MissingMediaDialog(_("Media object could not be found"), - _("%(file_name)s is referenced in the database, but no longer exists. " - "The file may have been deleted or moved to a different location. " - "You may choose to either remove the reference from the database, " - "keep the reference to the missing file, or select a new file." - ) % { 'file_name' : oldfile }, - remove_clicked, leave_clicked, select_clicked) + if missmedia_action == 0: + mmd = MissingMediaDialog(_("Media object could not be found"), + _("%(file_name)s is referenced in the database, but no longer exists. " + "The file may have been deleted or moved to a different location. " + "You may choose to either remove the reference from the database, " + "keep the reference to the missing file, or select a new file." + ) % { 'file_name' : oldfile }, + remove_clicked, leave_clicked, select_clicked) + missmedia_action = mmd.default_action + elif missmedia_action == 1: + remove_clicked() + elif missmedia_action == 2: + leave_clicked() + elif missmedia_action == 3: + select_clicked() # Write XML now g = StringIO()