diff --git a/gramps/gui/editors/displaytabs/eventbackreflist.py b/gramps/gui/editors/displaytabs/eventbackreflist.py index fafe995ae..d88959f89 100644 --- a/gramps/gui/editors/displaytabs/eventbackreflist.py +++ b/gramps/gui/editors/displaytabs/eventbackreflist.py @@ -2,7 +2,6 @@ # Gramps - a GTK+/GNOME based genealogy program # # Copyright (C) 2000-2006 Donald N. Allingham -# Copyright (C) 2018 Alois Poettker # # 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 @@ -28,24 +27,10 @@ from .backrefmodel import BackRefModel from .backreflist import BackRefList class EventBackRefList(BackRefList): - """""" - def __init__(self, dbstate, uistate, track, obj, option=None, callback=None): - """ - Connector class between events and back reference mechanism - """ - self.option = option + def __init__(self, dbstate, uistate, track, obj, callback=None): BackRefList.__init__(self, dbstate, uistate, track, obj, BackRefModel, callback) def get_icon_name(self): return 'gramps-event' - - def get_data(self): - """ - Method overrides 'get_data' from BackRefList.py - """ - if self.option and self.option['action']: - return [] - else: - return self.obj diff --git a/gramps/gui/editors/editevent.py b/gramps/gui/editors/editevent.py index 0d7ab6c1e..f2726f292 100644 --- a/gramps/gui/editors/editevent.py +++ b/gramps/gui/editors/editevent.py @@ -4,7 +4,6 @@ # Copyright (C) 2000-2007 Donald N. Allingham # Copyright (C) 2009 Gary Burton # Copyright (C) 2011 Tim G L Lyons -# Copyright (C) 2018 Alois Poettker # # 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 @@ -72,9 +71,6 @@ WIKI_HELP_SEC = _('manual|New_Event_dialog') class EditEvent(EditPrimary): def __init__(self, dbstate, uistate, track, event, callback=None): - """""" - self.callback = callback - self.action = uistate.action.split('-')[1] EditPrimary.__init__(self, dbstate, uistate, track, event, dbstate.db.get_event_from_handle, @@ -90,27 +86,18 @@ class EditEvent(EditPrimary): return Event() def get_menu_title(self): - """ compile menu title out of different actions """ handle = self.obj.get_handle() - - event_action, event_name = '', '' if handle: - if self.action == 'clone': - event_action = _('Clone') - if self.action == 'edit': - event_action = _('Edit') - who = get_participant_from_event(self.db, handle) desc = self.obj.get_description() - event_name = self.obj.get_type().string + event_name = self.obj.get_type() + if desc: + event_name = '%s - %s' % (event_name, desc) if who: - event_name = ': %s - %s' % (event_name, who) - elif desc: - event_name = ': %s - %s' % (event_name, desc) + event_name = '%s - %s' % (event_name, who) + dialog_title = _('Event: %s') % event_name else: - event_action = _('New') - - dialog_title = _('%s Event%s') % (event_action, event_name) + dialog_title = _('New Event') return dialog_title def get_custom_events(self): @@ -220,14 +207,10 @@ class EditEvent(EditPrimary): self._add_tab(notebook, self.attr_list) handle_list = self.dbstate.db.find_backlink_handles(self.obj.handle) - # Additional variables in 'EventBackRefList' injected via 'option' - backref_option = {} - backref_option['action'] = self.action == 'clone' self.backref_list = EventBackRefList(self.dbstate, self.uistate, self.track, - handle_list, - option=backref_option) + handle_list) self._add_tab(notebook, self.backref_list) self._setup_notebook_tabs(notebook) @@ -286,11 +269,7 @@ class EditEvent(EditPrimary): self.db) as trans: self.db.add_event(self.obj, trans) else: - if self.action == 'clone': - with DbTxn(_("Clone Event"), self.db) as trans: - self.obj.handle = None - self.db.add_event(self.obj, trans) - elif self.data_has_changed(): + if self.data_has_changed(): with DbTxn(_("Edit Event (%s)") % self.obj.get_gramps_id(), self.db) as trans: if not self.obj.get_gramps_id(): @@ -308,6 +287,7 @@ class EditEvent(EditPrimary): entered date when importing from a XML file, so we can get an incorrect fail. """ + if self.db.readonly: return False elif self.obj.handle: diff --git a/gramps/gui/editors/editeventref.py b/gramps/gui/editors/editeventref.py index 053b70bf6..676b1d78c 100644 --- a/gramps/gui/editors/editeventref.py +++ b/gramps/gui/editors/editeventref.py @@ -241,7 +241,7 @@ class EditEventRef(EditReference): self.uistate, self.track, self.db.find_backlink_handles(self.source.handle), - callback=self.enable_warnbox) + self.enable_warnbox) self._add_tab(notebook, self.backref_tab) self.track_ref_for_deletion("backref_tab") diff --git a/gramps/plugins/view/eventview.py b/gramps/plugins/view/eventview.py index c369799f1..e133406fb 100644 --- a/gramps/plugins/view/eventview.py +++ b/gramps/plugins/view/eventview.py @@ -3,7 +3,7 @@ # Copyright (C) 2001-2007 Donald N. Allingham # Copyright (C) 2008 Gary Burton # Copyright (C) 2011 Tim G L Lyons -# Copyright (C) 2018 Alois Poettker +# Copyright (C) 2017 Alois Poettker # # 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 @@ -29,7 +29,6 @@ Provide the event view. # Standard python modules # #------------------------------------------------------------------------- -import copy import logging _LOG = logging.getLogger(".plugins.eventview") @@ -41,16 +40,16 @@ _LOG = logging.getLogger(".plugins.eventview") from gramps.gen.const import GRAMPS_LOCALE as glocale _ = glocale.translation.gettext +from gramps.gui.dialog import ErrorDialog, MultiSelectDialog, QuestionDialog from gramps.gen.errors import WindowActiveError from gramps.gen.lib import Event -from gramps.gen.plug import CATEGORY_QR_EVENT from gramps.gen.utils.string import data_recover_msg -from gramps.gui.dialog import ErrorDialog, MultiSelectDialog, QuestionDialog from gramps.gui.ddtargets import DdTargets from gramps.gui.editors import EditEvent, DeleteEventQuery from gramps.gui.filters.sidebar import EventSidebarFilter from gramps.gui.merge import MergeEvent +from gramps.gen.plug import CATEGORY_QR_EVENT from gramps.gui.views.bookmarks import EventBookmarks from gramps.gui.views.listview import ListView, TEXT, MARKUP, ICON from gramps.gui.views.treemodels import EventModel @@ -98,7 +97,6 @@ class EventView(ListView): EDIT_MSG = _("Edit the selected event") DEL_MSG = _("Delete the selected event") MERGE_MSG = _("Merge the selected events") - CLONE_MSG = _("Clones the selected event") FILTER_TYPE = "Event" QR_CATEGORY = CATEGORY_QR_EVENT @@ -126,8 +124,6 @@ class EventView(ListView): 'BackSpace' : self.key_delete, }) - # Identify the requested action in several sublevel - uistate.action = '' uistate.connect('nameformat-changed', self.build_tree) uistate.connect('placeformat-changed', self.build_tree) @@ -178,7 +174,6 @@ class EventView(ListView): - @@ -193,7 +188,6 @@ class EventView(ListView): - @@ -204,7 +198,6 @@ class EventView(ListView): - @@ -212,13 +205,8 @@ class EventView(ListView): def define_actions(self): ListView.define_actions(self) - self.edit_action.add_actions([ - ('Clone', 'gramps-clone', _('Clone...'), None, - self.CLONE_MSG, self.clone), - ]) self._add_action('FilterEdit', None, - _('Event Filter Editor'), - callback=self.filter_editor,) + _('Event Filter Editor'), callback=self.filter_editor) self._add_action('QuickReport', None, _("Quick View"), None, None, None) @@ -231,7 +219,6 @@ class EventView(ListView): def add(self, obj): try: - self.uistate.action = 'event-add' EditEvent(self.dbstate, self.uistate, [], Event()) except WindowActiveError: pass @@ -295,7 +282,6 @@ class EventView(ListView): for handle in self.selected_handles(): event = self.dbstate.db.get_event_from_handle(handle) try: - self.uistate.action = 'event-edit' EditEvent(self.dbstate, self.uistate, [], event) except WindowActiveError: pass @@ -304,38 +290,16 @@ class EventView(ListView): """ Merge the selected events. """ - merge_list = self.selected_handles() + mlist = self.selected_handles() - if len(merge_list) != 2: + if len(mlist) != 2: msg = _("Cannot merge event objects.") msg2 = _("Exactly two events must be selected to perform a merge. " "A second object can be selected by holding down the " "control key while clicking on the desired event.") ErrorDialog(msg, msg2, parent=self.uistate.window) else: - self.uistate.action = 'event-merge' - MergeEvent(self.dbstate, self.uistate, [], merge_list[0], merge_list[1]) - - def clone(self, obj): - """ - Clones the selected event. - """ - event_list = self.selected_handles() - - if len(event_list) != 1: - msg = _("Cannot clone event object.") - msg2 = _("Exactly one event must be selected to perform a clone.") - ErrorDialog(msg, msg2, parent=self.uistate.window) - else: - event = Event() - event = copy.deepcopy(self.dbstate.db.get_event_from_handle(event_list[0])) - event.gramps_id = None - - try: - self.uistate.action = 'event-clone' - EditEvent(self.dbstate, self.uistate, [], event) - except WindowActiveError: - pass + MergeEvent(self.dbstate, self.uistate, [], mlist[0], mlist[1]) def tag_updated(self, handle_list): """ diff --git a/images/hicolor/16x16/actions/gramps-clone.png b/images/hicolor/16x16/actions/gramps-clone.png deleted file mode 100644 index a8b5edaff..000000000 Binary files a/images/hicolor/16x16/actions/gramps-clone.png and /dev/null differ diff --git a/images/hicolor/22x22/actions/gramps-clone.png b/images/hicolor/22x22/actions/gramps-clone.png deleted file mode 100644 index d2144b8ad..000000000 Binary files a/images/hicolor/22x22/actions/gramps-clone.png and /dev/null differ diff --git a/images/hicolor/24x24/actions/gramps-clone.png b/images/hicolor/24x24/actions/gramps-clone.png deleted file mode 100644 index e2c8f029b..000000000 Binary files a/images/hicolor/24x24/actions/gramps-clone.png and /dev/null differ diff --git a/images/hicolor/48x48/actions/gramps-clone.png b/images/hicolor/48x48/actions/gramps-clone.png deleted file mode 100644 index df054a60e..000000000 Binary files a/images/hicolor/48x48/actions/gramps-clone.png and /dev/null differ diff --git a/images/hicolor/gramps-clone.png b/images/hicolor/gramps-clone.png deleted file mode 100644 index e2c8f029b..000000000 Binary files a/images/hicolor/gramps-clone.png and /dev/null differ diff --git a/images/hicolor/scalable/actions/gramps-clone.svg b/images/hicolor/scalable/actions/gramps-clone.svg deleted file mode 100644 index de1b3d548..000000000 --- a/images/hicolor/scalable/actions/gramps-clone.svg +++ /dev/null @@ -1,24 +0,0 @@ - - - - - - - - - - - - - - - - -