← Back to team overview

kicad-developers team mailing list archive

Re: [PATCH] Add/modify python APIs for querying available pcbnew footprints

 

Miles,

Please configure your editor to remove tailing white space and follow
the kicad coding policy for formatting the c++ code.

You have mixed the footprint enumeration of symbol library table entries
and the io plugin which is confusing.  These enumerations have separate
intentions and should not be mixed.  If you need to open a footprint
library outside of the footprint library table, you should use PLUGIN
directly.  I think this kind of code belongs in your own personal
library.  It's a bit too high level for kicad python api use.

The FOOTPRINT_INFO helper should be using LIB_ID not wxString to look up
footprints.  I think this could be useful once you fix LIB_ID issue.

The autodoc.i makes sense for providing more detailed api documention
but I thought you could use the """ """ pydoc strings for this as well
which would be easier to read.  Maybe I'm not fully understanding the
autodoc.i feature.

Cheers,

Wayne

On 3/16/2018 11:25 AM, miles mccoo wrote:
> 
> Note: I have attempted to follow the kicad coding standards. Surely,
> there's something  that I missed.
> Please, instead of: "syntax error. Please see the coding guidelines",
> please give an idea of the nature of things I missed. ;-) 
> 
> 
> This change adds the python apis: GetLogicalLibs and FootprintInfo.
> Extends FootprintEnumerate
> 
> *GetLogicalLibs* will return the list of available footprint libraries
> *FootprintEnumerate* lists the footprints in a library. It used to only
> take a path to a .pretty library. Now,
> it also excepts a library name
> *FootprintInfo* will return basic information about a particular
> footprint (num pads...)
> 
> 
> 
> *A couple of interesting ways in which this patch may be different from
> other python interface patches:*
> created the file autodoc.i which gives help messages (docstrings as they
> are called in python) for the new APIs. The default docstrings generated
> by SWIG are often not that helpful. knowing that a function takes a
> string is not enough. What should that string contain. It seemed to me
> these messages should be together.
> 
> created the file swig_typemaps.i: a vector<int>, by default is returned
> as a point to a vector instance. in swig_typemaps.i should go directives
> for when to expand stl templates as well as customized transformations
> of helper classes.
> 
> exposed pcb_edit_frame pointer stored in pcbnew_scripting_helpers to
> other parts of the SWIG files. This doesn't expose it to python.
> pcb_edit_frame has a lot of interesting methods and also many that
> should be excluded.
> 
> 
> Thank you to Orson (Maciej Sumiński) and Jeff Young for their hints in
> this thread:
> https://lists.launchpad.net/kicad-developers/msg34925.html
> 
> 
>  
> 
> Miles
> 
> 
> 
> for personal reference: patch 7/8
> 
> 
> _______________________________________________
> 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
> 


References