diff --git a/gramps2/ChangeLog b/gramps2/ChangeLog index caabefdc2..496b01d6a 100644 --- a/gramps2/ChangeLog +++ b/gramps2/ChangeLog @@ -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 * src/data/gramps.keys, src/data/mime: Add package and GEDCOM. diff --git a/gramps2/src/plugins/WriteCD.py b/gramps2/src/plugins/WriteCD.py index f2f29d36d..9b4b51a3b 100644 --- a/gramps2/src/plugins/WriteCD.py +++ b/gramps2/src/plugins/WriteCD.py @@ -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 diff --git a/gramps2/src/plugins/WritePkg.py b/gramps2/src/plugins/WritePkg.py index 1c973e7ea..6d7a6578d 100644 --- a/gramps2/src/plugins/WritePkg.py +++ b/gramps2/src/plugins/WritePkg.py @@ -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():