← Back to team overview

kicad-developers team mailing list archive

Re: Python binding of enums

 

2012/8/9 Lorenzo Marcantonio <l.marcantonio@xxxxxxxxxxxx>:
> On Thu, Aug 09, 2012 at 11:53:42AM -0500, Dick Hollenbeck wrote:

> Then a facade between python and wx would be the best; also it would be
> an 'insulation layer' from C++ specific stuff, providing context and
> translation (for example 'hiding' the whole BIU stuff and omitting
> internal-only interfaces).

I thought about that, but then on what kind of measurements? mm, or inches? ,
we could add extension methods to wxPoint and wxSize to allow
conversion from/to measurements, now we have FromMM(xx)  ToMM(xx) ,
etc.

>
> As an example: do you *really* want to expose to the python users
> functions like EnsureTextCtrlWidth, ProcessExecute or the drawing
> functions?

Well, that's was really weighted when we started the scripting
implementation, we could "clone" all our exposed classes interfaces in
the .i files, or we could just suck up all the header files of any
interest to us.

This way we:

   * Save an awful amount of man/hours.
   * The moment a class is updated in the .h with new (public) methods
it gets updated on the python side at compilation time, no human
rework needed.

But:

   * We cannot manually document (with pydoc style) the classes and methods.
   * We expose things we wouldn't like too

Anyway, this last unwanted "feature" could be avoided with the use of
"ignore" clauses into the .i swig files, that could make a lot of
sense.

Also we have the #ifdef SWIG that Dick told us about

>
> IMHO python classes should be tinked about and defined separately... It
> doesn't seem a good idea to expose the innards of pcbnew in this way, to
> me...

If we did it that way, we wouldn't have scripting now (I think)
because it's a ton of work, even more when I'm still learning about
KiCAD internals, which is huge!! :)

The day we have time enough, if we find the benefit interesting enough
we could do it just rewriting the .i files (I think it's the only
change we might need), but , it would be a long term maintenance cost
(compared to the drawbacks of over-exposing).

Cheers :-)
Mike,

>
> --
> Lorenzo Marcantonio
> Logos Srl
>
> _______________________________________________
> Mailing list: https://launchpad.net/~kicad-developers
> Post to     : kicad-developers@xxxxxxxxxxxxxxxxxxx
> Unsubscribe : https://launchpad.net/~kicad-developers
> More help   : https://help.launchpad.net/ListHelp



-- 

Miguel Angel Ajo Pelayo
http://www.nbee.es
+34 636 52 25 69
skype: ajoajoajo


Follow ups

References