Пример #1
0
 def _validateFontInfoAttributeValue(self, attr, value):
     from ufoLib import validateFontInfoVersion3ValueForAttribute
     valid = validateFontInfoVersion3ValueForAttribute(attr, value)
     if not valid:
         raise ValueError("Invalid value %s for attribute '%s'." %
                          (value, attr))
     return value
Пример #2
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
Пример #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
Пример #4
0
 def _validateFontInfoAttributeValue(self, attr, value):
     valid = validateFontInfoVersion3ValueForAttribute(attr, value)
     if not valid:
         raise FontPartsError("Invalid value %s for attribute '%s'." % (value, attr))
     return value
Пример #5
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)
Пример #6
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)