Example #1
0
 def _validateFontInfoAttributeValue(attr, value):
     from fontTools.ufoLib import validateFontInfoVersion3ValueForAttribute
     valid = validateFontInfoVersion3ValueForAttribute(attr, value)
     if not valid:
         raise ValueError("Invalid value %s for attribute '%s'."
                          % (value, attr))
     return value
Example #2
0
 def _validateFontInfoAttributeValue(attr, value):
     from fontTools.ufoLib import validateFontInfoVersion3ValueForAttribute
     valid = validateFontInfoVersion3ValueForAttribute(attr, value)
     if not valid:
         raise ValueError("Invalid value %s for attribute '%s'." %
                          (value, attr))
     return value
Example #3
0
 def setter(self, value):
     oldValue = getattr(self, privateName)
     if oldValue == value:
         return
     if value is None:
         value = copy(default)
     else:
         valid = ufoLib.validateFontInfoVersion3ValueForAttribute(name, value)
         if not valid:
             raise ValueError("Invalid value ({0}) for attribute {1}.".format(repr(value), name))
     setattr(self, privateName, value)
     self.postNotification("Info.ValueChanged", data=dict(attribute=name, oldValue=oldValue, newValue=value))
     self.dirty = True
Example #4
0
 def __setattr__(self, attr, value):
     if attr in fontInfoAttributesVersion3:
         if validateFontInfoVersion3ValueForAttribute(attr, value):
             setattr(self._object, attr, value)
     else:
         super(RelaxedInfo, self).__setattr__(attr, value)