This commit is contained in:
système 2017-01-14 10:21:03 +01:00
commit b31f6922dd
26 changed files with 676 additions and 307 deletions

View File

@ -271,6 +271,8 @@ register('preferences.use-last-view', False)
register('preferences.last-view', '') register('preferences.last-view', '')
register('preferences.last-views', []) register('preferences.last-views', [])
register('preferences.family-relation-type', 3) # UNKNOWN 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.age-display-precision', 1)
register('preferences.color-gender-male-alive', '#b8cee6') register('preferences.color-gender-male-alive', '#b8cee6')
register('preferences.color-gender-male-death', '#b8cee6') register('preferences.color-gender-male-death', '#b8cee6')

View File

@ -40,10 +40,12 @@ import os
#------------------------------------------------------------------------ #------------------------------------------------------------------------
from ...const import GRAMPS_LOCALE as glocale from ...const import GRAMPS_LOCALE as glocale
_ = glocale.translation.gettext _ = glocale.translation.gettext
from gramps.gen.config import config
from ...datehandler import get_date from ...datehandler import get_date
from ...display.place import displayer as _pd from ...display.place import displayer as _pd
from ...utils.file import media_path_full from ...utils.file import media_path_full
from ..docgen import IndexMark, INDEX_TYPE_ALP 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 # _T_ is a gramps-defined keyword -- see po/update_po.py and po/genpot.sh
def _T_(value): def _T_(value):
@ -392,3 +394,27 @@ def get_family_filters(database, family,
the_filters = [all_families, d_fams, ans] the_filters = [all_families, d_fams, ans]
the_filters.extend(CustomFilters.get_filters('Family')) the_filters.extend(CustomFilters.get_filters('Family'))
return the_filters 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 = _('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

@ -399,10 +399,11 @@ def show_settings():
print(' version : %s' % bsddb_str) print(' version : %s' % bsddb_str)
print(' db version : %s' % bsddb_db_str) print(' db version : %s' % bsddb_db_str)
print(' location : %s' % bsddb_location_str) print(' location : %s' % bsddb_location_str)
print(' sqlite3 :') if __debug__:
print(' version : %s' % sqlite3_version_str) print(' sqlite3 :')
print(' py version : %s' % sqlite3_py_version_str) print(' version : %s' % sqlite3_version_str)
print(' location : %s' % sqlite3_location_str) print(' py version : %s' % sqlite3_py_version_str)
print(' location : %s' % sqlite3_location_str)
print('') print('')
def run(): def run():

View File

@ -132,19 +132,22 @@ class GrampsAboutDialog(Gtk.AboutDialog):
operatingsystem = sys.platform operatingsystem = sys.platform
distribution = " " distribution = " "
sqlite = ''
if __debug__:
sqlite = "sqlite: %s (%s)\n" % (sqlite3_version_str,
sqlite3_py_version_str)
return (("\n\n" + return (("\n\n" +
"GRAMPS: %s \n" + "GRAMPS: %s \n" +
"Python: %s \n" + "Python: %s \n" +
"BSDDB: %s \n" + "BSDDB: %s \n" +
"sqlite: %s (%s)\n" + sqlite +
"LANG: %s\n" + "LANG: %s\n" +
"OS: %s\n" + "OS: %s\n" +
"Distribution: %s") "Distribution: %s")
% (ellipses(str(VERSION)), % (ellipses(str(VERSION)),
ellipses(str(sys.version).replace('\n','')), ellipses(str(sys.version).replace('\n','')),
BSDDB_STR, BSDDB_STR,
sqlite3_version_str,
sqlite3_py_version_str,
ellipses(get_env_var('LANG','')), ellipses(get_env_var('LANG','')),
ellipses(operatingsystem), ellipses(operatingsystem),
ellipses(distribution))) ellipses(distribution)))

View File

@ -1072,6 +1072,14 @@ class GrampsPreferences(ConfigureDialog):
grid.attach(obox, 1, row, 2, 1) grid.attach(obox, 1, row, 2, 1)
row += 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 #height multiple surname table
self.add_pos_int_entry(grid, self.add_pos_int_entry(grid,
_('Height multiple surname box (pixels)'), _('Height multiple surname box (pixels)'),

View File

@ -88,7 +88,7 @@ class AddMedia(ManagedWindow):
The media is updated with the information, and on save, the The media is updated with the information, and on save, the
callback function is called callback function is called
""" """
ManagedWindow.__init__(self, uistate, track, self) ManagedWindow.__init__(self, uistate, track, self, modal=True)
self.dbase = dbstate.db self.dbase = dbstate.db
self.obj = media self.obj = media
@ -140,7 +140,6 @@ class AddMedia(ManagedWindow):
section=WIKI_HELP_SEC)) section=WIKI_HELP_SEC))
self.cancel_button.connect('clicked', self.close) self.cancel_button.connect('clicked', self.close)
self.show() self.show()
self.modal_call()
def build_menu_names(self, obj): def build_menu_names(self, obj):
""" """
@ -192,6 +191,7 @@ class AddMedia(ManagedWindow):
self._cleanup_on_exit() self._cleanup_on_exit()
if self.callback: if self.callback:
self.callback(self.obj) self.callback(self.obj)
self.close()
def on_name_changed(self, *obj): def on_name_changed(self, *obj):
""" """

