* src/DateEdit.py (update_after_editor): Add method.
* src/EditPerson.py: Always have birth/death events (never None); Use new update method for dates; Only commit death/birth if changed; Only add new birth/death if non-empty. * src/EventEdit.py: Translate stored event names before including in menu; Exclude birth/death from menu; Do not add birth/death to the custom event types; Only detect type change for non-birth/death. * src/GrampsDbBase.py: Do not commit objects with empty handles. * src/GrampsInMemDB.py: Do not commit objects with empty handles. * src/Utils.py (family_name): Add clause for unknown parents. svn: r4172
This commit is contained in:
parent
9130c8819e
commit
98e031a825
@ -1,3 +1,15 @@
|
|||||||
|
2005-03-13 Alex Roitman <shura@gramps-project.org>
|
||||||
|
* src/DateEdit.py (update_after_editor): Add method.
|
||||||
|
* src/EditPerson.py: Always have birth/death events (never None);
|
||||||
|
Use new update method for dates; Only commit death/birth if changed;
|
||||||
|
Only add new birth/death if non-empty.
|
||||||
|
* src/EventEdit.py: Translate stored event names before including in
|
||||||
|
menu; Exclude birth/death from menu; Do not add birth/death to the
|
||||||
|
custom event types; Only detect type change for non-birth/death.
|
||||||
|
* src/GrampsDbBase.py: Do not commit objects with empty handles.
|
||||||
|
* src/GrampsInMemDB.py: Do not commit objects with empty handles.
|
||||||
|
* src/Utils.py (family_name): Add clause for unknown parents.
|
||||||
|
|
||||||
2005-03-12 Martin Hawlisch <Martin.Hawlisch@gmx.de>
|
2005-03-12 Martin Hawlisch <Martin.Hawlisch@gmx.de>
|
||||||
* src/GenericFilter.py (Rule,GenericFilter): New methods prepare() and
|
* src/GenericFilter.py (Rule,GenericFilter): New methods prepare() and
|
||||||
reset(), that are called before/after a filter is applied, to properly
|
reset(), that are called before/after a filter is applied, to properly
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#
|
#
|
||||||
# Gramps - a GTK+/GNOME based genealogy program
|
# Gramps - a GTK+/GNOME based genealogy program
|
||||||
#
|
#
|
||||||
# Copyright (C) 2002-2004 Donald N. Allingham
|
# Copyright (C) 2002-2005 Donald N. Allingham
|
||||||
#
|
#
|
||||||
# This program is free software; you can redistribute it and/or modify
|
# 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
|
# it under the terms of the GNU General Public License as published by
|
||||||
@ -156,8 +156,14 @@ class DateEdit:
|
|||||||
"""
|
"""
|
||||||
date_dialog = DateEditorDialog(self.date_obj,self.parent_window)
|
date_dialog = DateEditorDialog(self.date_obj,self.parent_window)
|
||||||
the_date = date_dialog.return_date
|
the_date = date_dialog.return_date
|
||||||
if the_date:
|
self.update_after_editor(the_date)
|
||||||
self.date_obj.copy(the_date)
|
|
||||||
|
def update_after_editor(self,date_obj):
|
||||||
|
"""
|
||||||
|
Update text field and LED button to reflect the given date instance.
|
||||||
|
"""
|
||||||
|
if date_obj:
|
||||||
|
self.date_obj.copy(date_obj)
|
||||||
self.text_obj.set_text(DateHandler.displayer.display(self.date_obj))
|
self.text_obj.set_text(DateHandler.displayer.display(self.date_obj))
|
||||||
self.check()
|
self.check()
|
||||||
|
|
||||||
|
@ -27,6 +27,7 @@
|
|||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
import pickle
|
import pickle
|
||||||
import os
|
import os
|
||||||
|
import locale
|
||||||
from gettext import gettext as _
|
from gettext import gettext as _
|
||||||
|
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
@ -38,8 +39,6 @@ import gtk
|
|||||||
import gtk.glade
|
import gtk.glade
|
||||||
import gobject
|
import gobject
|
||||||
import gnome
|
import gnome
|
||||||
import locale
|
|
||||||
|
|
||||||
from gtk.gdk import ACTION_COPY, BUTTON1_MASK, INTERP_BILINEAR, pixbuf_new_from_file
|
from gtk.gdk import ACTION_COPY, BUTTON1_MASK, INTERP_BILINEAR, pixbuf_new_from_file
|
||||||
|
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
@ -260,9 +259,19 @@ class EditPerson:
|
|||||||
self.prefix_label.set_use_underline(True)
|
self.prefix_label.set_use_underline(True)
|
||||||
|
|
||||||
birth_handle = person.get_birth_handle()
|
birth_handle = person.get_birth_handle()
|
||||||
|
if birth_handle:
|
||||||
|
self.orig_birth = self.db.get_event_from_handle(birth_handle)
|
||||||
|
else:
|
||||||
|
self.orig_birth = RelLib.Event()
|
||||||
|
self.orig_birth.set_name("Birth")
|
||||||
|
|
||||||
death_handle = person.get_death_handle()
|
death_handle = person.get_death_handle()
|
||||||
self.orig_birth = self.db.get_event_from_handle(birth_handle)
|
if death_handle:
|
||||||
self.orig_death = self.db.get_event_from_handle(death_handle)
|
self.orig_death = self.db.get_event_from_handle(death_handle)
|
||||||
|
else:
|
||||||
|
self.orig_death = RelLib.Event()
|
||||||
|
self.orig_death.set_name("Death")
|
||||||
|
|
||||||
self.death = RelLib.Event(self.orig_death)
|
self.death = RelLib.Event(self.orig_death)
|
||||||
self.birth = RelLib.Event(self.orig_birth)
|
self.birth = RelLib.Event(self.orig_birth)
|
||||||
self.pname = RelLib.Name(person.get_primary_name())
|
self.pname = RelLib.Name(person.get_primary_name())
|
||||||
@ -423,7 +432,6 @@ class EditPerson:
|
|||||||
|
|
||||||
self.birth_date_object = self.birth.get_date_object()
|
self.birth_date_object = self.birth.get_date_object()
|
||||||
self.death_date_object = self.death.get_date_object()
|
self.death_date_object = self.death.get_date_object()
|
||||||
self.update_birth_death()
|
|
||||||
|
|
||||||
self.bdate_check = DateEdit.DateEdit(
|
self.bdate_check = DateEdit.DateEdit(
|
||||||
self.birth_date_object, self.bdate,
|
self.birth_date_object, self.bdate,
|
||||||
@ -433,6 +441,8 @@ class EditPerson:
|
|||||||
self.death_date_object, self.ddate,
|
self.death_date_object, self.ddate,
|
||||||
self.get_widget("death_stat"), self.window)
|
self.get_widget("death_stat"), self.window)
|
||||||
|
|
||||||
|
self.update_birth_death()
|
||||||
|
|
||||||
self.top.signal_autoconnect({
|
self.top.signal_autoconnect({
|
||||||
"destroy_passed_object" : self.on_cancel_edit,
|
"destroy_passed_object" : self.on_cancel_edit,
|
||||||
"on_up_clicked" : self.on_up_clicked,
|
"on_up_clicked" : self.on_up_clicked,
|
||||||
@ -717,23 +727,10 @@ class EditPerson:
|
|||||||
|
|
||||||
for fam_id in flist:
|
for fam_id in flist:
|
||||||
index += 1
|
index += 1
|
||||||
fam = self.db.get_family_from_handle(fam_id)
|
family = self.db.get_family_from_handle(fam_id)
|
||||||
if fam == None:
|
if family == None:
|
||||||
continue
|
continue
|
||||||
f_id = fam.get_father_handle()
|
name = Utils.family_name(family,self.db)
|
||||||
m_id = fam.get_mother_handle()
|
|
||||||
f = self.db.get_person_from_handle(f_id)
|
|
||||||
m = self.db.get_person_from_handle(m_id)
|
|
||||||
if f and m:
|
|
||||||
name = _("%(father)s and %(mother)s") % {
|
|
||||||
'father' : self.name_display.display(f),
|
|
||||||
'mother' : self.name_display.display(m) }
|
|
||||||
elif f:
|
|
||||||
name = self.name_display.display(f)
|
|
||||||
elif m:
|
|
||||||
name = self.name_display.display(m)
|
|
||||||
else:
|
|
||||||
name = _("unknown")
|
|
||||||
store.append(row=[name])
|
store.append(row=[name])
|
||||||
self.lds_fam_list.append(fam_id)
|
self.lds_fam_list.append(fam_id)
|
||||||
if fam_id == self.ldsfam:
|
if fam_id == self.ldsfam:
|
||||||
@ -1386,15 +1383,14 @@ class EditPerson:
|
|||||||
self.bplace.set_text(place_title(self.db,self.birth))
|
self.bplace.set_text(place_title(self.db,self.birth))
|
||||||
self.dplace.set_text(place_title(self.db,self.death))
|
self.dplace.set_text(place_title(self.db,self.death))
|
||||||
|
|
||||||
self.bdate.set_text(self.dd.display(self.birth_date_object))
|
self.bdate_check.update_after_editor(self.birth_date_object)
|
||||||
self.ddate.set_text(self.dd.display(self.death_date_object))
|
self.ddate_check.update_after_editor(self.death_date_object)
|
||||||
|
|
||||||
def on_update_attr_clicked(self,obj):
|
def on_update_attr_clicked(self,obj):
|
||||||
import AttrEdit
|
import AttrEdit
|
||||||
store,node = self.atree.get_selected()
|
store,node = self.atree.get_selected()
|
||||||
if node:
|
if node:
|
||||||
attr = self.atree.get_object(node)
|
attr = self.atree.get_object(node)
|
||||||
print attr.get_type()
|
|
||||||
pname = self.name_display.display(self.person)
|
pname = self.name_display.display(self.person)
|
||||||
AttrEdit.AttributeEditor(self,attr,pname,const.personalAttributes,
|
AttrEdit.AttributeEditor(self,attr,pname,const.personalAttributes,
|
||||||
self.attr_edit_callback,self.window,
|
self.attr_edit_callback,self.window,
|
||||||
@ -1696,10 +1692,10 @@ class EditPerson:
|
|||||||
p = self.db.get_place_from_handle(key).get_display_info()
|
p = self.db.get_place_from_handle(key).get_display_info()
|
||||||
self.pdmap[p[0]] = key
|
self.pdmap[p[0]] = key
|
||||||
|
|
||||||
if self.orig_birth == None:
|
if not self.orig_birth.are_equal(self.birth):
|
||||||
self.db.add_event(self.birth,trans)
|
if self.orig_birth.is_empty():
|
||||||
self.person.set_birth_handle(self.birth.get_handle())
|
self.db.add_event(self.birth,trans)
|
||||||
elif not self.orig_birth.are_equal(self.birth):
|
self.person.set_birth_handle(self.birth.get_handle())
|
||||||
self.db.commit_event(self.birth,trans)
|
self.db.commit_event(self.birth,trans)
|
||||||
|
|
||||||
# Update each of the families child lists to reflect any
|
# Update each of the families child lists to reflect any
|
||||||
@ -1717,10 +1713,10 @@ class EditPerson:
|
|||||||
self.death.set_date_object(self.death_date_object)
|
self.death.set_date_object(self.death_date_object)
|
||||||
self.death.set_place_handle(self.get_place(self.dplace,1))
|
self.death.set_place_handle(self.get_place(self.dplace,1))
|
||||||
|
|
||||||
if self.orig_death == None:
|
if not self.orig_death.are_equal(self.death):
|
||||||
self.db.add_event(self.death,trans)
|
if self.orig_death.is_empty():
|
||||||
self.person.set_death_handle(self.death.get_handle())
|
self.db.add_event(self.death,trans)
|
||||||
elif not self.orig_death.are_equal(self.death):
|
self.person.set_death_handle(self.death.get_handle())
|
||||||
self.db.commit_event(self.death,trans)
|
self.db.commit_event(self.death,trans)
|
||||||
|
|
||||||
male = self.is_male.get_active()
|
male = self.is_male.get_active()
|
||||||
@ -1905,13 +1901,11 @@ class EditPerson:
|
|||||||
self.load_photo(None)
|
self.load_photo(None)
|
||||||
|
|
||||||
def update_birth_info(self):
|
def update_birth_info(self):
|
||||||
self.birth_date_object.copy(self.birth.get_date_object())
|
self.bdate_check.update_after_editor(self.birth.get_date_object())
|
||||||
self.bdate.set_text(self.birth.get_date())
|
|
||||||
self.bplace.set_text(place_title(self.db,self.birth))
|
self.bplace.set_text(place_title(self.db,self.birth))
|
||||||
|
|
||||||
def update_death_info(self):
|
def update_death_info(self):
|
||||||
self.death_date_object.copy(self.death.get_date_object())
|
self.ddate_check.update_after_editor(self.death.get_date_object())
|
||||||
self.ddate.set_text(self.death.get_date())
|
|
||||||
self.dplace.set_text(place_title(self.db,self.death))
|
self.dplace.set_text(place_title(self.db,self.death))
|
||||||
|
|
||||||
def on_switch_page(self,obj,a,page):
|
def on_switch_page(self,obj,a,page):
|
||||||
|
@ -88,8 +88,10 @@ class EventEditor:
|
|||||||
values = {}
|
values = {}
|
||||||
for v in elist:
|
for v in elist:
|
||||||
values[v] = 1
|
values[v] = 1
|
||||||
for v in self.db.get_person_event_type_list():
|
for vv in self.db.get_person_event_type_list():
|
||||||
values[v] = 1
|
if vv not in ("Birth","Death"):
|
||||||
|
v = _(vv)
|
||||||
|
values[v] = 1
|
||||||
|
|
||||||
self.elist = values.keys()
|
self.elist = values.keys()
|
||||||
self.elist.sort()
|
self.elist.sort()
|
||||||
@ -108,8 +110,8 @@ class EventEditor:
|
|||||||
# add the name to the list if it is not already there. This
|
# add the name to the list if it is not already there. This
|
||||||
# tends to occur in translated languages with the 'Death'
|
# tends to occur in translated languages with the 'Death'
|
||||||
# event, which is a partial match to other events
|
# event, which is a partial match to other events
|
||||||
if not transname in elist:
|
#if not transname in elist:
|
||||||
elist.append(transname)
|
# elist.append(transname)
|
||||||
else:
|
else:
|
||||||
self.srcreflist = []
|
self.srcreflist = []
|
||||||
self.witnesslist = []
|
self.witnesslist = []
|
||||||
@ -321,7 +323,7 @@ class EventEditor:
|
|||||||
edesc = unicode(self.descr_field.get_text())
|
edesc = unicode(self.descr_field.get_text())
|
||||||
epriv = self.priv.get_active()
|
epriv = self.priv.get_active()
|
||||||
|
|
||||||
if not ename in self.elist:
|
if ename not in self.elist + [_("Birth") , _("Death")]:
|
||||||
WarningDialog(
|
WarningDialog(
|
||||||
_('New event type created'),
|
_('New event type created'),
|
||||||
_('The "%s" event type has been added to this database.\n'
|
_('The "%s" event type has been added to this database.\n'
|
||||||
@ -353,7 +355,8 @@ class EventEditor:
|
|||||||
self.event.set_place_handle("")
|
self.event.set_place_handle("")
|
||||||
self.parent.lists_changed = 1
|
self.parent.lists_changed = 1
|
||||||
|
|
||||||
if self.event.get_name() != self.trans.find_key(name):
|
if self.event.get_name() not in [self.trans.find_key(name),
|
||||||
|
"Birth","Death"]:
|
||||||
self.event.set_name(self.trans.find_key(name))
|
self.event.set_name(self.trans.find_key(name))
|
||||||
self.parent.lists_changed = 1
|
self.parent.lists_changed = 1
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#
|
#
|
||||||
# Gramps - a GTK+/GNOME based genealogy program
|
# Gramps - a GTK+/GNOME based genealogy program
|
||||||
#
|
#
|
||||||
# Copyright (C) 2000-2004 Donald N. Allingham
|
# Copyright (C) 2000-2005 Donald N. Allingham
|
||||||
#
|
#
|
||||||
# This program is free software; you can redistribute it and/or modify
|
# 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
|
# it under the terms of the GNU General Public License as published by
|
||||||
@ -228,7 +228,7 @@ class GrampsDbBase:
|
|||||||
Commits the specified Person to the database, storing the changes
|
Commits the specified Person to the database, storing the changes
|
||||||
as part of the transaction.
|
as part of the transaction.
|
||||||
"""
|
"""
|
||||||
if self.readonly:
|
if self.readonly or not person.get_handle():
|
||||||
return
|
return
|
||||||
if change_time:
|
if change_time:
|
||||||
person.change = int(change_time)
|
person.change = int(change_time)
|
||||||
@ -246,7 +246,7 @@ class GrampsDbBase:
|
|||||||
Commits the specified MediaObject to the database, storing the changes
|
Commits the specified MediaObject to the database, storing the changes
|
||||||
as part of the transaction.
|
as part of the transaction.
|
||||||
"""
|
"""
|
||||||
if self.readonly:
|
if self.readonly or not obj.get_handle():
|
||||||
return
|
return
|
||||||
if change_time:
|
if change_time:
|
||||||
obj.change = int(change_time)
|
obj.change = int(change_time)
|
||||||
@ -263,7 +263,7 @@ class GrampsDbBase:
|
|||||||
Commits the specified Source to the database, storing the changes
|
Commits the specified Source to the database, storing the changes
|
||||||
as part of the transaction.
|
as part of the transaction.
|
||||||
"""
|
"""
|
||||||
if self.readonly:
|
if self.readonly or not source.get_handle():
|
||||||
return
|
return
|
||||||
if change_time:
|
if change_time:
|
||||||
source.change = int(change_time)
|
source.change = int(change_time)
|
||||||
@ -280,7 +280,7 @@ class GrampsDbBase:
|
|||||||
Commits the specified Place to the database, storing the changes
|
Commits the specified Place to the database, storing the changes
|
||||||
as part of the transaction.
|
as part of the transaction.
|
||||||
"""
|
"""
|
||||||
if self.readonly:
|
if self.readonly or not place.get_handle():
|
||||||
return
|
return
|
||||||
if change_time:
|
if change_time:
|
||||||
place.change = int(change_time)
|
place.change = int(change_time)
|
||||||
@ -297,7 +297,7 @@ class GrampsDbBase:
|
|||||||
Commits the specified Event to the database, storing the changes
|
Commits the specified Event to the database, storing the changes
|
||||||
as part of the transaction.
|
as part of the transaction.
|
||||||
"""
|
"""
|
||||||
if self.readonly:
|
if self.readonly or not event.get_handle():
|
||||||
return
|
return
|
||||||
if change_time:
|
if change_time:
|
||||||
event.change = int(change_time)
|
event.change = int(change_time)
|
||||||
@ -314,7 +314,7 @@ class GrampsDbBase:
|
|||||||
Commits the specified Family to the database, storing the changes
|
Commits the specified Family to the database, storing the changes
|
||||||
as part of the transaction.
|
as part of the transaction.
|
||||||
"""
|
"""
|
||||||
if self.readonly:
|
if self.readonly or not family.get_handle():
|
||||||
return
|
return
|
||||||
if change_time:
|
if change_time:
|
||||||
family.change = int(change_time)
|
family.change = int(change_time)
|
||||||
|
@ -25,6 +25,11 @@ Provides the common infrastructure for database formats that
|
|||||||
must hold all of their data in memory.
|
must hold all of their data in memory.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
#-------------------------------------------------------------------------
|
||||||
|
#
|
||||||
|
# GRAMPS modules
|
||||||
|
#
|
||||||
|
#-------------------------------------------------------------------------
|
||||||
from RelLib import *
|
from RelLib import *
|
||||||
from GrampsDbBase import *
|
from GrampsDbBase import *
|
||||||
|
|
||||||
@ -189,35 +194,35 @@ class GrampsInMemDB(GrampsDbBase):
|
|||||||
del self.event_map[str(handle)]
|
del self.event_map[str(handle)]
|
||||||
|
|
||||||
def commit_person(self,person,transaction,change_time=None):
|
def commit_person(self,person,transaction,change_time=None):
|
||||||
if self.readonly:
|
if self.readonly or not person.get_handle():
|
||||||
return
|
return
|
||||||
gid = person.get_gramps_id()
|
gid = person.get_gramps_id()
|
||||||
self.id_trans[gid] = person.get_handle()
|
self.id_trans[gid] = person.get_handle()
|
||||||
GrampsDbBase.commit_person(self,person,transaction,change_time)
|
GrampsDbBase.commit_person(self,person,transaction,change_time)
|
||||||
|
|
||||||
def commit_place(self,place,transaction,change_time=None):
|
def commit_place(self,place,transaction,change_time=None):
|
||||||
if self.readonly:
|
if self.readonly or not place.get_handle():
|
||||||
return
|
return
|
||||||
gid = place.get_gramps_id()
|
gid = place.get_gramps_id()
|
||||||
self.pid_trans[gid] = place.get_handle()
|
self.pid_trans[gid] = place.get_handle()
|
||||||
GrampsDbBase.commit_place(self,place,transaction,change_time)
|
GrampsDbBase.commit_place(self,place,transaction,change_time)
|
||||||
|
|
||||||
def commit_family(self,family,transaction,change_time=None):
|
def commit_family(self,family,transaction,change_time=None):
|
||||||
if self.readonly:
|
if self.readonly or not family.get_handle():
|
||||||
return
|
return
|
||||||
gid = family.get_gramps_id()
|
gid = family.get_gramps_id()
|
||||||
self.fid_trans[gid] = family.get_handle()
|
self.fid_trans[gid] = family.get_handle()
|
||||||
GrampsDbBase.commit_family(self,family,transaction,change_time)
|
GrampsDbBase.commit_family(self,family,transaction,change_time)
|
||||||
|
|
||||||
def commit_media_object(self,obj,transaction,change_time=None):
|
def commit_media_object(self,obj,transaction,change_time=None):
|
||||||
if self.readonly:
|
if self.readonly or not obj.get_handle():
|
||||||
return
|
return
|
||||||
gid = obj.get_gramps_id()
|
gid = obj.get_gramps_id()
|
||||||
self.oid_trans[gid] = obj.get_handle()
|
self.oid_trans[gid] = obj.get_handle()
|
||||||
GrampsDbBase.commit_media_object(self,obj,transaction,change_time)
|
GrampsDbBase.commit_media_object(self,obj,transaction,change_time)
|
||||||
|
|
||||||
def commit_source(self,source,transaction,change_time=None):
|
def commit_source(self,source,transaction,change_time=None):
|
||||||
if self.readonly:
|
if self.readonly or not source.get_handle():
|
||||||
return
|
return
|
||||||
gid = source.get_gramps_id()
|
gid = source.get_gramps_id()
|
||||||
self.sid_trans[gid] = source.get_handle()
|
self.sid_trans[gid] = source.get_handle()
|
||||||
|
@ -117,8 +117,10 @@ def family_name(family,db):
|
|||||||
"mother" : mname}
|
"mother" : mname}
|
||||||
elif father:
|
elif father:
|
||||||
name = NameDisplay.displayer.display(father)
|
name = NameDisplay.displayer.display(father)
|
||||||
else:
|
elif mother:
|
||||||
name = NameDisplay.displayer.display(mother)
|
name = NameDisplay.displayer.display(mother)
|
||||||
|
else:
|
||||||
|
name = _("unknown")
|
||||||
return name
|
return name
|
||||||
|
|
||||||
def family_upper_name(family,db):
|
def family_upper_name(family,db):
|
||||||
|
Loading…
Reference in New Issue
Block a user