diff --git a/gramps/gui/dialog.py b/gramps/gui/dialog.py
index 8b2df82b6..91ce7bb77 100644
--- a/gramps/gui/dialog.py
+++ b/gramps/gui/dialog.py
@@ -339,6 +339,66 @@ class MissingMediaDialog(object):
self.top)
return True
+class MultiSelectDialog(object):
+ def __init__(self, msg1, msg2, task1, task2, task3, parent=None):
+ self.xml = Glade(toplevel='multiselectdialog')
+
+ self.top = self.xml.toplevel
+ self.top.set_icon(ICON)
+ self.top.set_title("%s - Gramps" % msg1)
+
+ self.task1 = task1
+ self.task2 = task2
+ self.task3 = task3
+ self.default_action = 0
+ self.last_action = 0
+
+ label1 = self.xml.get_object('label6')
+ label1.set_text('%s' % msg1)
+ label1.set_use_markup(True)
+
+ label2 = self.xml.get_object('label5')
+ label2.set_text(msg2)
+ label2.set_use_markup(True)
+
+ check_button = self.xml.get_object('apply_to_rest')
+
+ if parent:
+ self.top.set_transient_for(parent)
+ self.top.show()
+ self.top.connect('delete_event', self.warn)
+ response = Gtk.ResponseType.DELETE_EVENT
+
+ # Need some magic here, because an attempt to close the dialog
+ # with the X button not only emits the 'delete_event' signal
+ # but also exits with the RESPONSE_DELETE_EVENT
+ while response == Gtk.ResponseType.DELETE_EVENT:
+ response = self.top.run()
+
+ if check_button.get_active():
+ self.default_action = response
+ else:
+ self.default_action = 0
+ self.last_action = response
+ if response == 1:
+ if self.task1:
+ self.task1()
+ elif response == 2:
+ if self.task2:
+ self.task2()
+ elif response == 3:
+ if self.task3:
+ self.task3()
+ self.top.destroy()
+
+ def warn(self, obj, obj2):
+ WarningDialog(
+ _("Attempt to force closing the dialog"),
+ _("Please do not force closing this important dialog.\n"
+ "Instead select one of the available options"),
+ self.top)
+ return True
+
class MessageHideDialog(object):
def __init__(self, title, message, key, parent=None):
diff --git a/gramps/gui/glade/dialog.glade b/gramps/gui/glade/dialog.glade
index ddbcf837d..ae23b3085 100644
--- a/gramps/gui/glade/dialog.glade
+++ b/gramps/gui/glade/dialog.glade
@@ -397,6 +397,169 @@
button11
+
False
dialog
diff --git a/gramps/plugins/lib/libpersonview.py b/gramps/plugins/lib/libpersonview.py
index 90f89ab9c..ce7b16917 100644
--- a/gramps/plugins/lib/libpersonview.py
+++ b/gramps/plugins/lib/libpersonview.py
@@ -51,7 +51,7 @@ from gramps.gui.views.listview import ListView, TEXT, MARKUP, ICON
from gramps.gui.actiongroup import ActionGroup
from gramps.gen.utils.string import data_recover_msg
from gramps.gen.display.name import displayer as name_displayer
-from gramps.gui.dialog import ErrorDialog, QuestionDialog
+from gramps.gui.dialog import ErrorDialog, MultiSelectDialog
from gramps.gen.errors import WindowActiveError
from gramps.gui.views.bookmarks import PersonBookmarks
from gramps.gen.config import config
@@ -286,18 +286,34 @@ class BasePersonView(ListView):
"""
Remove a person from the database.
"""
+ self._multi_select_dialog = None
for sel in self.selected_handles():
person = self.dbstate.db.get_person_from_handle(sel)
self.active_person = person
- name = name_displayer.display(person)
-
- msg = _('Deleting the person will remove the person '
- 'from the database.')
- msg = "%s %s" % (msg, data_recover_msg)
- QuestionDialog(_('Delete %s?') % name,
- msg,
- _('_Delete Person'),
- self.delete_person_response)
+ if (self._multi_select_dialog and
+ self._multi_select_dialog.default_action != 0):
+ # Repeat previous choice
+ if self._multi_select_dialog.default_action == 1: # Cancel
+ break
+ elif self._multi_select_dialog.default_action == 2: # No
+ break
+ elif self._multi_select_dialog.default_action == 3: # Yes
+ self.delete_person_response()
+ elif (self._multi_select_dialog and
+ self._multi_select_dialog.last_action == 1): # Cancel
+ # Cancel the rest of the operations
+ break
+ else:
+ # Ask to delete; option to cancel, delete rest
+ name = name_displayer.display(person) + (" [%s]" % person.gramps_id)
+ msg = _('Deleting the person will remove the person '
+ 'from the database.')
+ self._multi_select_dialog = MultiSelectDialog(_('Delete %s?') % name,
+ msg,
+ None, # Cancel function
+ None, # No function
+ self.delete_person_response) # Yes
+ self._multi_select_dialog = None
def delete_person_response(self):
"""