From 0f6a7c7a7f0b8da4b195e131bc45966c67126d87 Mon Sep 17 00:00:00 2001 From: Alex Roitman Date: Tue, 22 Jun 2004 21:02:05 +0000 Subject: [PATCH] * src/plugins/WriteCD.py (PackageWriter.on_ok_clicked): Convert missing media handling to the database interface. svn: r3228 --- ChangeLog | 2 ++ src/plugins/WriteCD.py | 25 ++++++++++++++++++------- src/plugins/WritePkg.py | 2 -- 3 files changed, 20 insertions(+), 9 deletions(-) diff --git a/ChangeLog b/ChangeLog index caabefdc2..496b01d6a 100644 --- a/ChangeLog +++ b/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/src/plugins/WriteCD.py b/src/plugins/WriteCD.py index f2f29d36d..9b4b51a3b 100644 --- a/src/plugins/WriteCD.py +++ b/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/src/plugins/WritePkg.py b/src/plugins/WritePkg.py index 1c973e7ea..6d7a6578d 100644 --- a/src/plugins/WritePkg.py +++ b/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():