View File

@ -35,6 +35,7 @@ from gi.repository import GLib
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
from gramps.gen.const import GRAMPS_LOCALE as glocale from gramps.gen.const import GRAMPS_LOCALE as glocale
_ = glocale.translation.gettext _ = glocale.translation.gettext
from gramps.gen.config import config
from gramps.gen.lib import Event, EventRef, EventRoleType, EventType from gramps.gen.lib import Event, EventRef, EventRoleType, EventType
from gramps.gen.errors import WindowActiveError from gramps.gen.errors import WindowActiveError
from ...ddtargets import DdTargets from ...ddtargets import DdTargets
@ -57,8 +58,8 @@ class EventEmbedList(DbGUIElement, GroupEmbeddedList):
_WORKGROUP = EventRefModel._ROOTINDEX _WORKGROUP = EventRefModel._ROOTINDEX
_WORKNAME = _("Family") _WORKNAME = _("Family")
_FATHNAME = _("Father") _FATHNAME = config.get("preferences.father-label")
_MOTHNAME = _("Mother") _MOTHNAME = config.get("preferences.mother-label")
_MSG = { _MSG = {
'add' : _('Add a new family event'), 'add' : _('Add a new family event'),

View File

@ -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) get_marriage_or_fallback, preset_name, family_name)
from ..selectors import SelectorFactory from ..selectors import SelectorFactory
from gramps.gen.utils.id import create_id from gramps.gen.utils.id import create_id
from ..utils import parents_labels
from gramps.gen.const import URL_MANUAL_SECT1 from gramps.gen.const import URL_MANUAL_SECT1
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
@ -515,6 +516,9 @@ class EditFamily(EditPrimary):
# FIXME: remove if we can use show() # FIXME: remove if we can use show()
self.window.show_all = self.window.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.fbirth = self.top.get_object('fbirth')
self.fdeath = self.top.get_object('fdeath') self.fdeath = self.top.get_object('fdeath')
self.fbirth_label = self.top.get_object('label578') 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_del = self.top.get_object('mbutton_del')
self.mbutton_edit = self.top.get_object('mbutton_edit') self.mbutton_edit = self.top.get_object('mbutton_edit')
self.mbutton_index.set_tooltip_text(_("Select a person as the mother")) self.mbutton_index.set_tooltip_text(_("Select a woman"))
self.mbutton_add.set_tooltip_text(_("Add a new person as the mother")) self.mbutton_add.set_tooltip_text(_("Add a woman"))
self.mbutton_del.set_tooltip_text(_("Remove the person as the mother")) 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('button-press-event', self.edit_mother)
self.mbutton_edit.connect('key-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_del = self.top.get_object('fbutton_del')
self.fbutton_edit = self.top.get_object('fbutton_edit') self.fbutton_edit = self.top.get_object('fbutton_edit')
self.fbutton_index.set_tooltip_text(_("Select a person as the father")) self.fbutton_index.set_tooltip_text(_("Select a man"))
self.fbutton_add.set_tooltip_text(_("Add a new person as the father")) self.fbutton_add.set_tooltip_text(_("Add a man"))
self.fbutton_del.set_tooltip_text(_("Remove the person as the father")) 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('button-press-event', self.edit_father)
self.fbutton_edit.connect('key-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] 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): def get_start_date(self):
""" """
Get the start date for a family, usually a marriage date, or Get the start date for a family, usually a marriage date, or

View File

@ -40,6 +40,7 @@ from gi.repository import Gtk
# #
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
from ... import widgets from ... import widgets
from gramps.gen.config import config
from gramps.gen.lib import Event, EventType, Family, FamilyRelType from gramps.gen.lib import Event, EventType, Family, FamilyRelType
from .. import build_filter_model from .. import build_filter_model
from . import SidebarFilter from . import SidebarFilter
@ -109,8 +110,8 @@ class FamilySidebarFilter(SidebarFilter):
self.rtype.get_child().set_width_chars(5) self.rtype.get_child().set_width_chars(5)
self.add_text_entry(_('ID'), self.filter_id) self.add_text_entry(_('ID'), self.filter_id)
self.add_text_entry(_('Father'), self.filter_father) self.add_text_entry(config.get("preferences.father-label"), self.filter_father)
self.add_text_entry(_('Mother'), self.filter_mother) self.add_text_entry(config.get("preferences.mother-label"), self.filter_mother)
self.add_text_entry(_('Child'), self.filter_child) self.add_text_entry(_('Child'), self.filter_child)
self.add_entry(_('Relationship'), self.rtype) self.add_entry(_('Relationship'), self.rtype)
self.add_entry(_('Family Event'), self.etype) self.add_entry(_('Family Event'), self.etype)

View File

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

View File

@ -533,39 +533,6 @@ class ManagedWindow:
self.opened = True self.opened = True
self.window.show_all() self.window.show_all()
def modal_call(self, after_ok_func=None):
"""
This is deprecated; use the 'modal=True' on the ManagedWindow
initialization for new work.
Method to do modal run of the ManagedWindow.
Connect the OK button to a method that checks if all is ok,
Do not call close, close is called here.
(if not ok, do self.window.run() to obtain new response )
TODO: remove close here and do close in ReportDialog,
this can only be done, once all methods use modal_call()
instead of their own implementation
Connect Cancel to do close, delete event is connected to close
here in ManagedWindow.
Do not generete RESPONSE_OK/CANCEL/DELETE_EVENT on button clicks
of other buttons
after_ok_func is called on ok click in this method
"""
#self.show()
while True:
response = self.window.run()
if response == Gtk.ResponseType.OK:
# dialog will be closed by connect, now continue work while
# rest of dialog is unresponsive, release when finished
self.close()
if after_ok_func is not None:
after_ok_func()
break
elif (response == Gtk.ResponseType.DELETE_EVENT or
response == Gtk.ResponseType.CANCEL):
# connect buttons generating this to a close call
break
def close(self, *obj): def close(self, *obj):
""" """
Close itself. Close itself.

View File

@ -225,6 +225,6 @@ class MergeFamily(ManagedWindow):
query.execute() query.execute()
except MergeError as err: except MergeError as err:
ErrorDialog(_("Cannot merge people"), str(err), ErrorDialog(_("Cannot merge people"), str(err),
parent=self.uistate.window) parent=self.window)
self.uistate.set_busy_cursor(False) self.uistate.set_busy_cursor(False)
self.close() self.close()

View File

@ -38,6 +38,7 @@ from gi.repository import Pango
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
from gramps.gen.const import GRAMPS_LOCALE as glocale from gramps.gen.const import GRAMPS_LOCALE as glocale
_ = glocale.translation.sgettext _ = glocale.translation.sgettext
from gramps.gen.config import config
from gramps.gen.plug.report import utils from gramps.gen.plug.report import utils
from gramps.gen.display.name import displayer as name_displayer from gramps.gen.display.name import displayer as name_displayer
from gramps.gen.display.place import displayer as place_displayer from gramps.gen.display.place import displayer as place_displayer
@ -228,10 +229,10 @@ class MergePerson(ManagedWindow):
KEYVAL % {'key': _('Family ID'), 'value': gid}) KEYVAL % {'key': _('Family ID'), 'value': gid})
if fname: if fname:
self.add(tobj, indent, self.add(tobj, indent,
KEYVAL % {'key': _('Father'), 'value': fname}) KEYVAL % {'key': config.get("preferences.father-label"), 'value': fname})
if mname: if mname:
self.add(tobj, indent, self.add(tobj, indent,
KEYVAL % {'key': _('Mother'), 'value': mname}) KEYVAL % {'key': config.get("preferences.mother-label"), 'value': mname})
else: else:
self.add(tobj, normal, _("No parents found")) self.add(tobj, normal, _("No parents found"))

