2012-04-06 20:38:32 +00:00
|
|
|
/*
|
|
|
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
|
|
|
*
|
|
|
|
* Copyright (C) 2012 NBEE Embedded Systems, Miguel Angel Ajo <miguelangel@nbee.es>
|
|
|
|
* Copyright (C) 1992-2012 KiCad Developers, see AUTHORS.txt for contributors.
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
|
|
|
* of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, you may find one here:
|
|
|
|
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
|
|
|
* or you may search the http://www.gnu.org website for the version 2 license,
|
|
|
|
* or you may write to the Free Software Foundation, Inc.,
|
|
|
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @file module.i
|
|
|
|
* @brief Specific BOARD extensions and templates
|
|
|
|
*/
|
|
|
|
|
2016-09-21 01:07:41 +00:00
|
|
|
|
|
|
|
|
|
|
|
%include class_module.h
|
|
|
|
|
|
|
|
%rename(Get) operator MODULE*;
|
|
|
|
%template(MODULE_List) DLIST<MODULE>;
|
|
|
|
%{
|
|
|
|
#include <class_module.h>
|
|
|
|
%}
|
|
|
|
|
2012-04-06 20:38:32 +00:00
|
|
|
|
2016-09-21 19:08:04 +00:00
|
|
|
// BOARD_ITEM_CONTAINER's interface functions will be implemented by SWIG
|
2016-09-23 00:12:36 +00:00
|
|
|
// automatically and inherited by the python wrapper class.
|
2016-09-21 19:08:04 +00:00
|
|
|
|
|
|
|
|
|
|
|
/*
|
2012-04-06 20:38:32 +00:00
|
|
|
%extend MODULE
|
2014-10-02 17:09:32 +00:00
|
|
|
{
|
2016-09-21 01:07:41 +00:00
|
|
|
%pythoncode
|
|
|
|
%{
|
2014-10-02 17:09:32 +00:00
|
|
|
|
2012-04-06 20:38:32 +00:00
|
|
|
#def SaveToLibrary(self,filename):
|
|
|
|
# return SaveModuleToLibrary(filename,self)
|
2014-10-02 17:09:32 +00:00
|
|
|
|
2012-04-06 20:38:32 +00:00
|
|
|
#
|
|
|
|
# add function, clears the thisown to avoid python from deleting
|
|
|
|
# the object in the garbage collector
|
|
|
|
#
|
2016-09-21 01:07:41 +00:00
|
|
|
%}
|
2012-04-06 20:38:32 +00:00
|
|
|
}
|
2016-09-21 19:08:04 +00:00
|
|
|
*/
|
2012-04-06 20:38:32 +00:00
|
|
|
|
2014-10-02 17:09:32 +00:00
|
|
|
|
2016-09-21 01:07:41 +00:00
|
|
|
%pythoncode
|
|
|
|
%{
|
2014-10-02 17:09:32 +00:00
|
|
|
def GetPluginForPath(lpath):
|
2012-05-01 15:13:36 +00:00
|
|
|
return IO_MGR.PluginFind(IO_MGR.LEGACY)
|
2014-10-02 17:09:32 +00:00
|
|
|
|
|
|
|
def FootprintEnumerate(lpath):
|
2012-05-01 15:13:36 +00:00
|
|
|
plug = GetPluginForPath(lpath)
|
|
|
|
return plug.FootprintEnumerate(lpath)
|
2014-10-02 17:09:32 +00:00
|
|
|
|
|
|
|
def FootprintLoad(lpath,name):
|
2012-05-01 15:13:36 +00:00
|
|
|
plug = GetPluginForPath(lpath)
|
|
|
|
return plug.FootprintLoad(lpath,name)
|
2014-10-02 17:09:32 +00:00
|
|
|
|
|
|
|
def FootprintSave(lpath,module):
|
|
|
|
plug = GetPluginForPath(lpath)
|
2012-05-01 15:13:36 +00:00
|
|
|
return plug.FootprintSave(lpath,module)
|
2014-10-02 17:09:32 +00:00
|
|
|
|
|
|
|
def FootprintDelete(lpath,name):
|
2012-05-01 15:13:36 +00:00
|
|
|
plug = GetPluginForPath(lpath)
|
|
|
|
plug.FootprintDelete(lpath,name)
|
2014-10-02 17:09:32 +00:00
|
|
|
|
|
|
|
def FootprintLibCreate(lpath):
|
2012-05-01 15:13:36 +00:00
|
|
|
plug = GetPluginForPath(lpath)
|
|
|
|
plug.FootprintLibCreate(lpath)
|
2014-10-02 17:09:32 +00:00
|
|
|
|
|
|
|
def FootprintLibDelete(lpath):
|
2012-05-01 15:13:36 +00:00
|
|
|
plug = GetPluginForPath(lpath)
|
|
|
|
plug.FootprintLibDelete(lpath)
|
2014-10-02 17:09:32 +00:00
|
|
|
|
|
|
|
def FootprintIsWritable(lpath):
|
2012-05-01 15:13:36 +00:00
|
|
|
plug = GetPluginForPath(lpath)
|
|
|
|
plug.FootprintLibIsWritable(lpath)
|
2016-09-21 01:07:41 +00:00
|
|
|
%}
|
2012-05-10 08:53:05 +00:00
|
|
|
|
2016-09-21 19:08:04 +00:00
|
|
|
|
2012-05-10 08:53:05 +00:00
|
|
|
%{
|
2016-09-21 19:08:04 +00:00
|
|
|
|
|
|
|
// called from pcbnew/swig/pcbnew_footprint_wizards.cpp
|
|
|
|
MODULE* PyModule_to_MODULE(PyObject *obj0)
|
|
|
|
{
|
|
|
|
void* argp;
|
|
|
|
int res1 = SWIG_ConvertPtr(obj0, &argp,SWIGTYPE_p_MODULE, 0 | 0 );
|
|
|
|
if (!SWIG_IsOK(res1))
|
2012-05-10 08:53:05 +00:00
|
|
|
{
|
2016-09-21 19:08:04 +00:00
|
|
|
SWIG_exception_fail(SWIG_ArgError(res1), "Converting object to MODULE*");
|
|
|
|
}
|
2014-10-02 17:09:32 +00:00
|
|
|
|
2016-09-21 19:08:04 +00:00
|
|
|
return (MODULE*) argp;
|
2014-10-02 17:09:32 +00:00
|
|
|
|
2016-09-21 19:08:04 +00:00
|
|
|
fail:
|
|
|
|
return NULL;
|
|
|
|
}
|
2012-05-10 08:53:05 +00:00
|
|
|
|
2012-05-16 09:35:18 +00:00
|
|
|
%}
|