Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
K
kicad-source-mirror
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Commits
Open sidebar
Elphel
kicad-source-mirror
Commits
5140c348
Commit
5140c348
authored
Aug 01, 2012
by
Miguel Angel Ajo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
pcbnew: wxPyBeginBlockThreads before every python call
parent
beec3236
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
34 additions
and
9 deletions
+34
-9
appl_wxstruct.h
include/appl_wxstruct.h
+1
-1
pcbnew_footprint_wizards.cpp
pcbnew/scripting/pcbnew_footprint_wizards.cpp
+33
-8
No files found.
include/appl_wxstruct.h
View file @
5140c348
...
...
@@ -37,7 +37,7 @@
#include <wx/filename.h>
#include <param_config.h>
#ifdef KICAD_SCRIPTING_EXPERIMENT
#include <
python2.7/
Python.h>
#include <Python.h>
#include <wx/wxPython/wxPython.h>
#endif
...
...
pcbnew/scripting/pcbnew_footprint_wizards.cpp
View file @
5140c348
...
...
@@ -4,6 +4,7 @@
*/
#include "pcbnew_footprint_wizards.h"
#include <wx/wxPython/wxPython.h>
#include <stdio.h>
PYTHON_FOOTPRINT_WIZARD
::
PYTHON_FOOTPRINT_WIZARD
(
PyObject
*
aWizard
)
...
...
@@ -28,6 +29,8 @@ PyObject* PYTHON_FOOTPRINT_WIZARD::CallMethod(const char* aMethod, PyObject *aAr
{
PyObject
*
result
;
wxPyBlock_t
blocked
=
wxPyBeginBlockThreads
();
result
=
PyObject_CallObject
(
pFunc
,
aArglist
);
if
(
PyErr_Occurred
()
)
...
...
@@ -39,6 +42,8 @@ PyObject* PYTHON_FOOTPRINT_WIZARD::CallMethod(const char* aMethod, PyObject *aAr
printf
(
" : %s
\n
"
,
PyString_AsString
(
PyObject_Str
(
b
)
)
);
}
wxPyEndBlockThreads
(
blocked
);
if
(
result
)
{
Py_XDECREF
(
pFunc
);
...
...
@@ -65,9 +70,12 @@ wxString PYTHON_FOOTPRINT_WIZARD::CallRetStrMethod( const char* aMethod, PyObjec
PyObject
*
result
=
CallMethod
(
aMethod
,
aArglist
);
if
(
result
)
{
wxPyBlock_t
blocked
=
wxPyBeginBlockThreads
();
const
char
*
str_res
=
PyString_AsString
(
result
);
ret
=
wxString
::
FromUTF8
(
str_res
);
Py_DECREF
(
result
);
wxPyEndBlockThreads
(
blocked
);
}
return
ret
;
}
...
...
@@ -90,6 +98,8 @@ wxArrayString PYTHON_FOOTPRINT_WIZARD::CallRetArrayStrMethod
"result is not a list"
),
1
);
return
ret
;
}
wxPyBlock_t
blocked
=
wxPyBeginBlockThreads
();
int
list_size
=
PyList_Size
(
result
);
for
(
int
n
=
0
;
n
<
list_size
;
n
++
)
...
...
@@ -102,6 +112,7 @@ wxArrayString PYTHON_FOOTPRINT_WIZARD::CallRetArrayStrMethod
}
Py_DECREF
(
result
);
wxPyEndBlockThreads
(
blocked
);
}
...
...
@@ -137,8 +148,12 @@ int PYTHON_FOOTPRINT_WIZARD::GetNumParameterPages()
{
if
(
!
PyInt_Check
(
result
)
)
return
-
1
;
wxPyBlock_t
blocked
=
wxPyBeginBlockThreads
();
ret
=
PyInt_AsLong
(
result
);
Py_DECREF
(
result
);
wxPyEndBlockThreads
(
blocked
);
}
return
ret
;
}
...
...
@@ -156,9 +171,13 @@ wxString PYTHON_FOOTPRINT_WIZARD::GetParameterPageName( int aPage )
if
(
result
)
{
wxPyBlock_t
blocked
=
wxPyBeginBlockThreads
();
const
char
*
str_res
=
PyString_AsString
(
result
);
ret
=
wxString
::
FromUTF8
(
str_res
);
Py_DECREF
(
result
);
wxPyEndBlockThreads
(
blocked
);
}
return
ret
;
}
...
...
@@ -276,9 +295,11 @@ MODULE *PYTHON_FOOTPRINT_WIZARD::GetModule()
if
(
!
result
)
return
NULL
;
wxPyBlock_t
blocked
=
wxPyBeginBlockThreads
();
obj
=
PyObject_GetAttrString
(
result
,
"this"
);
if
(
PyErr_Occurred
()
)
if
(
PyErr_Occurred
()
)
{
/*
PyObject *t, *v, *b;
...
...
@@ -289,8 +310,11 @@ MODULE *PYTHON_FOOTPRINT_WIZARD::GetModule()
*/
PyErr_Print
();
}
wxPyEndBlockThreads
(
blocked
);
MODULE
*
mod
=
PyModule_to_MODULE
(
obj
);
return
PyModule_to_MODULE
(
obj
)
;
return
mod
;
}
...
...
@@ -300,9 +324,10 @@ void PYTHON_FOOTPRINT_WIZARDS::register_wizard(PyObject* aPyWizard)
fw
=
new
PYTHON_FOOTPRINT_WIZARD
(
aPyWizard
);
printf
(
"Registered python footprint wizard '%s'
\n
"
,
(
const
char
*
)
fw
->
GetName
().
mb_str
()
);
//printf( "Registered python footprint wizard '%s'\n",
// (const char*)fw->GetName().mb_str()
// );
// this get the wizard registered in the common
// FOOTPRINT_WIZARDS class
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment