From 90bdb0a8407d4187f5e3db2c74d5e2affac2b118 Mon Sep 17 00:00:00 2001 From: Nick Hall Date: Sat, 12 May 2018 22:59:52 +0100 Subject: [PATCH] Revert "Embedded Clone Event w. references (2nd pass, part A)" This reverts commit ae322dbdc829726923b10ba0cb0d5a511cad4aae. Changes requested in the PR not made. Such a change requires discussion on the list first. --- gramps/gui/editors/displaytabs/backreflist.py | 4 +- gramps/gui/editors/displaytabs/buttontab.py | 51 ++++--------------- .../gui/editors/displaytabs/embeddedlist.py | 9 ++-- .../gui/editors/displaytabs/eventembedlist.py | 25 +-------- .../editors/displaytabs/groupembeddedlist.py | 12 ++--- .../displaytabs/personeventembedlist.py | 1 - 6 files changed, 19 insertions(+), 83 deletions(-) diff --git a/gramps/gui/editors/displaytabs/backreflist.py b/gramps/gui/editors/displaytabs/backreflist.py index 2af843863..715fa7568 100644 --- a/gramps/gui/editors/displaytabs/backreflist.py +++ b/gramps/gui/editors/displaytabs/backreflist.py @@ -89,9 +89,7 @@ class BackRefList(EmbeddedList): def is_empty(self): return self.model.count == 0 - def _create_buttons(self, - share=False, clone=False, move=False, jump=False, - top_label=None): + def _create_buttons(self, share=False, move=False, jump=False, top_label=None): """ Create a button box consisting of one button: Edit. This button box is then appended hbox (self). diff --git a/gramps/gui/editors/displaytabs/buttontab.py b/gramps/gui/editors/displaytabs/buttontab.py index dd685bbf9..c8fd12b04 100644 --- a/gramps/gui/editors/displaytabs/buttontab.py +++ b/gramps/gui/editors/displaytabs/buttontab.py @@ -3,7 +3,6 @@ # # Copyright (C) 2000-2006 Donald N. Allingham # Copyright (C) 2009-2011 Gary Burton -# 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 @@ -71,16 +70,13 @@ class ButtonTab(GrampsTab): 'del' : _('Remove'), 'edit' : _('Edit'), 'share' : _('Share'), - 'clone' : _('Clone'), 'jump' : _('Jump To'), 'up' : _('Move Up'), 'down' : _('Move Down'), } - def __init__(self, dbstate, uistate, track, name, - share_button=False, clone_button=False, - move_buttons=False, jump_button=False, - top_label=None): + def __init__(self, dbstate, uistate, track, name, share_button=False, + move_buttons=False, jump_button=False, top_label=None): """ Similar to the base class, except after Build. @@ -99,8 +95,6 @@ class ButtonTab(GrampsTab): @type name: str/unicode @param share_button: Add a share button to the Notebook tab or not @type name: bool - @param clone_button: Add a clone button to the Notebook tab or not - @type name: bool @param move_buttons: Add up and down button to the Notebook tab or not @type name: bool @param jump_button: Add a goto button @@ -109,20 +103,17 @@ class ButtonTab(GrampsTab): @type top_label: string or None for no label """ self.dirty_selection = False - GrampsTab.__init__(self, dbstate, uistate, track, name) - self._create_buttons(share_button, clone_button, - move_buttons, jump_button, - top_label) + GrampsTab.__init__(self,dbstate, uistate, track, name) + self._create_buttons(share_button, move_buttons, jump_button, top_label) - def _create_buttons(self, - share_button, clone_button, move_buttons, jump_button, - top_label): + def _create_buttons(self, share_button, move_buttons, jump_button, + top_label): """ Create a button box consisting of three buttons, one for Add, one for Edit, and one for Delete. - Add buttons for Share, Clone, Move and Jump depending on parameters. - This button box is then appended hbox (self). + Add buttons for Share, Move and Jump depending on parameters. This + button box is then appended hbox (self). Prepend a label if top_label given Note: some ButtonTab subclasses override this method. @@ -150,13 +141,6 @@ class ButtonTab(GrampsTab): else: self.share_btn = None - if clone_button: - self.clone_btn = SimpleButton('gramps-clone', self.clone_button_clicked) - self.clone_btn.set_tooltip_text(self._MSG['clone']) - self.track_ref_for_deletion("clone_btn") - else: - self.clone_btn = None - if move_buttons: self.up_btn = SimpleButton('go-up', self.up_button_clicked) self.up_btn.set_tooltip_text(self._MSG['up']) @@ -183,8 +167,6 @@ class ButtonTab(GrampsTab): if share_button: hbox.pack_start(self.share_btn, False, True, 0) hbox.pack_start(self.edit_btn, False, True, 0) - if clone_button: - hbox.pack_start(self.clone_btn, False, True, 0) hbox.pack_start(self.del_btn, False, True, 0) if move_buttons: hbox.pack_start(self.up_btn, False, True, 0) @@ -200,8 +182,6 @@ class ButtonTab(GrampsTab): self.del_btn.set_sensitive(False) if share_button: self.share_btn.set_sensitive(False) - if clone_button: - self.clone_btn.set_sensitive(False) if jump_button and self.jump_btn: self.jump_btn.set_sensitive(False) if move_buttons: @@ -266,13 +246,6 @@ class ButtonTab(GrampsTab): """ print("Uncaught Share clicked") - def clone_button_clicked(self, obj): - """ - Function called with the Clone button is clicked. This function - should be overridden by the derived class. - """ - print("Uncaught Clone clicked") - def jump_button_clicked(self, obj): """ Function called with the Jump button is clicked. This function @@ -311,8 +284,8 @@ class ButtonTab(GrampsTab): def _selection_changed(self, obj=None): """ - Attached to the selection's 'changed' signal. Checks to see - if anything is selected. If it is, the edit, clone and + Attached to the selection's 'changed' signal. Checks + to see if anything is selected. If it is, the edit and delete buttons are enabled, otherwise the are disabled. """ # Comparing to None is important, as empty strings @@ -323,8 +296,6 @@ class ButtonTab(GrampsTab): return if self.get_selected() is not None: self.edit_btn.set_sensitive(True) - if self.clone_btn: - self.clone_btn.set_sensitive(True) if self.jump_btn: self.jump_btn.set_sensitive(True) if not self.dbstate.db.readonly: @@ -336,8 +307,6 @@ class ButtonTab(GrampsTab): # self.down_btn.set_sensitive(True) else: self.edit_btn.set_sensitive(False) - if self.clone_btn: - self.clone_btn.set_sensitive(False) if self.jump_btn: self.jump_btn.set_sensitive(False) if not self.dbstate.db.readonly: diff --git a/gramps/gui/editors/displaytabs/embeddedlist.py b/gramps/gui/editors/displaytabs/embeddedlist.py index 9bf818f4f..7bbeaf0a3 100644 --- a/gramps/gui/editors/displaytabs/embeddedlist.py +++ b/gramps/gui/editors/displaytabs/embeddedlist.py @@ -76,16 +76,13 @@ class EmbeddedList(ButtonTab): _DND_EXTRA = None def __init__(self, dbstate, uistate, track, name, build_model, - share_button=False, clone_button=False, - move_buttons=False, jump_button=False, + share_button=False, move_buttons=False, jump_button=False, top_label=None): """ Create a new list, using the passed build_model to populate the list. """ - ButtonTab.__init__(self, dbstate, uistate, track, name, - share_button, clone_button, - move_buttons, jump_button, - top_label) + ButtonTab.__init__(self, dbstate, uistate, track, name, share_button, + move_buttons, jump_button, top_label) self.changed = False self.model = None diff --git a/gramps/gui/editors/displaytabs/eventembedlist.py b/gramps/gui/editors/displaytabs/eventembedlist.py index 24bc3e4da..30e7bcb62 100644 --- a/gramps/gui/editors/displaytabs/eventembedlist.py +++ b/gramps/gui/editors/displaytabs/eventembedlist.py @@ -3,7 +3,6 @@ # # Copyright (C) 2000-2006 Donald N. Allingham # Copyright (C) 2009 B. Malengier -# 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 @@ -66,7 +65,6 @@ class EventEmbedList(DbGUIElement, GroupEmbeddedList): 'del' : _('Remove the selected family event'), 'edit' : _('Edit the selected family event or edit person'), 'share' : _('Share an existing event'), - 'clone' : _('Clone an existing event'), 'up' : _('Move the selected event upwards'), 'down' : _('Move the selected event downwards'), } @@ -98,7 +96,7 @@ class EventEmbedList(DbGUIElement, GroupEmbeddedList): self._data = [] DbGUIElement.__init__(self, dbstate.db) GroupEmbeddedList.__init__(self, dbstate, uistate, track, _('_Events'), - build_model, share_button=True, clone_button=True, + build_model, share_button=True, move_buttons=True, **kwargs) def _connect_db_signals(self): @@ -288,27 +286,6 @@ class EventEmbedList(DbGUIElement, GroupEmbeddedList): key = self._groups[ref[0]][0] self.editnotworkgroup(key) - def clone_button_clicked(self, obj): - 'Function called with the Clone button is clicked.' - source_ref = self.get_selected() - if source_ref and \ - source_ref[1] is not None \ - and source_ref[0] == self._WORKGROUP: - source_event = self.dbstate.db.get_event_from_handle(source_ref[1].ref) - - try: - ref = EventRef(source=source_ref[1]) - - event = Event(source=source_event) - event.set_gramps_id(self.dbstate.db.find_next_event_gramps_id()) - event.set_handle(None) - - self.get_ref_editor()( - self.dbstate, self.uistate, self.track, - event, ref, self.object_added) - except WindowActiveError: - pass - def object_added(self, reference, primary): reference.ref = primary.handle data = self.get_data()[self._WORKGROUP] diff --git a/gramps/gui/editors/displaytabs/groupembeddedlist.py b/gramps/gui/editors/displaytabs/groupembeddedlist.py index 266799ae2..a619c4134 100644 --- a/gramps/gui/editors/displaytabs/groupembeddedlist.py +++ b/gramps/gui/editors/displaytabs/groupembeddedlist.py @@ -60,21 +60,17 @@ class GroupEmbeddedList(EmbeddedList): _WORKGROUP = 0 def __init__(self, dbstate, uistate, track, name, build_model, - share_button=False, clone_button=False, - move_buttons=False, jump_button=False, **kwargs): + share_button=False, move_buttons=False, jump_button=False, **kwargs): """ Create a new list, using the passed build_model to populate the list. """ self.kwargs = kwargs - EmbeddedList.__init__(self, dbstate, uistate, track, name, build_model, - share_button, clone_button, - move_buttons, jump_button) - - # connect click on the first column + EmbeddedList.__init__(self, dbstate, uistate, track, name, build_model, + share_button, move_buttons, jump_button) + #connect click on the first column self.columns[0].connect('clicked', self.groupcol_click) for col in self.columns[1:]: col.connect('clicked', self.col_click) - self.dbsort = True def construct_model(self): diff --git a/gramps/gui/editors/displaytabs/personeventembedlist.py b/gramps/gui/editors/displaytabs/personeventembedlist.py index 4857543b5..320f04777 100644 --- a/gramps/gui/editors/displaytabs/personeventembedlist.py +++ b/gramps/gui/editors/displaytabs/personeventembedlist.py @@ -57,7 +57,6 @@ class PersonEventEmbedList(EventEmbedList): 'del' : _('Remove the selected personal event'), 'edit' : _('Edit the selected personal event or edit family'), 'share' : _('Share an existing event'), - 'clone' : _('Clone an existing event'), 'up' : _('Move the selected event upwards or change family order'), 'down' : _('Move the selected event downwards or change family order'), }