* src/plugins/WriteCD.py (PackageWriter.on_ok_clicked):

Convert missing media handling to the database interface.


svn: r3228
This commit is contained in:
Alex Roitman 2004-06-22 21:02:05 +00:00
parent 12d6398750
commit 0f6a7c7a7f
3 changed files with 20 additions and 9 deletions

View File

@ -11,6 +11,8 @@
* src/RelLib.py (get_event_keys): Add method to GrampsDB class.
* src/plugins/WritePkg.py (PackageWriter.export):
Convert missing media handling to the database interface.
* src/plugins/WriteCD.py (PackageWriter.on_ok_clicked):
Convert missing media handling to the database interface.
2004-06-21 Alex Roitman <shura@alex.neuro.umn.edu>
* src/data/gramps.keys, src/data/mime: Add package and GEDCOM.

View File

@ -200,37 +200,48 @@ class PackageWriter:
#--------------------------------------------------------
def remove_clicked():
# File is lost => remove all references and the object itself
mobj = self.db.get_object(self.object_id)
for p_id in self.db.get_family_keys:
for p_id in self.db.get_family_keys():
p = self.db.find_family_from_id(p_id)
nl = p.get_media_list()
for o in nl:
if o.get_reference() == mobj:
if o.get_reference_id() == self.object_id:
nl.remove(o)
p.set_media_list(nl)
self.db.commit_family(p,None)
for key in self.db.get_person_keys():
p = self.db.try_to_find_person_from_id(key)
nl = p.get_media_list()
for o in nl:
if o.get_reference() == mobj:
if o.get_reference_id() == self.object_id:
nl.remove(o)
p.set_media_list(nl)
self.db.commit_person(p,None)
for key in self.db.get_source_keys():
p = self.db.try_to_find_source_from_id(key)
nl = p.get_media_list()
for o in nl:
if o.get_reference() == mobj:
if o.get_reference_id() == self.object_id:
nl.remove(o)
p.set_media_list(nl)
self.db.commit_source(p,None)
for key in self.db.get_place_id_keys():
p = self.db.try_to_find_place_from_id(key)
nl = p.get_media_list()
for o in nl:
if o.get_reference() == mobj:
if o.get_reference_id() == self.object_id:
nl.remove(o)
p.set_media_list(nl)
self.db.remove_object(self.object_id)
self.db.commit_place(p,None)
for key in self.db.get_event_keys():
p = self.db.find_event_from_id(key)
nl = p.get_media_list()
for o in nl:
if o.get_reference_id() == self.object_id:
nl.remove(o)
p.set_media_list(nl)
self.db.commit_event(p,None)
self.db.remove_object(self.object_id,None)
def leave_clicked():
# File is lost => do nothing, leave as is

View File

@ -109,7 +109,6 @@ class PackageWriter:
#--------------------------------------------------------------
def remove_clicked():
# File is lost => remove all references and the object itself
mobj = self.db.try_to_find_object_from_id(m_id)
for p_id in self.db.get_family_keys():
p = self.db.find_family_from_id(p_id)
nl = p.get_media_list()
@ -124,7 +123,6 @@ class PackageWriter:
for o in nl:
if o.get_reference_id() == m_id:
nl.remove(o)
print key
p.set_media_list(nl)
self.db.commit_person(p,None)
for key in self.db.get_source_keys():