Minor wxPython scripting improvements.

* Wrap Pgm().OnPgmExit() changes in APP_SINGLE_TOP to build conditionally
  when KICAD_SCRIPTING_WXPYTHON is enabled.
* Check the result of loading the correct wxPython version during
  initialization.
This commit is contained in:
Wayne Stambaugh
2015-06-27 15:05:26 -04:00
parent 7be1d32a10
commit c288d200fb
2 changed files with 20 additions and 3 deletions
+10 -1
View File
@@ -145,7 +145,16 @@ bool pcbnewInitPythonScripting( const char * aUserPluginsPath )
// are different versions of wxPython installed this can lead to select wrong wxPython
// version being selected.
snprintf( cmd, sizeof(cmd), "import wxversion; wxversion.select('%s')", WXPYTHON_VERSION );
PyRun_SimpleString( cmd );
int retv = PyRun_SimpleString( cmd );
if( retv != 0 )
{
wxLogError( wxT( "Python error %d occurred running string `%s`" ), retv, cmd );
PyErr_Print();
Py_Finalize();
return false;
}
// Load the wxPython core API. Imports the wx._core_ module and sets a
// local pointer to a function table located there. The pointer is used