From dc4b261c686ec686b0148b39821af30ab6e7efaa Mon Sep 17 00:00:00 2001 From: Miguel Angel Ajo Date: Fri, 15 Mar 2013 14:27:18 +0100 Subject: [PATCH] wxT added to the locales fix, message box on python exceptions inside wizard, added some missing copyright notices --- pcbnew/class_footprint_wizard.cpp | 25 ++++++++++++ pcbnew/class_footprint_wizard.h | 25 ++++++++++++ pcbnew/footprint_wizard.cpp | 11 +++--- pcbnew/footprint_wizard_frame.cpp | 1 + pcbnew/scripting/TODO.txt | 3 +- pcbnew/scripting/pcbnew_footprint_wizards.cpp | 39 +++++++++++++++++-- pcbnew/scripting/pcbnew_footprint_wizards.h | 24 ++++++++++++ pcbnew/scripting/pcbnew_scripting_helpers.h | 24 ++++++++++++ pcbnew/scripting/plugins.i | 23 +++++++++++ 9 files changed, 166 insertions(+), 9 deletions(-) diff --git a/pcbnew/class_footprint_wizard.cpp b/pcbnew/class_footprint_wizard.cpp index 66d4c0b260..2e7f4776b2 100644 --- a/pcbnew/class_footprint_wizard.cpp +++ b/pcbnew/class_footprint_wizard.cpp @@ -1,3 +1,28 @@ +/* + * This program source code file is part of KiCad, a free EDA CAD application. + * + * Copyright (C) 2013 NBEE Embedded Systems SL, Miguel Angel Ajo + * 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 + */ + + /** * @file class_footprint_wizard.cpp * @brief Class FOOTPRINT_WIZARD and FOOTPRINT_WIZARDS diff --git a/pcbnew/class_footprint_wizard.h b/pcbnew/class_footprint_wizard.h index e24ba9e2fd..89b58f764c 100644 --- a/pcbnew/class_footprint_wizard.h +++ b/pcbnew/class_footprint_wizard.h @@ -1,3 +1,28 @@ +/* + * This program source code file is part of KiCad, a free EDA CAD application. + * + * Copyright (C) 2013 NBEE Embedded Systems SL, Miguel Angel Ajo + * 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 + */ + + /** * @file pcbnew_footprint_wizards.h * @brief Class PCBNEW_FOOTPRINT_WIZARDS diff --git a/pcbnew/footprint_wizard.cpp b/pcbnew/footprint_wizard.cpp index e2221895c3..a0bd1ea6d1 100644 --- a/pcbnew/footprint_wizard.cpp +++ b/pcbnew/footprint_wizard.cpp @@ -184,13 +184,14 @@ void FOOTPRINT_WIZARD_FRAME::ParametersUpdated( wxGridEvent& event ) dValue = From_User_Unit( g_UserUnit, dValue); value.Printf( wxT("%lf"), dValue ); - - // If our locale is set to use , for decimal point, just change it - // to be scripting compatible - value.Replace(",","."); - + } + // If our locale is set to use , for decimal point, just change it + // to be scripting compatible + + value.Replace( wxT( "," ), wxT( "." ) ); + arr.Add( value ); } diff --git a/pcbnew/footprint_wizard_frame.cpp b/pcbnew/footprint_wizard_frame.cpp index 2d2c91e0c3..b22250bf27 100644 --- a/pcbnew/footprint_wizard_frame.cpp +++ b/pcbnew/footprint_wizard_frame.cpp @@ -458,6 +458,7 @@ void FOOTPRINT_WIZARD_FRAME::ReCreateParameterList() } value.Printf( wxT( "%lf" ), dValue ); + value.Replace( wxT( "," ), wxT( "." ) ); } else if ( ptList[i]==wxT( "UNITS" ) ) // 1,2,3,4,5 ... N { diff --git a/pcbnew/scripting/TODO.txt b/pcbnew/scripting/TODO.txt index 089f72cbbc..aeeff2cc49 100644 --- a/pcbnew/scripting/TODO.txt +++ b/pcbnew/scripting/TODO.txt @@ -1,11 +1,12 @@ * think about documentation, how to do it -* toolbar button and menu for scripting console * Action plugins: right click hooks, toolbar hooks, menu hooks, * IO plugins * better footprint wizard (preview in footprint wizard list) +* fix WX asserts + diff --git a/pcbnew/scripting/pcbnew_footprint_wizards.cpp b/pcbnew/scripting/pcbnew_footprint_wizards.cpp index 4823eee294..7b3505d7f7 100644 --- a/pcbnew/scripting/pcbnew_footprint_wizards.cpp +++ b/pcbnew/scripting/pcbnew_footprint_wizards.cpp @@ -1,3 +1,27 @@ +/* + * This program source code file is part of KiCad, a free EDA CAD application. + * + * Copyright (C) 2013 NBEE Embedded Systems SL, Miguel Angel Ajo + * 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 + */ + /** * @file pcbnew_footprint_wizards.cpp * @brief Class PCBNEW_PYTHON_FOOTPRINT_WIZARDS @@ -39,14 +63,23 @@ PyObject* PYTHON_FOOTPRINT_WIZARD::CallMethod( const char* aMethod, PyObject* aA if( PyErr_Occurred() ) { + wxString message; PyObject* t; PyObject* v; PyObject* b; PyErr_Fetch( &t, &v, &b ); - printf ( "calling %s()\n", aMethod ); - printf ( "Exception: %s\n", PyString_AsString( PyObject_Str( v ) ) ); - printf ( " : %s\n", PyString_AsString( PyObject_Str( b ) ) ); + message.Printf ( wxT( "calling %s()\n" + "Exception: %s\n" + " : %s\n"), + aMethod, + PyString_AsString( PyObject_Str( v ) ), + PyString_AsString( PyObject_Str( b ) ) + ); + + wxMessageBox( message, + wxT( "Exception on python footprint wizard code" ), + wxICON_ERROR|wxOK); } if( result ) diff --git a/pcbnew/scripting/pcbnew_footprint_wizards.h b/pcbnew/scripting/pcbnew_footprint_wizards.h index af9af429e9..77854e36b0 100644 --- a/pcbnew/scripting/pcbnew_footprint_wizards.h +++ b/pcbnew/scripting/pcbnew_footprint_wizards.h @@ -1,3 +1,27 @@ +/* + * This program source code file is part of KiCad, a free EDA CAD application. + * + * Copyright (C) 2013 NBEE Embedded Systems SL, Miguel Angel Ajo + * 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 + */ + /** * @file pcbnew_footprint_wizards.h * @brief Class PCBNEW_FOOTPRINT_WIZARDS diff --git a/pcbnew/scripting/pcbnew_scripting_helpers.h b/pcbnew/scripting/pcbnew_scripting_helpers.h index be6ee28b2e..24f108fb0b 100644 --- a/pcbnew/scripting/pcbnew_scripting_helpers.h +++ b/pcbnew/scripting/pcbnew_scripting_helpers.h @@ -1,3 +1,27 @@ +/* + * This program source code file is part of KiCad, a free EDA CAD application. + * + * Copyright (C) 2013 NBEE Embedded Systems SL, Miguel Angel Ajo + * 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 + */ + #ifndef __PCBNEW_SCRIPTING_HELPERS_H #define __PCBNEW_SCRIPTING_HELPERS_H diff --git a/pcbnew/scripting/plugins.i b/pcbnew/scripting/plugins.i index 1957b7d2b4..821e2a72d1 100644 --- a/pcbnew/scripting/plugins.i +++ b/pcbnew/scripting/plugins.i @@ -1,3 +1,26 @@ +/* + * This program source code file is part of KiCad, a free EDA CAD application. + * + * Copyright (C) 2013 NBEE Embedded Systems SL, Miguel Angel Ajo + * 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 + */ %{ #include