scripting: fixed kicad compilation, cleanups

This commit is contained in:
Miguel Angel Ajo
2012-08-02 09:47:30 +02:00
parent 5140c348cd
commit b0881d8ec5
6 changed files with 82 additions and 72 deletions
+13 -2
View File
@@ -116,7 +116,10 @@ static void swigSwitchPythonBuiltin()
* initializes all the wxpython interface, and returns the python thread control structure
*
*/
bool pcbnewInitPythonScripting(PyThreadState** aMainTState)
PyThreadState *g_PythonMainTState;
bool pcbnewInitPythonScripting()
{
swigAddBuiltin(); // add builtin functions
@@ -139,7 +142,7 @@ bool pcbnewInitPythonScripting(PyThreadState** aMainTState)
// Save the current Python thread state and release the
// Global Interpreter Lock.
*aMainTState = wxPyBeginAllowThreads();
g_PythonMainTState = wxPyBeginAllowThreads();
// load pcbnew inside python, and load all the user plugins, TODO: add system wide plugins
@@ -153,3 +156,11 @@ bool pcbnewInitPythonScripting(PyThreadState** aMainTState)
return true;
}
void pcbnewFinishPythonScripting()
{
wxPyEndAllowThreads(g_PythonMainTState);
Py_Finalize();
}