pcbnew.i 3.88 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
/*
 * 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 pcbnew.i
 * @brief Specific pcbnew wrappers
 */


31
%module pcbnew
32 33 34

%feature("autodoc", "1");

35
%include "kicad.i"
36

37 38 39 40 41
// ignore a couple of items that generate warnings from swig built code

%ignore BOARD_ITEM::ZeroOffset;
%ignore D_PAD::m_PadSketchModePenSize;

42
// rename the Add method of classes to Add native, so we will handle
43
// the Add method in python
44

45 46
%rename(AddNative) *::Add;

47 48 49 50 51 52
%exception {
    try{
        $action
    }
    catch( IO_ERROR e )
    {
53 54 55
        std::string str = TO_UTF8( e.errorText );
        str += '\n';
        PyErr_SetString( PyExc_IOError, str.c_str() );
56 57 58 59
        return NULL;
    }
    catch( std::exception &e )
    {
60 61 62
        std::string str = e.what();
        str += '\n';
        PyErr_SetString( PyExc_IOError, str.c_str() );
63
        return NULL;
64 65 66 67 68 69 70 71 72
    }
    catch( ... )
    {
        SWIG_fail;
    }
}
%include exception.i


73 74
// this is what it must be included in the wrapper .cxx code to compile

75
%{
76
  #include <wx_python_helpers.h>
Miguel Angel Ajo's avatar
Miguel Angel Ajo committed
77 78
  #include <class_board_item.h>
  #include <class_board_connected_item.h>
79
  #include <class_board_design_settings.h>
Miguel Angel Ajo's avatar
Miguel Angel Ajo committed
80 81
  #include <class_board.h>
  #include <class_module.h>
82
  #include <class_track.h>
83
  #include <layers_id_colors_and_visibility.h>
Miguel Angel Ajo's avatar
Miguel Angel Ajo committed
84
  #include <class_pad.h>
85
  #include <pad_shapes.h>
Miguel Angel Ajo's avatar
Miguel Angel Ajo committed
86
  #include <class_netinfo.h>
87
  #include <class_pcb_text.h>
Miguel Angel Ajo's avatar
Miguel Angel Ajo committed
88 89 90 91 92 93 94 95 96 97
  #include <class_dimension.h>
  #include <class_drawsegment.h>
  #include <class_marker_pcb.h>
  #include <class_text_mod.h>
  #include <class_edge_mod.h>
  #include <dlist.h>
  #include <class_zone_settings.h>
  #include <class_netclass.h>
  #include <class_netinfo.h>
  #include <pcbnew_scripting_helpers.h>
98 99 100 101

  #include <plotcontroller.h>
  #include <pcb_plot_params.h>
  #include <colors.h>
102

Miguel Angel Ajo's avatar
Miguel Angel Ajo committed
103
  BOARD *GetBoard(); /* get current editor board */
104 105
%}

106

107
%{
Miguel Angel Ajo's avatar
Miguel Angel Ajo committed
108 109
  #include <io_mgr.h>
  #include <kicad_plugin.h>
110 111
%}

112
%include <class_board_item.h>
113
%include <class_board_connected_item.h>
114
%include <class_board_design_settings.h>
115 116 117
%include <class_board.h>
%include <class_module.h>
%include <class_track.h>
118
%include <layers_id_colors_and_visibility.h>
119
%include <class_pad.h>
120
%include <pad_shapes.h>
121 122 123
%include <class_netinfo.h>
%include <class_pcb_text.h>
%include <class_dimension.h>
124 125 126 127
%include <class_drawsegment.h>
%include <class_marker_pcb.h>
%include <class_text_mod.h>
%include <class_edge_mod.h>
128
%include <dlist.h>
129 130 131 132
%include <class_zone_settings.h>
%include <class_netclass.h>
%include <class_netinfo.h>

133 134 135 136 137
%include <plotcontroller.h>
%include <pcb_plot_params.h>
%include <plot_common.h>
%include <colors.h>

138
%include "board_item.i"
139

140
%include <pcbnew_scripting_helpers.h>
141

142

143 144 145 146
// ignore RELEASER as nested classes are still unsupported by swig
%ignore IO_MGR::RELEASER;
%include <io_mgr.h>
%include <kicad_plugin.h>
147

148

149
%include "board.i"
150
%include "module.i"
151
%include "plugins.i"
152
%include "units.i"
153

154