def writeLayerInfo(self, info):
if self.ufoFormatVersion < 3:
raise GlifLibError("layerinfo.plist is not allowed in UFO %d." % self.ufoFormatVersion)
# gather data
infoData = {}
for attr in list(layerInfoVersion3ValueData.keys()):
if hasattr(info, attr):
try:
value = getattr(info, attr)
except AttributeError:
raise GlifLibError("The supplied info object does not support getting a necessary attribute (%s)." % attr)
if value is None or (attr == 'lib' and not value):
continue
infoData[attr] = value
# validate
infoData = validateLayerInfoVersion3Data(infoData)
# write file
path = os.path.join(self.dirName, LAYERINFO_FILENAME)
with open(path, "wb") as f:
writePlist(infoData, f)
# read caching
评论列表
文章目录