← Back to team overview

kicad-developers team mailing list archive

Re: Scripting

 

Thanks Chris it’d be awesome!!, ping me anytime if you need me to clarify  
or fix anything of the design.

A little bit in the heart of everything is this to let you “wrap” any given swig object (known by the library, of course):
https://github.com/KiCad/kicad-python/blob/master/kicad/obj.py

and the “new” method:

https://github.com/KiCad/kicad-python/blob/master/kicad/__init__.py#L28


In C++ you’d do something like this with operator overload in the constructor, but python knows nothing about operator overloading, since it’s weakly typed.  

Best,
Miguel Ángel Ajo


On Sunday 14 June 2015 at 14:48, Chris Pavlina wrote:

> Oh, sweet! I'll definitely contribute to this. Hopefully we can get it  
> in usable condition soon. Thanks!
>  
> On Sun, Jun 14, 2015 at 12:23:16PM +0200, Miguel Angel Ajo wrote:
> > I can't do more than agree, and this is why (very slowly) I'm working on
> > this:
> >  
> > https://github.com/kicad/kicad-python
> >  
> > https://github.com/KiCad/kicad-python/blob/master/doc/source/index.rst
> >  
> > https://github.com/KiCad/kicad-python/blob/master/kicad/pcbnew/board.py
> >  
> > https://github.com/KiCad/kicad-python/blob/master/tests/unit/pcbnew/test_pcbnew_board.py
> >  
> >  
> > This is a work that Piers Titus van der Torren started, and that I perverted
> > a bit to
> > add documentation, testing, and trying to keep uniformity across all object
> > interfaces.
> >  
> > If you want to contribute, it can be done via pull requests to the main
> > repository,
> > those are automatically checked by CI, and reported back to github.
> >  
> > I haven't wrote any rules yet, but I really believe we should:
> >  
> > 1) Document as we code
> > 2) Write unit tests as we code
> >  
> > So we avoid regressions and provide a very consistent API for the users,
> > where
> > we can detect regressions or any issues.
> >  
> >  
> > Chris Pavlina wrote:
> > >  
> > > wrt scripting and SWIG - SWIG's good for generating a low-level wrapper,
> > > but if we'd like scripting to go anywhere, I really think we should come
> > > up with a more scripting-friendly API and high-level wrapper. Something
> > > with more proper iterables, fewer integer enums, fewer getters and
> > > setters, objects that are fully and usefully introspectable at the
> > > console, etc. Fewer things like this scattered about:
> > >  
> > > http://ci.kicad-pcb.org/job/kicad-doxygen/ws/build/pcbnew/doxygen-python/html/classpcbnew_1_1MODULE.html#a549dccf2a9eecffa83f76cfe8d1a7d19
> > >  
> > > Anyone else interested in seeing scripting improve? I'd be willing to
> > > contribute to this.
> > >  
> > >  
> > > On Sat, Jun 13, 2015 at 05:26:58PM -0400, Wayne Stambaugh wrote:
> > > >  
> > > > On 6/12/2015 10:48 AM, Rob Maris wrote:
> > > > >  
> > > > > Hi,
> > > > >  
> > > > > I'm interested in adding Lua scripting to Kicad as an alternative to
> > > > > Python. Can anybody present some information about complexity and API in
> > > > > order to integrate a lua interpreter?
> > > > >  
> > > > > Regards,
> > > > >  
> > > > > Rob
> > > >  
> > > > Rob,
> > > >  
> > > > There has been some interest in lua in the past. I'm not opposed to
> > > > adding lua as another scripting language. I not sure if lua can be
> > > > swigged. That would be the preferred method for generating the lua
> > > > scripting libraries. To get an idea of the complexity of the kicad API,
> > > > look at the python swig code and the c++ code documentation at
> > > > kicad-pcb.org (http://kicad-pcb.org). At this time only Pcbnew is scripted. Eeschema is due a
> > > > major over hall after the next stable release so I expected it to be
> > > > scripted at that point. Also, we are pretty much in feature freeze for
> > > > the next stable release so anything major like supporting another
> > > > scripting language will have to wait until after the next stable release.
> > > >  
> > > > Cheers,
> > > >  
> > > > Wayne
> > > >  
> > > > _______________________________________________
> > > > Mailing list: https://launchpad.net/~kicad-developers
> > > > Post to : kicad-developers@xxxxxxxxxxxxxxxxxxx (mailto:kicad-developers@xxxxxxxxxxxxxxxxxxx)
> > > > Unsubscribe : https://launchpad.net/~kicad-developers
> > > > More help : https://help.launchpad.net/ListHelp
> > > >  
> > >  
> > >  
> > >  
> > > _______________________________________________
> > > Mailing list: https://launchpad.net/~kicad-developers
> > > Post to : kicad-developers@xxxxxxxxxxxxxxxxxxx (mailto:kicad-developers@xxxxxxxxxxxxxxxxxxx)
> > > Unsubscribe : https://launchpad.net/~kicad-developers
> > > More help : https://help.launchpad.net/ListHelp
> > >  
> >  
> >  
>  
>  
> _______________________________________________
> Mailing list: https://launchpad.net/~kicad-developers
> Post to : kicad-developers@xxxxxxxxxxxxxxxxxxx (mailto:kicad-developers@xxxxxxxxxxxxxxxxxxx)
> Unsubscribe : https://launchpad.net/~kicad-developers
> More help : https://help.launchpad.net/ListHelp
>  
>  



References