Revert "9899: try to get labels on Family according to status"

This reverts commit dedb5122cb.
This commit is contained in:
système 2017-01-14 10:23:03 +01:00
parent 4f96497e64
commit db37a7dbd9
18 changed files with 37 additions and 135 deletions

View File

@ -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')

View File

@ -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()]

View File

@ -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)'),

View File

@ -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'),

View File

@ -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

View File

@ -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)

View File

@ -157,6 +157,7 @@
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="halign">start</property>
<property name="label" translatable="yes">Father/partner1</property>
<attributes>
<attribute name="weight" value="bold"/>
</attributes>
@ -188,7 +189,7 @@
</child>
<child internal-child="accessible">
<object class="AtkObject" id="fbutton_index-atkobject">
<property name="AtkObject::accessible-name" translatable="yes">Father, Partner, Spouse</property>
<property name="AtkObject::accessible-name" translatable="yes">Father</property>
</object>
</child>
</object>
@ -434,6 +435,7 @@
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="halign">start</property>
<property name="label" translatable="yes">Mother/partner2</property>
<attributes>
<attribute name="weight" value="bold"/>
</attributes>
@ -465,7 +467,7 @@
</child>
<child internal-child="accessible">
<object class="AtkObject" id="mbutton_index-atkobject">
<property name="AtkObject::accessible-name" translatable="yes">Mother, Partner, Spouse</property>
<property name="AtkObject::accessible-name" translatable="yes">Mother</property>
</object>
</child>
</object>

View File

@ -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"))

View File

@ -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),
]

View File

@ -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]]

View File

@ -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')

View File

@ -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:

View File

@ -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()

View File

@ -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),
])

View File

@ -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,

View File

@ -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,

View File

@ -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()

View File

@ -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))