Add more HANDLE_EXCEPTIONS(), board.i refactoring.

This commit is contained in:
Dick Hollenbeck 2016-09-19 14:31:26 -05:00 committed by Wayne Stambaugh
parent 64232ce10c
commit d957670034
5 changed files with 71 additions and 46 deletions

View File

@ -510,14 +510,12 @@ add_dependencies( dsntest lib-dependencies )
target_link_libraries( pcbcommon 3d-viewer )
# kiway.so
# _kiway.so
if( false ) # future
#if( KICAD_SCRIPTING OR KICAD_SCRIPTING_MODULES )
#file( MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/scripting )
set( SWIG_FLAGS
-I${CMAKE_CURRENT_SOURCE_DIR}/../include
-I${CMAKE_CURRENT_SOURCE_DIR}/swig/wx
)
if( DEBUG )
@ -535,8 +533,6 @@ if( false ) # future
set( CMAKE_SWIG_FLAGS ${SWIG_FLAGS} )
#set( SWIG_OPTS -python -c++ -outdir ${CMAKE_CURRENT_BINARY_DIR} ${SWIG_FLAGS} )
include_directories( BEFORE ${INC_BEFORE} )
include_directories(
../common
@ -550,10 +546,6 @@ if( false ) # future
swig_add_module( kiway python
swig/kiway.i
#../common/kiway.cpp
#../common/project.cpp
#../common/pgm_base.cpp
#../common/
)
swig_link_libraries( kiway
@ -563,6 +555,12 @@ if( false ) # future
${PYTHON_LIBRARIES}
)
set_source_files_properties( ${swig_generated_file_fullname} PROPERTIES
# See section 16.3 "The SWIG runtime code"
# http://www.swig.org/Doc3.0/SWIGDocumentation.html#Modules_nn2
COMPILE_FLAGS "-DSWIG_TYPE_TABLE=WXPYTHON_TYPE_TABLE -Wno-delete-non-virtual-dtor"
)
if( MAKE_LINK_MAPS )
set_target_properties( _kiway PROPERTIES
LINK_FLAGS "${TO_LINKER},-cref ${TO_LINKER},-Map=_kiway.so.map"

View File

@ -2,15 +2,21 @@
//%module(directors="1") kiway
%module kiway
/*
%import _defs.i
%import _window.i
%import _toplvl.i
%threadWrapperOff // _defs.i turns on thread protection, turn it off
*/
%import(module="wx") wx_kiway_player_hierarchy.h
%include ki_exception.i // affects all that follow it
/*
By default we do not translate exceptions for EVERY C++ function since not every
C++ function throws, and that would be unused and very bulky mapping code.
Therefore please help gather the subset of C++ functions for this class that do
throw and add them here, before the class declarations.
*/
HANDLE_EXCEPTIONS(KIWAY::Player)
%include pgm_base.h
%include frame_type.h
%include mail_type.h
@ -21,7 +27,6 @@
%include kiway_player.i
HANDLE_EXCEPTIONS(KIWAY::Player)
%constant KIWAY Kiway;
@ -46,7 +51,17 @@ HANDLE_EXCEPTIONS(KIWAY::Player)
KIWAY Kiway( &Pgm(), KFCTL_PY_PROJECT_SUITE );
// a dummy to quiet linking with EDA_BASE_FRAME::config();
#include <kiface_i.h>
KIFACE_I& Kiface()
{
// This function should never be called. It is only referenced from
// EDA_BASE_FRAME::config() and this is only provided to satisfy the linker,
// not to be actually called.
wxLogFatalError( wxT( "Unexpected call to Kiface() in kicad/kicad.cpp" ) );
return (KIFACE_I&) *(KIFACE_I*) 0;
}
/**

View File

@ -1,18 +1,8 @@
// Swig interface to classes KIWAY_PLAYER and KIWAY_HOLDER
class wxFrame
{
};
class KIWAY_PLAYER : public wxFrame
{
};
%ignore wxFrame;
%ignore KIWAY_PLAYER;
//%include kiway_player.h
%include kiway_player.h
%{
#include <kiway_player.h>

View File

@ -39,12 +39,16 @@ throw and add them here, before the class declarations.
HANDLE_EXCEPTIONS(BOARD::TracksInNetBetweenPoints)
%include <class_board_design_settings.h>
%{
#include <class_board_design_settings.h>
%}
%{
#include <class_board.h>
#include <class_board_design_settings.h>
#include <layers_id_colors_and_visibility.h>
%}
@ -130,6 +134,9 @@ HANDLE_EXCEPTIONS(BOARD::TracksInNetBetweenPoints)
%}
%include class_zone_settings.h
%{
#include <class_zone_settings.h>
%}
%include class_netinfo.h
%include class_netclass.h

View File

@ -70,8 +70,6 @@ class BASE_SET {};
#include <wx_python_helpers.h>
#include <colors.h>
//#include <dlist.h>
#include <class_zone_settings.h>
#include <pcbnew_scripting_helpers.h>
#include <plotcontroller.h>
@ -82,13 +80,34 @@ class BASE_SET {};
%}
// ignore RELEASER as nested classes are still unsupported by swig
%ignore IO_MGR::RELEASER;
%include <io_mgr.h>
%{
#include <io_mgr.h>
%}
/*
By default we do not translate exceptions for EVERY C++ function since not every
C++ function throws, and that would be unused and very bulky mapping code.
Therefore please help gather the subset of C++ functions for this class that do
throw and add them here, before the class declarations.
*/
HANDLE_EXCEPTIONS(PLUGIN::Load)
HANDLE_EXCEPTIONS(PLUGIN::Save)
HANDLE_EXCEPTIONS(PLUGIN::FootprintEnumerate)
HANDLE_EXCEPTIONS(PLUGIN::FootprintLoad)
HANDLE_EXCEPTIONS(PLUGIN::FootprintSave)
HANDLE_EXCEPTIONS(PLUGIN::FootprintDelete)
%include <kicad_plugin.h>
%{
#include <kicad_plugin.h>
%}
%include <class_board_design_settings.h>
%include <plotcontroller.h>
%include <pcb_plot_params.h>
%include <plot_common.h>
@ -98,10 +117,6 @@ class BASE_SET {};
%include <pcbnew_scripting_helpers.h>
// ignore RELEASER as nested classes are still unsupported by swig
%ignore IO_MGR::RELEASER;
%include <io_mgr.h>
%include <kicad_plugin.h>
%include board.i
%include module.i