gramps/src/gui/editors/editfamily.py

1138 lines
44 KiB
Python
Raw Normal View History

2006-01-12 05:37:11 +05:30
#
# Gramps - a GTK+/GNOME based genealogy program
#
2007-06-22 11:27:48 +05:30
# Copyright (C) 2000-2007 Donald N. Allingham
# Copyright (C) 2009 Gary Burton
2006-01-12 05:37:11 +05:30
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
# $Id$
#-------------------------------------------------------------------------
#
# python modules
#
#-------------------------------------------------------------------------
from bsddb import db as bsddb_db
from gen.ggettext import gettext as _
from DdTargets import DdTargets
import cPickle as pickle
#-------------------------------------------------------------------------
#
# enable logging for error handling
#
#-------------------------------------------------------------------------
2006-01-12 05:37:11 +05:30
import logging
log = logging.getLogger(".")
#-------------------------------------------------------------------------
#
# GTK/Gnome modules
#
#-------------------------------------------------------------------------
import gtk
from gtk import gdk
import pango
2006-01-12 05:37:11 +05:30
#-------------------------------------------------------------------------
#
# gramps modules
#
#-------------------------------------------------------------------------
import Utils
import config
from gen.display.name import displayer as name_displayer
import gen.lib
2006-03-24 10:37:58 +05:30
import Errors
import DateHandler
from glade import Glade
from editprimary import EditPrimary
from editchildref import EditChildRef
from editperson import EditPerson
from displaytabs import (EmbeddedList, EventEmbedList, SourceEmbedList,
FamilyAttrEmbedList, NoteTab, GalleryTab,
FamilyLdsEmbedList, ChildModel)
from gui.widgets import (PrivacyButton, MonitoredEntry, MonitoredDataType)
from gen.plug import CATEGORY_QR_FAMILY
from QuestionDialog import (ErrorDialog, RunDatabaseRepair, WarningDialog,
MessageHideDialog)
from gen.utils import get_birth_or_fallback, get_death_or_fallback
from gui.selectors import SelectorFactory
SelectPerson = SelectorFactory('Person')
2006-03-20 05:04:23 +05:30
_RETURN = gdk.keyval_from_name("Return")
_KP_ENTER = gdk.keyval_from_name("KP_Enter")
_LEFT_BUTTON = 1
_RIGHT_BUTTON = 3
2006-01-16 10:23:42 +05:30
class ChildEmbedList(EmbeddedList):
"""
The child embed list is specific to the Edit Family dialog, so it
is contained here instead of in displaytabs.
"""
_HANDLE_COL = 10
_DND_TYPE = DdTargets.PERSON_LINK
_MSG = {
'add' : _('Create a new person and add the child to the family'),
'del' : _('Remove the child from the family'),
'edit' : _('Edit the child reference'),
'share' : _('Add an existing person as a child of the family'),
'up' : _('Move the child up in the childrens list'),
'down' : _('Move the child down in the childrens list'),
}
_column_names = [
(_('#'),0) ,
(_('ID'),1) ,
(_('Name'),11),
(_('Gender'),3),
(_('Paternal'),4),
(_('Maternal'),5),
(_('Birth Date'),12),
(_('Death Date'),13),
(_('Birth Place'),8),
(_('Death Place'),9),
]
2006-04-22 09:30:58 +05:30
def __init__(self, dbstate, uistate, track, family):
"""
Create the object, storing the passed family value
"""
self.family = family
EmbeddedList.__init__(self, dbstate, uistate, track, _('Chil_dren'),
ChildModel, share_button=True, move_buttons=True)
2006-01-13 09:24:31 +05:30
def get_popup_menu_items(self):
return [
(False, True, (gtk.STOCK_EDIT, _('Edit child')),
self.edit_child_button_clicked),
(True, True, gtk.STOCK_ADD, self.add_button_clicked),
(True, False, _('Add an existing child'),
self.share_button_clicked),
(False, True, (gtk.STOCK_EDIT, _('Edit relationship')),
self.edit_button_clicked),
(True, True, gtk.STOCK_REMOVE, self.del_button_clicked),
]
def get_middle_click(self):
return self.edit_child_button_clicked
def find_index(self, obj):
2006-03-07 02:29:00 +05:30
"""
returns the index of the object within the associated data
"""
reflist = [ref.ref for ref in self.family.get_child_ref_list()]
return reflist.index(obj)
2006-03-07 02:29:00 +05:30
def _find_row(self, x, y):
row = self.tree.get_path_at_pos(x, y)
if row is None:
2006-04-13 21:46:00 +05:30
return len(self.family.get_child_ref_list())
2006-03-07 02:29:00 +05:30
else:
return row[0][0]
def _handle_drag(self, row, obj):
self.family.get_child_ref_list().insert(row, obj)
2006-03-07 02:29:00 +05:30
self.changed = True
self.rebuild()
def _move(self, row_from, row_to, obj):
2006-04-13 21:46:00 +05:30
dlist = self.family.get_child_ref_list()
2006-03-07 02:29:00 +05:30
if row_from < row_to:
dlist.insert(row_to, obj)
2006-03-07 02:29:00 +05:30
del dlist[row_from]
else:
del dlist[row_from]
dlist.insert(row_to-1, obj)
2006-03-07 02:29:00 +05:30
self.changed = True
self.rebuild()
def build_columns(self):
for column in self.columns:
self.tree.remove_column(column)
self.columns = []
for pair in self.column_order():
if not pair[0]:
continue
name = self._column_names[pair[1]][0]
render = gtk.CellRendererText()
column = gtk.TreeViewColumn(name, render, markup=pair[1])
column.set_min_width(50)
column.set_resizable(True)
column.set_sort_column_id(self._column_names[pair[1]][1])
self.columns.append(column)
self.tree.append_column(column)
def get_icon_name(self):
return 'gramps-family'
def is_empty(self):
"""
The list is considered empty if the child list is empty.
"""
2006-04-13 21:46:00 +05:30
return len(self.family.get_child_ref_list()) == 0
def get_data(self):
"""
Normally, get_data returns a list. However, we return family
object here instead.
"""
return self.family
def column_order(self):
return [(1, 0), (1, 1), (1, 2), (1, 3), (1, 4), (1, 5), (1, 6),
(0, 8), (0, 9)]
def add_button_clicked(self, obj):
person = gen.lib.Person()
autoname = config.get('behavior.surname-guessing')
#_("Father's surname"),
#_("None"),
#_("Combination of mother's and father's surname"),
#_("Icelandic style"),
2006-03-31 03:45:03 +05:30
if autoname == 0:
name = self.north_american()
elif autoname == 2:
name = self.latin_american()
else:
name = self.no_name()
person.get_primary_name().set_surname(name[1])
person.get_primary_name().set_surname_prefix(name[0])
EditPerson(self.dbstate, self.uistate, self.track, person,
self.new_child_added)
2006-03-19 12:19:03 +05:30
def new_child_added(self, person):
ref = gen.lib.ChildRef()
2006-04-13 21:46:00 +05:30
ref.ref = person.get_handle()
self.family.add_child_ref(ref)
2006-03-19 12:19:03 +05:30
self.rebuild()
self.call_edit_childref(ref.ref)
2006-03-19 12:19:03 +05:30
def child_ref_edited(self, person):
self.rebuild()
def share_button_clicked(self, obj):
2006-03-19 12:19:03 +05:30
# it only makes sense to skip those who are already in the family
skip_list = [self.family.get_father_handle(), \
self.family.get_mother_handle()] + \
2006-04-22 09:30:58 +05:30
[x.ref for x in self.family.get_child_ref_list() ]
sel = SelectPerson(self.dbstate, self.uistate, self.track,
_("Select Child"), skip=skip_list)
2006-03-19 12:19:03 +05:30
person = sel.run()
2006-03-20 05:04:23 +05:30
2006-03-19 12:19:03 +05:30
if person:
ref = gen.lib.ChildRef()
2006-04-13 21:46:00 +05:30
ref.ref = person.get_handle()
self.family.add_child_ref(ref)
2006-03-19 12:19:03 +05:30
self.rebuild()
self.call_edit_childref(ref.ref)
2006-03-19 12:19:03 +05:30
def run(self, skip):
2006-04-22 09:30:58 +05:30
skip_list = [ x for x in skip if x]
SelectPerson(self.dbstate, self.uistate, self.track,
_("Select Child"), skip=skip_list)
2006-03-20 05:04:23 +05:30
def del_button_clicked(self, obj):
handle = self.get_selected()
if handle:
for ref in self.family.get_child_ref_list():
if ref.ref == handle:
self.family.remove_child_ref(ref)
self.rebuild()
def edit_button_clicked(self, obj):
handle = self.get_selected()
if handle:
self.call_edit_childref(handle)
def call_edit_childref(self, handle):
for ref in self.family.get_child_ref_list():
if ref.ref == handle:
p = self.dbstate.db.get_person_from_handle(handle)
n = name_displayer.display(p)
try:
EditChildRef(n, self.dbstate, self.uistate, self.track,
ref, self.child_ref_edited)
except Errors.WindowActiveError:
pass
break
def edit_child_button_clicked(self, obj):
handle = self.get_selected()
if handle:
for ref in self.family.get_child_ref_list():
if ref.ref == handle:
p = self.dbstate.db.get_person_from_handle(handle)
try:
EditPerson(self.dbstate, self.uistate, self.track,
p, self.child_ref_edited)
except Errors.WindowActiveError:
pass
break
def up_button_clicked(self, obj):
handle = self.get_selected()
if handle:
pos = self.find_index(handle)
if pos > 0 :
self._move_up(pos,self.family.get_child_ref_list()[pos],
selmethod=self.family.get_child_ref_list)
def down_button_clicked(self, obj):
ref = self.get_selected()
if ref:
pos = self.find_index(ref)
if pos >=0 and pos < len(self.family.get_child_ref_list())-1:
self._move_down(pos,self.family.get_child_ref_list()[pos],
selmethod=self.family.get_child_ref_list)
def drag_data_received(self, widget, context, x, y, sel_data, info, time):
"""
Handle the standard gtk interface for drag_data_received.
If the selection data is define, extract the value from sel_data.data,
and decide if this is a move or a reorder.
"""
if sel_data and sel_data.data:
(mytype, selfid, obj, row_from) = pickle.loads(sel_data.data)
# make sure this is the correct DND type for this object
if mytype == self._DND_TYPE.drag_type:
# determine the destination row
row = self._find_row(x, y)
# if the is same object, we have a move, otherwise,
# it is a standard drag-n-drop
if id(self) == selfid:
obj = self.get_data().get_child_ref_list()[row_from]
self._move(row_from, row, obj)
else:
handle = obj
obj = gen.lib.ChildRef()
obj.ref = handle
self._handle_drag(row, obj)
self.rebuild()
elif self._DND_EXTRA and mytype == self._DND_EXTRA.drag_type:
self.handle_extra_type(mytype, obj)
2006-03-31 03:45:03 +05:30
def north_american(self):
father_handle = self.family.get_father_handle()
if father_handle:
father = self.dbstate.db.get_person_from_handle(father_handle)
pname = father.get_primary_name()
return (pname.get_surname_prefix(), pname.get_surname())
2006-03-31 03:45:03 +05:30
return ("","")
def no_name(self):
return ("","")
def latin_american(self):
if self.family:
father_handle = self.family.get_father_handle()
mother_handle = self.family.get_mother_handle()
if not father_handle or not mother_handle:
return ("","")
2006-04-22 09:30:58 +05:30
father = self.dbstate.db.get_person_from_handle(father_handle)
mother = self.dbstate.db.get_person_from_handle(mother_handle)
2006-03-31 03:45:03 +05:30
if not father or not mother:
return ("","")
fsn = father.get_primary_name().get_surname()
msn = mother.get_primary_name().get_surname()
2006-03-31 03:45:03 +05:30
try:
return ("", "%s %s" % (fsn.split()[0], msn.split()[0]))
2006-03-31 03:45:03 +05:30
except:
return ("", "")
2006-03-31 03:45:03 +05:30
else:
return ("", "")
2006-03-31 03:45:03 +05:30
class FastMaleFilter(object):
def __init__(self, db):
self.db = db
def match(self, handle, db):
value = self.db.get_raw_person_data(handle)
return value[2] == gen.lib.Person.MALE
class FastFemaleFilter(object):
def __init__(self, db):
self.db = db
def match(self, handle, db):
value = self.db.get_raw_person_data(handle)
return value[2] == gen.lib.Person.FEMALE
2006-01-12 05:37:11 +05:30
#-------------------------------------------------------------------------
#
# EditFamily
2006-01-12 05:37:11 +05:30
#
#-------------------------------------------------------------------------
2006-03-04 12:04:48 +05:30
class EditFamily(EditPrimary):
2006-01-12 05:37:11 +05:30
QR_CATEGORY = CATEGORY_QR_FAMILY
def __init__(self, dbstate, uistate, track, family):
2006-04-08 11:26:31 +05:30
2006-03-04 12:04:48 +05:30
EditPrimary.__init__(self, dbstate, uistate, track,
family, dbstate.db.get_family_from_handle,
dbstate.db.get_family_from_gramps_id)
2006-01-12 05:37:11 +05:30
2006-03-22 09:27:51 +05:30
# look for the scenerio of a child and no parents on a new
# family
if self.added and self.obj.get_father_handle() is None and \
self.obj.get_mother_handle() is None and \
2006-04-20 10:29:04 +05:30
len(self.obj.get_child_ref_list()) == 1:
self.add_parent = True
if not config.get('preferences.family-warn'):
2006-03-22 09:27:51 +05:30
for i in self.hidden:
i.set_sensitive(False)
MessageHideDialog(
2006-09-23 Don Allingham <don@gramps-project.org> * src/images/sources.svg: new icon * src/images/reports.svg: new icon * src/images/tools.svg: new icon * src/images/events.svg: new icon * src/images/place.svg: new icon * src/images/tools.svg: new icon * src/ViewManager.py: use new icons * src/gramps_main.py: register new icons 2006-09-22 Don Allingham <don@gramps-project.org> * src/GrampsDb/_GrampsGEDDB.py: support for disabling transactions * src/GrampsDb/_GrampsXMLDB.py: support for disabling transactions * src/GrampsDb/_GrampsBSDDB.py: support for disabling transactions * src/GrampsDb/_GrampsDbBase.py: support for disabling transactions * src/GrampsDb/_ReadGedcom.py: check for IO Eror * src/ViewManager.py: display message if a portability problem is detected * src/QuestionDialog.py: Add Warning dialog that can be disabled * src/DbLoader.py: Detect missing database problem * src/ArgHandler.py: support for disabling transactions * src/GrampsCfg.py: new config keys for transactions * src/Config/_GrampsConfigKeys.py: new config keys for transactions 2006-09-17 Don Allingham <don@gramps-project.org> * src/ViewManager.py: handle missing database on autoload (#447) * src/ArgHandler.py: handle missing database on autoload (#447) * src/DbLoader.py: handle missing database on autoload (#447) * src/Makefile.am: remove uninstalled packages from makefile * src/GrampsDb/_ReadXML.py: place vs. address changes * src/GrampsDb/_WriteXML.py: place vs. address changes * src/GrampsDb/_EditPlace.py: place vs. address changes * src/Editors/_EditPlace.py: place vs. address changes * src/Editors/_EditLocation.py: place vs. address changes * src/RelLib/_Address.py: place vs. address changes * src/RelLib/_LocationBase.py: place vs. address changes * src/RelLib/_Location.py: place vs. address changes * src/DisplayTabs/_LocationModel.py: place vs. address changes * src/DisplayTabs/_LocationEmbedList.py: place vs. address changes * src/glade/gramps.glade: place vs. address changes svn: r7325
2006-09-24 10:07:59 +05:30
_("Adding parents to a person"),
_("It is possible to accidentally create multiple "
"families with the same parents. To help avoid "
"this problem, only the buttons to select parents "
"are available when you create a new family. The "
"remaining fields will become available after you "
"attempt to select a parent."),
'preferences.family-warn')
else:
self.add_parent = False
* src/AddrEdit.py: remove already_exist check in favor of exception * src/AttrEdit.py: remove already_exist check in favor of exception * src/DisplayState.py: remove already_exist variable * src/DisplayTabs.py: handle exception * src/EditEventRef.py: remove already_exist check in favor of exception * src/EditFamily.py: update to derive from EditPrimary * src/EditMedia.py: update to derive from EditPrimary * src/EditMediaRef.py: remove already_exist check in favor of exception * src/EditPerson.py: update to derive from EditPrimary * src/EditPlace.py: update to derive from EditPrimary * src/EditRepository.py:update to derive from EditPrimary * src/EditSource.py: update to derive from EditPrimary * src/EditSourceRef.py: remove already_exist check in favor of exception * src/Errors.py: new exception * src/EventEdit.py: update to derive from EditPrimary * src/EventView.py: catch exception of window already exists * src/FamilyList.py: catch exception of window already exists * src/FamilyView.py: catch exception of window already exists * src/GrampsWidgets.py: typos * src/NameEdit.py: remove already_exist check in favor of exception * src/PedView.py: catch exception of window already exists * src/PersonView.py: catch exception of window already exists * src/PlaceView.py: catch exception of window already exists * src/Plugins.py: catch exception of window already exists * src/UrlEdit.py: remove already_exist check in favor of exception * src/const.py.in: dynamically determine path * src/gramps.glade: name changes * src/gramps.py: set path svn: r6014
2006-03-01 10:38:11 +05:30
2006-04-01 01:16:41 +05:30
def empty_object(self):
return gen.lib.Family()
2006-04-01 01:16:41 +05:30
* src/AddrEdit.py: remove already_exist check in favor of exception * src/AttrEdit.py: remove already_exist check in favor of exception * src/DisplayState.py: remove already_exist variable * src/DisplayTabs.py: handle exception * src/EditEventRef.py: remove already_exist check in favor of exception * src/EditFamily.py: update to derive from EditPrimary * src/EditMedia.py: update to derive from EditPrimary * src/EditMediaRef.py: remove already_exist check in favor of exception * src/EditPerson.py: update to derive from EditPrimary * src/EditPlace.py: update to derive from EditPrimary * src/EditRepository.py:update to derive from EditPrimary * src/EditSource.py: update to derive from EditPrimary * src/EditSourceRef.py: remove already_exist check in favor of exception * src/Errors.py: new exception * src/EventEdit.py: update to derive from EditPrimary * src/EventView.py: catch exception of window already exists * src/FamilyList.py: catch exception of window already exists * src/FamilyView.py: catch exception of window already exists * src/GrampsWidgets.py: typos * src/NameEdit.py: remove already_exist check in favor of exception * src/PedView.py: catch exception of window already exists * src/PersonView.py: catch exception of window already exists * src/PlaceView.py: catch exception of window already exists * src/Plugins.py: catch exception of window already exists * src/UrlEdit.py: remove already_exist check in favor of exception * src/const.py.in: dynamically determine path * src/gramps.glade: name changes * src/gramps.py: set path svn: r6014
2006-03-01 10:38:11 +05:30
def _local_init(self):
2006-01-12 05:37:11 +05:30
self.build_interface()
self.added = self.obj.handle is None
2006-03-08 05:19:26 +05:30
if self.added:
self.obj.handle = Utils.create_id()
* src/AddrEdit.py: remove already_exist check in favor of exception * src/AttrEdit.py: remove already_exist check in favor of exception * src/DisplayState.py: remove already_exist variable * src/DisplayTabs.py: handle exception * src/EditEventRef.py: remove already_exist check in favor of exception * src/EditFamily.py: update to derive from EditPrimary * src/EditMedia.py: update to derive from EditPrimary * src/EditMediaRef.py: remove already_exist check in favor of exception * src/EditPerson.py: update to derive from EditPrimary * src/EditPlace.py: update to derive from EditPrimary * src/EditRepository.py:update to derive from EditPrimary * src/EditSource.py: update to derive from EditPrimary * src/EditSourceRef.py: remove already_exist check in favor of exception * src/Errors.py: new exception * src/EventEdit.py: update to derive from EditPrimary * src/EventView.py: catch exception of window already exists * src/FamilyList.py: catch exception of window already exists * src/FamilyView.py: catch exception of window already exists * src/GrampsWidgets.py: typos * src/NameEdit.py: remove already_exist check in favor of exception * src/PedView.py: catch exception of window already exists * src/PersonView.py: catch exception of window already exists * src/PlaceView.py: catch exception of window already exists * src/Plugins.py: catch exception of window already exists * src/UrlEdit.py: remove already_exist check in favor of exception * src/const.py.in: dynamically determine path * src/gramps.glade: name changes * src/gramps.py: set path svn: r6014
2006-03-01 10:38:11 +05:30
self.load_data()
def _connect_db_signals(self):
"""
implement from base class DbGUIElement
Register the callbacks we need.
Note:
* we do not connect to person-delete, as a delete of a person in
the family outside of this editor will cause a family-update
signal of this family
"""
self.callman.register_handles({'family': [self.obj.get_handle()]})
self.callman.register_callbacks(
{'family-update': self.check_for_family_change,
'family-delete': self.check_for_close,
'family-rebuild': self._do_close,
'event-update': self.topdata_updated, # change eg birth event fath
'event-rebuild': self.topdata_updated,
'event-delete': self.topdata_updated, # delete eg birth event fath
'person-update': self.topdata_updated, # change eg name of father
'person-rebuild': self._do_close,
})
self.callman.connect_all(keys=['family', 'event', 'person'])
2007-02-03 23:38:43 +05:30
def check_for_family_change(self, handles):
"""
Callback for family-update signal
1. This method checks to see if the family shown has been changed. This
is possible eg in the relationship view. If the family was changed,
the view is refreshed and a warning dialog shown to indicate all
changes have been lost.
If a source/note/event is deleted, this method is called too. This
is unfortunate as the displaytabs can track themself a delete and
correct the view for this. Therefore, these tabs are not rebuild.
Conclusion: this method updates so that remove/change of parent or
remove/change of children in relationship view reloads the family
from db.
2. Changes in other families are of no consequence to the family shown
"""
2007-06-22 11:27:48 +05:30
if self.obj.get_handle() in handles:
#rebuild data
## Todo: Gallery and note tab are not rebuild ??
objreal = self.dbstate.db.get_family_from_handle(
self.obj.get_handle())
#update selection of data that we obtain from database change:
maindatachanged = (self.obj.gramps_id != objreal.gramps_id or
self.obj.father_handle != objreal.father_handle or
self.obj.mother_handle != objreal.mother_handle or
self.obj.private != objreal.private or
self.obj.type != objreal.type or
self.obj.marker != objreal.marker or
self.obj.child_ref_list != objreal.child_ref_list)
if maindatachanged:
self.obj.gramps_id = objreal.gramps_id
self.obj.father_handle = objreal.father_handle
self.obj.mother_handle = objreal.mother_handle
self.obj.private = objreal.private
self.obj.type = objreal.type
self.obj.marker = objreal.marker
self.obj.child_ref_list = objreal.child_ref_list
self.reload_people()
# No matter why the family changed (eg delete of a source), we notify
# the user
WarningDialog(
_("Family has changed"),
_("The %(object)s you are editing has changed outside this editor."
" This can be due to a change in one of the main views, for "
"example a source used here is deleted in the source view.\n"
"To make sure the information shown is still correct, the "
"data shown has been updated. Some edits you have made may have"
" been lost.") % {'object': _('family')}, parent=self.window)
def topdata_updated(self, *obj):
"""
Callback method called if data shown in top part of family editor
(a parent, birth/death event of parent) changes
Note: person events shown in the event list are not tracked, the
tabpage itself tracks it
"""
self.load_data()
def show_buttons(self):
"""
Used to reshow hidden/showing buttons.
"""
fhandle = self.obj.get_father_handle()
self.update_father(fhandle)
mhandle = self.obj.get_mother_handle()
self.update_mother(mhandle)
def reload_people(self):
* src/AddrEdit.py: remove already_exist check in favor of exception * src/AttrEdit.py: remove already_exist check in favor of exception * src/DisplayState.py: remove already_exist variable * src/DisplayTabs.py: handle exception * src/EditEventRef.py: remove already_exist check in favor of exception * src/EditFamily.py: update to derive from EditPrimary * src/EditMedia.py: update to derive from EditPrimary * src/EditMediaRef.py: remove already_exist check in favor of exception * src/EditPerson.py: update to derive from EditPrimary * src/EditPlace.py: update to derive from EditPrimary * src/EditRepository.py:update to derive from EditPrimary * src/EditSource.py: update to derive from EditPrimary * src/EditSourceRef.py: remove already_exist check in favor of exception * src/Errors.py: new exception * src/EventEdit.py: update to derive from EditPrimary * src/EventView.py: catch exception of window already exists * src/FamilyList.py: catch exception of window already exists * src/FamilyView.py: catch exception of window already exists * src/GrampsWidgets.py: typos * src/NameEdit.py: remove already_exist check in favor of exception * src/PedView.py: catch exception of window already exists * src/PersonView.py: catch exception of window already exists * src/PlaceView.py: catch exception of window already exists * src/Plugins.py: catch exception of window already exists * src/UrlEdit.py: remove already_exist check in favor of exception * src/const.py.in: dynamically determine path * src/gramps.glade: name changes * src/gramps.py: set path svn: r6014
2006-03-01 10:38:11 +05:30
fhandle = self.obj.get_father_handle()
self.update_father(fhandle)
* src/AddrEdit.py: remove already_exist check in favor of exception * src/AttrEdit.py: remove already_exist check in favor of exception * src/DisplayState.py: remove already_exist variable * src/DisplayTabs.py: handle exception * src/EditEventRef.py: remove already_exist check in favor of exception * src/EditFamily.py: update to derive from EditPrimary * src/EditMedia.py: update to derive from EditPrimary * src/EditMediaRef.py: remove already_exist check in favor of exception * src/EditPerson.py: update to derive from EditPrimary * src/EditPlace.py: update to derive from EditPrimary * src/EditRepository.py:update to derive from EditPrimary * src/EditSource.py: update to derive from EditPrimary * src/EditSourceRef.py: remove already_exist check in favor of exception * src/Errors.py: new exception * src/EventEdit.py: update to derive from EditPrimary * src/EventView.py: catch exception of window already exists * src/FamilyList.py: catch exception of window already exists * src/FamilyView.py: catch exception of window already exists * src/GrampsWidgets.py: typos * src/NameEdit.py: remove already_exist check in favor of exception * src/PedView.py: catch exception of window already exists * src/PersonView.py: catch exception of window already exists * src/PlaceView.py: catch exception of window already exists * src/Plugins.py: catch exception of window already exists * src/UrlEdit.py: remove already_exist check in favor of exception * src/const.py.in: dynamically determine path * src/gramps.glade: name changes * src/gramps.py: set path svn: r6014
2006-03-01 10:38:11 +05:30
mhandle = self.obj.get_mother_handle()
self.update_mother(mhandle)
self.child_tab.rebuild()
def get_menu_title(self):
if self.obj.get_handle():
dialog_title = Utils.family_name(self.obj, self.db, _("New Family"))
dialog_title = _("Family") + ': ' + dialog_title
else:
dialog_title = _("New Family")
return dialog_title
def build_menu_names(self, family):
return (_('Edit Family'), self.get_menu_title())
2006-01-12 05:37:11 +05:30
def build_interface(self):
self.width_key = 'interface.family-width'
self.height_key = 'interface.family-height'
self.top = Glade()
self.set_window(self.top.toplevel, None, self.get_menu_title())
2006-01-12 05:37:11 +05:30
# HACK: how to prevent hidden items from showing
# when you use show_all?
# Consider using show() rather than show_all()?
# FIXME: remove if we can use show()
self.window.show_all = self.window.show
self.fbirth = self.top.get_object('fbirth')
self.fdeath = self.top.get_object('fdeath')
self.fbirth_label = self.top.get_object('label578')
self.fdeath_label = self.top.get_object('label579')
2006-01-12 05:37:11 +05:30
self.mbirth = self.top.get_object('mbirth')
self.mdeath = self.top.get_object('mdeath')
self.mbirth_label = self.top.get_object('label567')
self.mdeath_label = self.top.get_object('label568')
2006-01-12 05:37:11 +05:30
self.mname = self.top.get_object('mname')
self.fname = self.top.get_object('fname')
self.mbutton_index = self.top.get_object('mbutton_index')
self.mbutton_add = self.top.get_object('mbutton_add')
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_edit.connect('button-press-event', self.edit_mother)
self.mbutton_edit.connect('key-press-event', self.edit_mother)
self.mbutton_index.connect('clicked', self.sel_mother_clicked)
self.mbutton_del.connect('clicked', self.del_mother_clicked)
self.mbutton_add.connect('clicked', self.add_mother_clicked)
self.fbutton_index = self.top.get_object('fbutton_index')
self.fbutton_add = self.top.get_object('fbutton_add')
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_edit.connect('button-press-event', self.edit_father)
self.fbutton_edit.connect('key-press-event', self.edit_father)
self.fbutton_index.connect('clicked', self.sel_father_clicked)
self.fbutton_del.connect('clicked', self.del_father_clicked)
self.fbutton_add.connect('clicked', self.add_father_clicked)
2006-04-29 04:12:07 +05:30
#allow for a context menu
self.set_contexteventbox(self.top.get_object("eventboxtop"))
* src/AddrEdit.py: remove already_exist check in favor of exception * src/AttrEdit.py: remove already_exist check in favor of exception * src/DisplayState.py: remove already_exist variable * src/DisplayTabs.py: handle exception * src/EditEventRef.py: remove already_exist check in favor of exception * src/EditFamily.py: update to derive from EditPrimary * src/EditMedia.py: update to derive from EditPrimary * src/EditMediaRef.py: remove already_exist check in favor of exception * src/EditPerson.py: update to derive from EditPrimary * src/EditPlace.py: update to derive from EditPrimary * src/EditRepository.py:update to derive from EditPrimary * src/EditSource.py: update to derive from EditPrimary * src/EditSourceRef.py: remove already_exist check in favor of exception * src/Errors.py: new exception * src/EventEdit.py: update to derive from EditPrimary * src/EventView.py: catch exception of window already exists * src/FamilyList.py: catch exception of window already exists * src/FamilyView.py: catch exception of window already exists * src/GrampsWidgets.py: typos * src/NameEdit.py: remove already_exist check in favor of exception * src/PedView.py: catch exception of window already exists * src/PersonView.py: catch exception of window already exists * src/PlaceView.py: catch exception of window already exists * src/Plugins.py: catch exception of window already exists * src/UrlEdit.py: remove already_exist check in favor of exception * src/const.py.in: dynamically determine path * src/gramps.glade: name changes * src/gramps.py: set path svn: r6014
2006-03-01 10:38:11 +05:30
def _connect_signals(self):
self.define_ok_button(self.top.get_object('ok'), self.save)
self.define_cancel_button(self.top.get_object('cancel'))
2006-03-22 09:27:51 +05:30
def _can_be_replaced(self):
pass
* src/AddrEdit.py: remove already_exist check in favor of exception * src/AttrEdit.py: remove already_exist check in favor of exception * src/DisplayState.py: remove already_exist variable * src/DisplayTabs.py: handle exception * src/EditEventRef.py: remove already_exist check in favor of exception * src/EditFamily.py: update to derive from EditPrimary * src/EditMedia.py: update to derive from EditPrimary * src/EditMediaRef.py: remove already_exist check in favor of exception * src/EditPerson.py: update to derive from EditPrimary * src/EditPlace.py: update to derive from EditPrimary * src/EditRepository.py:update to derive from EditPrimary * src/EditSource.py: update to derive from EditPrimary * src/EditSourceRef.py: remove already_exist check in favor of exception * src/Errors.py: new exception * src/EventEdit.py: update to derive from EditPrimary * src/EventView.py: catch exception of window already exists * src/FamilyList.py: catch exception of window already exists * src/FamilyView.py: catch exception of window already exists * src/GrampsWidgets.py: typos * src/NameEdit.py: remove already_exist check in favor of exception * src/PedView.py: catch exception of window already exists * src/PersonView.py: catch exception of window already exists * src/PlaceView.py: catch exception of window already exists * src/Plugins.py: catch exception of window already exists * src/UrlEdit.py: remove already_exist check in favor of exception * src/const.py.in: dynamically determine path * src/gramps.glade: name changes * src/gramps.py: set path svn: r6014
2006-03-01 10:38:11 +05:30
def _setup_fields(self):
self.private = PrivacyButton(
self.top.get_object('private'),
* src/AddrEdit.py: remove already_exist check in favor of exception * src/AttrEdit.py: remove already_exist check in favor of exception * src/DisplayState.py: remove already_exist variable * src/DisplayTabs.py: handle exception * src/EditEventRef.py: remove already_exist check in favor of exception * src/EditFamily.py: update to derive from EditPrimary * src/EditMedia.py: update to derive from EditPrimary * src/EditMediaRef.py: remove already_exist check in favor of exception * src/EditPerson.py: update to derive from EditPrimary * src/EditPlace.py: update to derive from EditPrimary * src/EditRepository.py:update to derive from EditPrimary * src/EditSource.py: update to derive from EditPrimary * src/EditSourceRef.py: remove already_exist check in favor of exception * src/Errors.py: new exception * src/EventEdit.py: update to derive from EditPrimary * src/EventView.py: catch exception of window already exists * src/FamilyList.py: catch exception of window already exists * src/FamilyView.py: catch exception of window already exists * src/GrampsWidgets.py: typos * src/NameEdit.py: remove already_exist check in favor of exception * src/PedView.py: catch exception of window already exists * src/PersonView.py: catch exception of window already exists * src/PlaceView.py: catch exception of window already exists * src/Plugins.py: catch exception of window already exists * src/UrlEdit.py: remove already_exist check in favor of exception * src/const.py.in: dynamically determine path * src/gramps.glade: name changes * src/gramps.py: set path svn: r6014
2006-03-01 10:38:11 +05:30
self.obj,
self.db.readonly)
self.gid = MonitoredEntry(
self.top.get_object('gid'),
* src/AddrEdit.py: remove already_exist check in favor of exception * src/AttrEdit.py: remove already_exist check in favor of exception * src/DisplayState.py: remove already_exist variable * src/DisplayTabs.py: handle exception * src/EditEventRef.py: remove already_exist check in favor of exception * src/EditFamily.py: update to derive from EditPrimary * src/EditMedia.py: update to derive from EditPrimary * src/EditMediaRef.py: remove already_exist check in favor of exception * src/EditPerson.py: update to derive from EditPrimary * src/EditPlace.py: update to derive from EditPrimary * src/EditRepository.py:update to derive from EditPrimary * src/EditSource.py: update to derive from EditPrimary * src/EditSourceRef.py: remove already_exist check in favor of exception * src/Errors.py: new exception * src/EventEdit.py: update to derive from EditPrimary * src/EventView.py: catch exception of window already exists * src/FamilyList.py: catch exception of window already exists * src/FamilyView.py: catch exception of window already exists * src/GrampsWidgets.py: typos * src/NameEdit.py: remove already_exist check in favor of exception * src/PedView.py: catch exception of window already exists * src/PersonView.py: catch exception of window already exists * src/PlaceView.py: catch exception of window already exists * src/Plugins.py: catch exception of window already exists * src/UrlEdit.py: remove already_exist check in favor of exception * src/const.py.in: dynamically determine path * src/gramps.glade: name changes * src/gramps.py: set path svn: r6014
2006-03-01 10:38:11 +05:30
self.obj.set_gramps_id,
self.obj.get_gramps_id,
self.db.readonly)
self.marker = MonitoredDataType(
self.top.get_object('marker'),
self.obj.set_marker,
self.obj.get_marker,
self.db.readonly,
self.db.get_marker_types(),
)
self.data_type = MonitoredDataType(
self.top.get_object('marriage_type'),
* src/AddrEdit.py: remove already_exist check in favor of exception * src/AttrEdit.py: remove already_exist check in favor of exception * src/DisplayState.py: remove already_exist variable * src/DisplayTabs.py: handle exception * src/EditEventRef.py: remove already_exist check in favor of exception * src/EditFamily.py: update to derive from EditPrimary * src/EditMedia.py: update to derive from EditPrimary * src/EditMediaRef.py: remove already_exist check in favor of exception * src/EditPerson.py: update to derive from EditPrimary * src/EditPlace.py: update to derive from EditPrimary * src/EditRepository.py:update to derive from EditPrimary * src/EditSource.py: update to derive from EditPrimary * src/EditSourceRef.py: remove already_exist check in favor of exception * src/Errors.py: new exception * src/EventEdit.py: update to derive from EditPrimary * src/EventView.py: catch exception of window already exists * src/FamilyList.py: catch exception of window already exists * src/FamilyView.py: catch exception of window already exists * src/GrampsWidgets.py: typos * src/NameEdit.py: remove already_exist check in favor of exception * src/PedView.py: catch exception of window already exists * src/PersonView.py: catch exception of window already exists * src/PlaceView.py: catch exception of window already exists * src/Plugins.py: catch exception of window already exists * src/UrlEdit.py: remove already_exist check in favor of exception * src/const.py.in: dynamically determine path * src/gramps.glade: name changes * src/gramps.py: set path svn: r6014
2006-03-01 10:38:11 +05:30
self.obj.set_relationship,
self.obj.get_relationship,
self.db.readonly,
self.db.get_family_relation_types(),
)
2006-01-12 05:37:11 +05:30
def load_data(self):
"""
Show top data of family editor: father and mother info
and set self.phandles with all person handles in the family
"""
* src/AddrEdit.py: remove already_exist check in favor of exception * src/AttrEdit.py: remove already_exist check in favor of exception * src/DisplayState.py: remove already_exist variable * src/DisplayTabs.py: handle exception * src/EditEventRef.py: remove already_exist check in favor of exception * src/EditFamily.py: update to derive from EditPrimary * src/EditMedia.py: update to derive from EditPrimary * src/EditMediaRef.py: remove already_exist check in favor of exception * src/EditPerson.py: update to derive from EditPrimary * src/EditPlace.py: update to derive from EditPrimary * src/EditRepository.py:update to derive from EditPrimary * src/EditSource.py: update to derive from EditPrimary * src/EditSourceRef.py: remove already_exist check in favor of exception * src/Errors.py: new exception * src/EventEdit.py: update to derive from EditPrimary * src/EventView.py: catch exception of window already exists * src/FamilyList.py: catch exception of window already exists * src/FamilyView.py: catch exception of window already exists * src/GrampsWidgets.py: typos * src/NameEdit.py: remove already_exist check in favor of exception * src/PedView.py: catch exception of window already exists * src/PersonView.py: catch exception of window already exists * src/PlaceView.py: catch exception of window already exists * src/Plugins.py: catch exception of window already exists * src/UrlEdit.py: remove already_exist check in favor of exception * src/const.py.in: dynamically determine path * src/gramps.glade: name changes * src/gramps.py: set path svn: r6014
2006-03-01 10:38:11 +05:30
fhandle = self.obj.get_father_handle()
self.update_father(fhandle)
* src/AddrEdit.py: remove already_exist check in favor of exception * src/AttrEdit.py: remove already_exist check in favor of exception * src/DisplayState.py: remove already_exist variable * src/DisplayTabs.py: handle exception * src/EditEventRef.py: remove already_exist check in favor of exception * src/EditFamily.py: update to derive from EditPrimary * src/EditMedia.py: update to derive from EditPrimary * src/EditMediaRef.py: remove already_exist check in favor of exception * src/EditPerson.py: update to derive from EditPrimary * src/EditPlace.py: update to derive from EditPrimary * src/EditRepository.py:update to derive from EditPrimary * src/EditSource.py: update to derive from EditPrimary * src/EditSourceRef.py: remove already_exist check in favor of exception * src/Errors.py: new exception * src/EventEdit.py: update to derive from EditPrimary * src/EventView.py: catch exception of window already exists * src/FamilyList.py: catch exception of window already exists * src/FamilyView.py: catch exception of window already exists * src/GrampsWidgets.py: typos * src/NameEdit.py: remove already_exist check in favor of exception * src/PedView.py: catch exception of window already exists * src/PersonView.py: catch exception of window already exists * src/PlaceView.py: catch exception of window already exists * src/Plugins.py: catch exception of window already exists * src/UrlEdit.py: remove already_exist check in favor of exception * src/const.py.in: dynamically determine path * src/gramps.glade: name changes * src/gramps.py: set path svn: r6014
2006-03-01 10:38:11 +05:30
mhandle = self.obj.get_mother_handle()
self.update_mother(mhandle)
2006-04-13 21:46:00 +05:30
self.phandles = [mhandle, fhandle] + \
[ x.ref for x in self.obj.get_child_ref_list()]
self.phandles = [handle for handle in self.phandles if handle]
* src/AddrEdit.py: remove already_exist check in favor of exception * src/AttrEdit.py: remove already_exist check in favor of exception * src/DisplayState.py: remove already_exist variable * src/DisplayTabs.py: handle exception * src/EditEventRef.py: remove already_exist check in favor of exception * src/EditFamily.py: update to derive from EditPrimary * src/EditMedia.py: update to derive from EditPrimary * src/EditMediaRef.py: remove already_exist check in favor of exception * src/EditPerson.py: update to derive from EditPrimary * src/EditPlace.py: update to derive from EditPrimary * src/EditRepository.py:update to derive from EditPrimary * src/EditSource.py: update to derive from EditPrimary * src/EditSourceRef.py: remove already_exist check in favor of exception * src/Errors.py: new exception * src/EventEdit.py: update to derive from EditPrimary * src/EventView.py: catch exception of window already exists * src/FamilyList.py: catch exception of window already exists * src/FamilyView.py: catch exception of window already exists * src/GrampsWidgets.py: typos * src/NameEdit.py: remove already_exist check in favor of exception * src/PedView.py: catch exception of window already exists * src/PersonView.py: catch exception of window already exists * src/PlaceView.py: catch exception of window already exists * src/Plugins.py: catch exception of window already exists * src/UrlEdit.py: remove already_exist check in favor of exception * src/const.py.in: dynamically determine path * src/gramps.glade: name changes * src/gramps.py: set path svn: r6014
2006-03-01 10:38:11 +05:30
def _create_tabbed_pages(self):
notebook = gtk.Notebook()
self.child_list = ChildEmbedList(self.dbstate,
self.uistate,
self.track,
self.obj)
self.child_tab = self._add_tab(notebook, self.child_list)
self.track_ref_for_deletion("child_list")
self.track_ref_for_deletion("child_tab")
* src/AddrEdit.py: remove already_exist check in favor of exception * src/AttrEdit.py: remove already_exist check in favor of exception * src/DisplayState.py: remove already_exist variable * src/DisplayTabs.py: handle exception * src/EditEventRef.py: remove already_exist check in favor of exception * src/EditFamily.py: update to derive from EditPrimary * src/EditMedia.py: update to derive from EditPrimary * src/EditMediaRef.py: remove already_exist check in favor of exception * src/EditPerson.py: update to derive from EditPrimary * src/EditPlace.py: update to derive from EditPrimary * src/EditRepository.py:update to derive from EditPrimary * src/EditSource.py: update to derive from EditPrimary * src/EditSourceRef.py: remove already_exist check in favor of exception * src/Errors.py: new exception * src/EventEdit.py: update to derive from EditPrimary * src/EventView.py: catch exception of window already exists * src/FamilyList.py: catch exception of window already exists * src/FamilyView.py: catch exception of window already exists * src/GrampsWidgets.py: typos * src/NameEdit.py: remove already_exist check in favor of exception * src/PedView.py: catch exception of window already exists * src/PersonView.py: catch exception of window already exists * src/PlaceView.py: catch exception of window already exists * src/Plugins.py: catch exception of window already exists * src/UrlEdit.py: remove already_exist check in favor of exception * src/const.py.in: dynamically determine path * src/gramps.glade: name changes * src/gramps.py: set path svn: r6014
2006-03-01 10:38:11 +05:30
self.event_list = EventEmbedList(self.dbstate,
self.uistate,
self.track,
self.obj)
self._add_tab(notebook, self.event_list)
self.track_ref_for_deletion("event_list")
* src/AddrEdit.py: remove already_exist check in favor of exception * src/AttrEdit.py: remove already_exist check in favor of exception * src/DisplayState.py: remove already_exist variable * src/DisplayTabs.py: handle exception * src/EditEventRef.py: remove already_exist check in favor of exception * src/EditFamily.py: update to derive from EditPrimary * src/EditMedia.py: update to derive from EditPrimary * src/EditMediaRef.py: remove already_exist check in favor of exception * src/EditPerson.py: update to derive from EditPrimary * src/EditPlace.py: update to derive from EditPrimary * src/EditRepository.py:update to derive from EditPrimary * src/EditSource.py: update to derive from EditPrimary * src/EditSourceRef.py: remove already_exist check in favor of exception * src/Errors.py: new exception * src/EventEdit.py: update to derive from EditPrimary * src/EventView.py: catch exception of window already exists * src/FamilyList.py: catch exception of window already exists * src/FamilyView.py: catch exception of window already exists * src/GrampsWidgets.py: typos * src/NameEdit.py: remove already_exist check in favor of exception * src/PedView.py: catch exception of window already exists * src/PersonView.py: catch exception of window already exists * src/PlaceView.py: catch exception of window already exists * src/Plugins.py: catch exception of window already exists * src/UrlEdit.py: remove already_exist check in favor of exception * src/const.py.in: dynamically determine path * src/gramps.glade: name changes * src/gramps.py: set path svn: r6014
2006-03-01 10:38:11 +05:30
self.source_list = SourceEmbedList(self.dbstate,
self.uistate,
self.track,
self.obj)
self._add_tab(notebook, self.source_list)
self.track_ref_for_deletion("source_list")
self.attr_list = FamilyAttrEmbedList(self.dbstate,
self.uistate,
self.track,
2007-02-03 23:38:43 +05:30
self.obj.get_attribute_list())
self._add_tab(notebook, self.attr_list)
self.track_ref_for_deletion("attr_list")
* src/AddrEdit.py: remove already_exist check in favor of exception * src/AttrEdit.py: remove already_exist check in favor of exception * src/DisplayState.py: remove already_exist variable * src/DisplayTabs.py: handle exception * src/EditEventRef.py: remove already_exist check in favor of exception * src/EditFamily.py: update to derive from EditPrimary * src/EditMedia.py: update to derive from EditPrimary * src/EditMediaRef.py: remove already_exist check in favor of exception * src/EditPerson.py: update to derive from EditPrimary * src/EditPlace.py: update to derive from EditPrimary * src/EditRepository.py:update to derive from EditPrimary * src/EditSource.py: update to derive from EditPrimary * src/EditSourceRef.py: remove already_exist check in favor of exception * src/Errors.py: new exception * src/EventEdit.py: update to derive from EditPrimary * src/EventView.py: catch exception of window already exists * src/FamilyList.py: catch exception of window already exists * src/FamilyView.py: catch exception of window already exists * src/GrampsWidgets.py: typos * src/NameEdit.py: remove already_exist check in favor of exception * src/PedView.py: catch exception of window already exists * src/PersonView.py: catch exception of window already exists * src/PlaceView.py: catch exception of window already exists * src/Plugins.py: catch exception of window already exists * src/UrlEdit.py: remove already_exist check in favor of exception * src/const.py.in: dynamically determine path * src/gramps.glade: name changes * src/gramps.py: set path svn: r6014
2006-03-01 10:38:11 +05:30
self.note_tab = NoteTab(self.dbstate,
self.uistate,
self.track,
self.obj.get_note_list(),
self.get_menu_title(),
notetype=gen.lib.NoteType.FAMILY)
self._add_tab(notebook, self.note_tab)
self.track_ref_for_deletion("note_tab")
* src/AddrEdit.py: remove already_exist check in favor of exception * src/AttrEdit.py: remove already_exist check in favor of exception * src/DisplayState.py: remove already_exist variable * src/DisplayTabs.py: handle exception * src/EditEventRef.py: remove already_exist check in favor of exception * src/EditFamily.py: update to derive from EditPrimary * src/EditMedia.py: update to derive from EditPrimary * src/EditMediaRef.py: remove already_exist check in favor of exception * src/EditPerson.py: update to derive from EditPrimary * src/EditPlace.py: update to derive from EditPrimary * src/EditRepository.py:update to derive from EditPrimary * src/EditSource.py: update to derive from EditPrimary * src/EditSourceRef.py: remove already_exist check in favor of exception * src/Errors.py: new exception * src/EventEdit.py: update to derive from EditPrimary * src/EventView.py: catch exception of window already exists * src/FamilyList.py: catch exception of window already exists * src/FamilyView.py: catch exception of window already exists * src/GrampsWidgets.py: typos * src/NameEdit.py: remove already_exist check in favor of exception * src/PedView.py: catch exception of window already exists * src/PersonView.py: catch exception of window already exists * src/PlaceView.py: catch exception of window already exists * src/Plugins.py: catch exception of window already exists * src/UrlEdit.py: remove already_exist check in favor of exception * src/const.py.in: dynamically determine path * src/gramps.glade: name changes * src/gramps.py: set path svn: r6014
2006-03-01 10:38:11 +05:30
self.gallery_tab = GalleryTab(self.dbstate,
self.uistate,
self.track,
self.obj.get_media_list())
self._add_tab(notebook, self.gallery_tab)
self.track_ref_for_deletion("gallery_tab")
self.lds_embed = FamilyLdsEmbedList(self.dbstate,
self.uistate,
self.track,
2007-02-03 23:38:43 +05:30
self.obj.get_lds_ord_list())
self._add_tab(notebook, self.lds_embed)
self.track_ref_for_deletion("lds_embed")
self._setup_notebook_tabs( notebook)
* src/AddrEdit.py: remove already_exist check in favor of exception * src/AttrEdit.py: remove already_exist check in favor of exception * src/DisplayState.py: remove already_exist variable * src/DisplayTabs.py: handle exception * src/EditEventRef.py: remove already_exist check in favor of exception * src/EditFamily.py: update to derive from EditPrimary * src/EditMedia.py: update to derive from EditPrimary * src/EditMediaRef.py: remove already_exist check in favor of exception * src/EditPerson.py: update to derive from EditPrimary * src/EditPlace.py: update to derive from EditPrimary * src/EditRepository.py:update to derive from EditPrimary * src/EditSource.py: update to derive from EditPrimary * src/EditSourceRef.py: remove already_exist check in favor of exception * src/Errors.py: new exception * src/EventEdit.py: update to derive from EditPrimary * src/EventView.py: catch exception of window already exists * src/FamilyList.py: catch exception of window already exists * src/FamilyView.py: catch exception of window already exists * src/GrampsWidgets.py: typos * src/NameEdit.py: remove already_exist check in favor of exception * src/PedView.py: catch exception of window already exists * src/PersonView.py: catch exception of window already exists * src/PlaceView.py: catch exception of window already exists * src/Plugins.py: catch exception of window already exists * src/UrlEdit.py: remove already_exist check in favor of exception * src/const.py.in: dynamically determine path * src/gramps.glade: name changes * src/gramps.py: set path svn: r6014
2006-03-01 10:38:11 +05:30
notebook.show_all()
2006-03-22 09:27:51 +05:30
self.hidden = (notebook, self.top.get_object('info'))
self.top.get_object('vbox').pack_start(notebook, True)
2006-01-13 09:24:31 +05:30
def update_father(self, handle):
self.load_parent(handle, self.fname, self.fbirth, self.fbirth_label,
self.fdeath, self.fdeath_label,
self.fbutton_index, self.fbutton_add,
self.fbutton_del, self.fbutton_edit)
def update_mother(self, handle):
self.load_parent(handle, self.mname, self.mbirth, self.mbirth_label,
self.mdeath, self.mdeath_label,
self.mbutton_index, self.mbutton_add,
self.mbutton_del, self.mbutton_edit)
def add_mother_clicked(self, obj):
person = gen.lib.Person()
person.set_gender(gen.lib.Person.FEMALE)
autoname = config.get('behavior.surname-guessing')
#_("Father's surname"),
#_("None"),
#_("Combination of mother's and father's surname"),
#_("Icelandic style"),
if autoname == 2:
name = self.latin_american_child("mother")
else:
name = self.no_name()
person.get_primary_name().set_surname(name[1])
person.get_primary_name().set_surname_prefix(name[0])
EditPerson(self.dbstate, self.uistate, self.track, person,
self.new_mother_added)
def add_father_clicked(self, obj):
person = gen.lib.Person()
person.set_gender(gen.lib.Person.MALE)
autoname = config.get('behavior.surname-guessing')
#_("Father's surname"),
#_("None"),
#_("Combination of mother's and father's surname"),
#_("Icelandic style"),
if autoname == 0:
name = self.north_american_child()
elif autoname == 2:
name = self.latin_american_child("father")
else:
name = self.no_name()
person.get_primary_name().set_surname(name[1])
person.get_primary_name().set_surname_prefix(name[0])
EditPerson(self.dbstate, self.uistate, self.track,
person, self.new_father_added)
def new_mother_added(self, person):
for i in self.hidden:
i.set_sensitive(True)
self.obj.set_mother_handle(person.handle)
self.update_mother(person.handle)
def new_father_added(self, person):
for i in self.hidden:
i.set_sensitive(True)
self.obj.set_father_handle(person.handle)
self.update_father(person.handle)
def del_mother_clicked(self, obj):
2006-03-22 09:27:51 +05:30
for i in self.hidden:
i.set_sensitive(True)
2006-03-21 11:53:45 +05:30
self.obj.set_mother_handle(None)
self.update_mother(None)
2006-03-22 09:27:51 +05:30
def sel_mother_clicked(self, obj):
for i in self.hidden:
i.set_sensitive(True)
2006-03-22 09:27:51 +05:30
data_filter = FastFemaleFilter(self.dbstate.db)
sel = SelectPerson(self.dbstate, self.uistate, self.track,
_("Select Mother"),
filter=data_filter,
skip=[x.ref for x in self.obj.get_child_ref_list()])
person = sel.run()
if person:
self.check_for_existing_family(self.obj.get_father_handle(),
person.handle,
self.obj.handle)
self.obj.set_mother_handle(person.handle)
self.update_mother(person.handle)
2006-03-22 09:27:51 +05:30
def on_change_father(self, selector_window, obj):
if obj.__class__ == gen.lib.Person:
try:
person = obj
* src/AddrEdit.py: remove already_exist check in favor of exception * src/AttrEdit.py: remove already_exist check in favor of exception * src/DisplayState.py: remove already_exist variable * src/DisplayTabs.py: handle exception * src/EditEventRef.py: remove already_exist check in favor of exception * src/EditFamily.py: update to derive from EditPrimary * src/EditMedia.py: update to derive from EditPrimary * src/EditMediaRef.py: remove already_exist check in favor of exception * src/EditPerson.py: update to derive from EditPrimary * src/EditPlace.py: update to derive from EditPrimary * src/EditRepository.py:update to derive from EditPrimary * src/EditSource.py: update to derive from EditPrimary * src/EditSourceRef.py: remove already_exist check in favor of exception * src/Errors.py: new exception * src/EventEdit.py: update to derive from EditPrimary * src/EventView.py: catch exception of window already exists * src/FamilyList.py: catch exception of window already exists * src/FamilyView.py: catch exception of window already exists * src/GrampsWidgets.py: typos * src/NameEdit.py: remove already_exist check in favor of exception * src/PedView.py: catch exception of window already exists * src/PersonView.py: catch exception of window already exists * src/PlaceView.py: catch exception of window already exists * src/Plugins.py: catch exception of window already exists * src/UrlEdit.py: remove already_exist check in favor of exception * src/const.py.in: dynamically determine path * src/gramps.glade: name changes * src/gramps.py: set path svn: r6014
2006-03-01 10:38:11 +05:30
self.obj.set_father_handle(person.get_handle())
self.update_father(person.get_handle())
except:
log.warn("Failed to update father: \n"
"obj returned from selector was: %s\n"
% (repr(obj),))
raise
else:
log.warn(
"Object selector returned obj.__class__ = %s, it should "
"have been of type %s." % (obj.__class__.__name__,
gen.lib.Person.__name__))
selector_window.close()
def del_father_clicked(self, obj):
2006-03-22 09:27:51 +05:30
for i in self.hidden:
i.set_sensitive(True)
self.obj.set_father_handle(None)
self.update_father(None)
def sel_father_clicked(self, obj):
for i in self.hidden:
i.set_sensitive(True)
data_filter = FastMaleFilter(self.dbstate.db)
sel = SelectPerson(self.dbstate, self.uistate, self.track,
_("Select Father"),
filter=data_filter,
skip=[x.ref for x in self.obj.get_child_ref_list()])
person = sel.run()
if person:
self.check_for_existing_family(person.handle,
self.obj.get_mother_handle(),
self.obj.handle)
self.obj.set_father_handle(person.handle)
self.update_father(person.handle)
def check_for_existing_family(self, father_handle, mother_handle,
family_handle):
if father_handle:
father = self.dbstate.db.get_person_from_handle(father_handle)
ffam = set(father.get_family_handle_list())
if mother_handle:
mother = self.dbstate.db.get_person_from_handle(mother_handle)
mfam = set(mother.get_family_handle_list())
common = list(mfam.intersection(ffam))
if len(common) > 0:
if self.add_parent or self.obj.handle not in common:
WarningDialog(
_('Duplicate Family'),
_('A family with these parents already exists '
'in the database. If you save, you will create '
'a duplicate family. It is recommended that '
'you cancel the editing of this window, and '
'select the existing family'),
parent=self.window)
def edit_father(self, obj, event):
handle = self.obj.get_father_handle()
return self.edit_person(obj, event, handle)
def edit_mother(self, obj, event):
handle = self.obj.get_mother_handle()
return self.edit_person(obj, event, handle)
def edit_person(self, obj, event, handle):
if button_activated(event, _LEFT_BUTTON):
* src/AddrEdit.py: remove already_exist check in favor of exception * src/AttrEdit.py: remove already_exist check in favor of exception * src/DisplayState.py: remove already_exist variable * src/DisplayTabs.py: handle exception * src/EditEventRef.py: remove already_exist check in favor of exception * src/EditFamily.py: update to derive from EditPrimary * src/EditMedia.py: update to derive from EditPrimary * src/EditMediaRef.py: remove already_exist check in favor of exception * src/EditPerson.py: update to derive from EditPrimary * src/EditPlace.py: update to derive from EditPrimary * src/EditRepository.py:update to derive from EditPrimary * src/EditSource.py: update to derive from EditPrimary * src/EditSourceRef.py: remove already_exist check in favor of exception * src/Errors.py: new exception * src/EventEdit.py: update to derive from EditPrimary * src/EventView.py: catch exception of window already exists * src/FamilyList.py: catch exception of window already exists * src/FamilyView.py: catch exception of window already exists * src/GrampsWidgets.py: typos * src/NameEdit.py: remove already_exist check in favor of exception * src/PedView.py: catch exception of window already exists * src/PersonView.py: catch exception of window already exists * src/PlaceView.py: catch exception of window already exists * src/Plugins.py: catch exception of window already exists * src/UrlEdit.py: remove already_exist check in favor of exception * src/const.py.in: dynamically determine path * src/gramps.glade: name changes * src/gramps.py: set path svn: r6014
2006-03-01 10:38:11 +05:30
try:
person = self.db.get_person_from_handle(handle)
2006-03-09 09:30:29 +05:30
EditPerson(self.dbstate, self.uistate,
self.track, person)
* src/AddrEdit.py: remove already_exist check in favor of exception * src/AttrEdit.py: remove already_exist check in favor of exception * src/DisplayState.py: remove already_exist variable * src/DisplayTabs.py: handle exception * src/EditEventRef.py: remove already_exist check in favor of exception * src/EditFamily.py: update to derive from EditPrimary * src/EditMedia.py: update to derive from EditPrimary * src/EditMediaRef.py: remove already_exist check in favor of exception * src/EditPerson.py: update to derive from EditPrimary * src/EditPlace.py: update to derive from EditPrimary * src/EditRepository.py:update to derive from EditPrimary * src/EditSource.py: update to derive from EditPrimary * src/EditSourceRef.py: remove already_exist check in favor of exception * src/Errors.py: new exception * src/EventEdit.py: update to derive from EditPrimary * src/EventView.py: catch exception of window already exists * src/FamilyList.py: catch exception of window already exists * src/FamilyView.py: catch exception of window already exists * src/GrampsWidgets.py: typos * src/NameEdit.py: remove already_exist check in favor of exception * src/PedView.py: catch exception of window already exists * src/PersonView.py: catch exception of window already exists * src/PlaceView.py: catch exception of window already exists * src/Plugins.py: catch exception of window already exists * src/UrlEdit.py: remove already_exist check in favor of exception * src/const.py.in: dynamically determine path * src/gramps.glade: name changes * src/gramps.py: set path svn: r6014
2006-03-01 10:38:11 +05:30
except Errors.WindowActiveError:
pass
def load_parent(self, handle, name_obj, birth_obj, birth_label, death_obj,
death_label, btn_index, btn_add, btn_del, btn_edit):
# is a parent used here:
is_used = handle is not None
# now we display the area:
if is_used:
* src/AddrEdit.py: remove already_exist check in favor of exception * src/AttrEdit.py: remove already_exist check in favor of exception * src/DisplayState.py: remove already_exist variable * src/DisplayTabs.py: handle exception * src/EditEventRef.py: remove already_exist check in favor of exception * src/EditFamily.py: update to derive from EditPrimary * src/EditMedia.py: update to derive from EditPrimary * src/EditMediaRef.py: remove already_exist check in favor of exception * src/EditPerson.py: update to derive from EditPrimary * src/EditPlace.py: update to derive from EditPrimary * src/EditRepository.py:update to derive from EditPrimary * src/EditSource.py: update to derive from EditPrimary * src/EditSourceRef.py: remove already_exist check in favor of exception * src/Errors.py: new exception * src/EventEdit.py: update to derive from EditPrimary * src/EventView.py: catch exception of window already exists * src/FamilyList.py: catch exception of window already exists * src/FamilyView.py: catch exception of window already exists * src/GrampsWidgets.py: typos * src/NameEdit.py: remove already_exist check in favor of exception * src/PedView.py: catch exception of window already exists * src/PersonView.py: catch exception of window already exists * src/PlaceView.py: catch exception of window already exists * src/Plugins.py: catch exception of window already exists * src/UrlEdit.py: remove already_exist check in favor of exception * src/const.py.in: dynamically determine path * src/gramps.glade: name changes * src/gramps.py: set path svn: r6014
2006-03-01 10:38:11 +05:30
db = self.db
2006-01-12 05:37:11 +05:30
person = db.get_person_from_handle(handle)
* src/TreeViews/_PersonTreeView.py: Use name_displayer. * src/ReportBase/_ReportUtils.py: Use name_displayer. * src/ReportBase/_CommandLineReport.py: Use name_displayer. * src/ReportBase/_BareReportDialog.py: Use name_displayer. * src/PluginUtils/_Tool.py: Use name_displayer. * src/plugins/TimeLine.py: Use name_displayer. * src/plugins/RelCalc.py: Use name_displayer. * src/plugins/ReadGrdb.py: Use name_displayer. * src/plugins/NarrativeWeb.py: Use name_displayer. * src/plugins/IndivComplete.py: Use name_displayer. * src/plugins/GraphViz.py: Use name_displayer. * src/plugins/FindDupes.py: Use name_displayer. * src/plugins/FamilyGroup.py: Use name_displayer. * src/plugins/DetDescendantReport.py: Use name_displayer. * src/plugins/DetAncestralReport.py: Use name_displayer. * src/plugins/DesGraph.py: Use name_displayer. * src/plugins/DescendReport.py: Use name_displayer. * src/plugins/DescendChart.py: Use name_displayer. * src/plugins/Check.py: Use name_displayer. * src/plugins/Ancestors.py: Use name_displayer. * src/plugins/AncestorReport.py: Use name_displayer. * src/plugins/AncestorChart2.py: Use name_displayer. * src/ObjectSelector/_PersonTreeFrame.py: Use name_displayer. * src/ObjectSelector/_PersonFrame.py: Use name_displayer. * src/Merge/_MergePerson.py: Use name_displayer. * src/GrampsDbUtils/_WriteGedcom.py: Use name_displayer. * src/GrampsDbUtils/_ReadXML.py: Use name_displayer. * src/GrampsDbUtils/_GedcomParse.py: Use name_displayer. * src/FilterEditor/_ShowResults.py: Use name_displayer. * src/FilterEditor/_EditRule.py: Use name_displayer. * src/Editors/_EditPrimary.py: Use name_displayer. * src/Editors/_EditPersonRef.py: Use name_displayer. * src/Editors/_EditPerson.py: Use name_displayer. * src/Editors/_EditName.py: Use name_displayer. * src/Editors/_EditLdsOrd.py: Use name_displayer. * src/Editors/_EditFamily.py: Use name_displayer. * src/DisplayTabs/_PersonRefModel.py: Use name_displayer. * src/DisplayTabs/_NameModel.py: Use name_displayer. * src/DisplayTabs/_ChildModel.py: Use name_displayer. * src/DisplayTabs/_BackRefModel.py: Use name_displayer. * src/DisplayModels/_PeopleModel.py: Use name_displayer. * src/DisplayModels/_FamilyModel.py: Use name_displayer. * src/DataViews/_PersonView.py: Use name_displayer. * src/DataViews/_RelationView.py: Use name_displayer. * src/DataViews/_PedigreeView.py: Use name_displayer. * src/Utils.py: Use name_displayer. * src/SubstKeywords.py: Use name_displayer. * src/Sort.py: Use name_displayer. * src/Reorder.py: Use name_displayer. * src/PageView.py (BookMarkView.add_bookmark): Use name_displayer. * src/Navigation.py: Use name_displayer. * src/DisplayState.py: Use name_displayer. * src/GrampsCfg.py: Use name_displayer. * src/Bookmarks.py (Bookmarks.make_label): Use name_displayer. * src/GrampsDb/Makefile.am (pkgdata_PYTHON): Ship new files. * src/Makefile.am (gdir_PYTHON): Ship ProgressDialog.py svn: r8680
2007-06-28 11:11:40 +05:30
name = "%s [%s]" % (name_displayer.display(person),
2006-01-12 05:37:11 +05:30
person.gramps_id)
birth = get_birth_or_fallback(db, person)
self.callman.register_handles({'person': [handle]})
if birth:
#if event changes it view needs to update
self.callman.register_handles({'event': [birth.get_handle()]})
if birth and birth.get_type() == gen.lib.EventType.BAPTISM:
birth_label.set_label(_("Baptism:"))
death = get_death_or_fallback(db, person)
if death:
#if event changes it view needs to update
self.callman.register_handles({'event': [death.get_handle()]})
if death and death.get_type() == gen.lib.EventType.BURIAL:
death_label.set_label(_("Burial:"))
btn_edit.set_tooltip_text(_('Edit %s') % name)
btn_index.hide()
btn_add.hide()
btn_del.show()
btn_edit.show()
2006-01-12 05:37:11 +05:30
else:
name = ""
birth = None
death = None
2006-01-12 05:37:11 +05:30
btn_index.show()
btn_add.show()
btn_del.hide()
btn_edit.hide()
if name_obj:
name_obj.set_text(name)
if birth:
birth_str = DateHandler.displayer.display(birth.get_date_object())
else:
birth_str = ""
birth_obj.set_text(birth_str)
if death:
death_str = DateHandler.displayer.display(death.get_date_object())
else:
death_str = ""
death_obj.set_text(death_str)
2006-01-12 05:37:11 +05:30
def fix_parent_handles(self, orig_handle, new_handle, trans):
if orig_handle != new_handle:
if orig_handle:
* src/AddrEdit.py: remove already_exist check in favor of exception * src/AttrEdit.py: remove already_exist check in favor of exception * src/DisplayState.py: remove already_exist variable * src/DisplayTabs.py: handle exception * src/EditEventRef.py: remove already_exist check in favor of exception * src/EditFamily.py: update to derive from EditPrimary * src/EditMedia.py: update to derive from EditPrimary * src/EditMediaRef.py: remove already_exist check in favor of exception * src/EditPerson.py: update to derive from EditPrimary * src/EditPlace.py: update to derive from EditPrimary * src/EditRepository.py:update to derive from EditPrimary * src/EditSource.py: update to derive from EditPrimary * src/EditSourceRef.py: remove already_exist check in favor of exception * src/Errors.py: new exception * src/EventEdit.py: update to derive from EditPrimary * src/EventView.py: catch exception of window already exists * src/FamilyList.py: catch exception of window already exists * src/FamilyView.py: catch exception of window already exists * src/GrampsWidgets.py: typos * src/NameEdit.py: remove already_exist check in favor of exception * src/PedView.py: catch exception of window already exists * src/PersonView.py: catch exception of window already exists * src/PlaceView.py: catch exception of window already exists * src/Plugins.py: catch exception of window already exists * src/UrlEdit.py: remove already_exist check in favor of exception * src/const.py.in: dynamically determine path * src/gramps.glade: name changes * src/gramps.py: set path svn: r6014
2006-03-01 10:38:11 +05:30
person = self.db.get_person_from_handle(orig_handle)
person.family_list.remove(self.obj.handle)
self.db.commit_person(person, trans)
if new_handle:
person = self.db.get_person_from_handle(new_handle)
2006-03-09 07:25:03 +05:30
if self.obj.handle not in person.family_list:
* src/AddrEdit.py: remove already_exist check in favor of exception * src/AttrEdit.py: remove already_exist check in favor of exception * src/DisplayState.py: remove already_exist variable * src/DisplayTabs.py: handle exception * src/EditEventRef.py: remove already_exist check in favor of exception * src/EditFamily.py: update to derive from EditPrimary * src/EditMedia.py: update to derive from EditPrimary * src/EditMediaRef.py: remove already_exist check in favor of exception * src/EditPerson.py: update to derive from EditPrimary * src/EditPlace.py: update to derive from EditPrimary * src/EditRepository.py:update to derive from EditPrimary * src/EditSource.py: update to derive from EditPrimary * src/EditSourceRef.py: remove already_exist check in favor of exception * src/Errors.py: new exception * src/EventEdit.py: update to derive from EditPrimary * src/EventView.py: catch exception of window already exists * src/FamilyList.py: catch exception of window already exists * src/FamilyView.py: catch exception of window already exists * src/GrampsWidgets.py: typos * src/NameEdit.py: remove already_exist check in favor of exception * src/PedView.py: catch exception of window already exists * src/PersonView.py: catch exception of window already exists * src/PlaceView.py: catch exception of window already exists * src/Plugins.py: catch exception of window already exists * src/UrlEdit.py: remove already_exist check in favor of exception * src/const.py.in: dynamically determine path * src/gramps.glade: name changes * src/gramps.py: set path svn: r6014
2006-03-01 10:38:11 +05:30
person.family_list.append(self.obj.handle)
self.db.commit_person(person, trans)
* src/AddrEdit.py: remove already_exist check in favor of exception * src/AttrEdit.py: remove already_exist check in favor of exception * src/DisplayState.py: remove already_exist variable * src/DisplayTabs.py: handle exception * src/EditEventRef.py: remove already_exist check in favor of exception * src/EditFamily.py: update to derive from EditPrimary * src/EditMedia.py: update to derive from EditPrimary * src/EditMediaRef.py: remove already_exist check in favor of exception * src/EditPerson.py: update to derive from EditPrimary * src/EditPlace.py: update to derive from EditPrimary * src/EditRepository.py:update to derive from EditPrimary * src/EditSource.py: update to derive from EditPrimary * src/EditSourceRef.py: remove already_exist check in favor of exception * src/Errors.py: new exception * src/EventEdit.py: update to derive from EditPrimary * src/EventView.py: catch exception of window already exists * src/FamilyList.py: catch exception of window already exists * src/FamilyView.py: catch exception of window already exists * src/GrampsWidgets.py: typos * src/NameEdit.py: remove already_exist check in favor of exception * src/PedView.py: catch exception of window already exists * src/PersonView.py: catch exception of window already exists * src/PlaceView.py: catch exception of window already exists * src/Plugins.py: catch exception of window already exists * src/UrlEdit.py: remove already_exist check in favor of exception * src/const.py.in: dynamically determine path * src/gramps.glade: name changes * src/gramps.py: set path svn: r6014
2006-03-01 10:38:11 +05:30
2006-04-08 11:26:31 +05:30
def object_is_empty(self):
return self.obj.get_father_handle() is None and \
self.obj.get_mother_handle() is None and \
2006-04-13 21:46:00 +05:30
len(self.obj.get_child_ref_list()) == 0
def save(self, *obj):
try:
self.__do_save()
except bsddb_db.DBRunRecoveryError, msg:
RunDatabaseRepair(msg[1])
2006-04-08 11:26:31 +05:30
def __do_save(self):
self.ok_button.set_sensitive(False)
2006-03-08 05:19:26 +05:30
if not self.added:
* src/AddrEdit.py: remove already_exist check in favor of exception * src/AttrEdit.py: remove already_exist check in favor of exception * src/DisplayState.py: remove already_exist variable * src/DisplayTabs.py: handle exception * src/EditEventRef.py: remove already_exist check in favor of exception * src/EditFamily.py: update to derive from EditPrimary * src/EditMedia.py: update to derive from EditPrimary * src/EditMediaRef.py: remove already_exist check in favor of exception * src/EditPerson.py: update to derive from EditPrimary * src/EditPlace.py: update to derive from EditPrimary * src/EditRepository.py:update to derive from EditPrimary * src/EditSource.py: update to derive from EditPrimary * src/EditSourceRef.py: remove already_exist check in favor of exception * src/Errors.py: new exception * src/EventEdit.py: update to derive from EditPrimary * src/EventView.py: catch exception of window already exists * src/FamilyList.py: catch exception of window already exists * src/FamilyView.py: catch exception of window already exists * src/GrampsWidgets.py: typos * src/NameEdit.py: remove already_exist check in favor of exception * src/PedView.py: catch exception of window already exists * src/PersonView.py: catch exception of window already exists * src/PlaceView.py: catch exception of window already exists * src/Plugins.py: catch exception of window already exists * src/UrlEdit.py: remove already_exist check in favor of exception * src/const.py.in: dynamically determine path * src/gramps.glade: name changes * src/gramps.py: set path svn: r6014
2006-03-01 10:38:11 +05:30
original = self.db.get_family_from_handle(self.obj.handle)
else:
original = None
# do some basic checks
child_list = [ ref.ref for ref in self.obj.get_child_ref_list() ]
if self.obj.get_father_handle() in child_list:
2006-11-27 03:20:21 +05:30
father = self.db.get_person_from_handle(self.obj.get_father_handle())
* src/TreeViews/_PersonTreeView.py: Use name_displayer. * src/ReportBase/_ReportUtils.py: Use name_displayer. * src/ReportBase/_CommandLineReport.py: Use name_displayer. * src/ReportBase/_BareReportDialog.py: Use name_displayer. * src/PluginUtils/_Tool.py: Use name_displayer. * src/plugins/TimeLine.py: Use name_displayer. * src/plugins/RelCalc.py: Use name_displayer. * src/plugins/ReadGrdb.py: Use name_displayer. * src/plugins/NarrativeWeb.py: Use name_displayer. * src/plugins/IndivComplete.py: Use name_displayer. * src/plugins/GraphViz.py: Use name_displayer. * src/plugins/FindDupes.py: Use name_displayer. * src/plugins/FamilyGroup.py: Use name_displayer. * src/plugins/DetDescendantReport.py: Use name_displayer. * src/plugins/DetAncestralReport.py: Use name_displayer. * src/plugins/DesGraph.py: Use name_displayer. * src/plugins/DescendReport.py: Use name_displayer. * src/plugins/DescendChart.py: Use name_displayer. * src/plugins/Check.py: Use name_displayer. * src/plugins/Ancestors.py: Use name_displayer. * src/plugins/AncestorReport.py: Use name_displayer. * src/plugins/AncestorChart2.py: Use name_displayer. * src/ObjectSelector/_PersonTreeFrame.py: Use name_displayer. * src/ObjectSelector/_PersonFrame.py: Use name_displayer. * src/Merge/_MergePerson.py: Use name_displayer. * src/GrampsDbUtils/_WriteGedcom.py: Use name_displayer. * src/GrampsDbUtils/_ReadXML.py: Use name_displayer. * src/GrampsDbUtils/_GedcomParse.py: Use name_displayer. * src/FilterEditor/_ShowResults.py: Use name_displayer. * src/FilterEditor/_EditRule.py: Use name_displayer. * src/Editors/_EditPrimary.py: Use name_displayer. * src/Editors/_EditPersonRef.py: Use name_displayer. * src/Editors/_EditPerson.py: Use name_displayer. * src/Editors/_EditName.py: Use name_displayer. * src/Editors/_EditLdsOrd.py: Use name_displayer. * src/Editors/_EditFamily.py: Use name_displayer. * src/DisplayTabs/_PersonRefModel.py: Use name_displayer. * src/DisplayTabs/_NameModel.py: Use name_displayer. * src/DisplayTabs/_ChildModel.py: Use name_displayer. * src/DisplayTabs/_BackRefModel.py: Use name_displayer. * src/DisplayModels/_PeopleModel.py: Use name_displayer. * src/DisplayModels/_FamilyModel.py: Use name_displayer. * src/DataViews/_PersonView.py: Use name_displayer. * src/DataViews/_RelationView.py: Use name_displayer. * src/DataViews/_PedigreeView.py: Use name_displayer. * src/Utils.py: Use name_displayer. * src/SubstKeywords.py: Use name_displayer. * src/Sort.py: Use name_displayer. * src/Reorder.py: Use name_displayer. * src/PageView.py (BookMarkView.add_bookmark): Use name_displayer. * src/Navigation.py: Use name_displayer. * src/DisplayState.py: Use name_displayer. * src/GrampsCfg.py: Use name_displayer. * src/Bookmarks.py (Bookmarks.make_label): Use name_displayer. * src/GrampsDb/Makefile.am (pkgdata_PYTHON): Ship new files. * src/Makefile.am (gdir_PYTHON): Ship ProgressDialog.py svn: r8680
2007-06-28 11:11:40 +05:30
name = "%s [%s]" % (name_displayer.display(father),
father.gramps_id)
ErrorDialog(_("A father cannot be his own child"),
2007-02-03 23:38:43 +05:30
_("%s is listed as both the father and child "
"of the family.") % name)
self.ok_button.set_sensitive(True)
return
elif self.obj.get_mother_handle() in child_list:
2006-11-27 03:20:21 +05:30
mother = self.db.get_person_from_handle(self.obj.get_mother_handle())
* src/TreeViews/_PersonTreeView.py: Use name_displayer. * src/ReportBase/_ReportUtils.py: Use name_displayer. * src/ReportBase/_CommandLineReport.py: Use name_displayer. * src/ReportBase/_BareReportDialog.py: Use name_displayer. * src/PluginUtils/_Tool.py: Use name_displayer. * src/plugins/TimeLine.py: Use name_displayer. * src/plugins/RelCalc.py: Use name_displayer. * src/plugins/ReadGrdb.py: Use name_displayer. * src/plugins/NarrativeWeb.py: Use name_displayer. * src/plugins/IndivComplete.py: Use name_displayer. * src/plugins/GraphViz.py: Use name_displayer. * src/plugins/FindDupes.py: Use name_displayer. * src/plugins/FamilyGroup.py: Use name_displayer. * src/plugins/DetDescendantReport.py: Use name_displayer. * src/plugins/DetAncestralReport.py: Use name_displayer. * src/plugins/DesGraph.py: Use name_displayer. * src/plugins/DescendReport.py: Use name_displayer. * src/plugins/DescendChart.py: Use name_displayer. * src/plugins/Check.py: Use name_displayer. * src/plugins/Ancestors.py: Use name_displayer. * src/plugins/AncestorReport.py: Use name_displayer. * src/plugins/AncestorChart2.py: Use name_displayer. * src/ObjectSelector/_PersonTreeFrame.py: Use name_displayer. * src/ObjectSelector/_PersonFrame.py: Use name_displayer. * src/Merge/_MergePerson.py: Use name_displayer. * src/GrampsDbUtils/_WriteGedcom.py: Use name_displayer. * src/GrampsDbUtils/_ReadXML.py: Use name_displayer. * src/GrampsDbUtils/_GedcomParse.py: Use name_displayer. * src/FilterEditor/_ShowResults.py: Use name_displayer. * src/FilterEditor/_EditRule.py: Use name_displayer. * src/Editors/_EditPrimary.py: Use name_displayer. * src/Editors/_EditPersonRef.py: Use name_displayer. * src/Editors/_EditPerson.py: Use name_displayer. * src/Editors/_EditName.py: Use name_displayer. * src/Editors/_EditLdsOrd.py: Use name_displayer. * src/Editors/_EditFamily.py: Use name_displayer. * src/DisplayTabs/_PersonRefModel.py: Use name_displayer. * src/DisplayTabs/_NameModel.py: Use name_displayer. * src/DisplayTabs/_ChildModel.py: Use name_displayer. * src/DisplayTabs/_BackRefModel.py: Use name_displayer. * src/DisplayModels/_PeopleModel.py: Use name_displayer. * src/DisplayModels/_FamilyModel.py: Use name_displayer. * src/DataViews/_PersonView.py: Use name_displayer. * src/DataViews/_RelationView.py: Use name_displayer. * src/DataViews/_PedigreeView.py: Use name_displayer. * src/Utils.py: Use name_displayer. * src/SubstKeywords.py: Use name_displayer. * src/Sort.py: Use name_displayer. * src/Reorder.py: Use name_displayer. * src/PageView.py (BookMarkView.add_bookmark): Use name_displayer. * src/Navigation.py: Use name_displayer. * src/DisplayState.py: Use name_displayer. * src/GrampsCfg.py: Use name_displayer. * src/Bookmarks.py (Bookmarks.make_label): Use name_displayer. * src/GrampsDb/Makefile.am (pkgdata_PYTHON): Ship new files. * src/Makefile.am (gdir_PYTHON): Ship ProgressDialog.py svn: r8680
2007-06-28 11:11:40 +05:30
name = "%s [%s]" % (name_displayer.display(mother),
mother.gramps_id)
ErrorDialog(_("A mother cannot be her own child"),
2007-02-03 23:38:43 +05:30
_("%s is listed as both the mother and child "
"of the family.") % name)
self.ok_button.set_sensitive(True)
return
2007-06-22 11:27:48 +05:30
if not original and self.object_is_empty():
ErrorDialog(
2007-06-22 11:27:48 +05:30
_("Cannot save family"),
_("No data exists for this family. "
"Please enter data or cancel the edit."))
self.ok_button.set_sensitive(True)
return
(uses_dupe_id, id) = self._uses_duplicate_id()
if uses_dupe_id:
msg1 = _("Cannot save family. ID already exists.")
msg2 = _("You have attempted to use the existing Gramps ID with "
"value %(id)s. This value is already used. Please "
"enter a different ID or leave "
"blank to get the next available ID value.") % {
'id' : id}
ErrorDialog(msg1, msg2)
self.ok_button.set_sensitive(True)
2007-06-22 11:27:48 +05:30
return
2007-06-22 11:27:48 +05:30
# We disconnect the callbacks to all signals we connected earlier.
# This prevents the signals originating in any of the following
# commits from being caught by us again.
self._cleanup_callbacks()
2007-06-22 11:27:48 +05:30
2006-04-01 01:16:41 +05:30
if not original and not self.object_is_empty():
* src/AddrEdit.py: remove already_exist check in favor of exception * src/AttrEdit.py: remove already_exist check in favor of exception * src/DisplayState.py: remove already_exist variable * src/DisplayTabs.py: handle exception * src/EditEventRef.py: remove already_exist check in favor of exception * src/EditFamily.py: update to derive from EditPrimary * src/EditMedia.py: update to derive from EditPrimary * src/EditMediaRef.py: remove already_exist check in favor of exception * src/EditPerson.py: update to derive from EditPrimary * src/EditPlace.py: update to derive from EditPrimary * src/EditRepository.py:update to derive from EditPrimary * src/EditSource.py: update to derive from EditPrimary * src/EditSourceRef.py: remove already_exist check in favor of exception * src/Errors.py: new exception * src/EventEdit.py: update to derive from EditPrimary * src/EventView.py: catch exception of window already exists * src/FamilyList.py: catch exception of window already exists * src/FamilyView.py: catch exception of window already exists * src/GrampsWidgets.py: typos * src/NameEdit.py: remove already_exist check in favor of exception * src/PedView.py: catch exception of window already exists * src/PersonView.py: catch exception of window already exists * src/PlaceView.py: catch exception of window already exists * src/Plugins.py: catch exception of window already exists * src/UrlEdit.py: remove already_exist check in favor of exception * src/const.py.in: dynamically determine path * src/gramps.glade: name changes * src/gramps.py: set path svn: r6014
2006-03-01 10:38:11 +05:30
trans = self.db.transaction_begin()
2006-03-08 05:19:26 +05:30
# find the father, add the family handle to the father
handle = self.obj.get_father_handle()
if handle:
parent = self.db.get_person_from_handle(handle)
parent.add_family_handle(self.obj.handle)
self.db.commit_person(parent, trans)
2006-03-08 05:19:26 +05:30
# find the mother, add the family handle to the mother
handle = self.obj.get_mother_handle()
if handle:
parent = self.db.get_person_from_handle(handle)
parent.add_family_handle(self.obj.handle)
self.db.commit_person(parent, trans)
2006-03-08 05:19:26 +05:30
# for each child, add the family handle to the child
2006-04-13 21:46:00 +05:30
for ref in self.obj.get_child_ref_list():
child = self.db.get_person_from_handle(ref.ref)
2006-03-09 07:25:03 +05:30
# fix - relationships need to be extracted from the list
child.add_parent_family_handle(self.obj.handle)
self.db.commit_person(child, trans)
self.db.add_family(self.obj, trans)
self.db.transaction_commit(trans, _("Add Family"))
* src/AddrEdit.py: remove already_exist check in favor of exception * src/AttrEdit.py: remove already_exist check in favor of exception * src/DisplayState.py: remove already_exist variable * src/DisplayTabs.py: handle exception * src/EditEventRef.py: remove already_exist check in favor of exception * src/EditFamily.py: update to derive from EditPrimary * src/EditMedia.py: update to derive from EditPrimary * src/EditMediaRef.py: remove already_exist check in favor of exception * src/EditPerson.py: update to derive from EditPrimary * src/EditPlace.py: update to derive from EditPrimary * src/EditRepository.py:update to derive from EditPrimary * src/EditSource.py: update to derive from EditPrimary * src/EditSourceRef.py: remove already_exist check in favor of exception * src/Errors.py: new exception * src/EventEdit.py: update to derive from EditPrimary * src/EventView.py: catch exception of window already exists * src/FamilyList.py: catch exception of window already exists * src/FamilyView.py: catch exception of window already exists * src/GrampsWidgets.py: typos * src/NameEdit.py: remove already_exist check in favor of exception * src/PedView.py: catch exception of window already exists * src/PersonView.py: catch exception of window already exists * src/PlaceView.py: catch exception of window already exists * src/Plugins.py: catch exception of window already exists * src/UrlEdit.py: remove already_exist check in favor of exception * src/const.py.in: dynamically determine path * src/gramps.glade: name changes * src/gramps.py: set path svn: r6014
2006-03-01 10:38:11 +05:30
elif cmp(original.serialize(),self.obj.serialize()):
* src/AddrEdit.py: remove already_exist check in favor of exception * src/AttrEdit.py: remove already_exist check in favor of exception * src/DisplayState.py: remove already_exist variable * src/DisplayTabs.py: handle exception * src/EditEventRef.py: remove already_exist check in favor of exception * src/EditFamily.py: update to derive from EditPrimary * src/EditMedia.py: update to derive from EditPrimary * src/EditMediaRef.py: remove already_exist check in favor of exception * src/EditPerson.py: update to derive from EditPrimary * src/EditPlace.py: update to derive from EditPrimary * src/EditRepository.py:update to derive from EditPrimary * src/EditSource.py: update to derive from EditPrimary * src/EditSourceRef.py: remove already_exist check in favor of exception * src/Errors.py: new exception * src/EventEdit.py: update to derive from EditPrimary * src/EventView.py: catch exception of window already exists * src/FamilyList.py: catch exception of window already exists * src/FamilyView.py: catch exception of window already exists * src/GrampsWidgets.py: typos * src/NameEdit.py: remove already_exist check in favor of exception * src/PedView.py: catch exception of window already exists * src/PersonView.py: catch exception of window already exists * src/PlaceView.py: catch exception of window already exists * src/Plugins.py: catch exception of window already exists * src/UrlEdit.py: remove already_exist check in favor of exception * src/const.py.in: dynamically determine path * src/gramps.glade: name changes * src/gramps.py: set path svn: r6014
2006-03-01 10:38:11 +05:30
trans = self.db.transaction_begin()
self.fix_parent_handles(original.get_father_handle(),
self.obj.get_father_handle(), trans)
self.fix_parent_handles(original.get_mother_handle(),
self.obj.get_mother_handle(), trans)
2006-04-13 21:46:00 +05:30
orig_set = set(original.get_child_ref_list())
new_set = set(self.obj.get_child_ref_list())
# remove the family from children which have been removed
2006-04-15 11:54:35 +05:30
for ref in orig_set.difference(new_set):
person = self.db.get_person_from_handle(ref.ref)
* src/AddrEdit.py: remove already_exist check in favor of exception * src/AttrEdit.py: remove already_exist check in favor of exception * src/DisplayState.py: remove already_exist variable * src/DisplayTabs.py: handle exception * src/EditEventRef.py: remove already_exist check in favor of exception * src/EditFamily.py: update to derive from EditPrimary * src/EditMedia.py: update to derive from EditPrimary * src/EditMediaRef.py: remove already_exist check in favor of exception * src/EditPerson.py: update to derive from EditPrimary * src/EditPlace.py: update to derive from EditPrimary * src/EditRepository.py:update to derive from EditPrimary * src/EditSource.py: update to derive from EditPrimary * src/EditSourceRef.py: remove already_exist check in favor of exception * src/Errors.py: new exception * src/EventEdit.py: update to derive from EditPrimary * src/EventView.py: catch exception of window already exists * src/FamilyList.py: catch exception of window already exists * src/FamilyView.py: catch exception of window already exists * src/GrampsWidgets.py: typos * src/NameEdit.py: remove already_exist check in favor of exception * src/PedView.py: catch exception of window already exists * src/PersonView.py: catch exception of window already exists * src/PlaceView.py: catch exception of window already exists * src/Plugins.py: catch exception of window already exists * src/UrlEdit.py: remove already_exist check in favor of exception * src/const.py.in: dynamically determine path * src/gramps.glade: name changes * src/gramps.py: set path svn: r6014
2006-03-01 10:38:11 +05:30
person.remove_parent_family_handle(self.obj.handle)
self.db.commit_person(person, trans)
# add the family to children which have been added
2006-04-15 11:54:35 +05:30
for ref in new_set.difference(orig_set):
person = self.db.get_person_from_handle(ref.ref)
person.add_parent_family_handle(self.obj.handle)
self.db.commit_person(person, trans)
2006-04-01 01:16:41 +05:30
if self.object_is_empty():
self.db.remove_family(self.obj.handle, trans)
2006-04-01 01:16:41 +05:30
else:
if not self.obj.get_gramps_id():
self.obj.set_gramps_id(self.db.find_next_family_gramps_id())
self.db.commit_family(self.obj, trans)
self.db.transaction_commit(trans, _("Edit Family"))
2006-04-08 11:26:31 +05:30
self._do_close()
def no_name(self):
"""
Default surname guess.
"""
return ("","")
def north_american_child(self):
"""
If SURNAME_GUESSING is north american, then find a child
and return their name for the father.
"""
# for each child, find one with a last name
for ref in self.obj.get_child_ref_list():
child = self.db.get_person_from_handle(ref.ref)
if child:
pname = child.get_primary_name()
return (pname.get_surname_prefix(), pname.get_surname())
return ("", "")
def latin_american_child(self, parent):
"""
If SURNAME_GUESSING is latin american, then find a child
and return their name for the father or mother.
parent = "mother" | "father"
"""
# for each child, find one with a last name
for ref in self.obj.get_child_ref_list():
child = self.db.get_person_from_handle(ref.ref)
if child:
pname = child.get_primary_name()
prefix, surname = (pname.get_surname_prefix(),
pname.get_surname())
if " " in surname:
fsn, msn = surname.split(" ", 1)
else:
fsn, msn = surname, surname
if parent == "father":
return prefix, fsn
elif parent == "mother":
return prefix, msn
else:
return ("", "")
return ("", "")
def button_activated(event, mouse_button):
if (event.type == gtk.gdk.BUTTON_PRESS and \
event.button == mouse_button) or \
(event.type == gtk.gdk.KEY_PRESS and \
event.keyval in (_RETURN, _KP_ENTER)):
return True
else:
return False