svn: r2915
This commit is contained in:
Don Allingham 2004-02-26 04:51:57 +00:00
parent 068ff60c2b
commit ed8e38fe4b
7 changed files with 116 additions and 34 deletions

View File

@ -1,3 +1,16 @@
2004-02-24 Don Allingham <dallingham@users.sourceforge.net>
* src/plugins/WebPage.py: media reference fixes
* src/plugins/ReadGedcom.py: media reference fixes
* src/plugins/IndivSummary.py: media reference fixes
* src/plugins/IndivComplete.py: media reference fixes
* src/plugins/DetAncestralReport.py: media reference fixes
* src/plugins/DetDescendantReport.py: media reference fixes
* src/plugins/Check.py: media reference fixes
* src/gramps_main.py: media reference fixes
* src/Utils.py: gnome.vfs vs. grampslib
* src/RelLib.py: single db file, media reference fixes
* src/MediaView.py: media reference fixes
2004-02-24 Alex Roitman <shura@alex.neuro.umn.edu> 2004-02-24 Alex Roitman <shura@alex.neuro.umn.edu>
* src/RelLib.py (sortbysource): Low-level implementation; * src/RelLib.py (sortbysource): Low-level implementation;
(sortbyplace): Typo. (sortbyplace): Typo.

View File

@ -53,6 +53,7 @@ import const
import Utils import Utils
import GrampsCfg import GrampsCfg
import ListModel import ListModel
import Date
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
# #
@ -195,7 +196,9 @@ class AddSpouse:
if not self.active_family: if not self.active_family:
self.active_family = self.db.new_family() self.active_family = self.db.new_family()
self.person.add_family_id(self.active_family.get_id()) self.person.add_family_id(self.active_family.get_id())
self.db.commit_person(self.person)
spouse.add_family_id(self.active_family.get_id()) spouse.add_family_id(self.active_family.get_id())
self.db.commit_person(spouse)
if self.person.get_gender() == RelLib.Person.male: if self.person.get_gender() == RelLib.Person.male:
self.active_family.set_mother_id(spouse.get_id()) self.active_family.set_mother_id(spouse.get_id())
@ -205,6 +208,7 @@ class AddSpouse:
self.active_family.set_mother_id(self.person.get_id()) self.active_family.set_mother_id(self.person.get_id())
self.active_family.set_relationship(const.save_frel(unicode(self.relation_type.get_text()))) self.active_family.set_relationship(const.save_frel(unicode(self.relation_type.get_text())))
self.db.commit_family(self.active_family)
Utils.destroy_passed_object(obj) Utils.destroy_passed_object(obj)
self.update(self.active_family) self.update(self.active_family)
@ -224,8 +228,21 @@ class AddSpouse:
# the potential spouse list. If Partners is selected, use # the potential spouse list. If Partners is selected, use
# the same gender as the current person. # the same gender as the current person.
gender = self.person.get_gender() gender = self.person.get_gender()
bday = self.person.get_birth().get_date_object()
dday = self.person.get_death().get_date_object() birth_id = self.person.get_birth_id()
death_id = self.person.get_death_id()
bday = self.db.find_event_from_id(birth_id)
dday = self.db.find_event_from_id(death_id)
if birth_id:
bday = self.db.find_event_from_id(birth_id).get_date_object()
else:
bday = Date.Date()
if death_id:
dday = self.db.find_event_from_id(death_id).get_date_object()
else:
dday = Date.Date()
if text == _("Partners"): if text == _("Partners"):
if gender == RelLib.Person.male: if gender == RelLib.Person.male:
@ -247,9 +264,18 @@ class AddSpouse:
continue continue
if not self.showall.get_active(): if not self.showall.get_active():
pdday = self.db.get_person(key).get_death().get_date_object() pd_id = self.db.get_person(key).get_death_id()
pbday = self.db.get_person(key).get_birth().get_date_object() pb_id = self.db.get_person(key).get_birth_id()
if pd_id:
pdday = self.db.find_event_from_id(pd_id).get_date_object()
else:
pdday = Date.Date()
if pb_id:
pbday = self.db.find_event_from_id(pb_id).get_date_object()
else:
pbday = Date.Date()
if bday.getYearValid(): if bday.getYearValid():
if pbday.getYearValid(): if pbday.getYearValid():
# reject if person birthdate differs more than # reject if person birthdate differs more than

View File

