Allow multiple deletes from event view
svn: r10897
This commit is contained in:
parent
8eec2297bb
commit
36e115d473
@ -1,6 +1,7 @@
|
|||||||
# Gramps - a GTK+/GNOME based genealogy program
|
# Gramps - a GTK+/GNOME based genealogy program
|
||||||
#
|
#
|
||||||
# Copyright (C) 2001-2007 Donald N. Allingham
|
# Copyright (C) 2001-2007 Donald N. Allingham
|
||||||
|
# Copyright (C) 2008 Gary Burton
|
||||||
#
|
#
|
||||||
# This program is free software; you can redistribute it and/or modify
|
# 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
|
# it under the terms of the GNU General Public License as published by
|
||||||
@ -43,7 +44,7 @@ import Errors
|
|||||||
import Bookmarks
|
import Bookmarks
|
||||||
import Config
|
import Config
|
||||||
from DdTargets import DdTargets
|
from DdTargets import DdTargets
|
||||||
from QuestionDialog import QuestionDialog
|
from QuestionDialog import QuestionDialog, QuestionDialog2
|
||||||
from Editors import EditEvent, DelEventQuery
|
from Editors import EditEvent, DelEventQuery
|
||||||
from Filters.SideBar import EventSidebarFilter
|
from Filters.SideBar import EventSidebarFilter
|
||||||
from ReportBase import CATEGORY_QR_EVENT
|
from ReportBase import CATEGORY_QR_EVENT
|
||||||
@ -102,7 +103,9 @@ class EventView(PageView.ListView):
|
|||||||
EventView.COLUMN_NAMES, len(EventView.COLUMN_NAMES),
|
EventView.COLUMN_NAMES, len(EventView.COLUMN_NAMES),
|
||||||
DisplayModels.EventModel,
|
DisplayModels.EventModel,
|
||||||
signal_map, dbstate.db.get_event_bookmarks(),
|
signal_map, dbstate.db.get_event_bookmarks(),
|
||||||
Bookmarks.EventBookmarks, filter_class=EventSidebarFilter)
|
Bookmarks.EventBookmarks,
|
||||||
|
multiple=True,
|
||||||
|
filter_class=EventSidebarFilter)
|
||||||
|
|
||||||
Config.client.notify_add("/apps/gramps/interface/filter",
|
Config.client.notify_add("/apps/gramps/interface/filter",
|
||||||
self.filter_toggle)
|
self.filter_toggle)
|
||||||
@ -218,8 +221,20 @@ class EventView(PageView.ListView):
|
|||||||
pass
|
pass
|
||||||
|
|
||||||
def remove(self, obj):
|
def remove(self, obj):
|
||||||
|
prompt = True
|
||||||
|
if len(self.selected_handles()) > 1:
|
||||||
|
q = QuestionDialog2(
|
||||||
|
_("Remove selected events?"),
|
||||||
|
_("More than one event has been selected for deletion. "
|
||||||
|
"Ask before deleting each one?"),
|
||||||
|
_("Yes"),
|
||||||
|
_("No"))
|
||||||
|
prompt = q.run()
|
||||||
|
|
||||||
|
if not prompt:
|
||||||
|
self.uistate.set_busy_cursor(1)
|
||||||
|
|
||||||
for ehandle in self.selected_handles():
|
for ehandle in self.selected_handles():
|
||||||
db = self.dbstate.db
|
|
||||||
person_list = [
|
person_list = [
|
||||||
item[1] for item in
|
item[1] for item in
|
||||||
self.dbstate.db.find_backlink_handles(ehandle,['Person']) ]
|
self.dbstate.db.find_backlink_handles(ehandle,['Person']) ]
|
||||||
@ -228,26 +243,32 @@ class EventView(PageView.ListView):
|
|||||||
item[1] for item in
|
item[1] for item in
|
||||||
self.dbstate.db.find_backlink_handles(ehandle,['Family']) ]
|
self.dbstate.db.find_backlink_handles(ehandle,['Family']) ]
|
||||||
|
|
||||||
event = db.get_event_from_handle(ehandle)
|
event = self.dbstate.db.get_event_from_handle(ehandle)
|
||||||
|
|
||||||
ans = DelEventQuery(self.dbstate, self.uistate, event,
|
ans = DelEventQuery(self.dbstate, self.uistate, event,
|
||||||
person_list, family_list)
|
person_list, family_list)
|
||||||
|
|
||||||
if len(person_list) + len(family_list) > 0:
|
if prompt:
|
||||||
msg = _('This event is currently being used. Deleting it '
|
if len(person_list) + len(family_list) > 0:
|
||||||
'will remove it from the database and from all '
|
msg = _('This event is currently being used. Deleting it '
|
||||||
'people and families that reference it.')
|
'will remove it from the database and from all '
|
||||||
|
'people and families that reference it.')
|
||||||
|
else:
|
||||||
|
msg = _('Deleting event will remove it from the database.')
|
||||||
|
|
||||||
|
msg = "%s %s" % (msg, Utils.data_recover_msg)
|
||||||
|
descr = event.get_description()
|
||||||
|
if descr == "":
|
||||||
|
descr = event.get_gramps_id()
|
||||||
|
|
||||||
|
self.uistate.set_busy_cursor(1)
|
||||||
|
QuestionDialog(_('Delete %s?') % descr, msg,
|
||||||
|
_('_Delete Event'), ans.query_response)
|
||||||
|
self.uistate.set_busy_cursor(0)
|
||||||
else:
|
else:
|
||||||
msg = _('Deleting event will remove it from the database.')
|
ans.query_response()
|
||||||
|
|
||||||
msg = "%s %s" % (msg, Utils.data_recover_msg)
|
if not prompt:
|
||||||
descr = event.get_description()
|
|
||||||
if descr == "":
|
|
||||||
descr = event.get_gramps_id()
|
|
||||||
|
|
||||||
self.uistate.set_busy_cursor(1)
|
|
||||||
QuestionDialog(_('Delete %s?') % descr, msg,
|
|
||||||
_('_Delete Event'), ans.query_response)
|
|
||||||
self.uistate.set_busy_cursor(0)
|
self.uistate.set_busy_cursor(0)
|
||||||
|
|
||||||
def edit(self, obj):
|
def edit(self, obj):
|
||||||
|
Loading…
Reference in New Issue
Block a user