From f40526366a7d29acf61bf597f139d3f37e302e34 Mon Sep 17 00:00:00 2001 From: prculley Date: Mon, 17 Jul 2017 15:48:18 +0100 Subject: [PATCH] Add title properties to more of schema --- gramps/gen/lib/address.py | 35 +++++++++++++++++++++++---------- gramps/gen/lib/attribute.py | 13 +++++++++--- gramps/gen/lib/childref.py | 15 ++++++++++---- gramps/gen/lib/date.py | 20 +++++++++++++------ gramps/gen/lib/ldsord.py | 24 +++++++++++++++------- gramps/gen/lib/location.py | 30 +++++++++++++++++++--------- gramps/gen/lib/mediaref.py | 13 ++++++++++-- gramps/gen/lib/personref.py | 12 +++++++++-- gramps/gen/lib/placename.py | 12 ++++++++--- gramps/gen/lib/placeref.py | 7 ++++++- gramps/gen/lib/reporef.py | 11 +++++++++-- gramps/gen/lib/srcattribute.py | 9 +++++++-- gramps/gen/lib/styledtexttag.py | 9 +++++++-- gramps/gen/lib/url.py | 12 ++++++++--- 14 files changed, 166 insertions(+), 56 deletions(-) diff --git a/gramps/gen/lib/address.py b/gramps/gen/lib/address.py index 09d5cdc6c..2a30a6215 100644 --- a/gramps/gen/lib/address.py +++ b/gramps/gen/lib/address.py @@ -38,6 +38,8 @@ from .notebase import NoteBase from .datebase import DateBase from .locationbase import LocationBase 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 return { "type": "object", + "title": _("Address"), "properties": { "_class": {"enum": [cls.__name__]}, - "private": {"type": "boolean"}, + "private": {"type": "boolean", + "title": _("Private")}, "citation_list": {"type": "array", + "title": _("Citations"), "items": {"type": "string", "maxLength": 50}}, "note_list": {"type": "array", + "title": _("Notes"), "items": {"type": "string", "maxLength": 50}}, - "date": {"oneOf": [{"type": "null"}, Date.get_schema()]}, - "street": {"type": "string"}, - "locality": {"type": "string"}, - "city": {"type": "string"}, - "county": {"type": "string"}, - "state": {"type": "string"}, - "country": {"type": "string"}, - "postal": {"type": "string"}, - "phone": {"type": "string"} + "date": {"oneOf": [{"type": "null"}, Date.get_schema()], + "title": _("Date")}, + "street": {"type": "string", + "title": _("Street")}, + "locality": {"type": "string", + "title": _("Locality")}, + "city": {"type": "string", + "title": _("City")}, + "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")} } } diff --git a/gramps/gen/lib/attribute.py b/gramps/gen/lib/attribute.py index 7ab2a6f12..169c13d95 100644 --- a/gramps/gen/lib/attribute.py +++ b/gramps/gen/lib/attribute.py @@ -36,6 +36,8 @@ from .citationbase import CitationBase from .notebase import NoteBase from .attrtype import AttributeType 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 { "type": "object", + "title": _("Attribute"), "properties": { "_class": {"enum": [cls.__name__]}, - "private": {"type": "boolean"}, + "private": {"type": "boolean", + "title": _("Private")}, "citation_list": {"type": "array", + "title": _("Citations"), "items": {"type": "string", "maxLength": 50}}, "note_list": {"type": "array", "items": {"type": "string", - "maxLength": 50}}, + "maxLength": 50}, + "title": _("Notes")}, "type": AttributeType.get_schema(), - "value": {"type": "string"} + "value": {"type": "string", + "title": _("Value")} } } diff --git a/gramps/gen/lib/childref.py b/gramps/gen/lib/childref.py index 2dda97a7a..10f770150 100644 --- a/gramps/gen/lib/childref.py +++ b/gramps/gen/lib/childref.py @@ -37,6 +37,8 @@ from .notebase import NoteBase from .refbase import RefBase from .childreftype import ChildRefType 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 { "type": "object", + "title": _("Child Reference"), "properties": { "_class": {"enum": [cls.__name__]}, - "private": {"type": "boolean"}, + "private": {"type": "boolean", + "title": _("Private")}, "citation_list": {"type": "array", "items": {"type": "string", - "maxLength": 50}}, + "maxLength": 50}, + "title": _("Citations")}, "note_list": {"type": "array", "items": {"type": "string", - "maxLength": 50}}, + "maxLength": 50}, + "title": _("Notes")}, "ref": {"type": "string", - "maxLength": 50}, + "maxLength": 50, + "title": _("Handle")}, "frel": ChildRefType.get_schema(), "mrel": ChildRefType.get_schema() } diff --git a/gramps/gen/lib/date.py b/gramps/gen/lib/date.py index 5f4a63369..41e17577c 100644 --- a/gramps/gen/lib/date.py +++ b/gramps/gen/lib/date.py @@ -703,16 +703,24 @@ class Date: """ return { "type": "object", + "title": _("Date"), "properties": { "_class": {"enum": [cls.__name__]}, - "calendar": {"type": "integer"}, - "modifier": {"type": "integer"}, - "quality": {"type": "integer"}, + "calendar": {"type": "integer", + "title": _("Calendar")}, + "modifier": {"type": "integer", + "title": _("Modifier")}, + "quality": {"type": "integer", + "title": _("Quality")}, "dateval": {"type": "array", + "title": _("Values"), "items": {"type": ["integer", "boolean"]}}, - "text": {"type": "string"}, - "sortval": {"type": "integer"}, - "newyear": {"type": "integer"} + "text": {"type": "string", + "title": _("Text")}, + "sortval": {"type": "integer", + "title": _("Sort value")}, + "newyear": {"type": "integer", + "title": _("New year begins")} } } diff --git a/gramps/gen/lib/ldsord.py b/gramps/gen/lib/ldsord.py index 18036d2f9..e5c8fec07 100644 --- a/gramps/gen/lib/ldsord.py +++ b/gramps/gen/lib/ldsord.py @@ -167,21 +167,31 @@ class LdsOrd(SecondaryObject, CitationBase, NoteBase, from .date import Date return { "type": "object", + "title": _("LDS Ordinance"), "properties": { "_class": {"enum": [cls.__name__]}, "citation_list": {"type": "array", + "title": _("Citations"), "items": {"type": "string", "maxLength": 50}}, "note_list": {"type": "array", + "title": _("Notes"), "items": {"type": "string", "maxLength": 50}}, - "date": {"oneOf": [{"type": "null"}, Date.get_schema()]}, - "type": {"type": "integer"}, - "place": {"type": "string"}, - "famc": {"type": ["null", "string"]}, - "temple": {"type": "string"}, - "status": {"type": "integer"}, - "private": {"type": "boolean"} + "date": {"oneOf": [{"type": "null"}, Date.get_schema()], + "title": _("Date")}, + "type": {"type": "integer", + "title": _("Type")}, + "place": {"type": "string", + "title": _("Place")}, + "famc": {"type": ["null", "string"], + "title": _("Family")}, + "temple": {"type": "string", + "title": _("Temple")}, + "status": {"type": "integer", + "title": _("Status")}, + "private": {"type": "boolean", + "title": _("Private")} } } diff --git a/gramps/gen/lib/location.py b/gramps/gen/lib/location.py index 841f589dd..d7341fdb8 100644 --- a/gramps/gen/lib/location.py +++ b/gramps/gen/lib/location.py @@ -33,6 +33,8 @@ Location class for Gramps. from .secondaryobj import SecondaryObject from .locationbase import LocationBase from .const import IDENTICAL, DIFFERENT +from ..const import GRAMPS_LOCALE as glocale +_ = glocale.translation.gettext #------------------------------------------------------------------------- # @@ -82,17 +84,27 @@ class Location(SecondaryObject, LocationBase): """ return { "type": "object", + "title": _("Location"), "properties": { "_class": {"enum": [cls.__name__]}, - "street": {"type": "string"}, - "locality": {"type": "string"}, - "city": {"type": "string"}, - "county": {"type": "string"}, - "state": {"type": "string"}, - "country": {"type": "string"}, - "postal": {"type": "string"}, - "phone": {"type": "string"}, - "parish": {"type": "string"} + "street": {"type": "string", + "title": _("Street")}, + "locality": {"type": "string", + "title": _("Locality")}, + "city": {"type": "string", + "title": _("City")}, + "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")}, + "parish": {"type": "string", + "title": _("Parish")} } } diff --git a/gramps/gen/lib/mediaref.py b/gramps/gen/lib/mediaref.py index c908c5abb..0f088380d 100644 --- a/gramps/gen/lib/mediaref.py +++ b/gramps/gen/lib/mediaref.py @@ -38,6 +38,8 @@ from .notebase import NoteBase from .refbase import RefBase from .attrbase import AttributeBase 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 return { "type": "object", + "title": _("Media ref"), "properties": { "_class": {"enum": [cls.__name__]}, - "private": {"type": "boolean"}, + "private": {"type": "boolean", + "title": _("Private")}, "citation_list": {"type": "array", + "title": _("Citations"), "items": {"type": "string", "maxLength": 50}}, "note_list": {"type": "array", + "title": _("Notes"), "items": {"type": "string", "maxLength": 50}}, "attribute_list": {"type": "array", + "title": _("Attributes"), "items": Attribute.get_schema()}, "ref": {"type": "string", + "title": _("Handle"), "maxLength": 50}, "rect": {"oneOf": [{"type": "null"}, {"type": "array", "items": {"type": "integer"}, "minItems": 4, - "maxItems": 4}]} + "maxItems": 4}], + "title": _("Region")} } } diff --git a/gramps/gen/lib/personref.py b/gramps/gen/lib/personref.py index a64150d0a..743d0a408 100644 --- a/gramps/gen/lib/personref.py +++ b/gramps/gen/lib/personref.py @@ -37,6 +37,8 @@ from .citationbase import CitationBase from .notebase import NoteBase from .refbase import RefBase 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 { "type": "object", + "title": _("Person ref"), "properties": { "_class": {"enum": [cls.__name__]}, - "private": {"type": "boolean"}, + "private": {"type": "boolean", + "title": _("Private")}, "citation_list": {"type": "array", + "title": _("Citations"), "items": {"type": "string", "maxLength": 50}}, "note_list": {"type": "array", + "title": _("Notes"), "items": {"type": "string", "maxLength": 50}}, "ref": {"type": "string", + "title": _("Handle"), "maxLength": 50}, - "rel": {"type": "string"} + "rel": {"type": "string", + "title": _("Association")} } } diff --git a/gramps/gen/lib/placename.py b/gramps/gen/lib/placename.py index 3a97fcecb..41881bd68 100644 --- a/gramps/gen/lib/placename.py +++ b/gramps/gen/lib/placename.py @@ -31,6 +31,8 @@ Place name class for Gramps from .secondaryobj import SecondaryObject from .datebase import DateBase 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 return { "type": "object", + "title": _("Place Name"), "properties": { "_class": {"enum": [cls.__name__]}, - "value": {"type": "string"}, - "date": {"oneOf": [{"type": "null"}, Date.get_schema()]}, - "lang": {"type": "string"} + "value": {"type": "string", + "title": _("Text")}, + "date": {"oneOf": [{"type": "null"}, Date.get_schema()], + "title": _("Date")}, + "lang": {"type": "string", + "title": _("Language")} } } diff --git a/gramps/gen/lib/placeref.py b/gramps/gen/lib/placeref.py index 673657688..6197f3f57 100644 --- a/gramps/gen/lib/placeref.py +++ b/gramps/gen/lib/placeref.py @@ -32,6 +32,8 @@ from .secondaryobj import SecondaryObject from .refbase import RefBase from .datebase import DateBase 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 return { "type": "object", + "title": _("Place ref"), "properties": { "_class": {"enum": [cls.__name__]}, "ref": {"type": "string", + "title": _("Handle"), "maxLength": 50}, - "date": {"oneOf": [{"type": "null"}, Date.get_schema()]} + "date": {"oneOf": [{"type": "null"}, Date.get_schema()], + "title": _("Date")} } } diff --git a/gramps/gen/lib/reporef.py b/gramps/gen/lib/reporef.py index e281b9ea9..a4a982313 100644 --- a/gramps/gen/lib/reporef.py +++ b/gramps/gen/lib/reporef.py @@ -36,6 +36,8 @@ from .notebase import NoteBase from .refbase import RefBase from .srcmediatype import SourceMediaType 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 { "type": "object", + "title": _("Repository ref"), "properties": { "_class": {"enum": [cls.__name__]}, "note_list": {"type": "array", + "title": _("Notes"), "items": {"type": "string", "maxLength": 50}}, "ref": {"type": "string", + "title": _("Handle"), "maxLength": 50}, - "call_number": {"type": "string"}, + "call_number": {"type": "string", + "title": _("Call Number")}, "media_type": SourceMediaType.get_schema(), - "private": {"type": "boolean"} + "private": {"type": "boolean", + "title": _("Private")} } } diff --git a/gramps/gen/lib/srcattribute.py b/gramps/gen/lib/srcattribute.py index c1ff97bb0..b98625efd 100644 --- a/gramps/gen/lib/srcattribute.py +++ b/gramps/gen/lib/srcattribute.py @@ -30,6 +30,8 @@ Source Attribute class for Gramps. #------------------------------------------------------------------------- from .attribute import AttributeRoot from .srcattrtype import SrcAttributeType +from ..const import GRAMPS_LOCALE as glocale +_ = glocale.translation.gettext #------------------------------------------------------------------------- # @@ -65,10 +67,13 @@ class SrcAttribute(AttributeRoot): """ return { "type": "object", + "title": _("Attribute"), "properties": { "_class": {"enum": [cls.__name__]}, - "private": {"type": "boolean"}, + "private": {"type": "boolean", + "title": _("Private")}, "type": SrcAttributeType.get_schema(), - "value": {"type": "string"} + "value": {"type": "string", + "title": _("Value")} } } diff --git a/gramps/gen/lib/styledtexttag.py b/gramps/gen/lib/styledtexttag.py index dee7a38e1..56ba7043e 100644 --- a/gramps/gen/lib/styledtexttag.py +++ b/gramps/gen/lib/styledtexttag.py @@ -28,6 +28,8 @@ # #------------------------------------------------------------------------- from .styledtexttagtype import StyledTextTagType +from ..const import GRAMPS_LOCALE as glocale +_ = glocale.translation.gettext #------------------------------------------------------------------------- # @@ -96,14 +98,17 @@ class StyledTextTag: """ return { "type": "object", + "title": _("Tag"), "properties": { "_class": {"enum": [cls.__name__]}, "name": StyledTextTagType.get_schema(), - "value": {"type": ["null", "string", "integer"]}, + "value": {"type": ["null", "string", "integer"], + "title": _("Value")}, "ranges": {"type": "array", "items": {"type": "array", "items": {"type": "integer"}, "minItems": 2, - "maxItems": 2}} + "maxItems": 2}, + "title": _("Ranges")} } } diff --git a/gramps/gen/lib/url.py b/gramps/gen/lib/url.py index f7668572b..b3d4543e0 100644 --- a/gramps/gen/lib/url.py +++ b/gramps/gen/lib/url.py @@ -41,6 +41,8 @@ from .secondaryobj import SecondaryObject from .privacybase import PrivacyBase from .urltype import UrlType 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 { "type": "object", + "title": _("Url"), "properties": { "_class": {"enum": [cls.__name__]}, - "private": {"type": "boolean"}, - "path": {"type": "string"}, - "desc": {"type": "string"}, + "private": {"type": "boolean", + "title": _("Private")}, + "path": {"type": "string", + "title": _("Path")}, + "desc": {"type": "string", + "title": _("Description")}, "type": UrlType.get_schema() } }