From f26c9f70559f5a81a7b749d054b6400323fff162 Mon Sep 17 00:00:00 2001 From: Doug Blank Date: Fri, 8 Jan 2016 18:44:38 -0500 Subject: [PATCH] Added missing get_labels, get_schema --- gramps/gen/lib/family.py | 45 ++++++++++++++++++++++++++++++++++++ gramps/gen/lib/grampstype.py | 8 +++++++ 2 files changed, 53 insertions(+) diff --git a/gramps/gen/lib/family.py b/gramps/gen/lib/family.py index 64648829d..2ee59a0fd 100644 --- a/gramps/gen/lib/family.py +++ b/gramps/gen/lib/family.py @@ -199,6 +199,51 @@ class Family(CitationBase, NoteBase, MediaBase, AttributeBase, LdsOrdBase, TagBase.from_struct(struct.get("tag_list", default.tag_list)), struct.get("private", default.private)) + @classmethod + def get_schema(cls): + from .mediaref import MediaRef + from .ldsord import LdsOrd + from .childref import ChildRef + from .attribute import Attribute + return { + "handle": Handle("Family", "FAMILY-HANDLE"), + "gramps_id": str, + "father_handle": Handle("Person", "PERSON-HANDLE"), + "mother_handle": Handle("Person", "PERSON-HANDLE"), + "child_ref_list": [ChildRef], + "type": FamilyRelType, + "event_ref_list": [EventRef], + "media_list": [MediaRef], + "attribute_list": [Attribute], + "lds_ord_list": [LdsOrd], + "citation_list": [Handle("Citation", "CITATION-HANDLE")], + "note_list": [Handle("Note", "NOTE-HANDLE")], + "change": int, + "tag_list": [Handle("Tag", "TAG-HANDLE")], + "private": bool + } + + @classmethod + def get_labels(cls, _): + return { + "_class": _("Family"), + "handle": _("Handle"), + "gramps_id": _("Gramps ID"), + "father_handle": _("Father"), + "mother_handle": _("Mother"), + "child_ref_list": _("Children"), + "type": _("Relationship"), + "event_ref_list": _("Events"), + "media_list": _("Media"), + "attribute_list": _("Attributes"), + "lds_ord_list": _("LDS ordinances"), + "citation_list": _("Citations"), + "note_list": _("Notes"), + "change": _("Last changed"), + "tag_list": _("Tags"), + "private": _("Private"), + } + def unserialize(self, data): """ Convert the data held in a tuple created by the serialize method diff --git a/gramps/gen/lib/grampstype.py b/gramps/gen/lib/grampstype.py index 2db49c496..e55de59ad 100644 --- a/gramps/gen/lib/grampstype.py +++ b/gramps/gen/lib/grampstype.py @@ -207,6 +207,14 @@ class GrampsType(object, metaclass=GrampsTypeMeta): """Convert the object to a serialized tuple of data. """ return (self.__value, self.__string) + @classmethod + def get_labels(cls, _): + return { + "_class": _("Family Relationship"), + "value": _("Family Relationship"), + "string": _("Family Relationship"), + } + def to_struct(self): """ Convert the data held in this object to a structure (eg,