Re: A couple of questions about custom shapes...



At 29.01.2012 01:02, Daniel Katz wrote:
Hi,

So I'm doing a bit of work involving a Python export filter which
interacts with a small library of custom shapes, and I've run into a
couple of questions.

First a question about properties.  Using the custom shapes module I can
add custom properties to a shape.  That's great.  But what I'd also like
to do is make a number of the standard properties invisible so that the
users of these custom shapes don't have to think about (usual but
irrelevant in this case) things like 'Line width' and so on.  Is there a
way to do that through the custom shapes module?
Not without coding it in C. Some of these useless properties could be detected automatically from the content already available in the shape file, e.g. if there is no color replacing requested. But other things like line-width are (almost) always used with the current implementation/shape files.

Or do custom shapes
provide a way to attach a bit of code to run when a custom shape is
instantiated (i.e. a runtime hook) that could be used to make some of
those properties invisible?

No - even less - I even can't think of clean way to do that.

The other question is about the optional textbox in a custom shape.  In
the Python export filter I'd like to grab the contents of the textbox
from the custom shape to use it, but I couldn't find a way to do that
through the Python interface.  Does anyone know of a way to do that?  (I
thought it made sense to ask here before diving into the guts of the
python module and custom shape module to see how things are wired up…)

object.properties["text"].value.text should do

HTH,
        Hans

-------- Hans "at" Breuer "dot" Org -----------
Tell me what you need, and I'll tell you how to
get along without it.                -- Dilbert



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]