@ -48,6 +48,7 @@ import gnome
# gramps modules # gramps modules
# #
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
import Date
import RelLib import RelLib
import const import const
import Utils import Utils
@ -305,12 +306,12 @@ class ChooseParents:
if birth_event: if birth_event:
bday = birth_event.get_date_object() bday = birth_event.get_date_object()
else: else:
bday = None bday = Date.Date()
death_event = self.db.find_event_from_id(self.person.get_death_id()) death_event = self.db.find_event_from_id(self.person.get_death_id())
if death_event: if death_event:
dday = death_event.get_date_object() dday = death_event.get_date_object()
else: else:
dday = None dday = Date.Date()
person_list = [] person_list = []
for key in self.db.sort_person_keys(): for key in self.db.sort_person_keys():
@ -329,13 +330,13 @@ class ChooseParents:
if birth_event: if birth_event:
pbday = birth_event.get_date_object() pbday = birth_event.get_date_object()
else: else:
pbday = None pbday = Date.Date()
death_event = self.db.find_event_from_id(person.get_death_id()) death_event = self.db.find_event_from_id(person.get_death_id())
if death_event: if death_event:
pdday = death_event.get_date_object() pdday = death_event.get_date_object()
else: else:
pdday = None pdday = Date.Date()
if bday and bday.getYearValid(): if bday and bday.getYearValid():
if pbday and pbday.getYearValid(): if pbday and pbday.getYearValid():
@ -401,8 +402,8 @@ class ChooseParents:
if not father_id and not mother_id: if not father_id and not mother_id:
return None return None
families = self.db.get_family_id_map().values() for family_id in self.db.get_family_keys():
for family in families: family = self.db.find_family_from_id(family_id)
if family.get_father_id() == father_id and family.get_mother_id() == mother_id: if family.get_father_id() == father_id and family.get_mother_id() == mother_id:
return family return family
elif family.get_father_id() == mother_id and family.get_mother_id() == father_id: elif family.get_father_id() == mother_id and family.get_mother_id() == father_id:
@ -416,10 +417,13 @@ class ChooseParents:
if father_id: if father_id:
father = self.db.find_person_from_id(father_id) father = self.db.find_person_from_id(father_id)
father.add_family_id(family.get_id()) father.add_family_id(family.get_id())
if mother: self.db.commit_person(father)
if mother_id:
mother = self.db.find_person_from_id(mother_id) mother = self.db.find_person_from_id(mother_id)
mother.add_family_id(family.get_id()) mother.add_family_id(family.get_id())
self.db.commit_person(mother)
self.db.commit_family(family)
return family return family
def mother_list_select_row(self,obj): def mother_list_select_row(self,obj):

View File

