* src/AddMedia.py: media reference fixes

* src/MediaView.py: media reference fixes
* src/FamilyView.py: commit child changes
* src/PlaceView.py: ID fixes


svn: r2917
This commit is contained in:
Don Allingham 2004-02-27 04:07:23 +00:00
parent 0234523e08
commit 75a1c4d3e6
4 changed files with 33 additions and 14 deletions

View File

@ -135,7 +135,7 @@ class AddMediaObject:
if self.update: if self.update:
self.update() self.update()
self.object = mobj self.object = mobj
self.db.commit_media_object(self.object) self.db.commit_media_object(mobj)
def on_name_changed(self,obj): def on_name_changed(self,obj):
""" """

View File

@ -686,12 +686,14 @@ class FamilyView:
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())
if self.person.get_gender() == RelLib.Person.male: if self.person.get_gender() == RelLib.Person.male:
self.family.set_father_id(self.person) self.family.set_father_id(self.person.get_id())
else: else:
self.family.set_mother_id(self.person) self.family.set_mother_id(self.person.get_id())
self.family.add_child_id(epo.person) self.family.add_child_id(epo.person.get_id())
epo.person.add_parent_family_id(self.family.get_id(),"Birth","Birth") epo.person.add_parent_family_id(self.family.get_id(),"Birth","Birth")
self.parent.db.commit_person(epo.person)
self.parent.db.commit_family(self.family)
self.display_marriage(self.family) self.display_marriage(self.family)
def select_child_clicked(self,obj): def select_child_clicked(self,obj):
@ -715,7 +717,7 @@ class FamilyView:
id = self.child_model.get_value(iter,2) id = self.child_model.get_value(iter,2)
child = self.parent.db.get_person(id) child = self.parent.db.get_person(id)
self.family.remove_child_id(child) self.family.remove_child_id(child.get_id())
child.remove_parent_family_id(self.family) child.remove_parent_family_id(self.family)
if len(self.family.get_child_id_list()) == 0: if len(self.family.get_child_id_list()) == 0:
@ -995,8 +997,15 @@ class FamilyView:
fiter = self.child_model.get_path(iter) fiter = self.child_model.get_path(iter)
val = self.parent.db.get_person_display(child.get_id()) val = self.parent.db.get_person_display(child.get_id())
i += 1 i += 1
event = self.parent.db.find_event_from_id(val[3])
if event:
dval = event.get_date()
else:
dval = u''
self.child_model.set(iter,0,i,1,val[0],2,val[1],3,val[2], self.child_model.set(iter,0,i,1,val[0],2,val[1],3,val[2],
4,val[3],5,status,6,val[6]) 4,dval,5,status,6,val[6])
def build_parents_menu(self,family,event): def build_parents_menu(self,family,event):
"""Builds the menu that allows editing operations on the child list""" """Builds the menu that allows editing operations on the child list"""

View File

@ -200,9 +200,10 @@ class MediaView:
id = store.get_value(iter,1) id = store.get_value(iter,1)
object = self.db.find_object_from_id(id) object = self.db.find_object_from_id(id)
self.obj = object self.obj = object
Utils.add_menuitem(menu,_("View in the default viewer"),None,self.popup_view_photo) Utils.add_menuitem(menu,_("View in the default viewer"),None,
self.popup_view_photo)
if object.get_mime_type()[0:5] == "image": if object.get_mime_type()[0:5] == "image":
Utils.add_menuitem(menu,_("Edit with the GIMP"),\ Utils.add_menuitem(menu,_("Edit with the GIMP"),
None,self.popup_edit_photo) None,self.popup_edit_photo)
if object.get_local() == 0: if object.get_local() == 0:
Utils.add_menuitem(menu,_("Convert to local copy"),None, Utils.add_menuitem(menu,_("Convert to local copy"),None,
@ -268,7 +269,6 @@ class MediaView:
self.id2col[id] = iter self.id2col[id] = iter
self.model.set(iter, 0, title, 1, id, 2, type, 3, path, 4, stitle) self.model.set(iter, 0, title, 1, id, 2, type, 3, path, 4, stitle)
def on_add_clicked(self,obj): def on_add_clicked(self,obj):
"""Add a new media object to the media list""" """Add a new media object to the media list"""
import AddMedia import AddMedia
@ -290,7 +290,7 @@ class MediaView:
return return
id = store.get_value(iter,1) id = store.get_value(iter,1)
mobj = self.db.get_object(id) mobj = self.db.find_object_from_id(id)
if self.is_object_used(mobj): if self.is_object_used(mobj):
ans = ImageSelect.DeleteMediaQuery(mobj,self.db,self.update) ans = ImageSelect.DeleteMediaQuery(mobj,self.db,self.update)
QuestionDialog(_('Delete Media Object?'), QuestionDialog(_('Delete Media Object?'),
@ -306,7 +306,8 @@ class MediaView:
self.update(0) self.update(0)
def is_object_used(self,mobj): def is_object_used(self,mobj):
for p in self.db.get_family_id_map().values(): for family_id in self.db.get_family_keys():
p = self.db.find_family_from_id(family_id)
for o in p.get_media_list(): for o in p.get_media_list():
if o.get_reference_id() == mobj.get_id(): if o.get_reference_id() == mobj.get_id():
return 1 return 1

View File

@ -225,7 +225,11 @@ class PlaceView:
used = 0 used = 0
for key in self.db.get_person_keys(): for key in self.db.get_person_keys():
p = self.db.get_person(key) p = self.db.get_person(key)
event_list = [p.get_birth(), p.get_death()] + p.get_event_list()[:] event_list = []
for e in [p.get_birth_id(),p.get_death_id()] + p.get_event_list():
event = self.db.find_event_from_id(e)
if event:
event_list.append(event)
if p.get_lds_baptism(): if p.get_lds_baptism():
event_list.append(p.get_lds_baptism()) event_list.append(p.get_lds_baptism())
if p.get_lds_endowment(): if p.get_lds_endowment():
@ -236,8 +240,13 @@ class PlaceView:
if event.get_place_id() == place: if event.get_place_id() == place:
used = 1 used = 1
for f in self.db.get_family_id_map().values(): for fid in self.db.get_family_keys():
event_list = f.get_event_list()[:] f = self.db.find_family_from_id(fid)
event_list = []
for e in f.get_event_list():
event = self.db.find_event_from_id(e)
if event:
event_list.append(event)
if f.get_lds_sealing(): if f.get_lds_sealing():
event_list.append(f.get_lds_sealing()) event_list.append(f.get_lds_sealing())
for event in event_list: for event in event_list: