Add title properties to more of schema

This commit is contained in:
prculley
2017-07-17 15:48:18 +01:00
committed by Nick Hall
parent d6ca3cf527
commit f40526366a
14 changed files with 166 additions and 56 deletions

View File

@@ -38,6 +38,8 @@ from .notebase import NoteBase
from .datebase import DateBase from .datebase import DateBase
from .locationbase import LocationBase from .locationbase import LocationBase
from .const import IDENTICAL, EQUAL, DIFFERENT from .const import IDENTICAL, EQUAL, DIFFERENT
from ..const import GRAMPS_LOCALE as glocale
_ = glocale.translation.gettext
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
# #
@@ -92,24 +94,37 @@ class Address(SecondaryObject, PrivacyBase, CitationBase, NoteBase, DateBase,
from .date import Date from .date import Date
return { return {
"type": "object", "type": "object",
"title": _("Address"),
"properties": { "properties": {
"_class": {"enum": [cls.__name__]}, "_class": {"enum": [cls.__name__]},
"private": {"type": "boolean"}, "private": {"type": "boolean",
"title": _("Private")},
"citation_list": {"type": "array", "citation_list": {"type": "array",
"title": _("Citations"),
"items": {"type": "string", "items": {"type": "string",
"maxLength": 50}}, "maxLength": 50}},
"note_list": {"type": "array", "note_list": {"type": "array",
"title": _("Notes"),
"items": {"type": "string", "items": {"type": "string",
"maxLength": 50}}, "maxLength": 50}},
"date": {"oneOf": [{"type": "null"}, Date.get_schema()]}, "date": {"oneOf": [{"type": "null"}, Date.get_schema()],
"street": {"type": "string"}, "title": _("Date")},
"locality": {"type": "string"}, "street": {"type": "string",
"city": {"type": "string"}, "title": _("Street")},
"county": {"type": "string"}, "locality": {"type": "string",
"state": {"type": "string"}, "title": _("Locality")},
"country": {"type": "string"}, "city": {"type": "string",
"postal": {"type": "string"}, "title": _("City")},
"phone": {"type": "string"} "county": {"type": "string",
"title": _("County")},
"state": {"type": "string",
"title": _("State")},
"country": {"type": "string",
"title": _("Country")},
"postal": {"type": "string",
"title": _("Postal Code")},
"phone": {"type": "string",
"title": _("Phone")}
} }
} }

View File

@@ -36,6 +36,8 @@ from .citationbase import CitationBase
from .notebase import NoteBase from .notebase import NoteBase
from .attrtype import AttributeType from .attrtype import AttributeType
from .const import IDENTICAL, EQUAL, DIFFERENT from .const import IDENTICAL, EQUAL, DIFFERENT
from ..const import GRAMPS_LOCALE as glocale
_ = glocale.translation.gettext
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
# #
@@ -231,17 +233,22 @@ class Attribute(AttributeRoot, CitationBase, NoteBase):
""" """
return { return {
"type": "object", "type": "object",
"title": _("Attribute"),
"properties": { "properties": {
"_class": {"enum": [cls.__name__]}, "_class": {"enum": [cls.__name__]},
"private": {"type": "boolean"}, "private": {"type": "boolean",
"title": _("Private")},
"citation_list": {"type": "array", "citation_list": {"type": "array",
"title": _("Citations"),
"items": {"type": "string", "items": {"type": "string",
"maxLength": 50}}, "maxLength": 50}},
"note_list": {"type": "array", "note_list": {"type": "array",
"items": {"type": "string", "items": {"type": "string",
"maxLength": 50}}, "maxLength": 50},
"title": _("Notes")},
"type": AttributeType.get_schema(), "type": AttributeType.get_schema(),
"value": {"type": "string"} "value": {"type": "string",
"title": _("Value")}
} }
} }

View File

@@ -37,6 +37,8 @@ from .notebase import NoteBase
from .refbase import RefBase from .refbase import RefBase
from .childreftype import ChildRefType from .childreftype import ChildRefType
from .const import IDENTICAL, EQUAL, DIFFERENT from .const import IDENTICAL, EQUAL, DIFFERENT
from ..const import GRAMPS_LOCALE as glocale
_ = glocale.translation.gettext
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
# #
@@ -100,17 +102,22 @@ class ChildRef(SecondaryObject, PrivacyBase, CitationBase, NoteBase, RefBase):
""" """
return { return {
"type": "object", "type": "object",
"title": _("Child Reference"),
"properties": { "properties": {
"_class": {"enum": [cls.__name__]}, "_class": {"enum": [cls.__name__]},
"private": {"type": "boolean"}, "private": {"type": "boolean",
"title": _("Private")},
"citation_list": {"type": "array", "citation_list": {"type": "array",
"items": {"type": "string", "items": {"type": "string",
"maxLength": 50}}, "maxLength": 50},
"title": _("Citations")},
"note_list": {"type": "array", "note_list": {"type": "array",
"items": {"type": "string", "items": {"type": "string",
"maxLength": 50}}, "maxLength": 50},
"title": _("Notes")},
"ref": {"type": "string", "ref": {"type": "string",
"maxLength": 50}, "maxLength": 50,
"title": _("Handle")},
"frel": ChildRefType.get_schema(), "frel": ChildRefType.get_schema(),
"mrel": ChildRefType.get_schema() "mrel": ChildRefType.get_schema()
} }

View File

@@ -703,16 +703,24 @@ class Date:
""" """
return { return {
"type": "object", "type": "object",
"title": _("Date"),
"properties": { "properties": {
"_class": {"enum": [cls.__name__]}, "_class": {"enum": [cls.__name__]},
"calendar": {"type": "integer"}, "calendar": {"type": "integer",
"modifier": {"type": "integer"}, "title": _("Calendar")},
"quality": {"type": "integer"}, "modifier": {"type": "integer",
"title": _("Modifier")},
"quality": {"type": "integer",
"title": _("Quality")},
"dateval": {"type": "array", "dateval": {"type": "array",
"title": _("Values"),
"items": {"type": ["integer", "boolean"]}}, "items": {"type": ["integer", "boolean"]}},
"text": {"type": "string"}, "text": {"type": "string",
"sortval": {"type": "integer"}, "title": _("Text")},
"newyear": {"type": "integer"} "sortval": {"type": "integer",
"title": _("Sort value")},
"newyear": {"type": "integer",
"title": _("New year begins")}
} }
} }

View File

@@ -167,21 +167,31 @@ class LdsOrd(SecondaryObject, CitationBase, NoteBase,
from .date import Date from .date import Date
return { return {
"type": "object", "type": "object",
"title": _("LDS Ordinance"),
"properties": { "properties": {
"_class": {"enum": [cls.__name__]}, "_class": {"enum": [cls.__name__]},
"citation_list": {"type": "array", "citation_list": {"type": "array",
"title": _("Citations"),
"items": {"type": "string", "items": {"type": "string",
"maxLength": 50}}, "maxLength": 50}},
"note_list": {"type": "array", "note_list": {"type": "array",
"title": _("Notes"),
"items": {"type": "string", "items": {"type": "string",
"maxLength": 50}}, "maxLength": 50}},
"date": {"oneOf": [{"type": "null"}, Date.get_schema()]}, "date": {"oneOf": [{"type": "null"}, Date.get_schema()],
"type": {"type": "integer"}, "title": _("Date")},
"place": {"type": "string"}, "type": {"type": "integer",
"famc": {"type": ["null", "string"]}, "title": _("Type")},
"temple": {"type": "string"}, "place": {"type": "string",
"status": {"type": "integer"}, "title": _("Place")},
"private": {"type": "boolean"} "famc": {"type": ["null", "string"],
"title": _("Family")},
"temple": {"type": "string",
"title": _("Temple")},
"status": {"type": "integer",
"title": _("Status")},
"private": {"type": "boolean",
"title": _("Private")}
} }
} }

View File

@@ -33,6 +33,8 @@ Location class for Gramps.
from .secondaryobj import SecondaryObject from .secondaryobj import SecondaryObject
from .locationbase import LocationBase from .locationbase import LocationBase
from .const import IDENTICAL, DIFFERENT from .const import IDENTICAL, DIFFERENT
from ..const import GRAMPS_LOCALE as glocale
_ = glocale.translation.gettext
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
# #
@@ -82,17 +84,27 @@ class Location(SecondaryObject, LocationBase):
""" """
return { return {
"type": "object", "type": "object",
"title": _("Location"),
"properties": { "properties": {
"_class": {"enum": [cls.__name__]}, "_class": {"enum": [cls.__name__]},
"street": {"type": "string"}, "street": {"type": "string",
"locality": {"type": "string"}, "title": _("Street")},
"city": {"type": "string"}, "locality": {"type": "string",
"county": {"type": "string"}, "title": _("Locality")},
"state": {"type": "string"}, "city": {"type": "string",
"country": {"type": "string"}, "title": _("City")},
"postal": {"type": "string"}, "county": {"type": "string",
"phone": {"type": "string"}, "title": _("County")},
"parish": {"type": "string"} "state": {"type": "string",
"title": _("State")},
"country": {"type": "string",
"title": _("Country")},
"postal": {"type": "string",
"title": _("Postal Code")},
"phone": {"type": "string",
"title": _("Phone")},
"parish": {"type": "string",
"title": _("Parish")}
} }
} }

View File

@@ -38,6 +38,8 @@ from .notebase import NoteBase
from .refbase import RefBase from .refbase import RefBase
from .attrbase import AttributeBase from .attrbase import AttributeBase
from .const import IDENTICAL, EQUAL, DIFFERENT from .const import IDENTICAL, EQUAL, DIFFERENT
from ..const import GRAMPS_LOCALE as glocale
_ = glocale.translation.gettext
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
# #
@@ -81,24 +83,31 @@ class MediaRef(SecondaryObject, PrivacyBase, CitationBase, NoteBase, RefBase,
from .attribute import Attribute from .attribute import Attribute
return { return {
"type": "object", "type": "object",
"title": _("Media ref"),
"properties": { "properties": {
"_class": {"enum": [cls.__name__]}, "_class": {"enum": [cls.__name__]},
"private": {"type": "boolean"}, "private": {"type": "boolean",
"title": _("Private")},
"citation_list": {"type": "array", "citation_list": {"type": "array",
"title": _("Citations"),
"items": {"type": "string", "items": {"type": "string",
"maxLength": 50}}, "maxLength": 50}},
"note_list": {"type": "array", "note_list": {"type": "array",
"title": _("Notes"),
"items": {"type": "string", "items": {"type": "string",
"maxLength": 50}}, "maxLength": 50}},
"attribute_list": {"type": "array", "attribute_list": {"type": "array",
"title": _("Attributes"),
"items": Attribute.get_schema()}, "items": Attribute.get_schema()},
"ref": {"type": "string", "ref": {"type": "string",
"title": _("Handle"),
"maxLength": 50}, "maxLength": 50},
"rect": {"oneOf": [{"type": "null"}, "rect": {"oneOf": [{"type": "null"},
{"type": "array", {"type": "array",
"items": {"type": "integer"}, "items": {"type": "integer"},
"minItems": 4, "minItems": 4,
"maxItems": 4}]} "maxItems": 4}],
"title": _("Region")}
} }
} }

View File

@@ -37,6 +37,8 @@ from .citationbase import CitationBase
from .notebase import NoteBase from .notebase import NoteBase
from .refbase import RefBase from .refbase import RefBase
from .const import IDENTICAL, EQUAL, DIFFERENT from .const import IDENTICAL, EQUAL, DIFFERENT
from ..const import GRAMPS_LOCALE as glocale
_ = glocale.translation.gettext
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
# #
@@ -93,18 +95,24 @@ class PersonRef(SecondaryObject, PrivacyBase, CitationBase, NoteBase, RefBase):
""" """
return { return {
"type": "object", "type": "object",
"title": _("Person ref"),
"properties": { "properties": {
"_class": {"enum": [cls.__name__]}, "_class": {"enum": [cls.__name__]},
"private": {"type": "boolean"}, "private": {"type": "boolean",
"title": _("Private")},
"citation_list": {"type": "array", "citation_list": {"type": "array",
"title": _("Citations"),
"items": {"type": "string", "items": {"type": "string",
"maxLength": 50}}, "maxLength": 50}},
"note_list": {"type": "array", "note_list": {"type": "array",
"title": _("Notes"),
"items": {"type": "string", "items": {"type": "string",
"maxLength": 50}}, "maxLength": 50}},
"ref": {"type": "string", "ref": {"type": "string",
"title": _("Handle"),
"maxLength": 50}, "maxLength": 50},
"rel": {"type": "string"} "rel": {"type": "string",
"title": _("Association")}
} }
} }

View File

@@ -31,6 +31,8 @@ Place name class for Gramps
from .secondaryobj import SecondaryObject from .secondaryobj import SecondaryObject
from .datebase import DateBase from .datebase import DateBase
from .const import IDENTICAL, EQUAL, DIFFERENT from .const import IDENTICAL, EQUAL, DIFFERENT
from ..const import GRAMPS_LOCALE as glocale
_ = glocale.translation.gettext
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
# #
@@ -90,11 +92,15 @@ class PlaceName(SecondaryObject, DateBase):
from .date import Date from .date import Date
return { return {
"type": "object", "type": "object",
"title": _("Place Name"),
"properties": { "properties": {
"_class": {"enum": [cls.__name__]}, "_class": {"enum": [cls.__name__]},
"value": {"type": "string"}, "value": {"type": "string",
"date": {"oneOf": [{"type": "null"}, Date.get_schema()]}, "title": _("Text")},
"lang": {"type": "string"} "date": {"oneOf": [{"type": "null"}, Date.get_schema()],
"title": _("Date")},
"lang": {"type": "string",
"title": _("Language")}
} }
} }

View File

@@ -32,6 +32,8 @@ from .secondaryobj import SecondaryObject
from .refbase import RefBase from .refbase import RefBase
from .datebase import DateBase from .datebase import DateBase
from .const import IDENTICAL, EQUAL, DIFFERENT from .const import IDENTICAL, EQUAL, DIFFERENT
from ..const import GRAMPS_LOCALE as glocale
_ = glocale.translation.gettext
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
# #
@@ -82,11 +84,14 @@ class PlaceRef(RefBase, DateBase, SecondaryObject):
from .date import Date from .date import Date
return { return {
"type": "object", "type": "object",
"title": _("Place ref"),
"properties": { "properties": {
"_class": {"enum": [cls.__name__]}, "_class": {"enum": [cls.__name__]},
"ref": {"type": "string", "ref": {"type": "string",
"title": _("Handle"),
"maxLength": 50}, "maxLength": 50},
"date": {"oneOf": [{"type": "null"}, Date.get_schema()]} "date": {"oneOf": [{"type": "null"}, Date.get_schema()],
"title": _("Date")}
} }
} }

View File

@@ -36,6 +36,8 @@ from .notebase import NoteBase
from .refbase import RefBase from .refbase import RefBase
from .srcmediatype import SourceMediaType from .srcmediatype import SourceMediaType
from .const import IDENTICAL, EQUAL, DIFFERENT from .const import IDENTICAL, EQUAL, DIFFERENT
from ..const import GRAMPS_LOCALE as glocale
_ = glocale.translation.gettext
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
# #
@@ -91,16 +93,21 @@ class RepoRef(SecondaryObject, PrivacyBase, NoteBase, RefBase):
""" """
return { return {
"type": "object", "type": "object",
"title": _("Repository ref"),
"properties": { "properties": {
"_class": {"enum": [cls.__name__]}, "_class": {"enum": [cls.__name__]},
"note_list": {"type": "array", "note_list": {"type": "array",
"title": _("Notes"),
"items": {"type": "string", "items": {"type": "string",
"maxLength": 50}}, "maxLength": 50}},
"ref": {"type": "string", "ref": {"type": "string",
"title": _("Handle"),
"maxLength": 50}, "maxLength": 50},
"call_number": {"type": "string"}, "call_number": {"type": "string",
"title": _("Call Number")},
"media_type": SourceMediaType.get_schema(), "media_type": SourceMediaType.get_schema(),
"private": {"type": "boolean"} "private": {"type": "boolean",
"title": _("Private")}
} }
} }

View File

@@ -30,6 +30,8 @@ Source Attribute class for Gramps.
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
from .attribute import AttributeRoot from .attribute import AttributeRoot
from .srcattrtype import SrcAttributeType from .srcattrtype import SrcAttributeType
from ..const import GRAMPS_LOCALE as glocale
_ = glocale.translation.gettext
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
# #
@@ -65,10 +67,13 @@ class SrcAttribute(AttributeRoot):
""" """
return { return {
"type": "object", "type": "object",
"title": _("Attribute"),
"properties": { "properties": {
"_class": {"enum": [cls.__name__]}, "_class": {"enum": [cls.__name__]},
"private": {"type": "boolean"}, "private": {"type": "boolean",
"title": _("Private")},
"type": SrcAttributeType.get_schema(), "type": SrcAttributeType.get_schema(),
"value": {"type": "string"} "value": {"type": "string",
"title": _("Value")}
} }
} }

View File

@@ -28,6 +28,8 @@
# #
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
from .styledtexttagtype import StyledTextTagType from .styledtexttagtype import StyledTextTagType
from ..const import GRAMPS_LOCALE as glocale
_ = glocale.translation.gettext
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
# #
@@ -96,14 +98,17 @@ class StyledTextTag:
""" """
return { return {
"type": "object", "type": "object",
"title": _("Tag"),
"properties": { "properties": {
"_class": {"enum": [cls.__name__]}, "_class": {"enum": [cls.__name__]},
"name": StyledTextTagType.get_schema(), "name": StyledTextTagType.get_schema(),
"value": {"type": ["null", "string", "integer"]}, "value": {"type": ["null", "string", "integer"],
"title": _("Value")},
"ranges": {"type": "array", "ranges": {"type": "array",
"items": {"type": "array", "items": {"type": "array",
"items": {"type": "integer"}, "items": {"type": "integer"},
"minItems": 2, "minItems": 2,
"maxItems": 2}} "maxItems": 2},
"title": _("Ranges")}
} }
} }

View File

@@ -41,6 +41,8 @@ from .secondaryobj import SecondaryObject
from .privacybase import PrivacyBase from .privacybase import PrivacyBase
from .urltype import UrlType from .urltype import UrlType
from .const import IDENTICAL, EQUAL, DIFFERENT from .const import IDENTICAL, EQUAL, DIFFERENT
from ..const import GRAMPS_LOCALE as glocale
_ = glocale.translation.gettext
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
# #
@@ -83,11 +85,15 @@ class Url(SecondaryObject, PrivacyBase):
""" """
return { return {
"type": "object", "type": "object",
"title": _("Url"),
"properties": { "properties": {
"_class": {"enum": [cls.__name__]}, "_class": {"enum": [cls.__name__]},
"private": {"type": "boolean"}, "private": {"type": "boolean",
"path": {"type": "string"}, "title": _("Private")},
"desc": {"type": "string"}, "path": {"type": "string",
"title": _("Path")},
"desc": {"type": "string",
"title": _("Description")},
"type": UrlType.get_schema() "type": UrlType.get_schema()
} }
} }