@ -531,12 +531,14 @@ class FamilyView:
def set_preferred_spouse(self,obj): def set_preferred_spouse(self,obj):
if self.selected_spouse: if self.selected_spouse:
self.person.set_preferred_family_id(self.family) self.person.set_preferred_family_id(self.family)
self.parent.db.commit_person(self.person)
self.load_family() self.load_family()
def edit_spouse_callback(self,obj): def edit_spouse_callback(self,obj):
if self.selected_spouse: if self.selected_spouse:
try: try:
EditPerson.EditPerson(self.parent, self.selected_spouse, self.parent.db, self.spouse_after_edit) EditPerson.EditPerson(self.parent, self.selected_spouse,
self.parent.db, self.spouse_after_edit)
except: except:
DisplayTrace.DisplayTrace() DisplayTrace.DisplayTrace()
@ -588,7 +590,8 @@ class FamilyView:
else: else:
person.set_gender(RelLib.Person.male) person.set_gender(RelLib.Person.male)
try: try:
EditPerson.EditPerson(self.parent, person, self.parent.db, self.new_spouse_after_edit) EditPerson.EditPerson(self.parent, person, self.parent.db,
self.new_spouse_after_edit)
except: except:
DisplayTrace.DisplayTrace() DisplayTrace.DisplayTrace()
@ -596,6 +599,7 @@ class FamilyView:
ap = self.parent.active_person ap = self.parent.active_person
if epo: if epo:
self.parent.db.build_person_display(epo.person.get_id(),epo.original_id) self.parent.db.build_person_display(epo.person.get_id(),epo.original_id)
self.parent.db.commit_person(epo.person)
self.parent.people_view.remove_from_person_list(epo.person,epo.original_id) self.parent.people_view.remove_from_person_list(epo.person,epo.original_id)
self.parent.people_view.redisplay_person_list(epo.person) self.parent.people_view.redisplay_person_list(epo.person)
@ -609,20 +613,22 @@ class FamilyView:
else: else:
self.parent.db.add_person_no_map(epo.person,epo.person.get_id()) self.parent.db.add_person_no_map(epo.person,epo.person.get_id())
self.parent.db.build_person_display(epo.person.get_id())
self.parent.people_view.add_to_person_list(epo.person,0) self.parent.people_view.add_to_person_list(epo.person,0)
self.family = self.parent.db.new_family() self.family = self.parent.db.new_family()
self.person.add_family_id(self.family.get_id()) self.person.add_family_id(self.family.get_id())
epo.person.add_family_id(self.family.get_id()) epo.person.add_family_id(self.family.get_id())
self.parent.db.commit_person(epo.person)
self.parent.db.commit_person(self.person)
if self.person.get_gender() == RelLib.Person.male: if self.person.get_gender() == RelLib.Person.male:
self.family.set_mother_id(epo.person.get_id()) self.family.set_mother_id(epo.person.get_id())
self.family.set_father_id(self.person.get_id()) self.family.set_father_id(self.person.get_id())
else: else:
self.family.set_father_id(epo.person.get_id()) self.family.set_father_id(epo.person.get_id())
self.family.set_mother_id(self.person.get_id()) self.family.set_mother_id(self.person.get_id())
self.parent.db.commit_family(self.family)
self.load_family(self.family) self.load_family(self.family)
Marriage.Marriage(self.parent,self.family,self.parent.db, Marriage.Marriage(self.parent,self.family,self.parent.db,
@ -718,6 +724,8 @@ class FamilyView:
elif self.family.get_mother_id() == None: elif self.family.get_mother_id() == None:
self.delete_family_from(self.family.get_father_id()) self.delete_family_from(self.family.get_father_id())
self.parent.db.commit_person(child)
self.parent.db.commit_family(self.family)
Utils.modified() Utils.modified()
self.load_family() self.load_family()
@ -738,23 +746,29 @@ class FamilyView:
"""Delete the currently selected spouse from the family""" """Delete the currently selected spouse from the family"""
if self.person == None: if self.person == None:
return return
if self.selected_spouse == self.family.get_father_id():
if self.selected_spouse.get_id() == self.family.get_father_id():
self.family.set_father_id(None) self.family.set_father_id(None)
else: else:
self.family.set_mother_id(None) self.family.set_mother_id(None)
if self.selected_spouse: if self.selected_spouse:
self.selected_spouse.remove_family_id(self.family.get_id()) self.selected_spouse.remove_family_id(self.family.get_id())
self.parent.db.commit_person(self.selected_spouse)
self.parent.db.commit_family(self.family)
if len(self.family.get_child_id_list()) == 0: if len(self.family.get_child_id_list()) == 0:
self.person.remove_family_id(self.family.get_id()) self.person.remove_family_id(self.family.get_id())
self.parent.db.commit_person(self.person)
self.parent.db.delete_family(self.family.get_id()) self.parent.db.delete_family(self.family.get_id())
if len(self.person.get_family_id_list()) > 0: if len(self.person.get_family_id_list()) > 0:
self.load_family(self.person.get_family_id_list()[0]) family_id = self.person.get_family_id_list()[0]
self.load_family(self.parent.db.find_family_from_id(family_id))
else: else:
self.load_family() self.load_family(self.family)
else: else:
self.load_family() self.load_family(self.family)
if len(self.person.get_family_id_list()) <= 1: if len(self.person.get_family_id_list()) <= 1:
self.spouse_selection.set_mode(gtk.SELECTION_NONE) self.spouse_selection.set_mode(gtk.SELECTION_NONE)
@ -793,6 +807,8 @@ class FamilyView:
person_id = family.get_mother_id() person_id = family.get_mother_id()
person = self.parent.db.find_person_from_id(person_id) person = self.parent.db.find_person_from_id(person_id)
self.parent.change_active_person(person) self.parent.change_active_person(person)
self.parent.db.commit_family(family)
self.load_family(family) self.load_family(family)
def clear(self): def clear(self):
@ -849,12 +865,12 @@ class FamilyView:
sp_id = fm.get_mother_id() sp_id = fm.get_mother_id()
else: else:
sp_id = fm.get_father_id() sp_id = fm.get_father_id()
sp = self.parent.db.find_person_from_id(sp_id)
iter = self.spouse_model.append() iter = self.spouse_model.append()
flist[f] = iter flist[f] = iter
if sp: if sp_id:
sp = self.parent.db.find_person_from_id(sp_id)
event = self.find_marriage(fm) event = self.find_marriage(fm)
if event: if event:
mdate = " - %s" % event.get_date() mdate = " - %s" % event.get_date()
@ -939,9 +955,17 @@ class FamilyView:
return return
if family.get_father_id() == self.person.get_id(): if family.get_father_id() == self.person.get_id():
self.selected_spouse = self.parent.db.find_person_from_id(family.get_mother_id()) sp_id = family.get_mother_id()
if sp_id:
self.selected_spouse = self.parent.db.find_person_from_id(sp_id)
else:
self.selected_spouse = None
else: else:
self.selected_spouse = self.parent.db.find_person_from_id(family.get_father_id()) sp_id = family.get_father_id()
if sp_id:
self.selected_spouse = self.parent.db.find_person_from_id(sp_id)
else:
self.selected_spouse = None
if self.selected_spouse: if self.selected_spouse:
self.update_list(self.sp_parents_model,self.sp_parents, self.update_list(self.sp_parents_model,self.sp_parents,
@ -1197,6 +1221,8 @@ class FamilyView:
row = model.get_path(iter) row = model.get_path(iter)
fam = person.get_parent_family_id_list()[row[0]] fam = person.get_parent_family_id_list()[row[0]]
person.remove_parent_family_id(fam[0]) person.remove_parent_family_id(fam[0])
self.parent.db.commit_person(person)
Utils.modified() Utils.modified()
self.load_family() self.load_family()

View File

@ -128,8 +128,18 @@ class Marriage:
}) })
father = self.db.find_person_from_id(family.get_father_id()) fid = family.get_father_id()
mother = self.db.find_person_from_id(family.get_mother_id()) mid = family.get_mother_id()
if fid:
father = self.db.find_person_from_id(family.get_father_id())
else:
father = None
if mid:
mother = self.db.find_person_from_id(family.get_mother_id())
else:
mother = None
self.title = _("%s and %s") % (GrampsCfg.nameof(father), self.title = _("%s and %s") % (GrampsCfg.nameof(father),
GrampsCfg.nameof(mother)) GrampsCfg.nameof(mother))

