kicad-developers team mailing list archive
-
kicad-developers team
-
Mailing list archive
-
Message #29835
Re: Pcbnew Python Interface breakage?
-
To:
kicad-developers@xxxxxxxxxxxxxxxxxxx
-
From:
jp charras <jp.charras@xxxxxxxxxx>
-
Date:
Wed, 28 Jun 2017 09:03:50 +0200
-
In-reply-to:
<CAB+dmjiNgjh8m_K=RHc0ooN-raNLUZVxR8VuVeeu_i5-YPVWqg@mail.gmail.com>
-
User-agent:
Mozilla/5.0 (Windows NT 6.1; rv:52.0) Gecko/20100101 Thunderbird/52.2.1
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)
%}
Follow ups
References
-
Pcbnew Python Interface breakage?
From: Simon Küppers, 2017-06-25
-
Re: Pcbnew Python Interface breakage?
From: easyw, 2017-06-26
-
Re: Pcbnew Python Interface breakage?
From: Maciej Sumiński, 2017-06-26
-
Re: Pcbnew Python Interface breakage?
From: easyw, 2017-06-26
-
Re: Pcbnew Python Interface breakage?
From: Maciej Sumiński, 2017-06-26
-
Re: Pcbnew Python Interface breakage?
From: Kaspar Emanuel, 2017-06-26
-
Re: Pcbnew Python Interface breakage?
From: Maciej Sumiński, 2017-06-27
-
Re: Pcbnew Python Interface breakage?
From: Kaspar Emanuel, 2017-06-27
-
Re: Pcbnew Python Interface breakage?
From: Maciej Sumiński, 2017-06-27
-
Re: Pcbnew Python Interface breakage?
From: Kaspar Emanuel, 2017-06-27