From db37a7dbd948d8b661d05ac87b561c98d92eb149 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?syst=C3=A8me?= Date: Sat, 14 Jan 2017 10:23:03 +0100 Subject: [PATCH] Revert "9899: try to get labels on Family according to status" This reverts commit dedb5122cb682da069d2d23e25f2ea3b0d54f094. --- gramps/gen/config.py | 2 -- gramps/gen/plug/report/utils.py | 26 ------------------- gramps/gui/configure.py | 8 ------ .../gui/editors/displaytabs/eventembedlist.py | 5 ++-- gramps/gui/editors/editfamily.py | 22 +++++----------- .../filters/sidebar/_familysidebarfilter.py | 5 ++-- gramps/gui/glade/editfamily.glade | 6 +++-- gramps/gui/merge/mergeperson.py | 5 ++-- gramps/gui/selectors/selectfamily.py | 5 ++-- gramps/gui/utils.py | 25 ------------------ gramps/gui/widgets/reorderfam.py | 5 ++-- gramps/plugins/textreport/familygroup.py | 23 ++-------------- gramps/plugins/textreport/tagreport.py | 4 +-- gramps/plugins/view/familyview.py | 8 +++--- gramps/plugins/view/geofamclose.py | 6 ++--- gramps/plugins/view/geofamily.py | 6 ++--- gramps/plugins/view/relview.py | 7 +++-- gramps/plugins/webreport/narrativeweb.py | 4 +-- 18 files changed, 37 insertions(+), 135 deletions(-) diff --git a/gramps/gen/config.py b/gramps/gen/config.py index df5276c68..64d61e274 100644 --- a/gramps/gen/config.py +++ b/gramps/gen/config.py @@ -271,8 +271,6 @@ register('preferences.use-last-view', False) register('preferences.last-view', '') register('preferences.last-views', []) register('preferences.family-relation-type', 3) # UNKNOWN -register('preferences.father-label', "%s" % _("Father")) -register('preferences.mother-label', "%s" % _("Mother")) register('preferences.age-display-precision', 1) register('preferences.color-gender-male-alive', '#b8cee6') register('preferences.color-gender-male-death', '#b8cee6') diff --git a/gramps/gen/plug/report/utils.py b/gramps/gen/plug/report/utils.py index 8f4282553..796c0b058 100644 --- a/gramps/gen/plug/report/utils.py +++ b/gramps/gen/plug/report/utils.py @@ -40,12 +40,10 @@ import os #------------------------------------------------------------------------ from ...const import GRAMPS_LOCALE as glocale _ = glocale.translation.gettext -from gramps.gen.config import config from ...datehandler import get_date from ...display.place import displayer as _pd from ...utils.file import media_path_full from ..docgen import IndexMark, INDEX_TYPE_ALP -from ...relationship import get_relationship_calculator # _T_ is a gramps-defined keyword -- see po/update_po.py and po/genpot.sh def _T_(value): @@ -394,27 +392,3 @@ def get_family_filters(database, family, the_filters = [all_families, d_fams, ans] the_filters.extend(CustomFilters.get_filters('Family')) return the_filters - -def parents_labels(db, family, glocale): - """ - Get the label for parent - """ - father = db.get_person_from_handle(family.get_father_handle()) - mother = db.get_person_from_handle(family.get_mother_handle()) - - rel_father = config.get("preferences.father-label") - rel_mother = config.get("preferences.mother-label") - - if len(family.get_child_ref_list()) > 0: - rel_father = _('Father') - rel_mother = _('Mother') - if father.gender == 0: - rel_father = rel_mother - if mother.gender == 1: - rel_mother = rel_father - else: - rc = get_relationship_calculator(True, glocale) - rel_father = rc.get_one_relationship(db, mother, father) - rel_mother = rc.get_one_relationship(db, father, mother) - - return [rel_father[0].upper()+rel_father[1:].lower(), rel_mother[0].upper()+rel_mother[1:].lower()] diff --git a/gramps/gui/configure.py b/gramps/gui/configure.py index 2cb7866ae..963eac55e 100644 --- a/gramps/gui/configure.py +++ b/gramps/gui/configure.py @@ -1072,14 +1072,6 @@ class GrampsPreferences(ConfigureDialog): grid.attach(obox, 1, row, 2, 1) row += 1 - father_entry = self.add_entry(grid, _("Label for parent male"), - row, 'preferences.father-label') - row += 1 - - mother_entry = self.add_entry(grid, _("Label for parent female"), - row, 'preferences.mother-label') - row += 1 - #height multiple surname table self.add_pos_int_entry(grid, _('Height multiple surname box (pixels)'), diff --git a/gramps/gui/editors/displaytabs/eventembedlist.py b/gramps/gui/editors/displaytabs/eventembedlist.py index c819fb5c0..30e7bcb62 100644 --- a/gramps/gui/editors/displaytabs/eventembedlist.py +++ b/gramps/gui/editors/displaytabs/eventembedlist.py @@ -35,7 +35,6 @@ from gi.repository import GLib #------------------------------------------------------------------------- from gramps.gen.const import GRAMPS_LOCALE as glocale _ = glocale.translation.gettext -from gramps.gen.config import config from gramps.gen.lib import Event, EventRef, EventRoleType, EventType from gramps.gen.errors import WindowActiveError from ...ddtargets import DdTargets @@ -58,8 +57,8 @@ class EventEmbedList(DbGUIElement, GroupEmbeddedList): _WORKGROUP = EventRefModel._ROOTINDEX _WORKNAME = _("Family") - _FATHNAME = config.get("preferences.father-label") - _MOTHNAME = config.get("preferences.mother-label") + _FATHNAME = _("Father") + _MOTHNAME = _("Mother") _MSG = { 'add' : _('Add a new family event'), diff --git a/gramps/gui/editors/editfamily.py b/gramps/gui/editors/editfamily.py index 8e97a72a3..5d8d5e702 100644 --- a/gramps/gui/editors/editfamily.py +++ b/gramps/gui/editors/editfamily.py @@ -79,7 +79,6 @@ from gramps.gen.utils.db import (get_birth_or_fallback, get_death_or_fallback, get_marriage_or_fallback, preset_name, family_name) from ..selectors import SelectorFactory from gramps.gen.utils.id import create_id -from ..utils import parents_labels from gramps.gen.const import URL_MANUAL_SECT1 #------------------------------------------------------------------------- @@ -516,9 +515,6 @@ class EditFamily(EditPrimary): # FIXME: remove if we can use show() self.window.show_all = self.window.show - self.father_label = self.top.get_object('label589') - self.mother_label = self.top.get_object('label574') - self.fbirth = self.top.get_object('fbirth') self.fdeath = self.top.get_object('fdeath') self.fbirth_label = self.top.get_object('label578') @@ -537,9 +533,9 @@ class EditFamily(EditPrimary): self.mbutton_del = self.top.get_object('mbutton_del') self.mbutton_edit = self.top.get_object('mbutton_edit') - self.mbutton_index.set_tooltip_text(_("Select a woman")) - self.mbutton_add.set_tooltip_text(_("Add a woman")) - self.mbutton_del.set_tooltip_text(_("Remove the person as woman")) + self.mbutton_index.set_tooltip_text(_("Select a person as the mother")) + self.mbutton_add.set_tooltip_text(_("Add a new person as the mother")) + self.mbutton_del.set_tooltip_text(_("Remove the person as the mother")) self.mbutton_edit.connect('button-press-event', self.edit_mother) self.mbutton_edit.connect('key-press-event', self.edit_mother) @@ -552,9 +548,9 @@ class EditFamily(EditPrimary): self.fbutton_del = self.top.get_object('fbutton_del') self.fbutton_edit = self.top.get_object('fbutton_edit') - self.fbutton_index.set_tooltip_text(_("Select a man")) - self.fbutton_add.set_tooltip_text(_("Add a man")) - self.fbutton_del.set_tooltip_text(_("Remove the person as man")) + self.fbutton_index.set_tooltip_text(_("Select a person as the father")) + self.fbutton_add.set_tooltip_text(_("Add a new person as the father")) + self.fbutton_del.set_tooltip_text(_("Remove the person as the father")) self.fbutton_edit.connect('button-press-event', self.edit_father) self.fbutton_edit.connect('key-press-event', self.edit_father) @@ -683,12 +679,6 @@ class EditFamily(EditPrimary): self.phandles = [_f for _f in self.phandles if _f] - parents = parents_labels(self.db, self.obj) - self.father_label.set_label(parents[0][0].upper()+parents[0][1:].lower()) - self.fbutton_del.set_tooltip_text(_("Remove %s") % parents[0].lower()) - self.mother_label.set_label(parents[1][0].upper()+parents[1][1:].lower()) - self.mbutton_del.set_tooltip_text(_("Remove %s") % parents[1].lower()) - def get_start_date(self): """ Get the start date for a family, usually a marriage date, or diff --git a/gramps/gui/filters/sidebar/_familysidebarfilter.py b/gramps/gui/filters/sidebar/_familysidebarfilter.py index 9e2932942..6a82ca3a6 100644 --- a/gramps/gui/filters/sidebar/_familysidebarfilter.py +++ b/gramps/gui/filters/sidebar/_familysidebarfilter.py @@ -40,7 +40,6 @@ from gi.repository import Gtk # #------------------------------------------------------------------------- from ... import widgets -from gramps.gen.config import config from gramps.gen.lib import Event, EventType, Family, FamilyRelType from .. import build_filter_model from . import SidebarFilter @@ -110,8 +109,8 @@ class FamilySidebarFilter(SidebarFilter): self.rtype.get_child().set_width_chars(5) self.add_text_entry(_('ID'), self.filter_id) - self.add_text_entry(config.get("preferences.father-label"), self.filter_father) - self.add_text_entry(config.get("preferences.mother-label"), self.filter_mother) + self.add_text_entry(_('Father'), self.filter_father) + self.add_text_entry(_('Mother'), self.filter_mother) self.add_text_entry(_('Child'), self.filter_child) self.add_entry(_('Relationship'), self.rtype) self.add_entry(_('Family Event'), self.etype) diff --git a/gramps/gui/glade/editfamily.glade b/gramps/gui/glade/editfamily.glade index 1f5f507e7..a634982e5 100644 --- a/gramps/gui/glade/editfamily.glade +++ b/gramps/gui/glade/editfamily.glade @@ -157,6 +157,7 @@ True False start + Father/partner1 @@ -188,7 +189,7 @@ - Father, Partner, Spouse + Father @@ -434,6 +435,7 @@ True False start + Mother/partner2 @@ -465,7 +467,7 @@ - Mother, Partner, Spouse + Mother diff --git a/gramps/gui/merge/mergeperson.py b/gramps/gui/merge/mergeperson.py index ce1b2a4f7..f54e51527 100644 --- a/gramps/gui/merge/mergeperson.py +++ b/gramps/gui/merge/mergeperson.py @@ -38,7 +38,6 @@ from gi.repository import Pango #------------------------------------------------------------------------- from gramps.gen.const import GRAMPS_LOCALE as glocale _ = glocale.translation.sgettext -from gramps.gen.config import config from gramps.gen.plug.report import utils from gramps.gen.display.name import displayer as name_displayer from gramps.gen.display.place import displayer as place_displayer @@ -229,10 +228,10 @@ class MergePerson(ManagedWindow): KEYVAL % {'key': _('Family ID'), 'value': gid}) if fname: self.add(tobj, indent, - KEYVAL % {'key': config.get("preferences.father-label"), 'value': fname}) + KEYVAL % {'key': _('Father'), 'value': fname}) if mname: self.add(tobj, indent, - KEYVAL % {'key': config.get("preferences.mother-label"), 'value': mname}) + KEYVAL % {'key': _('Mother'), 'value': mname}) else: self.add(tobj, normal, _("No parents found")) diff --git a/gramps/gui/selectors/selectfamily.py b/gramps/gui/selectors/selectfamily.py index caa378a11..f5c7c4969 100644 --- a/gramps/gui/selectors/selectfamily.py +++ b/gramps/gui/selectors/selectfamily.py @@ -32,7 +32,6 @@ #------------------------------------------------------------------------- from gramps.gen.const import GRAMPS_LOCALE as glocale _ = glocale.translation.sgettext -from gramps.gen.config import config from ..views.treemodels import FamilyModel from .baseselector import BaseSelector from gramps.gui.display import display_help @@ -68,8 +67,8 @@ class SelectFamily(BaseSelector): def get_column_titles(self): return [ (_('ID'), 75, BaseSelector.TEXT, 0), - (config.get("preferences.father-label"), 200, BaseSelector.TEXT, 1), - (config.get("preferences.mother-label"), 200, BaseSelector.TEXT, 2), + (_('Father'), 200, BaseSelector.TEXT, 1), + (_('Mother'), 200, BaseSelector.TEXT, 2), (_('Last Change'), 150, BaseSelector.TEXT, 7), ] diff --git a/gramps/gui/utils.py b/gramps/gui/utils.py index f3c2e89da..f78acb679 100644 --- a/gramps/gui/utils.py +++ b/gramps/gui/utils.py @@ -57,7 +57,6 @@ from gramps.gen.constfunc import has_display, is_quartz, mac, win from gramps.gen.config import config from gramps.gen.plug.utils import available_updates from gramps.gen.errors import WindowActiveError -from gramps.gen.relationship import RelationshipCalculator #------------------------------------------------------------------------- # @@ -686,27 +685,3 @@ def text_to_clipboard(text): clipboard = Gtk.Clipboard.get_for_display(Gdk.Display.get_default(), Gdk.SELECTION_CLIPBOARD) clipboard.set_text(text, -1) - -def parents_labels(db, family): - """ - Get the label for parent - """ - father = db.get_person_from_handle(family.get_father_handle()) - mother = db.get_person_from_handle(family.get_mother_handle()) - - rel_father = config.get("preferences.father-label") - rel_mother = config.get("preferences.mother-label") - - if len(family.get_child_ref_list()) > 0: - rel_father = _('Father') - rel_mother = _('Mother') - if father.gender == 0: - rel_father = rel_mother - if mother.gender == 1: - rel_mother = rel_father - else: - rc = RelationshipCalculator() - rel_father = rc.get_one_relationship(db, mother, father) - rel_mother = rc.get_one_relationship(db, father, mother) - - return [rel_father.split()[-1], rel_mother.split()[-1]] diff --git a/gramps/gui/widgets/reorderfam.py b/gramps/gui/widgets/reorderfam.py index fb7be3347..03e70d92e 100644 --- a/gramps/gui/widgets/reorderfam.py +++ b/gramps/gui/widgets/reorderfam.py @@ -45,7 +45,6 @@ _LOG = logging.getLogger("gui.widgets.reorderfam") #------------------------------------------------------------------------- from gramps.gen.const import GRAMPS_LOCALE as glocale _ = glocale.translation.sgettext -from gramps.gen.config import config from gramps.gen.db import DbTxn from ..listmodel import ListModel from ..managedwindow import ManagedWindow @@ -82,8 +81,8 @@ class Reorder(ManagedWindow): self.ptree = xml.get_object('ptree') self.pmodel = ListModel(self.ptree, - [(config.get("preferences.father-label"), -1, 200), - (config.get("preferences.mother-label"), -1, 200), + [(_('Father'), -1, 200), + (_('Mother'), -1, 200), ('', -1, 0)]) self.ftree = xml.get_object('ftree') diff --git a/gramps/plugins/textreport/familygroup.py b/gramps/plugins/textreport/familygroup.py index de4cc8409..49ffd85bd 100644 --- a/gramps/plugins/textreport/familygroup.py +++ b/gramps/plugins/textreport/familygroup.py @@ -38,7 +38,6 @@ from functools import partial #------------------------------------------------------------------------ from gramps.gen.const import GRAMPS_LOCALE as glocale _ = glocale.translation.sgettext -from gramps.gen.config import config from gramps.gen.lib import EventRoleType, EventType, NoteType, Person from gramps.gen.plug.menu import BooleanOption, FamilyOption, FilterOption from gramps.gen.plug.report import Report @@ -617,26 +616,8 @@ class FamilyGroup(Report): self.doc.end_paragraph() family = self.db.get_family_from_handle(family_handle) - parents = utils.parents_labels(self.db, family, self._locale) - rel_father = config.get("preferences.father-label") - rel_mother = config.get("preferences.mother-label") - - nb_children = len(family.get_child_ref_list()) - father = self.db.get_person_from_handle(family.get_father_handle()) - mother = self.db.get_person_from_handle(family.get_mother_handle()) - if nb_children > 0: - rel_father = self._("Father") - rel_mother = self._("Mother") - if father.gender == 0: - rel_father = rel_mother - if mother.gender == 1: - rel_mother = rel_father - else: - rel_father = parents[0] - rel_mother = parents[1] - - self.dump_parent(rel_father, family.get_father_handle()) + self.dump_parent(self._("Husband"), family.get_father_handle()) self.doc.start_paragraph("FGR-blank") self.doc.end_paragraph() @@ -645,7 +626,7 @@ class FamilyGroup(Report): self.doc.start_paragraph("FGR-blank") self.doc.end_paragraph() - self.dump_parent(rel_mother, family.get_mother_handle()) + self.dump_parent(self._("Wife"), family.get_mother_handle()) length = len(family.get_child_ref_list()) if length > 0: diff --git a/gramps/plugins/textreport/tagreport.py b/gramps/plugins/textreport/tagreport.py index 11c17e2dd..4d47efe00 100644 --- a/gramps/plugins/textreport/tagreport.py +++ b/gramps/plugins/textreport/tagreport.py @@ -245,13 +245,13 @@ class TagReport(Report): self.doc.start_cell('TR-TableCell') self.doc.start_paragraph('TR-Normal-Bold') - self.doc.write_text(self._("Father, Partner, Spouse")) + self.doc.write_text(self._("Father")) self.doc.end_paragraph() self.doc.end_cell() self.doc.start_cell('TR-TableCell') self.doc.start_paragraph('TR-Normal-Bold') - self.doc.write_text(self._("Mother, Partner, Spouse")) + self.doc.write_text(self._("Mother")) self.doc.end_paragraph() self.doc.end_cell() diff --git a/gramps/plugins/view/familyview.py b/gramps/plugins/view/familyview.py index 6503b497c..24c3c203e 100644 --- a/gramps/plugins/view/familyview.py +++ b/gramps/plugins/view/familyview.py @@ -77,8 +77,8 @@ class FamilyView(ListView): # column definitions COLUMNS = [ (_('ID'), TEXT, None), - (config.get("preferences.father-label"), TEXT, None), - (config.get("preferences.mother-label"), TEXT, None), + (_('Father'), TEXT, None), + (_('Mother'), TEXT, None), (_('Relationship'), TEXT, None), (_('Marriage Date'), MARKUP, None), (_('Private'), ICON, 'gramps-lock'), @@ -202,9 +202,9 @@ class FamilyView(ListView): self.all_action = Gtk.ActionGroup(name=self.title + "/FamilyAll") self.all_action.add_actions([ - ('MakeFatherActive', None, _("Make %s Active Person") % config.get("preferences.father-label"), + ('MakeFatherActive', None, _("Make Father Active Person"), None, None, self._make_father_active), - ('MakeMotherActive', None, _("Make %s Active Person") % config.get("preferences.mother-label"), + ('MakeMotherActive', None, _("Make Mother Active Person"), None, None, self._make_mother_active), ('QuickReport', None, _("Quick View"), None, None, None), ]) diff --git a/gramps/plugins/view/geofamclose.py b/gramps/plugins/view/geofamclose.py index b5a9fb5a3..d0c81ea4e 100644 --- a/gramps/plugins/view/geofamclose.py +++ b/gramps/plugins/view/geofamclose.py @@ -605,8 +605,7 @@ class GeoFamClose(GeoGraphyView): if handle: father = dbstate.db.get_person_from_handle(handle) if father: - comment = _("%(father)s : %(id)s : %(name)s") % { - 'father': config.get("preferences.father-label"), + comment = _("Father : %(id)s : %(name)s") % { 'id': father.gramps_id, 'name': _nd.display(father)} self._createmap_for_one_person(father, color, @@ -615,8 +614,7 @@ class GeoFamClose(GeoGraphyView): if handle: mother = dbstate.db.get_person_from_handle(handle) if mother: - comment = _("%(mother)s : %(id)s : %(name)s") % { - 'mother': config.get("preferences.mother-label"), + comment = _("Mother : %(id)s : %(name)s") % { 'id': mother.gramps_id, 'name': _nd.display(mother)} self._createmap_for_one_person(mother, color, diff --git a/gramps/plugins/view/geofamily.py b/gramps/plugins/view/geofamily.py index 0dd72c90a..78825118b 100644 --- a/gramps/plugins/view/geofamily.py +++ b/gramps/plugins/view/geofamily.py @@ -342,8 +342,7 @@ class GeoFamily(GeoGraphyView): if handle: father = dbstate.db.get_person_from_handle(handle) if father: - comment = _("%(father)s : %(id)s : %(name)s") % { - 'father': config.get("preferences.father-label"), + comment = _("Father : %(id)s : %(name)s") % { 'id': father.gramps_id, 'name': _nd.display(father)} self._createpersonmarkers(dbstate, father, @@ -352,8 +351,7 @@ class GeoFamily(GeoGraphyView): if handle: mother = dbstate.db.get_person_from_handle(handle) if mother: - comment = _("%(mother)s : %(id)s : %(name)s") % { - 'mother': config.get("preferences.mother-label"), + comment = _("Mother : %(id)s : %(name)s") % { 'id': mother.gramps_id, 'name': _nd.display(mother)} self._createpersonmarkers(dbstate, mother, diff --git a/gramps/plugins/view/relview.py b/gramps/plugins/view/relview.py index 28e3d19db..9caf7970b 100644 --- a/gramps/plugins/view/relview.py +++ b/gramps/plugins/view/relview.py @@ -67,7 +67,7 @@ from gramps.gen.display.name import displayer as name_displayer from gramps.gen.display.place import displayer as place_displayer from gramps.gen.utils.file import media_path_full from gramps.gen.utils.alive import probably_alive -from gramps.gui.utils import open_file_with_default_application, parents_labels +from gramps.gui.utils import open_file_with_default_application from gramps.gen.datehandler import displayer, get_date from gramps.gen.utils.thumbnails import get_thumbnail_image from gramps.gen.config import config @@ -896,9 +896,8 @@ class RelationshipView(NavigationView): self.row += 1 # now advance it else: self.write_label(_("%s:") % _('Parents'), family, True, person) - parents = parents_labels(self.dbstate.db, family) - self.write_person(parents[0][0].upper()+parents[0][1:].lower(), family.get_father_handle()) - self.write_person(parents[1][0].upper()+parents[1][1:].lower(), family.get_mother_handle()) + self.write_person(_('Father'), family.get_father_handle()) + self.write_person(_('Mother'), family.get_mother_handle()) if self.show_siblings: active = self.get_active() diff --git a/gramps/plugins/webreport/narrativeweb.py b/gramps/plugins/webreport/narrativeweb.py index 82a01dc44..855edea19 100644 --- a/gramps/plugins/webreport/narrativeweb.py +++ b/gramps/plugins/webreport/narrativeweb.py @@ -7436,7 +7436,7 @@ class PersonPages(BasePage): # The parent may not be birth father in ths family, because it # may be a step family. However, it will be odd to display the # parent as anything other than "Father" - reln = self._("Father, Partner, Spouse") + reln = self._("Father") else: # Stepfather may not always be quite right (for example, it may # actually be StepFather-in-law), but it is too expensive to @@ -7450,7 +7450,7 @@ class PersonPages(BasePage): mother_handle = family.get_mother_handle() if mother_handle: if mother_handle == birthmother: - reln = self._("Mother, Partner, Spouse"") + reln = self._("Mother") else: reln = self._("Stepmother") trow = Html("tr") + (self.display_parent(mother_handle, reln, None))