View File

@ -194,7 +194,7 @@ class PeopleView:
def add_to_person_list(self,person,change): def add_to_person_list(self,person,change):
key = person.get_id() key = person.get_id()
val = self.parent.db.get_person_display(person.get_id()) val = self.parent.db.get_person_display(key)
pg = unicode(val[5]) pg = unicode(val[5])
pg = pg[0] pg = pg[0]
model = None model = None
@ -224,7 +224,12 @@ class PeopleView:
if change: if change:
self.parent.change_active_person(person) self.parent.change_active_person(person)
self.goto_active_person()
try:
self.goto_active_person()
except:
print "goto failed"
if model: if model:
model.enable_sort() model.enable_sort()
@ -242,10 +247,10 @@ class PeopleView:
return return
id = self.parent.active_person.get_id() id = self.parent.active_person.get_id()
val = self.parent.db.get_person_display(id)
if self.id2col.has_key(id): if self.id2col.has_key(id):
(model,iter) = self.id2col[id] (model,iter) = self.id2col[id]
else: else:
val = self.parent.db.get_person_display(id)
pg = val[5] pg = val[5]
if pg and pg != '@': if pg and pg != '@':
pg = pg[0] pg = pg[0]
@ -268,10 +273,10 @@ class PeopleView:
if not iter: if not iter:
self.parent.status_text(_('Updating display...')) self.parent.status_text(_('Updating display...'))
model.expand_row(val[-1]) model.fill_row(val[-1])
(m,iter) = self.id2col[id] (m,iter) = self.id2col[id]
self.parent.modify_statusbar() self.parent.modify_statusbar()
try: try:
model.selection.unselect_all() model.selection.unselect_all()
model.selection.select_iter(iter) model.selection.select_iter(iter)

View File

@ -2385,8 +2385,6 @@ class GrampsDB:
def build_person_display(self,nkey,okey=None): def build_person_display(self,nkey,okey=None):
pass pass
# name = self.person_map.get(str(nkey))[2]
# self.add_surname(name.get_surname())
def rebuild_person_table(self): def rebuild_person_table(self):
pass pass