9899: try to get labels on Family according to status
This commit is contained in:
parent
8f494a683f
commit
dedb5122cb
@ -269,6 +269,8 @@ 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')
|
||||
|
@ -40,10 +40,12 @@ 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):
|
||||
@ -392,3 +394,27 @@ 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()]
|
||||
|
@ -1072,6 +1072,14 @@ 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)'),
|
||||
|
@ -35,6 +35,7 @@ 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
|
||||
@ -57,8 +58,8 @@ class EventEmbedList(DbGUIElement, GroupEmbeddedList):
|
||||
_WORKGROUP = EventRefModel._ROOTINDEX
|
||||
|
||||
_WORKNAME = _("Family")
|
||||
_FATHNAME = _("Father")
|
||||
_MOTHNAME = _("Mother")
|
||||
_FATHNAME = config.get("preferences.father-label")
|
||||
_MOTHNAME = config.get("preferences.mother-label")
|
||||
|
||||
_MSG = {
|
||||
'add' : _('Add a new family event'),
|
||||
|
@ -79,6 +79,7 @@ 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
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
@ -515,6 +516,9 @@ 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')
|
||||
@ -533,9 +537,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 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_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_edit.connect('button-press-event', self.edit_mother)
|
||||
self.mbutton_edit.connect('key-press-event', self.edit_mother)
|
||||
@ -548,9 +552,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 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_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_edit.connect('button-press-event', self.edit_father)
|
||||
self.fbutton_edit.connect('key-press-event', self.edit_father)
|
||||
@ -679,6 +683,12 @@ 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
|
||||
|
@ -40,6 +40,7 @@ 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
|
||||
@ -109,8 +110,8 @@ class FamilySidebarFilter(SidebarFilter):
|
||||
self.rtype.get_child().set_width_chars(5)
|
||||
|
||||
self.add_text_entry(_('ID'), self.filter_id)
|
||||
self.add_text_entry(_('Father'), self.filter_father)
|
||||
self.add_text_entry(_('Mother'), self.filter_mother)
|
||||
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(_('Child'), self.filter_child)
|
||||
self.add_entry(_('Relationship'), self.rtype)
|
||||
self.add_entry(_('Family Event'), self.etype)
|
||||
|
@ -157,7 +157,6 @@
|
||||
<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>
|
||||
@ -189,7 +188,7 @@
|
||||
</child>
|
||||
<child internal-child="accessible">
|
||||
<object class="AtkObject" id="fbutton_index-atkobject">
|
||||
<property name="AtkObject::accessible-name" translatable="yes">Father</property>
|
||||
<property name="AtkObject::accessible-name" translatable="yes">Father, Partner, Spouse</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
@ -435,7 +434,6 @@
|
||||
<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>
|
||||
@ -467,7 +465,7 @@
|
||||
</child>
|
||||
<child internal-child="accessible">
|
||||
<object class="AtkObject" id="mbutton_index-atkobject">
|
||||
<property name="AtkObject::accessible-name" translatable="yes">Mother</property>
|
||||
<property name="AtkObject::accessible-name" translatable="yes">Mother, Partner, Spouse</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
|
@ -38,6 +38,7 @@ 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
|
||||
@ -228,10 +229,10 @@ class MergePerson(ManagedWindow):
|
||||
KEYVAL % {'key': _('Family ID'), 'value': gid})
|
||||
if fname:
|
||||
self.add(tobj, indent,
|
||||
KEYVAL % {'key': _('Father'), 'value': fname})
|
||||
KEYVAL % {'key': config.get("preferences.father-label"), 'value': fname})
|
||||
if mname:
|
||||
self.add(tobj, indent,
|
||||
KEYVAL % {'key': _('Mother'), 'value': mname})
|
||||
KEYVAL % {'key': config.get("preferences.mother-label"), 'value': mname})
|
||||
else:
|
||||
self.add(tobj, normal, _("No parents found"))
|
||||
|
||||
|
@ -32,6 +32,7 @@
|
||||
#-------------------------------------------------------------------------
|
||||
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
|
||||
@ -67,8 +68,8 @@ class SelectFamily(BaseSelector):
|
||||
def get_column_titles(self):
|
||||
return [
|
||||
(_('ID'), 75, BaseSelector.TEXT, 0),
|
||||
(_('Father'), 200, BaseSelector.TEXT, 1),
|
||||
(_('Mother'), 200, BaseSelector.TEXT, 2),
|
||||
(config.get("preferences.father-label"), 200, BaseSelector.TEXT, 1),
|
||||
(config.get("preferences.mother-label"), 200, BaseSelector.TEXT, 2),
|
||||
(_('Last Change'), 150, BaseSelector.TEXT, 7),
|
||||
]
|
||||
|
||||
|
@ -57,6 +57,7 @@ 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
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
@ -685,3 +686,27 @@ 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]]
|
||||
|
@ -45,6 +45,7 @@ _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
|
||||
@ -81,8 +82,8 @@ class Reorder(ManagedWindow):
|
||||
|
||||
self.ptree = xml.get_object('ptree')
|
||||
self.pmodel = ListModel(self.ptree,
|
||||
[(_('Father'), -1, 200),
|
||||
(_('Mother'), -1, 200),
|
||||
[(config.get("preferences.father-label"), -1, 200),
|
||||
(config.get("preferences.mother-label"), -1, 200),
|
||||
('', -1, 0)])
|
||||
|
||||
self.ftree = xml.get_object('ftree')
|
||||
|
@ -38,6 +38,7 @@ 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
|
||||
@ -616,8 +617,26 @@ 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)
|
||||
|
||||
self.dump_parent(self._("Husband"), family.get_father_handle())
|
||||
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.doc.start_paragraph("FGR-blank")
|
||||
self.doc.end_paragraph()
|
||||
|
||||
@ -626,7 +645,7 @@ class FamilyGroup(Report):
|
||||
self.doc.start_paragraph("FGR-blank")
|
||||
self.doc.end_paragraph()
|
||||
|
||||
self.dump_parent(self._("Wife"), family.get_mother_handle())
|
||||
self.dump_parent(rel_mother, family.get_mother_handle())
|
||||
|
||||
length = len(family.get_child_ref_list())
|
||||
if length > 0:
|
||||
|
@ -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"))
|
||||
self.doc.write_text(self._("Father, Partner, Spouse"))
|
||||
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"))
|
||||
self.doc.write_text(self._("Mother, Partner, Spouse"))
|
||||
self.doc.end_paragraph()
|
||||
self.doc.end_cell()
|
||||
|
||||
|
@ -77,8 +77,8 @@ class FamilyView(ListView):
|
||||
# column definitions
|
||||
COLUMNS = [
|
||||
(_('ID'), TEXT, None),
|
||||
(_('Father'), TEXT, None),
|
||||
(_('Mother'), TEXT, None),
|
||||
(config.get("preferences.father-label"), TEXT, None),
|
||||
(config.get("preferences.mother-label"), 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 Father Active Person"),
|
||||
('MakeFatherActive', None, _("Make %s Active Person") % config.get("preferences.father-label"),
|
||||
None, None, self._make_father_active),
|
||||
('MakeMotherActive', None, _("Make Mother Active Person"),
|
||||
('MakeMotherActive', None, _("Make %s Active Person") % config.get("preferences.mother-label"),
|
||||
None, None, self._make_mother_active),
|
||||
('QuickReport', None, _("Quick View"), None, None, None),
|
||||
])
|
||||
|
@ -605,7 +605,8 @@ class GeoFamClose(GeoGraphyView):
|
||||
if handle:
|
||||
father = dbstate.db.get_person_from_handle(handle)
|
||||
if father:
|
||||
comment = _("Father : %(id)s : %(name)s") % {
|
||||
comment = _("%(father)s : %(id)s : %(name)s") % {
|
||||
'father': config.get("preferences.father-label"),
|
||||
'id': father.gramps_id,
|
||||
'name': _nd.display(father)}
|
||||
self._createmap_for_one_person(father, color,
|
||||
@ -614,7 +615,8 @@ class GeoFamClose(GeoGraphyView):
|
||||
if handle:
|
||||
mother = dbstate.db.get_person_from_handle(handle)
|
||||
if mother:
|
||||
comment = _("Mother : %(id)s : %(name)s") % {
|
||||
comment = _("%(mother)s : %(id)s : %(name)s") % {
|
||||
'mother': config.get("preferences.mother-label"),
|
||||
'id': mother.gramps_id,
|
||||
'name': _nd.display(mother)}
|
||||
self._createmap_for_one_person(mother, color,
|
||||
|
@ -342,7 +342,8 @@ class GeoFamily(GeoGraphyView):
|
||||
if handle:
|
||||
father = dbstate.db.get_person_from_handle(handle)
|
||||
if father:
|
||||
comment = _("Father : %(id)s : %(name)s") % {
|
||||
comment = _("%(father)s : %(id)s : %(name)s") % {
|
||||
'father': config.get("preferences.father-label"),
|
||||
'id': father.gramps_id,
|
||||
'name': _nd.display(father)}
|
||||
self._createpersonmarkers(dbstate, father,
|
||||
@ -351,7 +352,8 @@ class GeoFamily(GeoGraphyView):
|
||||
if handle:
|
||||
mother = dbstate.db.get_person_from_handle(handle)
|
||||
if mother:
|
||||
comment = _("Mother : %(id)s : %(name)s") % {
|
||||
comment = _("%(mother)s : %(id)s : %(name)s") % {
|
||||
'mother': config.get("preferences.mother-label"),
|
||||
'id': mother.gramps_id,
|
||||
'name': _nd.display(mother)}
|
||||
self._createpersonmarkers(dbstate, mother,
|
||||
|
@ -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
|
||||
from gramps.gui.utils import open_file_with_default_application, parents_labels
|
||||
from gramps.gen.datehandler import displayer, get_date
|
||||
from gramps.gen.utils.thumbnails import get_thumbnail_image
|
||||
from gramps.gen.config import config
|
||||
@ -896,8 +896,9 @@ class RelationshipView(NavigationView):
|
||||
self.row += 1 # now advance it
|
||||
else:
|
||||
self.write_label(_("%s:") % _('Parents'), family, True, person)
|
||||
self.write_person(_('Father'), family.get_father_handle())
|
||||
self.write_person(_('Mother'), family.get_mother_handle())
|
||||
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())
|
||||
|
||||
if self.show_siblings:
|
||||
active = self.get_active()
|
||||
|
@ -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")
|
||||
reln = self._("Father, Partner, Spouse")
|
||||
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")
|
||||
reln = self._("Mother, Partner, Spouse"")
|
||||
else:
|
||||
reln = self._("Stepmother")
|
||||
trow = Html("tr") + (self.display_parent(mother_handle, reln, None))
|
||||
|
Loading…
Reference in New Issue
Block a user