Added schema to Note and StyledText
This commit is contained in:
parent
ae8572187e
commit
3b1ff1e30f
@ -125,6 +125,22 @@ class Note(BasicPrimaryObject):
|
||||
"tag_list": TagBase.to_struct(self),
|
||||
"private": self.private}
|
||||
|
||||
@classmethod
|
||||
def get_schema(cls):
|
||||
"""
|
||||
The schema for Note.
|
||||
"""
|
||||
return {
|
||||
"handle": Handle("Note", "NOTE-HANDLE"),
|
||||
"gramps_id": str,
|
||||
"text": StyledText,
|
||||
"format": int,
|
||||
"type": NoteType,
|
||||
"change": int,
|
||||
"tag_list": [Handle("Tag", "TAG-HANDLE")],
|
||||
"private": bool,
|
||||
}
|
||||
|
||||
@classmethod
|
||||
def from_struct(cls, struct):
|
||||
"""
|
||||
|
@ -329,6 +329,16 @@ class StyledText(object):
|
||||
[StyledTextTag.from_struct(t)
|
||||
for t in struct.get("tags", default.tags)])
|
||||
|
||||
@classmethod
|
||||
def get_schema(cls):
|
||||
"""
|
||||
The schema for StyledText.
|
||||
"""
|
||||
return {
|
||||
"string": str,
|
||||
"tags": [StyledTextTag],
|
||||
}
|
||||
|
||||
def unserialize(self, data):
|
||||
"""
|
||||
Convert a serialized tuple of data to an object.
|
||||
|
Loading…
Reference in New Issue
Block a user