2013-03-15 14:27:18 +01:00
|
|
|
/*
|
|
|
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
|
|
|
*
|
|
|
|
* Copyright (C) 2013 NBEE Embedded Systems SL, Miguel Angel Ajo <miguelangel@ajo.es>
|
|
|
|
* Copyright (C) 2013 KiCad Developers, see CHANGELOG.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
|
|
|
|
*/
|
|
|
|
|
2012-05-05 22:18:47 +02:00
|
|
|
/**
|
|
|
|
* @file pcbnew_footprint_wizards.cpp
|
2012-05-09 19:37:25 +02:00
|
|
|
* @brief Class PCBNEW_PYTHON_FOOTPRINT_WIZARDS
|
2012-05-05 22:18:47 +02:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include "pcbnew_footprint_wizards.h"
|
2012-08-02 19:24:53 +02:00
|
|
|
#include <python_scripting.h>
|
2012-05-05 22:18:47 +02:00
|
|
|
#include <stdio.h>
|
|
|
|
|
2013-03-11 03:09:48 -05:00
|
|
|
|
|
|
|
PYTHON_FOOTPRINT_WIZARD::PYTHON_FOOTPRINT_WIZARD( PyObject* aWizard )
|
2012-05-05 22:18:47 +02:00
|
|
|
{
|
2013-03-15 17:35:24 +01:00
|
|
|
PyLOCK lock;
|
2013-03-11 03:09:48 -05:00
|
|
|
|
2013-03-15 17:35:24 +01:00
|
|
|
this->m_PyWizard = aWizard;
|
2012-09-24 18:03:03 +02:00
|
|
|
Py_XINCREF( aWizard );
|
2012-05-05 22:18:47 +02:00
|
|
|
}
|
|
|
|
|
2013-03-11 03:09:48 -05:00
|
|
|
|
2012-05-09 19:37:25 +02:00
|
|
|
PYTHON_FOOTPRINT_WIZARD::~PYTHON_FOOTPRINT_WIZARD()
|
2012-05-05 22:18:47 +02:00
|
|
|
{
|
2013-03-15 17:35:24 +01:00
|
|
|
PyLOCK lock;
|
2013-03-11 03:09:48 -05:00
|
|
|
|
2012-07-31 23:00:33 +02:00
|
|
|
Py_XDECREF( this->m_PyWizard );
|
2012-05-05 22:18:47 +02:00
|
|
|
}
|
|
|
|
|
2013-03-11 03:09:48 -05:00
|
|
|
|
|
|
|
PyObject* PYTHON_FOOTPRINT_WIZARD::CallMethod( const char* aMethod, PyObject* aArglist )
|
2012-05-05 22:18:47 +02:00
|
|
|
{
|
2013-03-15 17:35:24 +01:00
|
|
|
PyLOCK lock;
|
2012-09-24 18:03:03 +02:00
|
|
|
|
2013-03-11 03:09:48 -05:00
|
|
|
// pFunc is a new reference to the desired method
|
2013-03-15 17:35:24 +01:00
|
|
|
PyObject* pFunc = PyObject_GetAttrString( this->m_PyWizard, aMethod );
|
2012-09-24 18:03:03 +02:00
|
|
|
|
2013-03-11 03:09:48 -05:00
|
|
|
if( pFunc && PyCallable_Check( pFunc ) )
|
2012-05-05 22:18:47 +02:00
|
|
|
{
|
2013-03-11 03:09:48 -05:00
|
|
|
PyObject* result = PyObject_CallObject( pFunc, aArglist );
|
2012-08-01 14:50:21 +02:00
|
|
|
|
2013-03-11 03:09:48 -05:00
|
|
|
if( PyErr_Occurred() )
|
2012-05-05 22:18:47 +02:00
|
|
|
{
|
2013-03-15 17:35:24 +01:00
|
|
|
wxString message;
|
|
|
|
PyObject* t;
|
|
|
|
PyObject* v;
|
|
|
|
PyObject* b;
|
2013-03-11 03:09:48 -05:00
|
|
|
|
2012-07-31 23:00:33 +02:00
|
|
|
PyErr_Fetch( &t, &v, &b );
|
2013-03-15 17:35:24 +01:00
|
|
|
message.Printf( wxT( "calling %s()\n"
|
|
|
|
"Exception: %s\n"
|
|
|
|
" : %s\n" ),
|
|
|
|
aMethod,
|
|
|
|
FROM_UTF8( PyString_AsString( PyObject_Str( v ) ) ),
|
|
|
|
FROM_UTF8( PyString_AsString( PyObject_Str( b ) ) )
|
2013-03-15 14:27:18 +01:00
|
|
|
);
|
|
|
|
|
|
|
|
wxMessageBox( message,
|
|
|
|
wxT( "Exception on python footprint wizard code" ),
|
2013-03-15 17:35:24 +01:00
|
|
|
wxICON_ERROR | wxOK );
|
2012-05-05 22:18:47 +02:00
|
|
|
}
|
2012-08-01 14:50:21 +02:00
|
|
|
|
2013-03-11 03:09:48 -05:00
|
|
|
if( result )
|
2012-05-05 22:18:47 +02:00
|
|
|
{
|
2012-07-31 23:00:33 +02:00
|
|
|
Py_XDECREF( pFunc );
|
|
|
|
return result;
|
2012-05-05 22:18:47 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2012-07-31 23:00:33 +02:00
|
|
|
printf( "method not found, or not callable: %s\n", aMethod );
|
2012-05-05 22:18:47 +02:00
|
|
|
}
|
2012-09-24 18:03:03 +02:00
|
|
|
|
2013-03-11 03:09:48 -05:00
|
|
|
if( pFunc )
|
2012-07-31 23:00:33 +02:00
|
|
|
Py_XDECREF( pFunc );
|
2012-09-24 18:03:03 +02:00
|
|
|
|
2012-05-05 22:18:47 +02:00
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2013-03-11 03:09:48 -05:00
|
|
|
|
|
|
|
wxString PYTHON_FOOTPRINT_WIZARD::CallRetStrMethod( const char* aMethod, PyObject* aArglist )
|
2012-05-05 22:18:47 +02:00
|
|
|
{
|
2013-03-11 03:09:48 -05:00
|
|
|
wxString ret;
|
|
|
|
PyLOCK lock;
|
2012-09-24 18:03:03 +02:00
|
|
|
|
2013-03-15 17:35:24 +01:00
|
|
|
PyObject* result = CallMethod( aMethod, aArglist );
|
|
|
|
|
2013-03-11 03:09:48 -05:00
|
|
|
if( result )
|
2012-05-05 22:18:47 +02:00
|
|
|
{
|
2013-03-15 17:35:24 +01:00
|
|
|
const char* str_res = PyString_AsString( result );
|
|
|
|
ret = FROM_UTF8( str_res );
|
|
|
|
Py_DECREF( result );
|
2012-05-05 22:18:47 +02:00
|
|
|
}
|
2013-03-15 17:35:24 +01:00
|
|
|
|
2012-05-05 22:18:47 +02:00
|
|
|
return ret;
|
|
|
|
}
|
2012-05-10 01:04:08 +02:00
|
|
|
|
2013-03-11 03:09:48 -05:00
|
|
|
|
2013-03-15 17:35:24 +01:00
|
|
|
wxArrayString PYTHON_FOOTPRINT_WIZARD::CallRetArrayStrMethod( const char* aMethod,
|
|
|
|
PyObject* aArglist )
|
2012-05-10 01:04:08 +02:00
|
|
|
{
|
2013-03-15 17:35:24 +01:00
|
|
|
wxArrayString ret;
|
|
|
|
wxString str_item;
|
|
|
|
PyLOCK lock;
|
2012-09-24 18:03:03 +02:00
|
|
|
|
2013-03-15 17:35:24 +01:00
|
|
|
PyObject* result = CallMethod( aMethod, aArglist );
|
2012-09-24 18:03:03 +02:00
|
|
|
|
2013-03-11 03:09:48 -05:00
|
|
|
if( result )
|
2012-05-10 08:44:08 +02:00
|
|
|
{
|
2013-03-15 17:35:24 +01:00
|
|
|
if( !PyList_Check( result ) )
|
|
|
|
{
|
|
|
|
Py_DECREF( result );
|
|
|
|
ret.Add( wxT(
|
|
|
|
"PYTHON_FOOTPRINT_WIZARD::CallRetArrayStrMethod, result is not a list" ),
|
|
|
|
1 );
|
|
|
|
return ret;
|
|
|
|
}
|
2012-08-01 14:50:21 +02:00
|
|
|
|
2013-03-15 17:35:24 +01:00
|
|
|
int list_size = PyList_Size( result );
|
2012-09-24 18:03:03 +02:00
|
|
|
|
2013-03-15 17:35:24 +01:00
|
|
|
for( int n = 0; n<list_size; n++ )
|
|
|
|
{
|
|
|
|
PyObject* element = PyList_GetItem( result, n );
|
2013-03-11 03:09:48 -05:00
|
|
|
|
|
|
|
const char* str_res = PyString_AsString( element );
|
2012-05-10 01:04:08 +02:00
|
|
|
|
2013-03-15 17:35:24 +01:00
|
|
|
str_item = FROM_UTF8( str_res );
|
2012-07-31 23:00:33 +02:00
|
|
|
ret.Add( str_item, 1 );
|
2013-03-15 17:35:24 +01:00
|
|
|
}
|
2012-09-24 18:03:03 +02:00
|
|
|
|
2013-03-15 17:35:24 +01:00
|
|
|
Py_DECREF( result );
|
2012-05-10 08:44:08 +02:00
|
|
|
}
|
2012-09-24 18:03:03 +02:00
|
|
|
|
2012-05-10 08:44:08 +02:00
|
|
|
return ret;
|
2012-05-10 01:04:08 +02:00
|
|
|
}
|
|
|
|
|
2013-03-11 03:09:48 -05:00
|
|
|
|
2012-05-09 19:37:25 +02:00
|
|
|
wxString PYTHON_FOOTPRINT_WIZARD::GetName()
|
2012-05-05 22:18:47 +02:00
|
|
|
{
|
2013-03-15 17:35:24 +01:00
|
|
|
PyLOCK lock;
|
2013-03-11 03:09:48 -05:00
|
|
|
|
2012-07-31 23:00:33 +02:00
|
|
|
return CallRetStrMethod( "GetName" );
|
2012-05-05 22:18:47 +02:00
|
|
|
}
|
|
|
|
|
2013-03-11 03:09:48 -05:00
|
|
|
|
2012-05-09 19:37:25 +02:00
|
|
|
wxString PYTHON_FOOTPRINT_WIZARD::GetImage()
|
2012-05-05 22:18:47 +02:00
|
|
|
{
|
2013-03-15 17:35:24 +01:00
|
|
|
PyLOCK lock;
|
2013-03-11 03:09:48 -05:00
|
|
|
|
2012-07-31 23:00:33 +02:00
|
|
|
return CallRetStrMethod( "GetImage" );
|
2012-05-05 22:18:47 +02:00
|
|
|
}
|
|
|
|
|
2013-03-11 03:09:48 -05:00
|
|
|
|
2012-05-09 19:37:25 +02:00
|
|
|
wxString PYTHON_FOOTPRINT_WIZARD::GetDescription()
|
2012-05-05 22:18:47 +02:00
|
|
|
{
|
2013-03-15 17:35:24 +01:00
|
|
|
PyLOCK lock;
|
2013-03-11 03:09:48 -05:00
|
|
|
|
2012-07-31 23:00:33 +02:00
|
|
|
return CallRetStrMethod( "GetDescription" );
|
2012-05-05 22:18:47 +02:00
|
|
|
}
|
|
|
|
|
2013-03-11 03:09:48 -05:00
|
|
|
|
2012-05-09 19:37:25 +02:00
|
|
|
int PYTHON_FOOTPRINT_WIZARD::GetNumParameterPages()
|
2012-05-05 22:18:47 +02:00
|
|
|
{
|
2013-03-11 03:09:48 -05:00
|
|
|
int ret = 0;
|
|
|
|
PyLOCK lock;
|
2012-09-24 18:03:03 +02:00
|
|
|
|
2013-03-11 03:09:48 -05:00
|
|
|
// Time to call the callback
|
2013-03-15 17:35:24 +01:00
|
|
|
PyObject* result = CallMethod( "GetNumParameterPages", NULL );
|
2012-09-24 18:03:03 +02:00
|
|
|
|
2013-03-11 03:09:48 -05:00
|
|
|
if( result )
|
2012-05-05 22:18:47 +02:00
|
|
|
{
|
2013-03-15 17:35:24 +01:00
|
|
|
if( !PyInt_Check( result ) )
|
2012-07-31 23:00:33 +02:00
|
|
|
return -1;
|
2012-09-24 18:03:03 +02:00
|
|
|
|
2013-03-15 17:35:24 +01:00
|
|
|
ret = PyInt_AsLong( result );
|
|
|
|
Py_DECREF( result );
|
2012-05-05 22:18:47 +02:00
|
|
|
}
|
2013-03-11 03:09:48 -05:00
|
|
|
|
2012-05-05 22:18:47 +02:00
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2013-03-11 03:09:48 -05:00
|
|
|
|
2012-07-31 23:00:33 +02:00
|
|
|
wxString PYTHON_FOOTPRINT_WIZARD::GetParameterPageName( int aPage )
|
2012-05-05 22:18:47 +02:00
|
|
|
{
|
2013-03-11 03:09:48 -05:00
|
|
|
wxString ret;
|
|
|
|
PyLOCK lock;
|
|
|
|
|
|
|
|
// Time to call the callback
|
2013-03-15 17:35:24 +01:00
|
|
|
PyObject* arglist = Py_BuildValue( "(i)", aPage );
|
|
|
|
PyObject* result = CallMethod( "GetParameterPageName", arglist );
|
2012-09-24 18:03:03 +02:00
|
|
|
|
2012-07-31 23:00:33 +02:00
|
|
|
Py_DECREF( arglist );
|
2012-09-24 18:03:03 +02:00
|
|
|
|
2013-03-11 03:09:48 -05:00
|
|
|
if( result )
|
2012-05-05 22:18:47 +02:00
|
|
|
{
|
2013-03-15 17:35:24 +01:00
|
|
|
const char* str_res = PyString_AsString( result );
|
|
|
|
ret = FROM_UTF8( str_res );
|
|
|
|
Py_DECREF( result );
|
2012-05-05 22:18:47 +02:00
|
|
|
}
|
2013-03-15 17:35:24 +01:00
|
|
|
|
2012-05-05 22:18:47 +02:00
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2013-03-11 03:09:48 -05:00
|
|
|
|
2012-07-31 23:00:33 +02:00
|
|
|
wxArrayString PYTHON_FOOTPRINT_WIZARD::GetParameterNames( int aPage )
|
2012-05-05 22:18:47 +02:00
|
|
|
{
|
2013-03-15 17:35:24 +01:00
|
|
|
wxArrayString ret;
|
|
|
|
PyLOCK lock;
|
|
|
|
|
|
|
|
PyObject* arglist = Py_BuildValue( "(i)", aPage );
|
2012-09-24 18:03:03 +02:00
|
|
|
|
2012-07-31 23:00:33 +02:00
|
|
|
ret = CallRetArrayStrMethod( "GetParameterNames", arglist );
|
|
|
|
Py_DECREF( arglist );
|
2012-09-24 18:03:03 +02:00
|
|
|
|
2013-03-15 17:35:24 +01:00
|
|
|
for( unsigned i = 0; i<ret.GetCount(); i++ )
|
2012-09-24 18:03:03 +02:00
|
|
|
{
|
2013-03-15 17:35:24 +01:00
|
|
|
wxString rest;
|
|
|
|
wxString item = ret[i];
|
|
|
|
|
2013-03-11 03:09:48 -05:00
|
|
|
if( item.StartsWith( wxT( "*" ), &rest ) )
|
2012-07-23 00:23:17 +02:00
|
|
|
{
|
2013-03-15 17:35:24 +01:00
|
|
|
ret[i] = rest;
|
2012-07-23 00:23:17 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2013-03-11 03:09:48 -05:00
|
|
|
|
2012-07-31 23:00:33 +02:00
|
|
|
wxArrayString PYTHON_FOOTPRINT_WIZARD::GetParameterTypes( int aPage )
|
2012-07-23 00:23:17 +02:00
|
|
|
{
|
2013-03-11 03:09:48 -05:00
|
|
|
wxArrayString ret;
|
|
|
|
PyLOCK lock;
|
2012-09-24 18:03:03 +02:00
|
|
|
|
2013-03-15 17:35:24 +01:00
|
|
|
PyObject* arglist = Py_BuildValue( "(i)", aPage );
|
|
|
|
|
2012-07-31 23:00:33 +02:00
|
|
|
ret = CallRetArrayStrMethod( "GetParameterNames", arglist );
|
2013-03-11 03:09:48 -05:00
|
|
|
Py_DECREF( arglist );
|
2012-09-24 18:03:03 +02:00
|
|
|
|
2013-03-15 17:35:24 +01:00
|
|
|
for( unsigned i = 0; i<ret.GetCount(); i++ )
|
2012-09-24 18:03:03 +02:00
|
|
|
{
|
2013-03-15 17:35:24 +01:00
|
|
|
wxString rest;
|
|
|
|
wxString item = ret[i];
|
|
|
|
|
2013-03-11 03:09:48 -05:00
|
|
|
if( item.StartsWith( wxT( "*" ), &rest ) )
|
2012-07-23 00:23:17 +02:00
|
|
|
{
|
2013-03-11 03:09:48 -05:00
|
|
|
ret[i] = wxT( "UNITS" ); // units
|
2012-07-23 00:23:17 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2013-03-11 03:09:48 -05:00
|
|
|
ret[i] = wxT( "IU" ); // internal units
|
2012-07-23 00:23:17 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-05-10 08:44:08 +02:00
|
|
|
return ret;
|
2012-05-05 22:18:47 +02:00
|
|
|
}
|
|
|
|
|
2012-07-23 00:23:17 +02:00
|
|
|
|
2012-07-31 23:00:33 +02:00
|
|
|
wxArrayString PYTHON_FOOTPRINT_WIZARD::GetParameterValues( int aPage )
|
2012-05-05 22:18:47 +02:00
|
|
|
{
|
2013-03-15 17:35:24 +01:00
|
|
|
PyLOCK lock;
|
2013-03-11 03:09:48 -05:00
|
|
|
|
2013-03-15 17:35:24 +01:00
|
|
|
PyObject* arglist = Py_BuildValue( "(i)", aPage );
|
2013-03-11 03:09:48 -05:00
|
|
|
|
2013-03-15 17:35:24 +01:00
|
|
|
wxArrayString ret = CallRetArrayStrMethod( "GetParameterValues", arglist );
|
2012-09-24 18:03:03 +02:00
|
|
|
|
2012-07-31 23:00:33 +02:00
|
|
|
Py_DECREF( arglist );
|
2012-09-24 18:03:03 +02:00
|
|
|
|
2012-05-10 10:53:05 +02:00
|
|
|
return ret;
|
2012-05-05 22:18:47 +02:00
|
|
|
}
|
|
|
|
|
2013-03-15 17:35:24 +01:00
|
|
|
|
2012-07-31 23:00:33 +02:00
|
|
|
wxArrayString PYTHON_FOOTPRINT_WIZARD::GetParameterErrors( int aPage )
|
2012-05-05 22:18:47 +02:00
|
|
|
{
|
2013-03-15 17:35:24 +01:00
|
|
|
PyLOCK lock;
|
|
|
|
|
|
|
|
PyObject* arglist = Py_BuildValue( "(i)", aPage );
|
2013-03-11 03:09:48 -05:00
|
|
|
|
2013-03-15 17:35:24 +01:00
|
|
|
wxArrayString ret = CallRetArrayStrMethod( "GetParameterErrors", arglist );
|
2012-09-24 18:03:03 +02:00
|
|
|
|
2012-07-31 23:00:33 +02:00
|
|
|
Py_DECREF( arglist );
|
2012-09-24 18:03:03 +02:00
|
|
|
|
2012-05-05 22:18:47 +02:00
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2013-03-11 03:09:48 -05:00
|
|
|
|
2012-07-31 23:00:33 +02:00
|
|
|
wxString PYTHON_FOOTPRINT_WIZARD::SetParameterValues( int aPage, wxArrayString& aValues )
|
2012-05-16 11:35:18 +02:00
|
|
|
{
|
2013-03-15 17:35:24 +01:00
|
|
|
int len = aValues.size();
|
2012-09-24 18:03:03 +02:00
|
|
|
|
2013-03-15 17:35:24 +01:00
|
|
|
PyLOCK lock;
|
2013-03-11 03:09:48 -05:00
|
|
|
|
2013-03-15 17:35:24 +01:00
|
|
|
PyObject* py_list = PyList_New( len );
|
2012-09-24 18:03:03 +02:00
|
|
|
|
2013-03-15 17:35:24 +01:00
|
|
|
for( int i = 0; i<len; i++ )
|
2012-05-16 11:35:18 +02:00
|
|
|
{
|
2013-03-15 17:35:24 +01:00
|
|
|
wxString str = aValues[i];
|
|
|
|
PyObject* py_str = PyString_FromString( (const char*) str.mb_str() );
|
2012-07-31 23:00:33 +02:00
|
|
|
PyList_SetItem( py_list, i, py_str );
|
2012-05-16 11:35:18 +02:00
|
|
|
}
|
2012-09-24 18:03:03 +02:00
|
|
|
|
2013-03-15 17:35:24 +01:00
|
|
|
PyObject* arglist;
|
2012-09-24 18:03:03 +02:00
|
|
|
|
2013-03-12 01:37:45 +01:00
|
|
|
arglist = Py_BuildValue( "(i,O)", aPage, py_list );
|
2013-03-15 17:35:24 +01:00
|
|
|
wxString res = CallRetStrMethod( "SetParameterValues", arglist );
|
2012-07-31 23:00:33 +02:00
|
|
|
Py_DECREF( arglist );
|
2012-09-24 18:03:03 +02:00
|
|
|
|
2012-05-16 11:35:18 +02:00
|
|
|
return res;
|
|
|
|
}
|
|
|
|
|
2012-05-10 10:53:05 +02:00
|
|
|
|
2013-03-11 03:09:48 -05:00
|
|
|
// this is a SWIG function declaration -from module.i
|
|
|
|
MODULE* PyModule_to_MODULE( PyObject* obj0 );
|
|
|
|
|
|
|
|
|
|
|
|
MODULE* PYTHON_FOOTPRINT_WIZARD::GetModule()
|
2012-05-05 22:18:47 +02:00
|
|
|
{
|
2013-03-11 03:09:48 -05:00
|
|
|
PyLOCK lock;
|
2012-07-31 23:00:33 +02:00
|
|
|
|
2013-03-11 03:09:48 -05:00
|
|
|
PyObject* result = CallMethod( "GetModule", NULL );
|
2012-09-24 18:03:03 +02:00
|
|
|
|
2013-03-11 03:09:48 -05:00
|
|
|
if( !result )
|
|
|
|
return NULL;
|
2012-08-01 14:50:21 +02:00
|
|
|
|
2013-03-11 03:09:48 -05:00
|
|
|
PyObject* obj = PyObject_GetAttrString( result, "this" );
|
2012-09-24 18:03:03 +02:00
|
|
|
|
2013-03-11 03:09:48 -05:00
|
|
|
if( PyErr_Occurred() )
|
2012-07-31 23:00:33 +02:00
|
|
|
PyErr_Print();
|
2012-08-01 14:50:21 +02:00
|
|
|
|
2013-03-11 03:09:48 -05:00
|
|
|
MODULE* mod = PyModule_to_MODULE( obj );
|
2012-08-01 14:50:21 +02:00
|
|
|
|
|
|
|
return mod;
|
2012-05-05 22:18:47 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2013-03-11 03:09:48 -05:00
|
|
|
void PYTHON_FOOTPRINT_WIZARDS::register_wizard( PyObject* aPyWizard )
|
2012-05-05 22:18:47 +02:00
|
|
|
{
|
2013-03-11 03:09:48 -05:00
|
|
|
PYTHON_FOOTPRINT_WIZARD* fw = new PYTHON_FOOTPRINT_WIZARD( aPyWizard );
|
2012-09-24 18:03:03 +02:00
|
|
|
|
|
|
|
fw->register_wizard();
|
2012-05-05 22:18:47 +02:00
|
|
|
}
|