Le 27/06/2017 à 17:03, Kaspar Emanuel a écrit : > I am just looking at writing a fix at > https://github.com/KiCad/kicad-source-mirror/blob/37f8c83c5bc5e8a61cc25d69de569dee7eea0e9f/pcbnew/swig/module.i#L69 > > If you can see a quick fix you could probably save me a lot of time as I am > planning on getting my > KiCad build set up again and submitting a patch. >
Hi Kasper, Please, test this patch. -- Jean-Pierre CHARRAS
pcbnew/swig/module.i | 73 +++++++++++++++++++++++++++++++++++----------------- 1 file changed, 50 insertions(+), 23 deletions(-) diff --git a/pcbnew/swig/module.i b/pcbnew/swig/module.i index b03c73c..600011e 100644 --- a/pcbnew/swig/module.i +++ b/pcbnew/swig/module.i @@ -60,39 +60,66 @@ %} } +%extend PLUGIN +{ + // This version of FootprintEnumerate is for Python scripts, because the c++ + // VERSION of FootprintEnumerate is not easy to handle in these Python scripts + + wxArrayString footprintPyEnumerate( const wxString& aLibraryPath ) + { + wxArrayString footprintNames; + + try + { + self->FootprintEnumerate( footprintNames, aLibraryPath ); + } + catch( const IO_ERROR& error ) + { + } + + return footprintNames; + } + + %pythoncode + %{ + def FootprintEnumerate(self, libname): + return self.footprintPyEnumerate( libname ) + %} +} %pythoncode %{ - def GetPluginForPath(lpath): - return IO_MGR.PluginFind(IO_MGR.LEGACY) + def GetPluginForPath(libname): + plugin_type = IO_MGR.GuessPluginTypeFromLibPath( libname ); + return IO_MGR.PluginFind(plugin_type) - def FootprintEnumerate(lpath): - plug = GetPluginForPath(lpath) - return plug.FootprintEnumerate(lpath) + def FootprintEnumerate(libname): + plug = GetPluginForPath(libname) + return plug.FootprintEnumerate(libname) - def FootprintLoad(lpath,name): - plug = GetPluginForPath(lpath) - return plug.FootprintLoad(lpath,name) + def FootprintLoad(libname,name): + plug = GetPluginForPath(libname) + return plug.FootprintLoad(libname,name) - def FootprintSave(lpath,module): - plug = GetPluginForPath(lpath) - return plug.FootprintSave(lpath,module) + def FootprintSave(libname,module): + plug = GetPluginForPath(libname) + return plug.FootprintSave(libname,module) - def FootprintDelete(lpath,name): - plug = GetPluginForPath(lpath) - plug.FootprintDelete(lpath,name) + def FootprintDelete(libname,name): + plug = GetPluginForPath(libname) + plug.FootprintDelete(libname,name) - def FootprintLibCreate(lpath): - plug = GetPluginForPath(lpath) - plug.FootprintLibCreate(lpath) + def FootprintLibCreate(libname): + plug = GetPluginForPath(libname) + plug.FootprintLibCreate(libname) - def FootprintLibDelete(lpath): - plug = GetPluginForPath(lpath) - plug.FootprintLibDelete(lpath) + def FootprintLibDelete(libname): + plug = GetPluginForPath(libname) + plug.FootprintLibDelete(libname) - def FootprintIsWritable(lpath): - plug = GetPluginForPath(lpath) - plug.FootprintLibIsWritable(lpath) + def FootprintIsWritable(libname): + plug = GetPluginForPath(libname) + plug.FootprintLibIsWritable(libname) %}
_______________________________________________ Mailing list: https://launchpad.net/~kicad-developers Post to : kicad-developers@lists.launchpad.net Unsubscribe : https://launchpad.net/~kicad-developers More help : https://help.launchpad.net/ListHelp