From 85ef7ee467f232231f2233e7d6223bd74d147a14 Mon Sep 17 00:00:00 2001 From: Dick Hollenbeck Date: Wed, 21 Sep 2016 14:08:04 -0500 Subject: [PATCH] Remove BOARD::Add() from board.i, since it is inherited from board_item_container.i --- pcbnew/swig/board.i | 13 ------------ pcbnew/swig/module.i | 48 ++++++++++++++++++++----------------------- pcbnew/swig/netinfo.i | 12 +++++++++++ 3 files changed, 34 insertions(+), 39 deletions(-) diff --git a/pcbnew/swig/board.i b/pcbnew/swig/board.i index a7f6cf8f48..3fe241c53a 100644 --- a/pcbnew/swig/board.i +++ b/pcbnew/swig/board.i @@ -177,16 +177,3 @@ HANDLE_EXCEPTIONS(BOARD::TracksInNetBetweenPoints) return netclassmap %} } - - -%feature("notabstract") NETINFO_ITEM; - -// http://swig.10945.n7.nabble.com/std-containers-and-pointers-td3728.html -%{ - namespace swig { - template <> struct traits { - typedef pointer_category category; - static const char* type_name() { return "NETINFO_ITEM"; } - }; - } -%} diff --git a/pcbnew/swig/module.i b/pcbnew/swig/module.i index 2c54c0f7c8..9d9009e747 100644 --- a/pcbnew/swig/module.i +++ b/pcbnew/swig/module.i @@ -27,8 +27,6 @@ * @brief Specific BOARD extensions and templates */ -%import dlist.i - %include class_module.h @@ -40,6 +38,11 @@ %} +// BOARD_ITEM_CONTAINER's interface functions will be implemented by SWIG +// automatically. + + +/* %extend MODULE { %pythoncode @@ -52,19 +55,9 @@ # add function, clears the thisown to avoid python from deleting # the object in the garbage collector # - - def Add(self,item): - - itemC = item.Cast() - - if type(itemC) is D_PAD: - item.thisown=0 - self.Pads().PushBack(itemC) - elif type(itemC) in [ TEXTE_PCB, DIMENSION, TEXTE_MODULE, DRAWSEGMENT,EDGE_MODULE]: - item.thisown = 0 - self.GraphicalItems().PushBack(item) %} } +*/ %pythoncode @@ -101,20 +94,23 @@ plug.FootprintLibIsWritable(lpath) %} + %{ - MODULE *PyModule_to_MODULE(PyObject *obj0) + +// 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)) { - void *argp; - int res1 = SWIG_ConvertPtr(obj0, &argp,SWIGTYPE_p_MODULE, 0 | 0 ); - if (!SWIG_IsOK(res1)) - { - SWIG_exception_fail(SWIG_ArgError(res1), "Converting object to MODULE*"); - } - - return (MODULE*)argp; - - fail: - return NULL; - + SWIG_exception_fail(SWIG_ArgError(res1), "Converting object to MODULE*"); } + + return (MODULE*) argp; + +fail: + return NULL; +} + %} diff --git a/pcbnew/swig/netinfo.i b/pcbnew/swig/netinfo.i index 74353a1cbe..7d5a67044f 100644 --- a/pcbnew/swig/netinfo.i +++ b/pcbnew/swig/netinfo.i @@ -3,3 +3,15 @@ %{ #include %} + +%feature("notabstract") NETINFO_ITEM; + +// http://swig.10945.n7.nabble.com/std-containers-and-pointers-td3728.html +%{ + namespace swig { + template <> struct traits { + typedef pointer_category category; + static const char* type_name() { return "NETINFO_ITEM"; } + }; + } +%}