View File

@ -32,6 +32,7 @@
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
from gramps.gen.const import GRAMPS_LOCALE as glocale from gramps.gen.const import GRAMPS_LOCALE as glocale
_ = glocale.translation.sgettext _ = glocale.translation.sgettext
from gramps.gen.config import config
from ..views.treemodels import FamilyModel from ..views.treemodels import FamilyModel
from .baseselector import BaseSelector from .baseselector import BaseSelector
from gramps.gui.display import display_help from gramps.gui.display import display_help
@ -67,8 +68,8 @@ class SelectFamily(BaseSelector):
def get_column_titles(self): def get_column_titles(self):
return [ return [
(_('ID'), 75, BaseSelector.TEXT, 0), (_('ID'), 75, BaseSelector.TEXT, 0),
(_('Father'), 200, BaseSelector.TEXT, 1), (config.get("preferences.father-label"), 200, BaseSelector.TEXT, 1),
(_('Mother'), 200, BaseSelector.TEXT, 2), (config.get("preferences.mother-label"), 200, BaseSelector.TEXT, 2),
(_('Last Change'), 150, BaseSelector.TEXT, 7), (_('Last Change'), 150, BaseSelector.TEXT, 7),
] ]

View File

@ -57,6 +57,7 @@ from gramps.gen.constfunc import has_display, is_quartz, mac, win
from gramps.gen.config import config from gramps.gen.config import config
from gramps.gen.plug.utils import available_updates from gramps.gen.plug.utils import available_updates
from gramps.gen.errors import WindowActiveError from gramps.gen.errors import WindowActiveError
from gramps.gen.relationship import RelationshipCalculator
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
# #
@ -152,6 +153,12 @@ class ProgressMeter:
self.__dialog.vbox.set_spacing(10) self.__dialog.vbox.set_spacing(10)
self.__dialog.vbox.set_border_width(24) self.__dialog.vbox.set_border_width(24)
self.__dialog.set_size_request(400, 125) self.__dialog.set_size_request(400, 125)
if not parent: # if we don't have an explicit parent, try to find one
for win in Gtk.Window.list_toplevels():
if win.is_active():
parent = win
break
# if we still don't have a parent, give up
if parent: if parent:
self.__dialog.set_transient_for(parent) self.__dialog.set_transient_for(parent)
self.__dialog.set_modal(True) self.__dialog.set_modal(True)
@ -679,3 +686,27 @@ def text_to_clipboard(text):
clipboard = Gtk.Clipboard.get_for_display(Gdk.Display.get_default(), clipboard = Gtk.Clipboard.get_for_display(Gdk.Display.get_default(),
Gdk.SELECTION_CLIPBOARD) Gdk.SELECTION_CLIPBOARD)
clipboard.set_text(text, -1) 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 == Person.FEMALE:
rel_father = rel_mother
if mother.gender == Person.MALE:
rel_mother = _('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

@ -51,6 +51,7 @@ from ..display import display_help
from ..dialog import ErrorDialog, QuestionDialog2 from ..dialog import ErrorDialog, QuestionDialog2
import gramps.gui.widgets.progressdialog as progressdlg import gramps.gui.widgets.progressdialog as progressdlg
from ..actiongroup import ActionGroup from ..actiongroup import ActionGroup
from ..managedwindow import ManagedWindow
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
# #
@ -245,9 +246,7 @@ class Tags(DbGUIElement):
""" """
Display the Organize Tags dialog. Display the Organize Tags dialog.
""" """
organize_dialog = OrganizeTagsDialog(self.db, OrganizeTagsDialog(self.db, self.uistate, [])
self.uistate.window)
organize_dialog.run()
def cb_new_tag(self, action): def cb_new_tag(self, action):
""" """
@ -255,8 +254,7 @@ class Tags(DbGUIElement):
""" """
tag = Tag() tag = Tag()
tag.set_priority(self.db.get_number_of_tags()) tag.set_priority(self.db.get_number_of_tags())
new_dialog = EditTag(self.db, self.uistate.window, tag) EditTag(self.db, self.uistate, [], tag)
new_dialog.run()
if tag.get_handle(): if tag.get_handle():
self.tag_selected_rows(tag.get_handle()) self.tag_selected_rows(tag.get_handle())
@ -313,16 +311,28 @@ def make_callback(func, tag_handle):
# Organize Tags Dialog # Organize Tags Dialog
# #
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
class OrganizeTagsDialog: class OrganizeTagsDialog(ManagedWindow):
""" """
A dialog to enable the user to organize tags. A dialog to enable the user to organize tags.
""" """
def __init__(self, db, parent_window): def __init__(self, db, uistate, track):
ManagedWindow.__init__(self, uistate, track, self.__class__, modal=True)
# the self.top.run() below makes Gtk make it modal, so any change to
# the previous line's "modal" would require that line to be changed
self.db = db self.db = db
self.parent_window = parent_window
self.namelist = None self.namelist = None
self.namemodel = None self.namemodel = None
self.top = self._create_dialog() self.top = self._create_dialog()
self.set_window(self.top, None, _('Organize Tags'))
self.setup_configs('interface.organizetagsdialog', 400, 350)
self.show()
self.run()
self.close()
# this is meaningless while it's modal, but since this ManagedWindow can
# have an EditTag ManagedWindow child it needs a non-None second argument
def build_menu_names(self, obj):
return (_('Organize Tags'), ' ')
def run(self): def run(self):
""" """
@ -330,6 +340,8 @@ class OrganizeTagsDialog:
""" """
self._populate_model() self._populate_model()
while True: while True:
# the self.top.run() makes Gtk make it modal, so any change to that
# line would require the ManagedWindow.__init__ to be changed also
response = self.top.run() response = self.top.run()
if response == Gtk.ResponseType.HELP: if response == Gtk.ResponseType.HELP:
display_help(webpage=WIKI_HELP_PAGE, display_help(webpage=WIKI_HELP_PAGE,
@ -342,8 +354,6 @@ class OrganizeTagsDialog:
with DbTxn(_('Change Tag Priority'), self.db) as trans: with DbTxn(_('Change Tag Priority'), self.db) as trans:
self.__change_tag_priority(trans) self.__change_tag_priority(trans)
self.top.destroy()
def __priorities_changed(self): def __priorities_changed(self):
""" """
Return True if the tag priorities have changed else return False. Return True if the tag priorities have changed else return False.
@ -384,11 +394,7 @@ class OrganizeTagsDialog:
Create a dialog box to organize tags. Create a dialog box to organize tags.
""" """
# pylint: disable-msg=E1101 # pylint: disable-msg=E1101
title = _("%(title)s - Gramps") % {'title': _("Organize Tags")} top = Gtk.Dialog(parent=self.parent_window)
top = Gtk.Dialog(title)
top.set_default_size(400, 350)
top.set_modal(True)
top.set_transient_for(self.parent_window)
top.vbox.set_spacing(5) top.vbox.set_spacing(5)
label = Gtk.Label(label='<span size="larger" weight="bold">%s</span>' label = Gtk.Label(label='<span size="larger" weight="bold">%s</span>'
% _("Organize Tags")) % _("Organize Tags"))
@ -429,7 +435,6 @@ class OrganizeTagsDialog:
bbox.add(edit) bbox.add(edit)
bbox.add(remove) bbox.add(remove)
box.pack_start(bbox, 0, 0, 5) box.pack_start(bbox, 0, 0, 5)
top.show_all()
return top return top
def cb_up_clicked(self, obj): def cb_up_clicked(self, obj):
@ -452,8 +457,7 @@ class OrganizeTagsDialog:
""" """
tag = Tag() tag = Tag()
tag.set_priority(self.db.get_number_of_tags()) tag.set_priority(self.db.get_number_of_tags())
edit_dialog = EditTag(self.db, top, tag) EditTag(self.db, self.uistate, self.track, tag)
edit_dialog.run()
if tag.get_handle(): if tag.get_handle():
self.namemodel.add((tag.get_priority(), self.namemodel.add((tag.get_priority(),
@ -470,8 +474,7 @@ class OrganizeTagsDialog:
return return
tag = self.db.get_tag_from_handle(store.get_value(iter_, 1)) tag = self.db.get_tag_from_handle(store.get_value(iter_, 1))
edit_dialog = EditTag(self.db, top, tag) EditTag(self.db, self.uistate, self.track, tag)
edit_dialog.run()
store.set_value(iter_, 2, tag.get_name()) store.set_value(iter_, 2, tag.get_name())
store.set_value(iter_, 3, tag.get_color()) store.set_value(iter_, 3, tag.get_color())
@ -492,7 +495,7 @@ class OrganizeTagsDialog:
"removed from all objects in the database."), "removed from all objects in the database."),
_("Yes"), _("Yes"),
_("No"), _("No"),
parent=self.parent_window) parent=self.window)
prompt = yes_no.run() prompt = yes_no.run()
if prompt: if prompt:
@ -543,23 +546,39 @@ class OrganizeTagsDialog:
# Tag editor # Tag editor
# #
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
class EditTag: class EditTag(ManagedWindow):
""" """
A dialog to enable the user to create a new tag. A dialog to enable the user to create a new tag.
""" """
def __init__(self, db, parent_window, tag): def __init__(self, db, uistate, track, tag):
self.parent_window = parent_window
self.db = db
self.tag = tag self.tag = tag
if self.tag.get_handle():
self.title = _('Tag: %s') % self.tag.get_name()
else:
self.title = _('New Tag')
ManagedWindow.__init__(self, uistate, track, self.__class__, modal=True)
# the self.top.run() below makes Gtk make it modal, so any change to
# the previous line's "modal" would require that line to be changed
self.db = db
self.entry = None self.entry = None
self.color = None self.color = None
self.top = self._create_dialog() self.top = self._create_dialog()
self.set_window(self.top, None, self.title)
self.setup_configs('interface.edittag', 320, 100)
self.show()
self.run()
self.close()
def build_menu_names(self, obj): # this is meaningless while it's modal
return (self.title, None)
def run(self): def run(self):
""" """
Run the dialog and return the result. Run the dialog and return the result.
""" """
while True: while True:
# the self.top.run() makes Gtk make it modal, so any change to that
# line would require the ManagedWindow.__init__ to be changed also
response = self.top.run() response = self.top.run()
if response == Gtk.ResponseType.HELP: if response == Gtk.ResponseType.HELP:
display_help(webpage=WIKI_HELP_PAGE, display_help(webpage=WIKI_HELP_PAGE,
@ -569,7 +588,6 @@ class EditTag:
if response == Gtk.ResponseType.OK: if response == Gtk.ResponseType.OK:
self._save() self._save()
self.top.destroy()
def _save(self): def _save(self):
""" """
@ -585,7 +603,7 @@ class EditTag:
if not self.tag.get_name(): if not self.tag.get_name():
ErrorDialog(_("Cannot save tag"), ErrorDialog(_("Cannot save tag"),
_("The tag name cannot be empty"), _("The tag name cannot be empty"),
parent=self.parent_window) parent=self.window)
return return
if not self.tag.get_handle(): if not self.tag.get_handle():
@ -604,14 +622,7 @@ class EditTag:
Create a dialog box to enter a new tag. Create a dialog box to enter a new tag.
""" """
# pylint: disable-msg=E1101 # pylint: disable-msg=E1101
if self.tag.get_handle(): top = Gtk.Dialog(parent=self.parent_window)
title = _('Tag: %s') % self.tag.get_name()
else:
title = _('New Tag')
top = Gtk.Dialog(_("%(title)s - Gramps") % {'title': title})
top.set_default_size(300, 100)
top.set_modal(True)
top.set_transient_for(self.parent_window)
top.vbox.set_spacing(5) top.vbox.set_spacing(5)
hbox = Gtk.Box() hbox = Gtk.Box()
@ -633,5 +644,4 @@ class EditTag:
top.add_button(_('_Help'), Gtk.ResponseType.HELP) top.add_button(_('_Help'), Gtk.ResponseType.HELP)
top.add_button(_('_Cancel'), Gtk.ResponseType.CANCEL) top.add_button(_('_Cancel'), Gtk.ResponseType.CANCEL)
top.add_button(_('_OK'), Gtk.ResponseType.OK) top.add_button(_('_OK'), Gtk.ResponseType.OK)
top.show_all()
return top return top

View File

@ -494,13 +494,17 @@ class GtkProgressDialog(Gtk.Dialog):
:type title: string :type title: string
""" """
Gtk.Dialog.__init__(self) Gtk.Dialog.__init__(self)
parent = None
if len(window_params) >= 2: if len(window_params) >= 2:
self.set_transient_for(window_params[1]) parent = window_params[1] # we got an explicit parent
else: else: # try to find an active window
for win in Gtk.Window.list_toplevels(): for win in Gtk.Window.list_toplevels():
if win.is_active(): if win.is_active():
self.set_transient_for(win) parent = win
break break
# if we still don't have a parent, give up
if parent:
self.set_transient_for(parent)
if len(window_params) >= 3: if len(window_params) >= 3:
flags = window_params[2] flags = window_params[2]
if Gtk.DialogFlags.MODAL & flags: if Gtk.DialogFlags.MODAL & flags:

View File

@ -45,6 +45,7 @@ _LOG = logging.getLogger("gui.widgets.reorderfam")
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
from gramps.gen.const import GRAMPS_LOCALE as glocale from gramps.gen.const import GRAMPS_LOCALE as glocale
_ = glocale.translation.sgettext _ = glocale.translation.sgettext
from gramps.gen.config import config
from gramps.gen.db import DbTxn from gramps.gen.db import DbTxn
from ..listmodel import ListModel from ..listmodel import ListModel
from ..managedwindow import ManagedWindow from ..managedwindow import ManagedWindow
@ -81,8 +82,8 @@ class Reorder(ManagedWindow):
self.ptree = xml.get_object('ptree') self.ptree = xml.get_object('ptree')
self.pmodel = ListModel(self.ptree, self.pmodel = ListModel(self.ptree,
[(_('Father'), -1, 200), [(config.get("preferences.father-label"), -1, 200),
(_('Mother'), -1, 200), (config.get("preferences.mother-label"), -1, 200),
('', -1, 0)]) ('', -1, 0)])
self.ftree = xml.get_object('ftree') self.ftree = xml.get_object('ftree')

View File

@ -38,6 +38,7 @@ from functools import partial
#------------------------------------------------------------------------ #------------------------------------------------------------------------
from gramps.gen.const import GRAMPS_LOCALE as glocale from gramps.gen.const import GRAMPS_LOCALE as glocale
_ = glocale.translation.sgettext _ = glocale.translation.sgettext
from gramps.gen.config import config
from gramps.gen.lib import EventRoleType, EventType, NoteType, Person from gramps.gen.lib import EventRoleType, EventType, NoteType, Person
from gramps.gen.plug.menu import BooleanOption, FamilyOption, FilterOption from gramps.gen.plug.menu import BooleanOption, FamilyOption, FilterOption
from gramps.gen.plug.report import Report from gramps.gen.plug.report import Report
@ -616,8 +617,26 @@ class FamilyGroup(Report):
self.doc.end_paragraph() self.doc.end_paragraph()
family = self.db.get_family_from_handle(family_handle) 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.start_paragraph("FGR-blank")
self.doc.end_paragraph() self.doc.end_paragraph()
@ -626,7 +645,7 @@ class FamilyGroup(Report):
self.doc.start_paragraph("FGR-blank") self.doc.start_paragraph("FGR-blank")
self.doc.end_paragraph() 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()) length = len(family.get_child_ref_list())
if length > 0: if length > 0:

View File

@ -245,13 +245,13 @@ class TagReport(Report):
self.doc.start_cell('TR-TableCell') self.doc.start_cell('TR-TableCell')
self.doc.start_paragraph('TR-Normal-Bold') 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_paragraph()
self.doc.end_cell() self.doc.end_cell()
self.doc.start_cell('TR-TableCell') self.doc.start_cell('TR-TableCell')
self.doc.start_paragraph('TR-Normal-Bold') 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_paragraph()
self.doc.end_cell() self.doc.end_cell()

View File

@ -77,8 +77,8 @@ class FamilyView(ListView):
# column definitions # column definitions
COLUMNS = [ COLUMNS = [
(_('ID'), TEXT, None), (_('ID'), TEXT, None),
(_('Father'), TEXT, None), (config.get("preferences.father-label"), TEXT, None),
(_('Mother'), TEXT, None), (config.get("preferences.mother-label"), TEXT, None),
(_('Relationship'), TEXT, None), (_('Relationship'), TEXT, None),
(_('Marriage Date'), MARKUP, None), (_('Marriage Date'), MARKUP, None),
(_('Private'), ICON, 'gramps-lock'), (_('Private'), ICON, 'gramps-lock'),
@ -202,9 +202,9 @@ class FamilyView(ListView):
self.all_action = Gtk.ActionGroup(name=self.title + "/FamilyAll") self.all_action = Gtk.ActionGroup(name=self.title + "/FamilyAll")
self.all_action.add_actions([ 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), 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), None, None, self._make_mother_active),
('QuickReport', None, _("Quick View"), None, None, None), ('QuickReport', None, _("Quick View"), None, None, None),
]) ])

View File

@ -605,7 +605,8 @@ class GeoFamClose(GeoGraphyView):
if handle: if handle:
father = dbstate.db.get_person_from_handle(handle) father = dbstate.db.get_person_from_handle(handle)
if father: 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, 'id': father.gramps_id,
'name': _nd.display(father)} 'name': _nd.display(father)}
self._createmap_for_one_person(father, color, self._createmap_for_one_person(father, color,
@ -614,7 +615,8 @@ class GeoFamClose(GeoGraphyView):
if handle: if handle:
mother = dbstate.db.get_person_from_handle(handle) mother = dbstate.db.get_person_from_handle(handle)
if mother: 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, 'id': mother.gramps_id,
'name': _nd.display(mother)} 'name': _nd.display(mother)}
self._createmap_for_one_person(mother, color, self._createmap_for_one_person(mother, color,

View File

@ -342,7 +342,8 @@ class GeoFamily(GeoGraphyView):
if handle: if handle:
father = dbstate.db.get_person_from_handle(handle) father = dbstate.db.get_person_from_handle(handle)
if father: 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, 'id': father.gramps_id,
'name': _nd.display(father)} 'name': _nd.display(father)}
self._createpersonmarkers(dbstate, father, self._createpersonmarkers(dbstate, father,
@ -351,7 +352,8 @@ class GeoFamily(GeoGraphyView):
if handle: if handle:
mother = dbstate.db.get_person_from_handle(handle) mother = dbstate.db.get_person_from_handle(handle)
if mother: 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, 'id': mother.gramps_id,
'name': _nd.display(mother)} 'name': _nd.display(mother)}
self._createpersonmarkers(dbstate, 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.display.place import displayer as place_displayer
from gramps.gen.utils.file import media_path_full from gramps.gen.utils.file import media_path_full
from gramps.gen.utils.alive import probably_alive 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.datehandler import displayer, get_date
from gramps.gen.utils.thumbnails import get_thumbnail_image from gramps.gen.utils.thumbnails import get_thumbnail_image
from gramps.gen.config import config from gramps.gen.config import config
@ -896,8 +896,9 @@ class RelationshipView(NavigationView):
self.row += 1 # now advance it self.row += 1 # now advance it
else: else:
self.write_label(_("%s:") % _('Parents'), family, True, person) self.write_label(_("%s:") % _('Parents'), family, True, person)
self.write_person(_('Father'), family.get_father_handle()) parents = parents_labels(self.dbstate.db, family)
self.write_person(_('Mother'), family.get_mother_handle()) 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: if self.show_siblings:
active = self.get_active() 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 # 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 # may be a step family. However, it will be odd to display the
# parent as anything other than "Father" # parent as anything other than "Father"
reln = self._("Father") reln = self._("Father, Partner, Spouse")
else: else:
# Stepfather may not always be quite right (for example, it may # Stepfather may not always be quite right (for example, it may
# actually be StepFather-in-law), but it is too expensive to # actually be StepFather-in-law), but it is too expensive to
@ -7450,7 +7450,7 @@ class PersonPages(BasePage):
mother_handle = family.get_mother_handle() mother_handle = family.get_mother_handle()
if mother_handle: if mother_handle:
if mother_handle == birthmother: if mother_handle == birthmother:
reln = self._("Mother") reln = self._("Mother, Partner, Spouse"")
else: else:
reln = self._("Stepmother") reln = self._("Stepmother")
trow = Html("tr") + (self.display_parent(mother_handle, reln, None)) trow = Html("tr") + (self.display_parent(mother_handle, reln, None))

656
po/it.po

File diff suppressed because it is too large Load Diff