From 945e126faafa87d30aba418f2106a07ed87bd42e Mon Sep 17 00:00:00 2001 From: Frederik Berlaen Date: Mon, 18 Feb 2019 19:21:53 +0100 Subject: [PATCH] add support for splitted controls where some keys are required by the spec (#28) see #26 --- Lib/defconAppKit/controls/fontInfoView.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/Lib/defconAppKit/controls/fontInfoView.py b/Lib/defconAppKit/controls/fontInfoView.py index 2c8d4a4..46650e0 100644 --- a/Lib/defconAppKit/controls/fontInfoView.py +++ b/Lib/defconAppKit/controls/fontInfoView.py @@ -2715,7 +2715,6 @@ def woffMetadataDirectionToUFO(value): hasDefault=False ) - # WOFF Credits def woffMetadataCreditsFromUFO(value): @@ -3207,6 +3206,13 @@ def woffMetadataGenericTextItemFactory(title=""): ] +controlRequiredPrototypes = { + "woffMetadataDescription": {"text": [{'text': 'Text'}]}, + "woffMetadataVendor": {"name": ""}, + "woffMetadataLicensee": {"name": ""}, +} + + # Attribute Getting and Setting def getAttributeValue(info, attr): @@ -3236,7 +3242,7 @@ def setAttributeValue(info, attr, value): keys = keys[1:] d = getattr(info, attr) if d is None: - d = {} + d = deepcopy(controlRequiredPrototypes.get(attr, {})) for key in keys[:-1]: if key not in d: d[key] = {}