diff --git a/gramps/gen/proxy/living.py b/gramps/gen/proxy/living.py index fa17a7513..e53f615a9 100644 --- a/gramps/gen/proxy/living.py +++ b/gramps/gen/proxy/living.py @@ -41,7 +41,8 @@ else: # #------------------------------------------------------------------------- from .proxybase import ProxyDbBase -from ..lib import Date, Person, Name, Surname, NameOriginType +from ..lib import (Date, Person, Name, Surname, NameOriginType, Family, Source, + Citation, Event, MediaObject, Place, Repository, Note, Tag) from ..utils.alive import probably_alive from ..config import config @@ -89,6 +90,87 @@ class LivingProxyDb(ProxyDbBase): else: self.current_date = None self.years_after_death = years_after_death + # need to update _tables with these functions + self._tables['Person'].update( + { + "handle_func": self.get_person_from_handle, + "gramps_id_func": self.get_person_from_gramps_id, + "class_func": Person, + "cursor_func": self.get_person_cursor, + "handles_func": self.get_person_handles, + }) + self._tables['Family'].update( + { + "handle_func": self.get_family_from_handle, + "gramps_id_func": self.get_family_from_gramps_id, + "class_func": Family, + "cursor_func": self.get_family_cursor, + "handles_func": self.get_family_handles, + }) + self._tables['Source'].update( + { + "handle_func": self.get_source_from_handle, + "gramps_id_func": self.get_source_from_gramps_id, + "class_func": Source, + "cursor_func": self.get_source_cursor, + "handles_func": self.get_source_handles, + }) + self._tables['Citation'].update( + { + "handle_func": self.get_citation_from_handle, + "gramps_id_func": self.get_citation_from_gramps_id, + "class_func": Citation, + "cursor_func": self.get_citation_cursor, + "handles_func": self.get_citation_handles, + }) + self._tables['Event'].update( + { + "handle_func": self.get_event_from_handle, + "gramps_id_func": self.get_event_from_gramps_id, + "class_func": Event, + "cursor_func": self.get_event_cursor, + "handles_func": self.get_event_handles, + }) + self._tables['Media'].update( + { + "handle_func": self.get_object_from_handle, + "gramps_id_func": self.get_object_from_gramps_id, + "class_func": MediaObject, + "cursor_func": self.get_media_cursor, + "handles_func": self.get_media_object_handles, + }) + self._tables['Place'].update( + { + "handle_func": self.get_place_from_handle, + "gramps_id_func": self.get_place_from_gramps_id, + "class_func": Place, + "cursor_func": self.get_place_cursor, + "handles_func": self.get_place_handles, + }) + self._tables['Repository'].update( + { + "handle_func": self.get_repository_from_handle, + "gramps_id_func": self.get_repository_from_gramps_id, + "class_func": Repository, + "cursor_func": self.get_repository_cursor, + "handles_func": self.get_repository_handles, + }) + self._tables['Note'].update( + { + "handle_func": self.get_note_from_handle, + "gramps_id_func": self.get_note_from_gramps_id, + "class_func": Note, + "cursor_func": self.get_note_cursor, + "handles_func": self.get_note_handles, + }) + self._tables['Tag'].update( + { + "handle_func": self.get_tag_from_handle, + "gramps_id_func": None, + "class_func": Tag, + "cursor_func": self.get_tag_cursor, + "handles_func": self.get_tag_handles, + }) def get_person_from_handle(self, handle): """ @@ -297,3 +379,4 @@ class LivingProxyDb(ProxyDbBase): new_person.set_tag_list(person.get_tag_list()) return new_person + diff --git a/gramps/gen/proxy/private.py b/gramps/gen/proxy/private.py index 421b52430..1a65ed732 100644 --- a/gramps/gen/proxy/private.py +++ b/gramps/gen/proxy/private.py @@ -44,7 +44,7 @@ LOG = logging.getLogger(".citation") from ..lib import (MediaRef, Attribute, Address, EventRef, Person, Name, Source, RepoRef, MediaObject, Place, Event, Family, ChildRef, Repository, LdsOrd, Surname, Citation, - SrcAttribute) + SrcAttribute, Note, Tag) from .proxybase import ProxyDbBase class PrivateProxyDb(ProxyDbBase): @@ -58,6 +58,86 @@ class PrivateProxyDb(ProxyDbBase): Create a new PrivateProxyDb instance. """ ProxyDbBase.__init__(self, db) + self._tables['Person'].update( + { + "handle_func": self.get_person_from_handle, + "gramps_id_func": self.get_person_from_gramps_id, + "class_func": Person, + "cursor_func": self.get_person_cursor, + "handles_func": self.get_person_handles, + }) + self._tables['Family'].update( + { + "handle_func": self.get_family_from_handle, + "gramps_id_func": self.get_family_from_gramps_id, + "class_func": Family, + "cursor_func": self.get_family_cursor, + "handles_func": self.get_family_handles, + }) + self._tables['Source'].update( + { + "handle_func": self.get_source_from_handle, + "gramps_id_func": self.get_source_from_gramps_id, + "class_func": Source, + "cursor_func": self.get_source_cursor, + "handles_func": self.get_source_handles, + }) + self._tables['Citation'].update( + { + "handle_func": self.get_citation_from_handle, + "gramps_id_func": self.get_citation_from_gramps_id, + "class_func": Citation, + "cursor_func": self.get_citation_cursor, + "handles_func": self.get_citation_handles, + }) + self._tables['Event'].update( + { + "handle_func": self.get_event_from_handle, + "gramps_id_func": self.get_event_from_gramps_id, + "class_func": Event, + "cursor_func": self.get_event_cursor, + "handles_func": self.get_event_handles, + }) + self._tables['Media'].update( + { + "handle_func": self.get_object_from_handle, + "gramps_id_func": self.get_object_from_gramps_id, + "class_func": MediaObject, + "cursor_func": self.get_media_cursor, + "handles_func": self.get_media_object_handles, + }) + self._tables['Place'].update( + { + "handle_func": self.get_place_from_handle, + "gramps_id_func": self.get_place_from_gramps_id, + "class_func": Place, + "cursor_func": self.get_place_cursor, + "handles_func": self.get_place_handles, + }) + self._tables['Repository'].update( + { + "handle_func": self.get_repository_from_handle, + "gramps_id_func": self.get_repository_from_gramps_id, + "class_func": Repository, + "cursor_func": self.get_repository_cursor, + "handles_func": self.get_repository_handles, + }) + self._tables['Note'].update( + { + "handle_func": self.get_note_from_handle, + "gramps_id_func": self.get_note_from_gramps_id, + "class_func": Note, + "cursor_func": self.get_note_cursor, + "handles_func": self.get_note_handles, + }) + self._tables['Tag'].update( + { + "handle_func": self.get_tag_from_handle, + "gramps_id_func": None, + "class_func": Tag, + "cursor_func": self.get_tag_cursor, + "handles_func": self.get_tag_handles, + }) def get_person_from_handle(self, handle): """ diff --git a/gramps/gen/proxy/proxybase.py b/gramps/gen/proxy/proxybase.py index 9e4696e9d..26d4876af 100644 --- a/gramps/gen/proxy/proxybase.py +++ b/gramps/gen/proxy/proxybase.py @@ -967,3 +967,4 @@ class ProxyDbBase(DbReadBase): Return the database ID. """ return self.basedb.get_dbid() + diff --git a/gramps/gen/proxy/referencedbyselection.py b/gramps/gen/proxy/referencedbyselection.py index 8d9be36aa..d940ff7ed 100644 --- a/gramps/gen/proxy/referencedbyselection.py +++ b/gramps/gen/proxy/referencedbyselection.py @@ -82,6 +82,87 @@ class ReferencedBySelectionProxyDb(ProxyDbBase): while len(self.queue): obj_type, handle, reference = self.queue.pop() self.process_object(obj_type, handle, reference) + # need to update _tables with these functions + self._tables['Person'].update( + { + "handle_func": self.get_person_from_handle, + "gramps_id_func": self.get_person_from_gramps_id, + "class_func": Person, + "cursor_func": self.get_person_cursor, + "handles_func": self.get_person_handles, + }) + self._tables['Family'].update( + { + "handle_func": self.get_family_from_handle, + "gramps_id_func": self.get_family_from_gramps_id, + "class_func": Family, + "cursor_func": self.get_family_cursor, + "handles_func": self.get_family_handles, + }) + self._tables['Source'].update( + { + "handle_func": self.get_source_from_handle, + "gramps_id_func": self.get_source_from_gramps_id, + "class_func": Source, + "cursor_func": self.get_source_cursor, + "handles_func": self.get_source_handles, + }) + self._tables['Citation'].update( + { + "handle_func": self.get_citation_from_handle, + "gramps_id_func": self.get_citation_from_gramps_id, + "class_func": Citation, + "cursor_func": self.get_citation_cursor, + "handles_func": self.get_citation_handles, + }) + self._tables['Event'].update( + { + "handle_func": self.get_event_from_handle, + "gramps_id_func": self.get_event_from_gramps_id, + "class_func": Event, + "cursor_func": self.get_event_cursor, + "handles_func": self.get_event_handles, + }) + self._tables['Media'].update( + { + "handle_func": self.get_object_from_handle, + "gramps_id_func": self.get_object_from_gramps_id, + "class_func": MediaObject, + "cursor_func": self.get_media_cursor, + "handles_func": self.get_media_object_handles, + }) + self._tables['Place'].update( + { + "handle_func": self.get_place_from_handle, + "gramps_id_func": self.get_place_from_gramps_id, + "class_func": Place, + "cursor_func": self.get_place_cursor, + "handles_func": self.get_place_handles, + }) + self._tables['Repository'].update( + { + "handle_func": self.get_repository_from_handle, + "gramps_id_func": self.get_repository_from_gramps_id, + "class_func": Repository, + "cursor_func": self.get_repository_cursor, + "handles_func": self.get_repository_handles, + }) + self._tables['Note'].update( + { + "handle_func": self.get_note_from_handle, + "gramps_id_func": self.get_note_from_gramps_id, + "class_func": Note, + "cursor_func": self.get_note_cursor, + "handles_func": self.get_note_handles, + }) + self._tables['Tag'].update( + { + "handle_func": self.get_tag_from_handle, + "gramps_id_func": None, + "class_func": Tag, + "cursor_func": self.get_tag_cursor, + "handles_func": self.get_tag_handles, + }) def queue_object(self, obj_type, handle, reference=True): self.queue.append((obj_type, handle, reference))