Jeremias Maerki wrote:

> I'm currently looking at implementing text-decoration. ATM 
> it's specified as an EnumProperty but should be more like a 
> set of enums with certain validation rules applied. I'm 
> unsure about the approach. If anyone already has an idea how 
> it should look like I'd appreciate any insight.
> My first idea was to implement a special property class
> (TextDecorationProperty) that handles the conversion of a 
> ListProperty of NCNames to an internal set of variables while 
> at the same time validating the enum combinations. I think my 
> approach would work even if it look a bit awkward. But I 
> wanted to check first so I didn't implement something really ugly.

I think you are on the right track, and it is a curiosity to me why the
standard writers did not create a separate datatype for this. The FOray
implementation uses a pseudo datatype to handle text decoration, handled the
same general way that keeps and spaces are:

The class that creates and uses the datatype is here:

After taking this approach (i.e. allowing all of the variations to be stored
together), text decoration was implemented properly. IOW, all of the other
pieces were already in place, all I had to do was get the data stored and
retrieved correctly. Caveat: FOray stores and retrieves properties using a
late- or no-binding scheme, so the timing will be different, but I would
think the general principle would be the same.


Victor Mote

Reply via email to