sketch-devel
[Top][All Lists]
Advanced

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

Re: Sketch Extension


From: Bernhard Herzog
Subject: Re: Sketch Extension
Date: Thu, 04 Mar 2004 21:09:42 +0100
User-agent: Gnus/5.1002 (Gnus v5.10.2) Emacs/21.2 (gnu/linux)

[reply to a question I got as private mail with approval from pierre]

"pierre" <address@hidden> writes:

> I ) In the developper guide you expose the hierarchy class of the
> graphics object. It starts with the Selectable class :
>       -Selectable
>               --GraphicsObject
>                       ...
>               --EditSelect
>                       ...
> And after you speak about the Base Classes: Bounded, HierarchyNode,
> Selectable and Protocols.
> I wonder what is the link between this classes ? Is the class
> Graphicsobject inheriting from all of this classes ?

Yes. Bounded, HierarchyNode, Selectable and Protocols are the base
classes of GraphicsObject.

> Which classe is their "mother class" ?

Bounded, HierarchyNode, Selectable and Protocols have no base classes.

Another base class of GraphicsObject new in 0.7 is the somewhat
awkwardly named ObjectWithMetaData.  Like the other base classes it's
not derived from any other class.

You can see all of this in Sketch/Graphics/base.py and most of it is
also mentioned in http://sketch.sourceforge.net/Doc/devguide-11.html


> II ) I want to add the possibility to draw HB splines, Catmull rom
> splines and x splines in Sketch. But which way could I take ?

I would probably try to use a plugin object for this.  

> Plugin
> or script ?  I'm not sure to understand the difference.

The main difference between a plugin and a script is in how it is loaded
into Skencil.  A plugin is in a directory automatically scanned by
Skencil and is loaded automatically when appropriate.  E.g. a plugin
implementing a new fileformat is imported when a file of that type is to
be read or written.  A plugin has to implement a certain interface for
this to work.  e.g. the module of an export filter has to have a
function called save accepting certain arguments.

A script OTOH is really just a function registered with
Sketch.Scripting.AddFunction (in 0.6, in 0.7 it's a little different,
but the principle is the same).  Usually the code for a script is put
into some module which is imported by ~/.sketch/userhooks.py

  Bernhard

-- 
Intevation GmbH                                 http://intevation.de/
Skencil                                http://sketch.sourceforge.net/
Thuban                                  http://thuban.intevation.org/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]