From 6e6b35578d9be94739e1f9ebadcb57d9a483db6a Mon Sep 17 00:00:00 2001 From: Robin Dunn Date: Wed, 9 Mar 2005 22:28:52 +0000 Subject: [PATCH] Use the PyGILState_* APIs on Python >= 2.3 git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@32701 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- wxPython/contrib/activex/activex.i | 12 +- wxPython/contrib/activex/activex_wrap.cpp | 14 +- wxPython/contrib/gizmos/gizmos.i | 12 +- wxPython/contrib/gizmos/msw/gizmos_wrap.cpp | 12 +- wxPython/contrib/ogl/_oglshapes2.i | 2 +- wxPython/contrib/ogl/msw/ogl_wrap.cpp | 10 +- wxPython/contrib/ogl/ogl.i | 8 +- wxPython/include/wx/wxPython/pyclasses.h | 2 +- wxPython/include/wx/wxPython/pytree.h | 4 +- wxPython/include/wx/wxPython/wxPython_int.h | 183 +++++++++++--------- wxPython/samples/embedded/embedded.cpp | 6 +- wxPython/src/_artprov.i | 2 +- wxPython/src/_dataobj.i | 22 +-- wxPython/src/_datetime.i | 2 +- wxPython/src/_display.i | 2 +- wxPython/src/_dnd.i | 2 +- wxPython/src/_filesys.i | 2 +- wxPython/src/_gbsizer.i | 12 +- wxPython/src/_gdicmn.i | 12 +- wxPython/src/_image.i | 4 +- wxPython/src/_joystick.i | 2 +- wxPython/src/_listctrl.i | 2 +- wxPython/src/_log.i | 4 +- wxPython/src/_mimetype.i | 4 +- wxPython/src/_pen.i | 4 +- wxPython/src/_printfw.i | 8 +- wxPython/src/_sizers.i | 24 +-- wxPython/src/_sound.i | 12 +- wxPython/src/_taskbar.i | 2 +- wxPython/src/_timer.i | 2 +- wxPython/src/_treectrl.i | 10 +- wxPython/src/_vscroll.i | 4 +- wxPython/src/calendar.i | 2 +- wxPython/src/drawlist.cpp | 4 +- wxPython/src/grid.i | 74 ++++---- wxPython/src/helpers.cpp | 104 ++++++----- wxPython/src/html.i | 12 +- 37 files changed, 318 insertions(+), 281 deletions(-) diff --git a/wxPython/contrib/activex/activex.i b/wxPython/contrib/activex/activex.i index 31258944cd..b1df9e26ae 100644 --- a/wxPython/contrib/activex/activex.i +++ b/wxPython/contrib/activex/activex.i @@ -64,7 +64,7 @@ static wxString _VARTYPEname(VARTYPE vt); inline bool wxPyErr_Occurred() { bool rval; - bool blocked = wxPyBeginBlockThreads(); + wxPyBlock_t blocked = wxPyBeginBlockThreads(); rval = PyErr_Occurred() != NULL; wxPyEndBlockThreads(blocked); return rval; @@ -329,7 +329,7 @@ public: void SetAXProp(const wxString& name, PyObject* value) { const wxPropX& prop = GetAXPropDesc(name); - bool blocked = wxPyBeginBlockThreads(); + wxPyBlock_t blocked = wxPyBeginBlockThreads(); if (! PyErr_Occurred() ) { if (! prop.CanSet()) { wxString msg; @@ -365,7 +365,7 @@ public: { PyObject* rval = NULL; const wxPropX& prop = GetAXPropDesc(name); - bool blocked = wxPyBeginBlockThreads(); + wxPyBlock_t blocked = wxPyBeginBlockThreads(); if (! PyErr_Occurred() ) { if (! prop.CanGet()) { wxString msg; @@ -411,7 +411,7 @@ public: PyObject* rval = NULL; const wxFuncX& func = GetAXMethodDesc(name); - bool blocked = wxPyBeginBlockThreads(); + wxPyBlock_t blocked = wxPyBeginBlockThreads(); if (! PyErr_Occurred() ) { nargs = func.params.size(); if (nargs > 0) @@ -641,7 +641,7 @@ public: // handler. We'll convert and load the ActiveX event parameters into // attributes of the Python event object. void _preCallInit(PyObject* pyself) { - bool blocked = wxPyBeginBlockThreads(); + wxPyBlock_t blocked = wxPyBeginBlockThreads(); PyObject* pList = PyList_New(0); PyObject_SetAttrString(pyself, "paramList", pList); Py_DECREF(pList); @@ -660,7 +660,7 @@ public: // handler. It reloads any "out" parameters from the python attributes // back into the wxVariant they came from. void _postCallCleanup(PyObject* pyself) { - bool blocked = wxPyBeginBlockThreads(); + wxPyBlock_t blocked = wxPyBeginBlockThreads(); for (int i=0; iParamCount(); i+=1) { PyObject* val = PyObject_GetAttrString( pyself, (char*)(const char*)self->ParamName(i).mb_str()); diff --git a/wxPython/contrib/activex/activex_wrap.cpp b/wxPython/contrib/activex/activex_wrap.cpp index 86819b61df..7a53c1a3fa 100644 --- a/wxPython/contrib/activex/activex_wrap.cpp +++ b/wxPython/contrib/activex/activex_wrap.cpp @@ -1408,7 +1408,7 @@ static wxString _VARTYPEname(VARTYPE vt); inline bool wxPyErr_Occurred() { bool rval; - bool blocked = wxPyBeginBlockThreads(); + wxPyBlock_t blocked = wxPyBeginBlockThreads(); rval = PyErr_Occurred() != NULL; wxPyEndBlockThreads(blocked); return rval; @@ -1700,7 +1700,7 @@ public: void SetAXProp(const wxString& name, PyObject* value) { const wxPropX& prop = GetAXPropDesc(name); - bool blocked = wxPyBeginBlockThreads(); + wxPyBlock_t blocked = wxPyBeginBlockThreads(); if (! PyErr_Occurred() ) { if (! prop.CanSet()) { wxString msg; @@ -1736,7 +1736,7 @@ public: { PyObject* rval = NULL; const wxPropX& prop = GetAXPropDesc(name); - bool blocked = wxPyBeginBlockThreads(); + wxPyBlock_t blocked = wxPyBeginBlockThreads(); if (! PyErr_Occurred() ) { if (! prop.CanGet()) { wxString msg; @@ -1782,7 +1782,7 @@ public: PyObject* rval = NULL; const wxFuncX& func = GetAXMethodDesc(name); - bool blocked = wxPyBeginBlockThreads(); + wxPyBlock_t blocked = wxPyBeginBlockThreads(); if (! PyErr_Occurred() ) { nargs = func.params.size(); if (nargs > 0) @@ -1896,7 +1896,7 @@ SWIG_Check_long(PyObject* obj) } static void wxActiveXEvent__preCallInit(wxActiveXEvent *self,PyObject *pyself){ - bool blocked = wxPyBeginBlockThreads(); + wxPyBlock_t blocked = wxPyBeginBlockThreads(); PyObject* pList = PyList_New(0); PyObject_SetAttrString(pyself, "paramList", pList); Py_DECREF(pList); @@ -1911,7 +1911,7 @@ static void wxActiveXEvent__preCallInit(wxActiveXEvent *self,PyObject *pyself){ wxPyEndBlockThreads(blocked); } static void wxActiveXEvent__postCallCleanup(wxActiveXEvent *self,PyObject *pyself){ - bool blocked = wxPyBeginBlockThreads(); + wxPyBlock_t blocked = wxPyBeginBlockThreads(); for (int i=0; iParamCount(); i+=1) { PyObject* val = PyObject_GetAttrString( pyself, (char*)(const char*)self->ParamName(i).mb_str()); @@ -4382,7 +4382,7 @@ static PyObject *_wrap_IEHtmlWindowBase_LoadStream(PyObject *, PyObject *args, P arg2 = wxPyCBInputStream_copy((wxPyCBInputStream*)temp2->m_wxis); } else { PyErr_Clear(); // clear the failure of the wxPyConvert above - arg2 = wxPyCBInputStream_create(obj1, false); + arg2 = wxPyCBInputStream_create(obj1, true); if (arg2 == NULL) { PyErr_SetString(PyExc_TypeError, "Expected wx.InputStream or Python file-like object."); SWIG_fail; diff --git a/wxPython/contrib/gizmos/gizmos.i b/wxPython/contrib/gizmos/gizmos.i index bb20287ecd..079cc312a9 100644 --- a/wxPython/contrib/gizmos/gizmos.i +++ b/wxPython/contrib/gizmos/gizmos.i @@ -283,7 +283,7 @@ public: virtual void DrawItem(wxDC& dc, wxTreeItemId id, const wxRect& rect) { bool found; - bool blocked = wxPyBeginBlockThreads(); + wxPyBlock_t blocked = wxPyBeginBlockThreads(); if ((found = wxPyCBH_findCallback(m_myInst, "DrawItem"))) { PyObject* dcobj = wxPyMake_wxObject(&dc,false); PyObject* idobj = wxPyConstructObject((void*)&id, wxT("wxTreeItemId"), false); @@ -495,7 +495,7 @@ public: const wxTreeItemId& item2) { int rval = 0; bool found; - bool blocked = wxPyBeginBlockThreads(); + wxPyBlock_t blocked = wxPyBeginBlockThreads(); if ((found = wxPyCBH_findCallback(m_myInst, "OnCompareItems"))) { PyObject *o1 = wxPyConstructObject((void*)&item1, wxT("wxTreeItemId"), 0); PyObject *o2 = wxPyConstructObject((void*)&item2, wxT("wxTreeItemId"), 0); @@ -757,7 +757,7 @@ public: //size_t GetSelections(wxArrayTreeItemIds&) const; %extend { PyObject* GetSelections() { - bool blocked = wxPyBeginBlockThreads(); + wxPyBlock_t blocked = wxPyBeginBlockThreads(); PyObject* rval = PyList_New(0); wxArrayTreeItemIds array; size_t num, x; @@ -793,7 +793,7 @@ public: PyObject* GetFirstChild(const wxTreeItemId& item) { void* cookie = 0; wxTreeItemId* ritem = new wxTreeItemId(self->GetFirstChild(item, cookie)); - bool blocked = wxPyBeginBlockThreads(); + wxPyBlock_t blocked = wxPyBeginBlockThreads(); PyObject* tup = PyTuple_New(2); PyTuple_SET_ITEM(tup, 0, wxPyConstructObject(ritem, wxT("wxTreeItemId"), true)); PyTuple_SET_ITEM(tup, 1, wxPyMakeSwigPtr(cookie, wxT("void"))); @@ -808,7 +808,7 @@ public: // passed to GetNextChild in order to continue the search. PyObject* GetNextChild(const wxTreeItemId& item, void* cookie) { wxTreeItemId* ritem = new wxTreeItemId(self->GetNextChild(item, cookie)); - bool blocked = wxPyBeginBlockThreads(); + wxPyBlock_t blocked = wxPyBeginBlockThreads(); PyObject* tup = PyTuple_New(2); PyTuple_SET_ITEM(tup, 0, wxPyConstructObject(ritem, wxT("wxTreeItemId"), true)); PyTuple_SET_ITEM(tup, 1, wxPyMakeSwigPtr(cookie, wxT("void"))); @@ -927,7 +927,7 @@ public: PyObject* GetBoundingRect(const wxTreeItemId& item, bool textOnly = false) { wxRect rect; if (self->GetBoundingRect(item, rect, textOnly)) { - bool blocked = wxPyBeginBlockThreads(); + wxPyBlock_t blocked = wxPyBeginBlockThreads(); wxRect* r = new wxRect(rect); PyObject* val = wxPyConstructObject((void*)r, wxT("wxRect"), 1); wxPyEndBlockThreads(blocked); diff --git a/wxPython/contrib/gizmos/msw/gizmos_wrap.cpp b/wxPython/contrib/gizmos/msw/gizmos_wrap.cpp index 6415ed6b3b..0f28d73b51 100644 --- a/wxPython/contrib/gizmos/msw/gizmos_wrap.cpp +++ b/wxPython/contrib/gizmos/msw/gizmos_wrap.cpp @@ -1549,7 +1549,7 @@ public: virtual void DrawItem(wxDC& dc, wxTreeItemId id, const wxRect& rect) { bool found; - bool blocked = wxPyBeginBlockThreads(); + wxPyBlock_t blocked = wxPyBeginBlockThreads(); if ((found = wxPyCBH_findCallback(m_myInst, "DrawItem"))) { PyObject* dcobj = wxPyMake_wxObject(&dc,false); PyObject* idobj = wxPyConstructObject((void*)&id, wxT("wxTreeItemId"), false); @@ -1673,7 +1673,7 @@ public: const wxTreeItemId& item2) { int rval = 0; bool found; - bool blocked = wxPyBeginBlockThreads(); + wxPyBlock_t blocked = wxPyBeginBlockThreads(); if ((found = wxPyCBH_findCallback(m_myInst, "OnCompareItems"))) { PyObject *o1 = wxPyConstructObject((void*)&item1, wxT("wxTreeItemId"), 0); PyObject *o2 = wxPyConstructObject((void*)&item2, wxT("wxTreeItemId"), 0); @@ -1822,7 +1822,7 @@ static void wxPyTreeListCtrl_SetItemPyData(wxPyTreeListCtrl *self,wxTreeItemId c data->SetData(obj); } static PyObject *wxPyTreeListCtrl_GetSelections(wxPyTreeListCtrl *self){ - bool blocked = wxPyBeginBlockThreads(); + wxPyBlock_t blocked = wxPyBeginBlockThreads(); PyObject* rval = PyList_New(0); wxArrayTreeItemIds array; size_t num, x; @@ -1838,7 +1838,7 @@ static PyObject *wxPyTreeListCtrl_GetSelections(wxPyTreeListCtrl *self){ static PyObject *wxPyTreeListCtrl_GetFirstChild(wxPyTreeListCtrl *self,wxTreeItemId const &item){ void* cookie = 0; wxTreeItemId* ritem = new wxTreeItemId(self->GetFirstChild(item, cookie)); - bool blocked = wxPyBeginBlockThreads(); + wxPyBlock_t blocked = wxPyBeginBlockThreads(); PyObject* tup = PyTuple_New(2); PyTuple_SET_ITEM(tup, 0, wxPyConstructObject(ritem, wxT("wxTreeItemId"), true)); PyTuple_SET_ITEM(tup, 1, wxPyMakeSwigPtr(cookie, wxT("void"))); @@ -1847,7 +1847,7 @@ static PyObject *wxPyTreeListCtrl_GetFirstChild(wxPyTreeListCtrl *self,wxTreeIte } static PyObject *wxPyTreeListCtrl_GetNextChild(wxPyTreeListCtrl *self,wxTreeItemId const &item,void *cookie){ wxTreeItemId* ritem = new wxTreeItemId(self->GetNextChild(item, cookie)); - bool blocked = wxPyBeginBlockThreads(); + wxPyBlock_t blocked = wxPyBeginBlockThreads(); PyObject* tup = PyTuple_New(2); PyTuple_SET_ITEM(tup, 0, wxPyConstructObject(ritem, wxT("wxTreeItemId"), true)); PyTuple_SET_ITEM(tup, 1, wxPyMakeSwigPtr(cookie, wxT("void"))); @@ -1885,7 +1885,7 @@ static PyObject *wxPyTreeListCtrl_GetNextChild(wxPyTreeListCtrl *self,wxTreeItem static PyObject *wxPyTreeListCtrl_GetBoundingRect(wxPyTreeListCtrl *self,wxTreeItemId const &item,bool textOnly=false){ wxRect rect; if (self->GetBoundingRect(item, rect, textOnly)) { - bool blocked = wxPyBeginBlockThreads(); + wxPyBlock_t blocked = wxPyBeginBlockThreads(); wxRect* r = new wxRect(rect); PyObject* val = wxPyConstructObject((void*)r, wxT("wxRect"), 1); wxPyEndBlockThreads(blocked); diff --git a/wxPython/contrib/ogl/_oglshapes2.i b/wxPython/contrib/ogl/_oglshapes2.i index bd2fcdd661..ef79bd7e70 100644 --- a/wxPython/contrib/ogl/_oglshapes2.i +++ b/wxPython/contrib/ogl/_oglshapes2.i @@ -312,7 +312,7 @@ public: wxObject* wxObj; wxNode* node = list->GetFirst(); - bool blocked = wxPyBeginBlockThreads(); + wxPyBlock_t blocked = wxPyBeginBlockThreads(); pyList = PyList_New(0); while (node) { wxObj = node->GetData(); diff --git a/wxPython/contrib/ogl/msw/ogl_wrap.cpp b/wxPython/contrib/ogl/msw/ogl_wrap.cpp index 06e1f9e452..b670e3f070 100644 --- a/wxPython/contrib/ogl/msw/ogl_wrap.cpp +++ b/wxPython/contrib/ogl/msw/ogl_wrap.cpp @@ -1816,7 +1816,7 @@ static PyObject *wxPyPolygonShape_GetOriginalPoints(wxPyPolygonShape *self){ wxObject* wxObj; wxNode* node = list->GetFirst(); - bool blocked = wxPyBeginBlockThreads(); + wxPyBlock_t blocked = wxPyBeginBlockThreads(); pyList = PyList_New(0); while (node) { wxObj = node->GetData(); @@ -1855,7 +1855,7 @@ static PyObject *wxDiagram_GetShapeList(wxDiagram *self){ // work for any class for the VERY generic cases, but beyond that the helper // needs to know more about the type. wxList* wxPy_wxListHelper(PyObject* pyList, const wxChar* className) { - bool blocked = wxPyBeginBlockThreads(); + wxPyBlock_t blocked = wxPyBeginBlockThreads(); if (!PyList_Check(pyList)) { PyErr_SetString(PyExc_TypeError, "Expected a list object."); wxPyEndBlockThreads(blocked); @@ -1888,7 +1888,7 @@ wxList* wxPy_wxListHelper(PyObject* pyList, const wxChar* className) { //--------------------------------------------------------------------------- wxList* wxPy_wxRealPoint_ListHelper(PyObject* pyList) { - bool blocked = wxPyBeginBlockThreads(); + wxPyBlock_t blocked = wxPyBeginBlockThreads(); if (!PyList_Check(pyList)) { PyErr_SetString(PyExc_TypeError, "Expected a list object."); wxPyEndBlockThreads(blocked); @@ -1960,7 +1960,7 @@ PyObject* wxPy_ConvertRealPointList(wxListBase* listbase) { wxObject* wxObj; wxNode* node = list->GetFirst(); - bool blocked = wxPyBeginBlockThreads(); + wxPyBlock_t blocked = wxPyBeginBlockThreads(); pyList = PyList_New(0); while (node) { wxObj = node->GetData(); @@ -1981,7 +1981,7 @@ PyObject* wxPy_ConvertShapeList(wxListBase* listbase) { wxObject* wxObj; wxNode* node = list->GetFirst(); - bool blocked = wxPyBeginBlockThreads(); + wxPyBlock_t blocked = wxPyBeginBlockThreads(); pyList = PyList_New(0); while (node) { wxObj = node->GetData(); diff --git a/wxPython/contrib/ogl/ogl.i b/wxPython/contrib/ogl/ogl.i index 3dc1464e04..c969bc11c7 100644 --- a/wxPython/contrib/ogl/ogl.i +++ b/wxPython/contrib/ogl/ogl.i @@ -171,7 +171,7 @@ void wxOGLCleanUp(); // work for any class for the VERY generic cases, but beyond that the helper // needs to know more about the type. wxList* wxPy_wxListHelper(PyObject* pyList, const wxChar* className) { - bool blocked = wxPyBeginBlockThreads(); + wxPyBlock_t blocked = wxPyBeginBlockThreads(); if (!PyList_Check(pyList)) { PyErr_SetString(PyExc_TypeError, "Expected a list object."); wxPyEndBlockThreads(blocked); @@ -204,7 +204,7 @@ wxList* wxPy_wxListHelper(PyObject* pyList, const wxChar* className) { //--------------------------------------------------------------------------- wxList* wxPy_wxRealPoint_ListHelper(PyObject* pyList) { - bool blocked = wxPyBeginBlockThreads(); + wxPyBlock_t blocked = wxPyBeginBlockThreads(); if (!PyList_Check(pyList)) { PyErr_SetString(PyExc_TypeError, "Expected a list object."); wxPyEndBlockThreads(blocked); @@ -276,7 +276,7 @@ PyObject* wxPy_ConvertRealPointList(wxListBase* listbase) { wxObject* wxObj; wxNode* node = list->GetFirst(); - bool blocked = wxPyBeginBlockThreads(); + wxPyBlock_t blocked = wxPyBeginBlockThreads(); pyList = PyList_New(0); while (node) { wxObj = node->GetData(); @@ -297,7 +297,7 @@ PyObject* wxPy_ConvertShapeList(wxListBase* listbase) { wxObject* wxObj; wxNode* node = list->GetFirst(); - bool blocked = wxPyBeginBlockThreads(); + wxPyBlock_t blocked = wxPyBeginBlockThreads(); pyList = PyList_New(0); while (node) { wxObj = node->GetData(); diff --git a/wxPython/include/wx/wxPython/pyclasses.h b/wxPython/include/wx/wxPython/pyclasses.h index 8ec04a4fde..11d4509376 100644 --- a/wxPython/include/wx/wxPython/pyclasses.h +++ b/wxPython/include/wx/wxPython/pyclasses.h @@ -45,7 +45,7 @@ public: wxPyValidator* ptr = NULL; wxPyValidator* self = (wxPyValidator*)this; - bool blocked = wxPyBeginBlockThreads(); + wxPyBlock_t blocked = wxPyBeginBlockThreads(); if (wxPyCBH_findCallback(self->m_myInst, "Clone")) { PyObject* ro; ro = wxPyCBH_callCallbackObj(self->m_myInst, Py_BuildValue("()")); diff --git a/wxPython/include/wx/wxPython/pytree.h b/wxPython/include/wx/wxPython/pytree.h index 2cd3172e92..a1b0e7bf8d 100644 --- a/wxPython/include/wx/wxPython/pytree.h +++ b/wxPython/include/wx/wxPython/pytree.h @@ -25,7 +25,7 @@ public: } ~wxPyTreeItemData() { - bool blocked = wxPyBeginBlockThreads(); + wxPyBlock_t blocked = wxPyBeginBlockThreads(); Py_DECREF(m_obj); wxPyEndBlockThreads(blocked); } @@ -36,7 +36,7 @@ public: } void SetData(PyObject* obj) { - bool blocked = wxPyBeginBlockThreads(); + wxPyBlock_t blocked = wxPyBeginBlockThreads(); Py_DECREF(m_obj); wxPyEndBlockThreads(blocked); m_obj = obj; diff --git a/wxPython/include/wx/wxPython/wxPython_int.h b/wxPython/include/wx/wxPython/wxPython_int.h index 7a572df572..f4afefcb7f 100644 --- a/wxPython/include/wx/wxPython/wxPython_int.h +++ b/wxPython/include/wx/wxPython/wxPython_int.h @@ -136,6 +136,21 @@ bool wxPySwigInstance_Check(PyObject* obj); #undef WXP_WITH_THREAD #endif + +// In Python 2.3 and later there are the PyGILState_* APIs that we can use for +// blocking threads when calling back into Python. Using them instead of my +// home-grown hacks greatly simplifies wxPyBeginBlockThreads and +// wxPyEndBlockThreads. + +#if PY_VERSION_HEX < 0x02030000 +#define wxPyUSE_GIL_STATE 0 +typedef bool wxPyBlock_t; +#else +#define wxPyUSE_GIL_STATE 1 +typedef PyGILState_STATE wxPyBlock_t; +#endif + + #ifndef wxPyUSE_EXPORTED_API // For Python --> C++ @@ -143,8 +158,8 @@ PyThreadState* wxPyBeginAllowThreads(); void wxPyEndAllowThreads(PyThreadState* state); // For C++ --> Python -bool wxPyBeginBlockThreads(); -void wxPyEndBlockThreads(bool blocked); +wxPyBlock_t wxPyBeginBlockThreads(); +void wxPyEndBlockThreads(wxPyBlock_t blocked); #endif // wxPyUSE_EXPORTED_API @@ -152,13 +167,13 @@ void wxPyEndBlockThreads(bool blocked); // A macro that will help to execute simple statments wrapped in // StartBlock/EndBlockThreads calls #define wxPyBLOCK_THREADS(stmt) \ - { bool blocked = wxPyBeginBlockThreads(); stmt; wxPyEndBlockThreads(blocked); } + { wxPyBlock_t blocked = wxPyBeginBlockThreads(); stmt; wxPyEndBlockThreads(blocked); } // Raise the NotImplementedError exception (blocking threads) #define wxPyRaiseNotImplemented() \ wxPyBLOCK_THREADS(PyErr_SetNone(PyExc_NotImplementedError)) -// Raise any exception witha string value (blocking threads) +// Raise any exception with a string value (blocking threads) #define wxPyErr_SetString(err, str) \ wxPyBLOCK_THREADS(PyErr_SetString(err, str)) @@ -341,8 +356,8 @@ struct wxPyCoreAPI { PyThreadState* (*p_wxPyBeginAllowThreads)(); void (*p_wxPyEndAllowThreads)(PyThreadState* state); - bool (*p_wxPyBeginBlockThreads)(); - void (*p_wxPyEndBlockThreads)(bool blocked); + wxPyBlock_t (*p_wxPyBeginBlockThreads)(); + void (*p_wxPyEndBlockThreads)(wxPyBlock_t blocked); PyObject* (*p_wxPy_ConvertList)(wxListBase* list); @@ -608,7 +623,7 @@ extern wxPyApp *wxPythonApp; #define IMP_PYCALLBACK__(CLASS, PCLASS, CBNAME) \ void CLASS::CBNAME() { \ bool found; \ - bool blocked = wxPyBeginBlockThreads(); \ + wxPyBlock_t blocked = wxPyBeginBlockThreads(); \ if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \ wxPyCBH_callCallback(m_myInst, Py_BuildValue("()")); \ wxPyEndBlockThreads(blocked); \ @@ -629,7 +644,7 @@ extern wxPyApp *wxPythonApp; #define IMP_PYCALLBACK_BOOL_INTINT(CLASS, PCLASS, CBNAME) \ bool CLASS::CBNAME(int a, int b) { \ bool rval=false, found; \ - bool blocked = wxPyBeginBlockThreads(); \ + wxPyBlock_t blocked = wxPyBeginBlockThreads(); \ if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \ rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(ii)",a,b)); \ wxPyEndBlockThreads(blocked); \ @@ -651,7 +666,7 @@ extern wxPyApp *wxPythonApp; #define IMP_PYCALLBACK_VOID_(CLASS, PCLASS, CBNAME) \ void CLASS::CBNAME() { \ bool found; \ - bool blocked = wxPyBeginBlockThreads(); \ + wxPyBlock_t blocked = wxPyBeginBlockThreads(); \ if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \ wxPyCBH_callCallback(m_myInst, Py_BuildValue("()")); \ wxPyEndBlockThreads(blocked); \ @@ -672,7 +687,7 @@ extern wxPyApp *wxPythonApp; #define IMP_PYCALLBACK_VOID_INTINT(CLASS, PCLASS, CBNAME) \ void CLASS::CBNAME(int a, int b) { \ bool found; \ - bool blocked = wxPyBeginBlockThreads(); \ + wxPyBlock_t blocked = wxPyBeginBlockThreads(); \ if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \ wxPyCBH_callCallback(m_myInst, Py_BuildValue("(ii)",a,b)); \ wxPyEndBlockThreads(blocked); \ @@ -693,7 +708,7 @@ extern wxPyApp *wxPythonApp; #define IMP_PYCALLBACK_VOID_INT(CLASS, PCLASS, CBNAME) \ void CLASS::CBNAME(int a) { \ bool found; \ - bool blocked = wxPyBeginBlockThreads(); \ + wxPyBlock_t blocked = wxPyBeginBlockThreads(); \ if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \ wxPyCBH_callCallback(m_myInst, Py_BuildValue("(i)",a)); \ wxPyEndBlockThreads(blocked); \ @@ -714,7 +729,7 @@ extern wxPyApp *wxPythonApp; #define IMP_PYCALLBACK_VOID_INT4(CLASS, PCLASS, CBNAME) \ void CLASS::CBNAME(int a, int b, int c, int d) { \ bool found; \ - bool blocked = wxPyBeginBlockThreads(); \ + wxPyBlock_t blocked = wxPyBeginBlockThreads(); \ if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \ wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iiii)",a,b,c,d)); \ wxPyEndBlockThreads(blocked); \ @@ -734,7 +749,7 @@ extern wxPyApp *wxPythonApp; #define IMP_PYCALLBACK_VOID_INT5(CLASS, PCLASS, CBNAME) \ void CLASS::CBNAME(int a, int b, int c, int d, int e) { \ bool found; \ - bool blocked = wxPyBeginBlockThreads(); \ + wxPyBlock_t blocked = wxPyBeginBlockThreads(); \ if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \ wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iiiii)",a,b,c,d,e)); \ wxPyEndBlockThreads(blocked); \ @@ -756,7 +771,7 @@ extern wxPyApp *wxPythonApp; void CLASS::CBNAME(int* a, int* b) const { \ const char* errmsg = #CBNAME " should return a 2-tuple of integers."; \ bool found; \ - bool blocked = wxPyBeginBlockThreads(); \ + wxPyBlock_t blocked = wxPyBeginBlockThreads(); \ if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \ PyObject* ro; \ ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("()")); \ @@ -798,7 +813,7 @@ extern wxPyApp *wxPythonApp; wxSize CLASS::CBNAME() const { \ const char* errmsg = #CBNAME " should return a 2-tuple of integers."; \ bool found; wxSize rval(0,0); \ - bool blocked = wxPyBeginBlockThreads(); \ + wxPyBlock_t blocked = wxPyBeginBlockThreads(); \ if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \ PyObject* ro; \ ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("()")); \ @@ -841,7 +856,7 @@ extern wxPyApp *wxPythonApp; #define IMP_PYCALLBACK_BOOL_BOOL(CLASS, PCLASS, CBNAME) \ bool CLASS::CBNAME(bool a) { \ bool rval=false, found; \ - bool blocked = wxPyBeginBlockThreads(); \ + wxPyBlock_t blocked = wxPyBeginBlockThreads(); \ if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \ rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(i)",a));\ wxPyEndBlockThreads(blocked); \ @@ -863,7 +878,7 @@ extern wxPyApp *wxPythonApp; #define IMP_PYCALLBACK_BOOL_INT(CLASS, PCLASS, CBNAME) \ bool CLASS::CBNAME(int a) { \ bool rval=false, found; \ - bool blocked = wxPyBeginBlockThreads(); \ + wxPyBlock_t blocked = wxPyBeginBlockThreads(); \ if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \ rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(i)",a));\ wxPyEndBlockThreads(blocked); \ @@ -884,7 +899,7 @@ extern wxPyApp *wxPythonApp; #define IMP_PYCALLBACK_BOOL_INT_pure(CLASS, PCLASS, CBNAME) \ bool CLASS::CBNAME(int a) { \ bool rval=false; \ - bool blocked = wxPyBeginBlockThreads(); \ + wxPyBlock_t blocked = wxPyBeginBlockThreads(); \ if (wxPyCBH_findCallback(m_myInst, #CBNAME)) \ rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(i)",a)); \ else rval = false; \ @@ -903,7 +918,7 @@ extern wxPyApp *wxPythonApp; #define IMP_PYCALLBACK__DC(CLASS, PCLASS, CBNAME) \ void CLASS::CBNAME(wxDC& a) { \ bool found; \ - bool blocked = wxPyBeginBlockThreads(); \ + wxPyBlock_t blocked = wxPyBeginBlockThreads(); \ if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \ PyObject* obj = wxPyMake_wxObject(&a,false); \ wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", obj)); \ @@ -929,7 +944,7 @@ extern wxPyApp *wxPythonApp; #define IMP_PYCALLBACK__DCBOOL(CLASS, PCLASS, CBNAME) \ void CLASS::CBNAME(wxDC& a, bool b) { \ bool found; \ - bool blocked = wxPyBeginBlockThreads(); \ + wxPyBlock_t blocked = wxPyBeginBlockThreads(); \ if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \ PyObject* obj = wxPyMake_wxObject(&a,false); \ wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Oi)", obj, (int)b)); \ @@ -953,7 +968,7 @@ extern wxPyApp *wxPythonApp; #define IMP_PYCALLBACK__DCBOOL(CLASS, PCLASS, CBNAME) \ void CLASS::CBNAME(wxDC& a, bool b) { \ bool found; \ - bool blocked = wxPyBeginBlockThreads(); \ + wxPyBlock_t blocked = wxPyBeginBlockThreads(); \ if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \ PyObject* obj = wxPyMake_wxObject(&a,false); \ wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Oi)", obj, (int)b)); \ @@ -977,7 +992,7 @@ extern wxPyApp *wxPythonApp; #define IMP_PYCALLBACK__2DBL(CLASS, PCLASS, CBNAME) \ void CLASS::CBNAME(double a, double b) { \ bool found; \ - bool blocked = wxPyBeginBlockThreads(); \ + wxPyBlock_t blocked = wxPyBeginBlockThreads(); \ if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \ wxPyCBH_callCallback(m_myInst, Py_BuildValue("(dd)",a,b)); \ wxPyEndBlockThreads(blocked); \ @@ -998,7 +1013,7 @@ extern wxPyApp *wxPythonApp; #define IMP_PYCALLBACK__2DBL2INT(CLASS, PCLASS, CBNAME) \ void CLASS::CBNAME(double a, double b, int c, int d) { \ bool found; \ - bool blocked = wxPyBeginBlockThreads(); \ + wxPyBlock_t blocked = wxPyBeginBlockThreads(); \ if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \ wxPyCBH_callCallback(m_myInst, Py_BuildValue("(ddii)", \ a,b,c,d)); \ @@ -1020,7 +1035,7 @@ extern wxPyApp *wxPythonApp; #define IMP_PYCALLBACK__DC4DBLBOOL(CLASS, PCLASS, CBNAME) \ void CLASS::CBNAME(wxDC& a, double b, double c, double d, double e, bool f) { \ bool found; \ - bool blocked = wxPyBeginBlockThreads(); \ + wxPyBlock_t blocked = wxPyBeginBlockThreads(); \ if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \ PyObject* obj = wxPyMake_wxObject(&a,false); \ wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Oddddi)", obj, b, c, d, e, (int)f)); \ @@ -1044,7 +1059,7 @@ extern wxPyApp *wxPythonApp; #define IMP_PYCALLBACK_BOOL_DC4DBLBOOL(CLASS, PCLASS, CBNAME) \ bool CLASS::CBNAME(wxDC& a, double b, double c, double d, double e, bool f) { \ bool found; \ - bool blocked = wxPyBeginBlockThreads(); \ + wxPyBlock_t blocked = wxPyBeginBlockThreads(); \ bool rval=false; \ if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \ PyObject* obj = wxPyMake_wxObject(&a,false); \ @@ -1070,7 +1085,7 @@ extern wxPyApp *wxPythonApp; #define IMP_PYCALLBACK__BOOL2DBL2INT(CLASS, PCLASS, CBNAME) \ void CLASS::CBNAME(bool a, double b, double c, int d, int e) { \ bool found; \ - bool blocked = wxPyBeginBlockThreads(); \ + wxPyBlock_t blocked = wxPyBeginBlockThreads(); \ if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \ wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iddii)", \ (int)a,b,c,d,e)); \ @@ -1092,7 +1107,7 @@ extern wxPyApp *wxPythonApp; #define IMP_PYCALLBACK__DC4DBL(CLASS, PCLASS, CBNAME) \ void CLASS::CBNAME(wxDC& a, double b, double c, double d, double e) { \ bool found; \ - bool blocked = wxPyBeginBlockThreads(); \ + wxPyBlock_t blocked = wxPyBeginBlockThreads(); \ if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \ PyObject* obj = wxPyMake_wxObject(&a,false); \ wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Odddd)", obj, b, c, d, e)); \ @@ -1116,7 +1131,7 @@ extern wxPyApp *wxPythonApp; #define IMP_PYCALLBACK__DCBOOL(CLASS, PCLASS, CBNAME) \ void CLASS::CBNAME(wxDC& a, bool b) { \ bool found; \ - bool blocked = wxPyBeginBlockThreads(); \ + wxPyBlock_t blocked = wxPyBeginBlockThreads(); \ if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \ PyObject* obj = wxPyMake_wxObject(&a,false); \ wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Oi)", obj, (int)b)); \ @@ -1141,7 +1156,7 @@ extern wxPyApp *wxPythonApp; void CLASS::CBNAME(wxControlPoint* a, bool b, double c, double d, \ int e, int f) { \ bool found; \ - bool blocked = wxPyBeginBlockThreads(); \ + wxPyBlock_t blocked = wxPyBeginBlockThreads(); \ if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \ PyObject* obj = wxPyMake_wxObject(a,false); \ wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Oiddii)", obj, (int)b, c, d, e, f));\ @@ -1166,7 +1181,7 @@ extern wxPyApp *wxPythonApp; #define IMP_PYCALLBACK__WXCP2DBL2INT(CLASS, PCLASS, CBNAME) \ void CLASS::CBNAME(wxControlPoint* a, double b, double c, int d, int e) { \ bool found; \ - bool blocked = wxPyBeginBlockThreads(); \ + wxPyBlock_t blocked = wxPyBeginBlockThreads(); \ if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \ PyObject* obj = wxPyMake_wxObject(a,false); \ wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Oddii)", obj, b, c, d, e)); \ @@ -1191,7 +1206,7 @@ extern wxPyApp *wxPythonApp; #define IMP_PYCALLBACK__2DBLINT(CLASS, PCLASS, CBNAME) \ void CLASS::CBNAME(double a, double b, int c) { \ bool found; \ - bool blocked = wxPyBeginBlockThreads(); \ + wxPyBlock_t blocked = wxPyBeginBlockThreads(); \ if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \ wxPyCBH_callCallback(m_myInst, Py_BuildValue("(ddi)", a,b,c)); \ wxPyEndBlockThreads(blocked); \ @@ -1212,7 +1227,7 @@ extern wxPyApp *wxPythonApp; #define IMP_PYCALLBACK__BOOL2DBLINT(CLASS, PCLASS, CBNAME) \ void CLASS::CBNAME(bool a, double b, double c, int d) { \ bool found; \ - bool blocked = wxPyBeginBlockThreads(); \ + wxPyBlock_t blocked = wxPyBeginBlockThreads(); \ if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \ wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iddi)", (int)a,b,c,d));\ wxPyEndBlockThreads(blocked); \ @@ -1233,7 +1248,7 @@ extern wxPyApp *wxPythonApp; #define IMP_PYCALLBACK__STRING(CLASS, PCLASS, CBNAME) \ void CLASS::CBNAME(const wxString& a) { \ bool found; \ - bool blocked = wxPyBeginBlockThreads(); \ + wxPyBlock_t blocked = wxPyBeginBlockThreads(); \ if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \ PyObject* s = wx2PyString(a); \ wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", s)); \ @@ -1257,7 +1272,7 @@ extern wxPyApp *wxPythonApp; bool CLASS::CBNAME(const wxString& a) { \ bool rval=false; \ bool found; \ - bool blocked = wxPyBeginBlockThreads(); \ + wxPyBlock_t blocked = wxPyBeginBlockThreads(); \ if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \ PyObject* s = wx2PyString(a); \ rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", s)); \ @@ -1280,7 +1295,7 @@ extern wxPyApp *wxPythonApp; #define IMP_PYCALLBACK_BOOL_STRING_pure(CLASS, PCLASS, CBNAME) \ bool CLASS::CBNAME(const wxString& a) { \ bool rval=false; \ - bool blocked = wxPyBeginBlockThreads(); \ + wxPyBlock_t blocked = wxPyBeginBlockThreads(); \ if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \ PyObject* s = wx2PyString(a); \ rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", s)); \ @@ -1298,7 +1313,7 @@ extern wxPyApp *wxPythonApp; #define IMP_PYCALLBACK_STRING_STRING_pure(CLASS, PCLASS, CBNAME) \ wxString CLASS::CBNAME(const wxString& a) { \ wxString rval; \ - bool blocked = wxPyBeginBlockThreads(); \ + wxPyBlock_t blocked = wxPyBeginBlockThreads(); \ if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \ PyObject* ro; \ PyObject* s = wx2PyString(a); \ @@ -1323,7 +1338,7 @@ extern wxPyApp *wxPythonApp; wxString CLASS::CBNAME(const wxString& a) { \ wxString rval; \ bool found; \ - bool blocked = wxPyBeginBlockThreads(); \ + wxPyBlock_t blocked = wxPyBeginBlockThreads(); \ if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \ PyObject* ro; \ PyObject* s = wx2PyString(a); \ @@ -1348,7 +1363,7 @@ extern wxPyApp *wxPythonApp; #define IMP_PYCALLBACK_STRING_STRINGINT_pure(CLASS, PCLASS, CBNAME) \ wxString CLASS::CBNAME(const wxString& a,int b) { \ wxString rval; \ - bool blocked = wxPyBeginBlockThreads(); \ + wxPyBlock_t blocked = wxPyBeginBlockThreads(); \ if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \ PyObject* ro; \ PyObject* s = wx2PyString(a); \ @@ -1373,7 +1388,7 @@ extern wxPyApp *wxPythonApp; bool CLASS::CBNAME(const wxString& a, const wxString& b) { \ bool rval=false; \ bool found; \ - bool blocked = wxPyBeginBlockThreads(); \ + wxPyBlock_t blocked = wxPyBeginBlockThreads(); \ if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \ PyObject* s1 = wx2PyString(a); \ PyObject* s2 = wx2PyString(b); \ @@ -1400,7 +1415,7 @@ extern wxPyApp *wxPythonApp; wxString CLASS::CBNAME() { \ wxString rval; \ bool found; \ - bool blocked = wxPyBeginBlockThreads(); \ + wxPyBlock_t blocked = wxPyBeginBlockThreads(); \ if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \ PyObject* ro; \ ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("()")); \ @@ -1428,7 +1443,7 @@ extern wxPyApp *wxPythonApp; wxString CLASS::CBNAME() const { \ wxString rval; \ bool found; \ - bool blocked = wxPyBeginBlockThreads(); \ + wxPyBlock_t blocked = wxPyBeginBlockThreads(); \ if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \ PyObject* ro; \ ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("()")); \ @@ -1454,7 +1469,7 @@ extern wxPyApp *wxPythonApp; #define IMP_PYCALLBACK_STRING__pure(CLASS, PCLASS, CBNAME) \ wxString CLASS::CBNAME() { \ wxString rval; \ - bool blocked = wxPyBeginBlockThreads(); \ + wxPyBlock_t blocked = wxPyBeginBlockThreads(); \ if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \ PyObject* ro; \ ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("()")); \ @@ -1475,7 +1490,7 @@ extern wxPyApp *wxPythonApp; #define IMP_PYCALLBACK_STRING__constpure(CLASS, PCLASS, CBNAME) \ wxString CLASS::CBNAME() const { \ wxString rval; \ - bool blocked = wxPyBeginBlockThreads(); \ + wxPyBlock_t blocked = wxPyBeginBlockThreads(); \ if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \ PyObject* ro; \ ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("()")); \ @@ -1497,7 +1512,7 @@ extern wxPyApp *wxPythonApp; #define IMP_PYCALLBACK_BOOL_TAG_pure(CLASS, PCLASS, CBNAME) \ bool CLASS::CBNAME(const wxHtmlTag& a) { \ bool rval=false; \ - bool blocked = wxPyBeginBlockThreads(); \ + wxPyBlock_t blocked = wxPyBeginBlockThreads(); \ if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \ PyObject* obj = wxPyConstructObject((void*)&a, wxT("wxHtmlTag"), 0);\ rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", obj)); \ @@ -1516,7 +1531,7 @@ extern wxPyApp *wxPythonApp; #define IMP_PYCALLBACK__CELLINTINT(CLASS, PCLASS, CBNAME) \ void CLASS::CBNAME(wxHtmlCell *cell, wxCoord x, wxCoord y) { \ bool found; \ - bool blocked = wxPyBeginBlockThreads(); \ + wxPyBlock_t blocked = wxPyBeginBlockThreads(); \ if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \ PyObject* obj = wxPyConstructObject((void*)cell, wxT("wxHtmlCell"), 0); \ wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(Oii)",obj,x,y)); \ @@ -1539,7 +1554,7 @@ extern wxPyApp *wxPythonApp; #define IMP_PYCALLBACK__COLOUR(CLASS, PCLASS, CBNAME) \ void CLASS::CBNAME(const wxColour& c) { \ bool found; \ - bool blocked = wxPyBeginBlockThreads(); \ + wxPyBlock_t blocked = wxPyBeginBlockThreads(); \ if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \ PyObject* obj = wxPyConstructObject((void*)&c, wxT("wxColour"), 0); \ wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(O)",obj)); \ @@ -1562,7 +1577,7 @@ extern wxPyApp *wxPythonApp; #define IMP_PYCALLBACK__CELLINTINTME(CLASS, PCLASS, CBNAME) \ void CLASS::CBNAME(wxHtmlCell *cell, wxCoord x, wxCoord y, const wxMouseEvent& e) { \ bool found; \ - bool blocked = wxPyBeginBlockThreads(); \ + wxPyBlock_t blocked = wxPyBeginBlockThreads(); \ if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \ PyObject* obj = wxPyConstructObject((void*)cell, wxT("wxHtmlCell"), 0); \ PyObject* o2 = wxPyConstructObject((void*)&e, wxT("wxMouseEvent"), 0); \ @@ -1588,7 +1603,7 @@ extern wxPyApp *wxPythonApp; #define IMP_PYCALLBACK___pure(CLASS, PCLASS, CBNAME) \ void CLASS::CBNAME() { \ - bool blocked = wxPyBeginBlockThreads(); \ + wxPyBlock_t blocked = wxPyBeginBlockThreads(); \ if (wxPyCBH_findCallback(m_myInst, #CBNAME)) \ wxPyCBH_callCallback(m_myInst, Py_BuildValue("()")); \ wxPyEndBlockThreads(blocked); \ @@ -1604,7 +1619,7 @@ extern wxPyApp *wxPythonApp; wxSize CLASS::CBNAME() { \ const char* errmsg = #CBNAME " should return a 2-tuple of integers or a wxSize object."; \ wxSize rval(0,0); \ - bool blocked = wxPyBeginBlockThreads(); \ + wxPyBlock_t blocked = wxPyBeginBlockThreads(); \ if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \ PyObject* ro; \ wxSize* ptr; \ @@ -1643,7 +1658,7 @@ extern wxPyApp *wxPythonApp; bool CLASS::CBNAME(wxWindow* a) { \ bool rval=false; \ bool found; \ - bool blocked = wxPyBeginBlockThreads(); \ + wxPyBlock_t blocked = wxPyBeginBlockThreads(); \ if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \ PyObject* obj = wxPyMake_wxObject(a,false); \ rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", obj)); \ @@ -1669,7 +1684,7 @@ extern wxPyApp *wxPythonApp; bool CLASS::CBNAME(wxWindow* a, wxDC& b) { \ bool rval=false; \ bool found; \ - bool blocked = wxPyBeginBlockThreads(); \ + wxPyBlock_t blocked = wxPyBeginBlockThreads(); \ if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \ PyObject* win = wxPyMake_wxObject(a,false); \ PyObject* dc = wxPyMake_wxObject(&b,false); \ @@ -1696,7 +1711,7 @@ extern wxPyApp *wxPythonApp; #define IMP_PYCALLBACK_VOID_WXWINBASE(CLASS, PCLASS, CBNAME) \ void CLASS::CBNAME(wxWindowBase* a) { \ bool found; \ - bool blocked = wxPyBeginBlockThreads(); \ + wxPyBlock_t blocked = wxPyBeginBlockThreads(); \ if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \ PyObject* obj = wxPyMake_wxObject(a,false); \ wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", obj)); \ @@ -1721,7 +1736,7 @@ extern wxPyApp *wxPythonApp; bool CLASS::CBNAME() { \ bool rval=false; \ bool found; \ - bool blocked = wxPyBeginBlockThreads(); \ + wxPyBlock_t blocked = wxPyBeginBlockThreads(); \ if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \ rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("()")); \ wxPyEndBlockThreads(blocked); \ @@ -1744,7 +1759,7 @@ extern wxPyApp *wxPythonApp; bool CLASS::CBNAME() const { \ bool rval=false; \ bool found; \ - bool blocked = wxPyBeginBlockThreads(); \ + wxPyBlock_t blocked = wxPyBeginBlockThreads(); \ if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \ rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("()")); \ wxPyEndBlockThreads(blocked); \ @@ -1767,7 +1782,7 @@ extern wxPyApp *wxPythonApp; wxDragResult CLASS::CBNAME(wxCoord a, wxCoord b, wxDragResult c) { \ int rval=0; \ bool found; \ - bool blocked = wxPyBeginBlockThreads(); \ + wxPyBlock_t blocked = wxPyBeginBlockThreads(); \ if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \ rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iii)", a,b,c));\ wxPyEndBlockThreads(blocked); \ @@ -1786,7 +1801,7 @@ extern wxPyApp *wxPythonApp; #define IMP_PYCALLBACK_FSF_FSSTRING_pure(CLASS, PCLASS, CBNAME) \ wxFSFile* CLASS::CBNAME(wxFileSystem& a,const wxString& b) { \ - bool blocked = wxPyBeginBlockThreads(); \ + wxPyBlock_t blocked = wxPyBeginBlockThreads(); \ wxFSFile* rval=0; \ if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \ PyObject* ro; \ @@ -1816,7 +1831,7 @@ extern wxPyApp *wxPythonApp; bool CLASS::CBNAME(wxDragResult a) { \ bool rval=false; \ bool found; \ - bool blocked = wxPyBeginBlockThreads(); \ + wxPyBlock_t blocked = wxPyBeginBlockThreads(); \ if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \ rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(i)", a)); \ wxPyEndBlockThreads(blocked); \ @@ -1836,7 +1851,7 @@ extern wxPyApp *wxPythonApp; #define IMP_PYCALLBACK_DR_2WXCDR_pure(CLASS, PCLASS, CBNAME) \ wxDragResult CLASS::CBNAME(wxCoord a, wxCoord b, wxDragResult c) { \ - bool blocked = wxPyBeginBlockThreads(); \ + wxPyBlock_t blocked = wxPyBeginBlockThreads(); \ int rval=0; \ if (wxPyCBH_findCallback(m_myInst, #CBNAME)) \ rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iii)", a,b,c));\ @@ -1852,7 +1867,7 @@ extern wxPyApp *wxPythonApp; #define IMP_PYCALLBACK_BOOL_INTINTSTR_pure(CLASS, PCLASS, CBNAME) \ bool CLASS::CBNAME(int a, int b, const wxString& c) { \ bool rval=false; \ - bool blocked = wxPyBeginBlockThreads(); \ + wxPyBlock_t blocked = wxPyBeginBlockThreads(); \ if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \ PyObject* s = wx2PyString(c); \ rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iiO)",a,b,s));\ @@ -1873,7 +1888,7 @@ extern wxPyApp *wxPythonApp; size_t CLASS::CBNAME() { \ size_t rval=0; \ bool found; \ - bool blocked = wxPyBeginBlockThreads(); \ + wxPyBlock_t blocked = wxPyBeginBlockThreads(); \ if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \ rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("()")); \ wxPyEndBlockThreads(blocked); \ @@ -1896,7 +1911,7 @@ extern wxPyApp *wxPythonApp; size_t CLASS::CBNAME() const { \ size_t rval=0; \ bool found; \ - bool blocked = wxPyBeginBlockThreads(); \ + wxPyBlock_t blocked = wxPyBeginBlockThreads(); \ if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \ rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("()")); \ wxPyEndBlockThreads(blocked); \ @@ -1919,7 +1934,7 @@ extern wxPyApp *wxPythonApp; wxDataFormat CLASS::CBNAME(size_t a) { \ wxDataFormat rval=0; \ bool found; \ - bool blocked = wxPyBeginBlockThreads(); \ + wxPyBlock_t blocked = wxPyBeginBlockThreads(); \ if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \ PyObject* ro; \ wxDataFormat* ptr; \ @@ -1949,7 +1964,7 @@ extern wxPyApp *wxPythonApp; #define IMP_PYCALLBACK__constany(CLASS, PCLASS, CBNAME, Type) \ void CLASS::CBNAME(const Type& a) { \ bool found; \ - bool blocked = wxPyBeginBlockThreads(); \ + wxPyBlock_t blocked = wxPyBeginBlockThreads(); \ if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \ PyObject* obj = wxPyConstructObject((void*)&a, wxT(#Type), 0); \ wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", obj)); \ @@ -1974,7 +1989,7 @@ extern wxPyApp *wxPythonApp; #define IMP_PYCALLBACK__any(CLASS, PCLASS, CBNAME, Type) \ void CLASS::CBNAME(Type& a) { \ bool found; \ - bool blocked = wxPyBeginBlockThreads(); \ + wxPyBlock_t blocked = wxPyBeginBlockThreads(); \ if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \ PyObject* obj = wxPyConstructObject((void*)&a, wxT(#Type), 0); \ wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", obj)); \ @@ -1999,7 +2014,7 @@ extern wxPyApp *wxPythonApp; bool CLASS::CBNAME(Type& a) { \ bool rv=false; \ bool found; \ - bool blocked = wxPyBeginBlockThreads(); \ + wxPyBlock_t blocked = wxPyBeginBlockThreads(); \ if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \ PyObject* obj = wxPyConstructObject((void*)&a, wxT(#Type), 0); \ rv = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", obj)); \ @@ -2023,7 +2038,7 @@ extern wxPyApp *wxPythonApp; #define IMP_PYCALLBACK_bool_anypure(CLASS, PCLASS, CBNAME, Type) \ bool CLASS::CBNAME(Type& a) { \ bool rv=false; \ - bool blocked = wxPyBeginBlockThreads(); \ + wxPyBlock_t blocked = wxPyBeginBlockThreads(); \ if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \ PyObject* obj = wxPyConstructObject((void*)&a, wxT(#Type), 0); \ rv = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", obj)); \ @@ -2043,7 +2058,7 @@ extern wxPyApp *wxPythonApp; wxString CLASS::CBNAME(long a, long b) const { \ wxString rval; \ bool found; \ - bool blocked = wxPyBeginBlockThreads(); \ + wxPyBlock_t blocked = wxPyBeginBlockThreads(); \ if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \ PyObject* ro; \ ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(ll)",a,b)); \ @@ -2072,7 +2087,7 @@ extern wxPyApp *wxPythonApp; int CLASS::CBNAME(long a) const { \ int rval=-1; \ bool found; \ - bool blocked = wxPyBeginBlockThreads(); \ + wxPyBlock_t blocked = wxPyBeginBlockThreads(); \ if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \ PyObject* ro; \ ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(l)",a)); \ @@ -2101,7 +2116,7 @@ extern wxPyApp *wxPythonApp; int CLASS::CBNAME(long a) const { \ int rval=-1; /* this rval is important for OnGetItemImage */ \ bool found; \ - bool blocked = wxPyBeginBlockThreads(); \ + wxPyBlock_t blocked = wxPyBeginBlockThreads(); \ if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \ PyObject* ro; \ ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(l)",a)); \ @@ -2126,7 +2141,7 @@ extern wxPyApp *wxPythonApp; wxListItemAttr *CLASS::CBNAME(long a) const { \ wxListItemAttr *rval = NULL; \ bool found; \ - bool blocked = wxPyBeginBlockThreads(); \ + wxPyBlock_t blocked = wxPyBeginBlockThreads(); \ if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \ PyObject* ro; \ wxListItemAttr* ptr; \ @@ -2156,7 +2171,7 @@ extern wxPyApp *wxPythonApp; bool CLASS::CBNAME(wxMouseEvent& e) { \ bool rval=false; \ bool found; \ - bool blocked = wxPyBeginBlockThreads(); \ + wxPyBlock_t blocked = wxPyBeginBlockThreads(); \ if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \ PyObject* ro; \ PyObject* obj = wxPyConstructObject((void*)&e, wxT("wxMouseEvent"), 0); \ @@ -2185,7 +2200,7 @@ extern wxPyApp *wxPythonApp; #define IMP_PYCALLBACK_WIZPG__pure(CLASS, PCLASS, CBNAME) \ wxWizardPage* CLASS::CBNAME() const { \ wxWizardPage* rv = NULL; \ - bool blocked = wxPyBeginBlockThreads(); \ + wxPyBlock_t blocked = wxPyBeginBlockThreads(); \ if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \ PyObject* ro; \ ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("()")); \ @@ -2206,7 +2221,7 @@ extern wxPyApp *wxPythonApp; #define IMP_PYCALLBACK_BITMAP__pure(CLASS, PCLASS, CBNAME) \ wxBitmap CLASS::CBNAME() const { \ wxBitmap rv; \ - bool blocked = wxPyBeginBlockThreads(); \ + wxPyBlock_t blocked = wxPyBeginBlockThreads(); \ if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \ PyObject* ro; \ wxBitmap* ptr; \ @@ -2229,7 +2244,7 @@ extern wxPyApp *wxPythonApp; #define IMP_PYCALLBACK_OBJECT__pure(CLASS, PCLASS, CBNAME) \ wxObject* CLASS::CBNAME() { \ wxObject* rv = NULL; \ - bool blocked = wxPyBeginBlockThreads(); \ + wxPyBlock_t blocked = wxPyBeginBlockThreads(); \ if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \ PyObject* ro; \ ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("()")); \ @@ -2250,7 +2265,7 @@ extern wxPyApp *wxPythonApp; #define IMP_PYCALLBACK_OBJECT_STRING_pure(CLASS, PCLASS, CBNAME) \ wxObject* CLASS::CBNAME(const wxString& a) { \ wxObject* rv = NULL; \ - bool blocked = wxPyBeginBlockThreads(); \ + wxPyBlock_t blocked = wxPyBeginBlockThreads(); \ if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \ PyObject* so = wx2PyString(a); \ PyObject* ro; \ @@ -2274,7 +2289,7 @@ extern wxPyApp *wxPythonApp; #define IMP_PYCALLBACK_BOOL_NODE_pure(CLASS, PCLASS, CBNAME) \ bool CLASS::CBNAME(wxXmlNode* a) { \ bool rv=false; \ - bool blocked = wxPyBeginBlockThreads(); \ + wxPyBlock_t blocked = wxPyBeginBlockThreads(); \ if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \ PyObject* obj = wxPyConstructObject((void*)a, wxT("wxXmlNode"), 0); \ rv = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", obj)); \ @@ -2294,7 +2309,7 @@ extern wxPyApp *wxPythonApp; wxCoord CLASS::CBNAME(size_t a) const { \ wxCoord rval=0; \ bool found; \ - bool blocked = wxPyBeginBlockThreads(); \ + wxPyBlock_t blocked = wxPyBeginBlockThreads(); \ if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \ rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(i)", a)); \ } \ @@ -2312,7 +2327,7 @@ extern wxPyApp *wxPythonApp; #define IMP_PYCALLBACK_VOID_SIZETSIZET_const(CLASS, PCLASS, CBNAME) \ void CLASS::CBNAME(size_t a, size_t b) const { \ bool found; \ - bool blocked = wxPyBeginBlockThreads(); \ + wxPyBlock_t blocked = wxPyBeginBlockThreads(); \ if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \ wxPyCBH_callCallback(m_myInst, Py_BuildValue("(ii)",a,b)); \ wxPyEndBlockThreads(blocked); \ @@ -2334,7 +2349,7 @@ extern wxPyApp *wxPythonApp; wxCoord CLASS::CBNAME() const { \ wxCoord rval=0; \ bool found; \ - bool blocked = wxPyBeginBlockThreads(); \ + wxPyBlock_t blocked = wxPyBeginBlockThreads(); \ if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \ rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("()")); \ wxPyEndBlockThreads(blocked); \ @@ -2355,7 +2370,7 @@ extern wxPyApp *wxPythonApp; #define IMP_PYCALLBACK__DCRECTSIZET_constpure(CLASS, PCLASS, CBNAME) \ void CLASS::CBNAME(wxDC& a, const wxRect& b, size_t c) const { \ bool found; \ - bool blocked = wxPyBeginBlockThreads(); \ + wxPyBlock_t blocked = wxPyBeginBlockThreads(); \ if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \ PyObject* obj = wxPyMake_wxObject(&a,false); \ PyObject* ro = wxPyConstructObject((void*)&b, wxT("wxRect"), 0); \ @@ -2375,7 +2390,7 @@ extern wxPyApp *wxPythonApp; #define IMP_PYCALLBACK__DCRECTSIZET_const(CLASS, PCLASS, CBNAME) \ void CLASS::CBNAME(wxDC& a, const wxRect& b, size_t c) const { \ bool found; \ - bool blocked = wxPyBeginBlockThreads(); \ + wxPyBlock_t blocked = wxPyBeginBlockThreads(); \ if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \ PyObject* obj = wxPyMake_wxObject(&a,false); \ PyObject* ro = wxPyConstructObject((void*)&b, wxT("wxRect"), 0); \ @@ -2401,7 +2416,7 @@ extern wxPyApp *wxPythonApp; wxString CLASS::CBNAME(size_t a) const { \ wxString rval; \ bool found; \ - bool blocked = wxPyBeginBlockThreads(); \ + wxPyBlock_t blocked = wxPyBeginBlockThreads(); \ if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \ PyObject* ro; \ ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(l)",a)); \ @@ -2428,7 +2443,7 @@ extern wxPyApp *wxPythonApp; wxString CLASS::CBNAME(size_t a) const { \ wxString rval; \ bool found; \ - bool blocked = wxPyBeginBlockThreads(); \ + wxPyBlock_t blocked = wxPyBeginBlockThreads(); \ if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \ PyObject* ro; \ ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(l)",a)); \ @@ -2452,7 +2467,7 @@ extern wxPyApp *wxPythonApp; wxVisualAttributes CLASS::CBNAME() const { \ wxVisualAttributes rval; \ bool found; \ - bool blocked = wxPyBeginBlockThreads(); \ + wxPyBlock_t blocked = wxPyBeginBlockThreads(); \ if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \ PyObject* ro; \ wxVisualAttributes* ptr; \ diff --git a/wxPython/samples/embedded/embedded.cpp b/wxPython/samples/embedded/embedded.cpp index 2805a649cf..67dde09ef4 100644 --- a/wxPython/samples/embedded/embedded.cpp +++ b/wxPython/samples/embedded/embedded.cpp @@ -190,7 +190,7 @@ void MyFrame::OnPyFrame(wxCommandEvent& event) // First, whenever you do anything with Python objects or code, you // *MUST* aquire the Global Interpreter Lock and block other // Python threads from running. - bool blocked = wxPyBeginBlockThreads(); + wxPyBlock_t blocked = wxPyBeginBlockThreads(); // Execute the code in the __main__ module PyRun_SimpleString(python_code1); @@ -211,7 +211,7 @@ import wx\n\ output = wx.PyOnDemandOutputWindow()\n\ sys.stdin = sys.stderr = output\n\ "; - bool blocked = wxPyBeginBlockThreads(); + wxPyBlock_t blocked = wxPyBeginBlockThreads(); PyRun_SimpleString(python_redirect); wxPyEndBlockThreads(blocked); } @@ -242,7 +242,7 @@ wxWindow* MyFrame::DoPythonStuff(wxWindow* parent) PyObject* result; // As always, first grab the GIL - bool blocked = wxPyBeginBlockThreads(); + wxPyBlock_t blocked = wxPyBeginBlockThreads(); // Now make a dictionary to serve as the global namespace when the code is // executed. Put a reference to the builtins module in it. (Yes, the diff --git a/wxPython/src/_artprov.i b/wxPython/src/_artprov.i index 72ef9ddd7d..e6e1bf6628 100644 --- a/wxPython/src/_artprov.i +++ b/wxPython/src/_artprov.i @@ -92,7 +92,7 @@ public: const wxArtClient& client, const wxSize& size) { wxBitmap rval = wxNullBitmap; - bool blocked = wxPyBeginBlockThreads(); + wxPyBlock_t blocked = wxPyBeginBlockThreads(); if ((wxPyCBH_findCallback(m_myInst, "CreateBitmap"))) { PyObject* so = wxPyConstructObject((void*)&size, wxT("wxSize"), 0); PyObject* ro; diff --git a/wxPython/src/_dataobj.i b/wxPython/src/_dataobj.i index e2d83d1eb3..84ecb3802a 100644 --- a/wxPython/src/_dataobj.i +++ b/wxPython/src/_dataobj.i @@ -243,7 +243,7 @@ in the given direction.", ""); wxDataFormat* formats = new wxDataFormat[count]; self->GetAllFormats(formats, dir); - bool blocked = wxPyBeginBlockThreads(); + wxPyBlock_t blocked = wxPyBeginBlockThreads(); PyObject* list = PyList_New(count); for (size_t i=0; iGetDataSize(format); - bool blocked = wxPyBeginBlockThreads(); + wxPyBlock_t blocked = wxPyBeginBlockThreads(); if (size) { char* buf = new char[size]; if (self->GetDataHere(format, buf)) @@ -301,7 +301,7 @@ in the given direction.", ""); %extend { bool SetData(const wxDataFormat& format, PyObject* data) { bool rval; - bool blocked = wxPyBeginBlockThreads(); + wxPyBlock_t blocked = wxPyBeginBlockThreads(); if (PyString_Check(data)) { rval = self->SetData(format, PyString_Size(data), PyString_AsString(data)); } @@ -363,7 +363,7 @@ supports rendering its data.", ""); PyObject* GetDataHere() { PyObject* rval = NULL; size_t size = self->GetDataSize(); - bool blocked = wxPyBeginBlockThreads(); + wxPyBlock_t blocked = wxPyBeginBlockThreads(); if (size) { char* buf = new char[size]; if (self->GetDataHere(buf)) @@ -388,7 +388,7 @@ derived class if the object supports setting its data. %extend { bool SetData(PyObject* data) { bool rval; - bool blocked = wxPyBeginBlockThreads(); + wxPyBlock_t blocked = wxPyBeginBlockThreads(); if (PyString_Check(data)) { rval = self->SetData(PyString_Size(data), PyString_AsString(data)); } @@ -428,7 +428,7 @@ bool wxPyDataObjectSimple::GetDataHere(void *buf) const { // C++ version. bool rval = false; - bool blocked = wxPyBeginBlockThreads(); + wxPyBlock_t blocked = wxPyBeginBlockThreads(); if (wxPyCBH_findCallback(m_myInst, "GetDataHere")) { PyObject* ro; ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("()")); @@ -447,7 +447,7 @@ bool wxPyDataObjectSimple::SetData(size_t len, const void *buf) const{ // For this one we simply need to make a string from buf and len // and send it to the Python method. bool rval = false; - bool blocked = wxPyBeginBlockThreads(); + wxPyBlock_t blocked = wxPyBeginBlockThreads(); if (wxPyCBH_findCallback(m_myInst, "SetData")) { PyObject* data = PyString_FromStringAndSize((char*)buf, len); rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", data)); @@ -665,7 +665,7 @@ public: wxBitmap wxPyBitmapDataObject::GetBitmap() const { wxBitmap* rval = &wxNullBitmap; - bool blocked = wxPyBeginBlockThreads(); + wxPyBlock_t blocked = wxPyBeginBlockThreads(); if (wxPyCBH_findCallback(m_myInst, "GetBitmap")) { PyObject* ro; wxBitmap* ptr; @@ -681,7 +681,7 @@ wxBitmap wxPyBitmapDataObject::GetBitmap() const { } void wxPyBitmapDataObject::SetBitmap(const wxBitmap& bitmap) { - bool blocked = wxPyBeginBlockThreads(); + wxPyBlock_t blocked = wxPyBeginBlockThreads(); if (wxPyCBH_findCallback(m_myInst, "SetBitmap")) { PyObject* bo = wxPyConstructObject((void*)&bitmap, wxT("wxBitmap"), false); wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", bo)); @@ -764,7 +764,7 @@ public: %extend { bool SetData(PyObject* data) { bool rval; - bool blocked = wxPyBeginBlockThreads(); + wxPyBlock_t blocked = wxPyBeginBlockThreads(); if (PyString_Check(data)) { rval = self->SetData(PyString_Size(data), PyString_AsString(data)); } @@ -790,7 +790,7 @@ public: %extend { PyObject* GetData() { PyObject* obj; - bool blocked = wxPyBeginBlockThreads(); + wxPyBlock_t blocked = wxPyBeginBlockThreads(); obj = PyString_FromStringAndSize((char*)self->GetData(), self->GetSize()); wxPyEndBlockThreads(blocked); return obj; diff --git a/wxPython/src/_datetime.i b/wxPython/src/_datetime.i index 9441f8ee1e..4bba1d2124 100644 --- a/wxPython/src/_datetime.i +++ b/wxPython/src/_datetime.i @@ -372,7 +372,7 @@ public: wxString am; wxString pm; wxDateTime::GetAmPmStrings(&am, &pm); - bool blocked = wxPyBeginBlockThreads(); + wxPyBlock_t blocked = wxPyBeginBlockThreads(); PyObject* tup = PyTuple_New(2); PyTuple_SET_ITEM(tup, 0, wx2PyString(am)); PyTuple_SET_ITEM(tup, 1, wx2PyString(pm)); diff --git a/wxPython/src/_display.i b/wxPython/src/_display.i index 938c85ada3..60b2c49c60 100644 --- a/wxPython/src/_display.i +++ b/wxPython/src/_display.i @@ -206,7 +206,7 @@ function is not supported at all on this platform.", ""); PyObject* GetModes(const wxVideoMode& mode = wxDefaultVideoMode) { PyObject* pyList = NULL; wxArrayVideoModes arr = self->GetModes(mode); - bool blocked = wxPyBeginBlockThreads(); + wxPyBlock_t blocked = wxPyBeginBlockThreads(); pyList = PyList_New(0); for (int i=0; i < arr.GetCount(); i++) { wxVideoMode* m = new wxVideoMode(arr.Item(i)); diff --git a/wxPython/src/_dnd.i b/wxPython/src/_dnd.i index a7f5e4ab3b..581ea93043 100644 --- a/wxPython/src/_dnd.i +++ b/wxPython/src/_dnd.i @@ -220,7 +220,7 @@ public: bool wxPyFileDropTarget::OnDropFiles(wxCoord x, wxCoord y, const wxArrayString& filenames) { bool rval = false; - bool blocked = wxPyBeginBlockThreads(); + wxPyBlock_t blocked = wxPyBeginBlockThreads(); if (wxPyCBH_findCallback(m_myInst, "OnDropFiles")) { PyObject* list = wxArrayString2PyList_helper(filenames); rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iiO)",x,y,list)); diff --git a/wxPython/src/_filesys.i b/wxPython/src/_filesys.i index bdcc819ed4..d02c4d8748 100644 --- a/wxPython/src/_filesys.i +++ b/wxPython/src/_filesys.i @@ -206,7 +206,7 @@ public: return; } - bool blocked = wxPyBeginBlockThreads(); + wxPyBlock_t blocked = wxPyBeginBlockThreads(); void* ptr = (void*)PyString_AsString(data); size_t size = PyString_Size(data); wxPyEndBlockThreads(blocked); diff --git a/wxPython/src/_gbsizer.i b/wxPython/src/_gbsizer.i index 483c92f441..80f6429fe2 100644 --- a/wxPython/src/_gbsizer.i +++ b/wxPython/src/_gbsizer.i @@ -94,7 +94,7 @@ public: } PyObject* Get() { - bool blocked = wxPyBeginBlockThreads(); + wxPyBlock_t blocked = wxPyBeginBlockThreads(); PyObject* tup = PyTuple_New(2); PyTuple_SET_ITEM(tup, 0, PyInt_FromLong(self->GetRow())); PyTuple_SET_ITEM(tup, 1, PyInt_FromLong(self->GetCol())); @@ -163,7 +163,7 @@ cell in each direction.", ""); } PyObject* Get() { - bool blocked = wxPyBeginBlockThreads(); + wxPyBlock_t blocked = wxPyBeginBlockThreads(); PyObject* tup = PyTuple_New(2); PyTuple_SET_ITEM(tup, 0, PyInt_FromLong(self->GetRowspan())); PyTuple_SET_ITEM(tup, 1, PyInt_FromLong(self->GetColspan())); @@ -231,7 +231,7 @@ are created automatically when the sizer's Add method is called.", ""); { wxPyUserData* data = NULL; if ( userData ) { - bool blocked = wxPyBeginBlockThreads(); + wxPyBlock_t blocked = wxPyBeginBlockThreads(); data = new wxPyUserData(userData); wxPyEndBlockThreads(blocked); } @@ -250,7 +250,7 @@ are created automatically when the sizer's Add method is called.", ""); { wxPyUserData* data = NULL; if ( userData ) { - bool blocked = wxPyBeginBlockThreads(); + wxPyBlock_t blocked = wxPyBeginBlockThreads(); data = new wxPyUserData(userData); wxPyEndBlockThreads(blocked); } @@ -270,7 +270,7 @@ are created automatically when the sizer's Add method is called.", ""); { wxPyUserData* data = NULL; if ( userData ) { - bool blocked = wxPyBeginBlockThreads(); + wxPyBlock_t blocked = wxPyBeginBlockThreads(); data = new wxPyUserData(userData); wxPyEndBlockThreads(blocked); } @@ -388,7 +388,7 @@ position, False if something was already there. PyObject* userData = NULL ) { wxPyUserData* data = NULL; - bool blocked = wxPyBeginBlockThreads(); + wxPyBlock_t blocked = wxPyBeginBlockThreads(); wxPySizerItemInfo info = wxPySizerItemTypeHelper(item, true, false); if ( userData && (info.window || info.sizer || info.gotSize) ) data = new wxPyUserData(userData); diff --git a/wxPython/src/_gdicmn.i b/wxPython/src/_gdicmn.i index 97ea430a07..22a3d83fbc 100644 --- a/wxPython/src/_gdicmn.i +++ b/wxPython/src/_gdicmn.i @@ -191,7 +191,7 @@ of this object (i.e. equal to -1) with those of the other.", ""); "Get() -> (width,height)", "Returns the width and height properties as a tuple.", ""); PyObject* Get() { - bool blocked = wxPyBeginBlockThreads(); + wxPyBlock_t blocked = wxPyBeginBlockThreads(); PyObject* tup = PyTuple_New(2); PyTuple_SET_ITEM(tup, 0, PyInt_FromLong(self->x)); PyTuple_SET_ITEM(tup, 1, PyInt_FromLong(self->y)); @@ -264,7 +264,7 @@ public: "Get() -> (x,y)", "Return the x and y properties as a tuple. ", ""); PyObject* Get() { - bool blocked = wxPyBeginBlockThreads(); + wxPyBlock_t blocked = wxPyBeginBlockThreads(); PyObject* tup = PyTuple_New(2); PyTuple_SET_ITEM(tup, 0, PyFloat_FromDouble(self->x)); PyTuple_SET_ITEM(tup, 1, PyFloat_FromDouble(self->y)); @@ -377,7 +377,7 @@ public: "Get() -> (x,y)", "Return the x and y properties as a tuple. ", ""); PyObject* Get() { - bool blocked = wxPyBeginBlockThreads(); + wxPyBlock_t blocked = wxPyBeginBlockThreads(); PyObject* tup = PyTuple_New(2); PyTuple_SET_ITEM(tup, 0, PyInt_FromLong(self->x)); PyTuple_SET_ITEM(tup, 1, PyInt_FromLong(self->y)); @@ -594,7 +594,7 @@ bottom, otherwise it is moved to the left or top respectively.", "", "Get() -> (x,y,width,height)", "Return the rectangle properties as a tuple.", ""); PyObject* Get() { - bool blocked = wxPyBeginBlockThreads(); + wxPyBlock_t blocked = wxPyBeginBlockThreads(); PyObject* tup = PyTuple_New(4); PyTuple_SET_ITEM(tup, 0, PyInt_FromLong(self->x)); PyTuple_SET_ITEM(tup, 1, PyInt_FromLong(self->y)); @@ -640,7 +640,7 @@ DocAStr(wxIntersectRect, dest = reg1.GetBox(); if (dest != wxRect(0,0,0,0)) { - bool blocked = wxPyBeginBlockThreads(); + wxPyBlock_t blocked = wxPyBeginBlockThreads(); wxRect* newRect = new wxRect(dest); obj = wxPyConstructObject((void*)newRect, wxT("wxRect"), true); wxPyEndBlockThreads(blocked); @@ -728,7 +728,7 @@ public: "Get() -> (x,y)", "Return x and y properties as a tuple.", ""); PyObject* Get() { - bool blocked = wxPyBeginBlockThreads(); + wxPyBlock_t blocked = wxPyBeginBlockThreads(); PyObject* tup = PyTuple_New(2); PyTuple_SET_ITEM(tup, 0, PyFloat_FromDouble(self->m_x)); PyTuple_SET_ITEM(tup, 1, PyFloat_FromDouble(self->m_y)); diff --git a/wxPython/src/_image.i b/wxPython/src/_image.i index e58431f96d..658da26003 100644 --- a/wxPython/src/_image.i +++ b/wxPython/src/_image.i @@ -306,7 +306,7 @@ The method will then fill up the whole image with the colour given.", ""); unsigned char* buffer; int size; - bool blocked = wxPyBeginBlockThreads(); + wxPyBlock_t blocked = wxPyBeginBlockThreads(); if (!PyArg_Parse(data, "t#", &buffer, &size)) goto done; @@ -360,7 +360,7 @@ The method will then fill up the whole image with the colour given.", ""); unsigned char* buffer; int size; - bool blocked = wxPyBeginBlockThreads(); + wxPyBlock_t blocked = wxPyBeginBlockThreads(); if (!PyArg_Parse(data, "t#", &buffer, &size)) goto done; diff --git a/wxPython/src/_joystick.i b/wxPython/src/_joystick.i index 01acf952e1..252208e9e5 100644 --- a/wxPython/src/_joystick.i +++ b/wxPython/src/_joystick.i @@ -48,7 +48,7 @@ enum class wxJoystick : public wxObject { public: wxJoystick(int joystick = wxJOYSTICK1) { - bool blocked = wxPyBeginBlockThreads(); + wxPyBlock_t blocked = wxPyBeginBlockThreads(); PyErr_SetString(PyExc_NotImplementedError, "wxJoystick is not available on this platform."); wxPyEndBlockThreads(blocked); diff --git a/wxPython/src/_listctrl.i b/wxPython/src/_listctrl.i index 861e103621..1505e755f9 100644 --- a/wxPython/src/_listctrl.i +++ b/wxPython/src/_listctrl.i @@ -345,7 +345,7 @@ EVT_LIST_SET_INFO = wx._deprecated(EVT_LIST_SET_INFO) static int wxCALLBACK wxPyListCtrl_SortItems(long item1, long item2, long funcPtr) { int retval = 0; PyObject* func = (PyObject*)funcPtr; - bool blocked = wxPyBeginBlockThreads(); + wxPyBlock_t blocked = wxPyBeginBlockThreads(); PyObject* args = Py_BuildValue("(ii)", item1, item2); PyObject* result = PyEval_CallObject(func, args); diff --git a/wxPython/src/_log.i b/wxPython/src/_log.i index 1010059672..4797f9fe7d 100644 --- a/wxPython/src/_log.i +++ b/wxPython/src/_log.i @@ -346,7 +346,7 @@ public: virtual void DoLog(wxLogLevel level, const wxChar *szString, time_t t) { bool found; - bool blocked = wxPyBeginBlockThreads(); + wxPyBlock_t blocked = wxPyBeginBlockThreads(); if ((found = wxPyCBH_findCallback(m_myInst, "DoLog"))) { PyObject* s = wx2PyString(szString); wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iOi)", level, s, t)); @@ -359,7 +359,7 @@ public: virtual void DoLogString(const wxChar *szString, time_t t) { bool found; - bool blocked = wxPyBeginBlockThreads(); + wxPyBlock_t blocked = wxPyBeginBlockThreads(); if ((found = wxPyCBH_findCallback(m_myInst, "DoLogString"))) { PyObject* s = wx2PyString(szString); wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Oi)", s, t)); diff --git a/wxPython/src/_mimetype.i b/wxPython/src/_mimetype.i index 5935b7dd31..6d84f3bca8 100644 --- a/wxPython/src/_mimetype.i +++ b/wxPython/src/_mimetype.i @@ -190,7 +190,7 @@ public: iconIndex = loc.GetIndex(); #endif // Make a tuple and put the values in it - bool blocked = wxPyBeginBlockThreads(); + wxPyBlock_t blocked = wxPyBeginBlockThreads(); PyObject* tuple = PyTuple_New(3); PyTuple_SetItem(tuple, 0, wxPyConstructObject(new wxIcon(loc), wxT("wxIcon"), true)); @@ -250,7 +250,7 @@ public: wxArrayString commands; if (self->GetAllCommands(&verbs, &commands, wxFileType::MessageParameters(filename, mimetype))) { - bool blocked = wxPyBeginBlockThreads(); + wxPyBlock_t blocked = wxPyBeginBlockThreads(); PyObject* tuple = PyTuple_New(2); PyTuple_SetItem(tuple, 0, wxArrayString2PyList_helper(verbs)); PyTuple_SetItem(tuple, 1, wxArrayString2PyList_helper(commands)); diff --git a/wxPython/src/_pen.i b/wxPython/src/_pen.i index 860f18c987..e0fca1cb17 100644 --- a/wxPython/src/_pen.i +++ b/wxPython/src/_pen.i @@ -56,7 +56,7 @@ public: PyObject* GetDashes() { wxDash* dashes; int count = self->GetDashes(&dashes); - bool blocked = wxPyBeginBlockThreads(); + wxPyBlock_t blocked = wxPyBeginBlockThreads(); PyObject* retval = PyList_New(0); for (int x=0; xGetPrivData(), self->GetPrivDataLen()); wxPyEndBlockThreads(blocked); @@ -121,7 +121,7 @@ public: return /* NULL */ ; } - bool blocked = wxPyBeginBlockThreads(); + wxPyBlock_t blocked = wxPyBeginBlockThreads(); self->SetPrivData(PyString_AS_STRING(data), PyString_GET_SIZE(data)); wxPyEndBlockThreads(blocked); } @@ -353,7 +353,7 @@ void wxPyPrintout::GetPageInfo(int *minPage, int *maxPage, int *pageFrom, int *p bool hadErr = false; bool found; - bool blocked = wxPyBeginBlockThreads(); + wxPyBlock_t blocked = wxPyBeginBlockThreads(); if ((found = wxPyCBH_findCallback(m_myInst, "GetPageInfo"))) { PyObject* result = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("()")); if (result && PyTuple_Check(result) && PyTuple_Size(result) == 4) { @@ -621,7 +621,7 @@ public: bool CLASS::CBNAME(wxPreviewCanvas* a, wxDC& b) { \ bool rval=false; \ bool found; \ - bool blocked = wxPyBeginBlockThreads(); \ + wxPyBlock_t blocked = wxPyBeginBlockThreads(); \ if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \ PyObject* win = wxPyMake_wxObject(a,false); \ PyObject* dc = wxPyMake_wxObject(&b,false); \ diff --git a/wxPython/src/_sizers.i b/wxPython/src/_sizers.i index 4544eac9dc..6f033ef9c6 100644 --- a/wxPython/src/_sizers.i +++ b/wxPython/src/_sizers.i @@ -56,7 +56,7 @@ methods are called. { wxPyUserData* data = NULL; if ( userData ) { - bool blocked = wxPyBeginBlockThreads(); + wxPyBlock_t blocked = wxPyBeginBlockThreads(); data = new wxPyUserData(userData); wxPyEndBlockThreads(blocked); } @@ -74,7 +74,7 @@ methods are called. { wxPyUserData* data = NULL; if ( userData ) { - bool blocked = wxPyBeginBlockThreads(); + wxPyBlock_t blocked = wxPyBeginBlockThreads(); data = new wxPyUserData(userData); wxPyEndBlockThreads(blocked); } @@ -91,7 +91,7 @@ methods are called. { wxPyUserData* data = NULL; if ( userData ) { - bool blocked = wxPyBeginBlockThreads(); + wxPyBlock_t blocked = wxPyBeginBlockThreads(); data = new wxPyUserData(userData); wxPyEndBlockThreads(blocked); } @@ -490,7 +490,7 @@ public: PyObject* userData=NULL) { wxPyUserData* data = NULL; - bool blocked = wxPyBeginBlockThreads(); + wxPyBlock_t blocked = wxPyBeginBlockThreads(); wxPySizerItemInfo info = wxPySizerItemTypeHelper(item, true, false); if ( userData && (info.window || info.sizer || info.gotSize) ) data = new wxPyUserData(userData); @@ -521,7 +521,7 @@ the item at index *before*. See `Add` for a description of the parameters.", "" int border=0, PyObject* userData=NULL) { wxPyUserData* data = NULL; - bool blocked = wxPyBeginBlockThreads(); + wxPyBlock_t blocked = wxPyBeginBlockThreads(); wxPySizerItemInfo info = wxPySizerItemTypeHelper(item, true, false); if ( userData && (info.window || info.sizer || info.gotSize) ) data = new wxPyUserData(userData); @@ -553,7 +553,7 @@ this sizer. See `Add` for a description of the parameters.", ""); PyObject* userData=NULL) { wxPyUserData* data = NULL; - bool blocked = wxPyBeginBlockThreads(); + wxPyBlock_t blocked = wxPyBeginBlockThreads(); wxPySizerItemInfo info = wxPySizerItemTypeHelper(item, true, false); if ( userData && (info.window || info.sizer || info.gotSize) ) data = new wxPyUserData(userData); @@ -589,7 +589,7 @@ and removed.", " instead. "); bool Remove(PyObject* item) { - bool blocked = wxPyBeginBlockThreads(); + wxPyBlock_t blocked = wxPyBeginBlockThreads(); wxPySizerItemInfo info = wxPySizerItemTypeHelper(item, false, true); wxPyEndBlockThreads(blocked); if ( info.window ) @@ -611,7 +611,7 @@ do so. The *item* parameter can be either a window, a sizer, or the zero-based index of the item to be detached. Returns True if the child item was found and detached.", ""); bool Detach(PyObject* item) { - bool blocked = wxPyBeginBlockThreads(); + wxPyBlock_t blocked = wxPyBeginBlockThreads(); wxPySizerItemInfo info = wxPySizerItemTypeHelper(item, false, true); wxPyEndBlockThreads(blocked); if ( info.window ) @@ -631,7 +631,7 @@ was found and detached.", ""); parameter can be either a window, a sizer, or the zero-based index of the item to be detached.", ""); wxSizerItem* GetItem(PyObject* item) { - bool blocked = wxPyBeginBlockThreads(); + wxPyBlock_t blocked = wxPyBeginBlockThreads(); wxPySizerItemInfo info = wxPySizerItemTypeHelper(item, false, true); wxPyEndBlockThreads(blocked); if ( info.window ) @@ -646,7 +646,7 @@ the item to be detached.", ""); void _SetItemMinSize(PyObject* item, const wxSize& size) { - bool blocked = wxPyBeginBlockThreads(); + wxPyBlock_t blocked = wxPyBeginBlockThreads(); wxPySizerItemInfo info = wxPySizerItemTypeHelper(item, false, true); wxPyEndBlockThreads(blocked); if ( info.window ) @@ -889,7 +889,7 @@ parameter can be either a window, a sizer, or the zero-based index of the item. Use the recursive parameter to show or hide an item in a subsizer. Returns True if the item was found.", ""); bool Show(PyObject* item, bool show = true, bool recursive=false) { - bool blocked = wxPyBeginBlockThreads(); + wxPyBlock_t blocked = wxPyBeginBlockThreads(); wxPySizerItemInfo info = wxPySizerItemTypeHelper(item, false, true); wxPyEndBlockThreads(blocked); if ( info.window ) @@ -909,7 +909,7 @@ item disappear or reappear, use Show followed by `Layout`. The *item* parameter can be either a window, a sizer, or the zero-based index of the item.", ""); bool IsShown(PyObject* item) { - bool blocked = wxPyBeginBlockThreads(); + wxPyBlock_t blocked = wxPyBeginBlockThreads(); wxPySizerItemInfo info = wxPySizerItemTypeHelper(item, false, false); wxPyEndBlockThreads(blocked); if ( info.window ) diff --git a/wxPython/src/_sound.i b/wxPython/src/_sound.i index 27fab6cc91..bed230c51c 100644 --- a/wxPython/src/_sound.i +++ b/wxPython/src/_sound.i @@ -38,19 +38,19 @@ class wxSound : public wxObject { public: wxSound() { - bool blocked = wxPyBeginBlockThreads(); + wxPyBlock_t blocked = wxPyBeginBlockThreads(); PyErr_SetString(PyExc_NotImplementedError, "wxSound is not available on this platform."); wxPyEndBlockThreads(blocked); } wxSound(const wxString&/*, bool*/) { - bool blocked = wxPyBeginBlockThreads(); + wxPyBlock_t blocked = wxPyBeginBlockThreads(); PyErr_SetString(PyExc_NotImplementedError, "wxSound is not available on this platform."); wxPyEndBlockThreads(blocked); } wxSound(int, const wxByte*) { - bool blocked = wxPyBeginBlockThreads(); + wxPyBlock_t blocked = wxPyBeginBlockThreads(); PyErr_SetString(PyExc_NotImplementedError, "wxSound is not available on this platform."); wxPyEndBlockThreads(blocked); @@ -90,7 +90,7 @@ public: unsigned char* buffer; int size; wxSound *sound = NULL; - bool blocked = wxPyBeginBlockThreads(); + wxPyBlock_t blocked = wxPyBeginBlockThreads(); if (!PyArg_Parse(data, "t#", &buffer, &size)) goto done; sound = new wxSound(size, buffer); @@ -113,7 +113,7 @@ public: int size; bool rv = false; - bool blocked = wxPyBeginBlockThreads(); + wxPyBlock_t blocked = wxPyBeginBlockThreads(); if (!PyArg_Parse(data, "t#", &buffer, &size)) goto done; rv = self->Create(size, buffer); @@ -121,7 +121,7 @@ public: wxPyEndBlockThreads(blocked); return rv; %#else - bool blocked = wxPyBeginBlockThreads(); + wxPyBlock_t blocked = wxPyBeginBlockThreads(); PyErr_SetString(PyExc_NotImplementedError, "Create from data is not available on this platform."); wxPyEndBlockThreads(blocked); diff --git a/wxPython/src/_taskbar.i b/wxPython/src/_taskbar.i index 71b22bf22f..1b7540f52c 100644 --- a/wxPython/src/_taskbar.i +++ b/wxPython/src/_taskbar.i @@ -69,7 +69,7 @@ public: wxMenu* CreatePopupMenu() { wxMenu *rval = NULL; bool found; - bool blocked = wxPyBeginBlockThreads(); + wxPyBlock_t blocked = wxPyBeginBlockThreads(); if ((found = wxPyCBH_findCallback(m_myInst, "CreatePopupMenu"))) { PyObject* ro; wxMenu* ptr; diff --git a/wxPython/src/_timer.i b/wxPython/src/_timer.i index c4bd285dbe..37461f1e50 100644 --- a/wxPython/src/_timer.i +++ b/wxPython/src/_timer.i @@ -45,7 +45,7 @@ wxPyTimer::wxPyTimer(wxEvtHandler *owner, int id) void wxPyTimer::Notify() { bool found; - bool blocked = wxPyBeginBlockThreads(); + wxPyBlock_t blocked = wxPyBeginBlockThreads(); if ((found = wxPyCBH_findCallback(m_myInst, "Notify"))) wxPyCBH_callCallback(m_myInst, Py_BuildValue("()")); wxPyEndBlockThreads(blocked); diff --git a/wxPython/src/_treectrl.i b/wxPython/src/_treectrl.i index f76254f658..d71dc7bb89 100644 --- a/wxPython/src/_treectrl.i +++ b/wxPython/src/_treectrl.i @@ -289,7 +289,7 @@ public: const wxTreeItemId& item2) { int rval = 0; bool found; - bool blocked = wxPyBeginBlockThreads(); + wxPyBlock_t blocked = wxPyBeginBlockThreads(); if ((found = wxPyCBH_findCallback(m_myInst, "OnCompareItems"))) { PyObject *o1 = wxPyConstructObject((void*)&item1, wxT("wxTreeItemId"), false); PyObject *o2 = wxPyConstructObject((void*)&item2, wxT("wxTreeItemId"), false); @@ -509,7 +509,7 @@ public: // NB: this operation is expensive and can take a long time for a // control with a lot of items (~ O(number of items)). PyObject* GetSelections() { - bool blocked = wxPyBeginBlockThreads(); + wxPyBlock_t blocked = wxPyBeginBlockThreads(); PyObject* rval = PyList_New(0); wxArrayTreeItemIds array; size_t num, x; @@ -539,7 +539,7 @@ public: PyObject* GetFirstChild(const wxTreeItemId& item) { void* cookie = 0; wxTreeItemId* ritem = new wxTreeItemId(self->GetFirstChild(item, cookie)); - bool blocked = wxPyBeginBlockThreads(); + wxPyBlock_t blocked = wxPyBeginBlockThreads(); PyObject* tup = PyTuple_New(2); PyTuple_SET_ITEM(tup, 0, wxPyConstructObject(ritem, wxT("wxTreeItemId"), true)); PyTuple_SET_ITEM(tup, 1, wxPyMakeSwigPtr(cookie, wxT("void"))); @@ -554,7 +554,7 @@ public: // passed to GetNextChild in order to continue the search. PyObject* GetNextChild(const wxTreeItemId& item, void* cookie) { wxTreeItemId* ritem = new wxTreeItemId(self->GetNextChild(item, cookie)); - bool blocked = wxPyBeginBlockThreads(); + wxPyBlock_t blocked = wxPyBeginBlockThreads(); PyObject* tup = PyTuple_New(2); PyTuple_SET_ITEM(tup, 0, wxPyConstructObject(ritem, wxT("wxTreeItemId"), true)); PyTuple_SET_ITEM(tup, 1, wxPyMakeSwigPtr(cookie, wxT("void"))); @@ -707,7 +707,7 @@ value is set to a bitmask of wxTREE_HITTEST_xxx constants. PyObject* GetBoundingRect(const wxTreeItemId& item, bool textOnly = false) { wxRect rect; if (self->GetBoundingRect(item, rect, textOnly)) { - bool blocked = wxPyBeginBlockThreads(); + wxPyBlock_t blocked = wxPyBeginBlockThreads(); wxRect* r = new wxRect(rect); PyObject* val = wxPyConstructObject((void*)r, wxT("wxRect"), true); wxPyEndBlockThreads(blocked); diff --git a/wxPython/src/_vscroll.i b/wxPython/src/_vscroll.i index db0f28cee9..ff24d30bd3 100644 --- a/wxPython/src/_vscroll.i +++ b/wxPython/src/_vscroll.i @@ -346,7 +346,7 @@ public: PyObject* GetFirstSelected() { unsigned long cookie = 0; int selected = self->GetFirstSelected(cookie); - bool blocked = wxPyBeginBlockThreads(); + wxPyBlock_t blocked = wxPyBeginBlockThreads(); PyObject* tup = PyTuple_New(2); PyTuple_SET_ITEM(tup, 0, PyInt_FromLong(selected)); PyTuple_SET_ITEM(tup, 1, PyInt_FromLong(cookie)); @@ -363,7 +363,7 @@ public: // int GetNextSelected(unsigned long& cookie) const; PyObject* GetNextSelected(unsigned long cookie) { int selected = self->GetNextSelected(cookie); - bool blocked = wxPyBeginBlockThreads(); + wxPyBlock_t blocked = wxPyBeginBlockThreads(); PyObject* tup = PyTuple_New(2); PyTuple_SET_ITEM(tup, 0, PyInt_FromLong(selected)); PyTuple_SET_ITEM(tup, 1, PyInt_FromLong(cookie)); diff --git a/wxPython/src/calendar.i b/wxPython/src/calendar.i index 7225d98553..803632db52 100644 --- a/wxPython/src/calendar.i +++ b/wxPython/src/calendar.i @@ -396,7 +396,7 @@ The result codes are: wxDateTime* date = new wxDateTime; wxDateTime::WeekDay wd; wxCalendarHitTestResult result = self->HitTest(pos, date, &wd); - bool blocked = wxPyBeginBlockThreads(); + wxPyBlock_t blocked = wxPyBeginBlockThreads(); PyObject* tup = PyTuple_New(3); PyTuple_SET_ITEM(tup, 0, PyInt_FromLong(result)); PyTuple_SET_ITEM(tup, 1, wxPyConstructObject(date, wxT("wxDateTime"), 1)); diff --git a/wxPython/src/drawlist.cpp b/wxPython/src/drawlist.cpp index 3764618895..c89342ac84 100644 --- a/wxPython/src/drawlist.cpp +++ b/wxPython/src/drawlist.cpp @@ -30,7 +30,7 @@ void wxPyDrawList_SetAPIPtr() PyObject* wxPyDrawXXXList(wxDC& dc, wxPyDrawListOp_t doDraw, PyObject* pyCoords, PyObject* pyPens, PyObject* pyBrushes) { - bool blocked = wxPyBeginBlockThreads(); + wxPyBlock_t blocked = wxPyBeginBlockThreads(); bool isFastSeq = PyList_Check(pyCoords) || PyTuple_Check(pyCoords); bool isFastPens = PyList_Check(pyPens) || PyTuple_Check(pyPens); @@ -215,7 +215,7 @@ bool wxPyDrawXXXPolygon(wxDC& dc, PyObject* coords) PyObject* wxPyDrawTextList(wxDC& dc, PyObject* textList, PyObject* pyPoints, PyObject* foregroundList, PyObject* backgroundList) { - bool blocked = wxPyBeginBlockThreads(); + wxPyBlock_t blocked = wxPyBeginBlockThreads(); bool isFastSeq = PyList_Check(pyPoints) || PyTuple_Check(pyPoints); bool isFastText = PyList_Check(textList) || PyTuple_Check(textList); diff --git a/wxPython/src/grid.i b/wxPython/src/grid.i index d5fb58ff43..48bfc14501 100644 --- a/wxPython/src/grid.i +++ b/wxPython/src/grid.i @@ -99,7 +99,7 @@ wxPyMake_TEMPLATE(wxGridTableBase) wxGridCellAttr* CBNAME(int a, int b, wxGridCellAttr::wxAttrKind c) { \ wxGridCellAttr* rval = NULL; \ bool found; \ - bool blocked = wxPyBeginBlockThreads(); \ + wxPyBlock_t blocked = wxPyBeginBlockThreads(); \ if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \ PyObject* ro; \ wxGridCellAttr* ptr; \ @@ -123,7 +123,7 @@ wxPyMake_TEMPLATE(wxGridTableBase) #define PYCALLBACK__GCAINTINT(PCLASS, CBNAME) \ void CBNAME(wxGridCellAttr *attr, int a, int b) { \ - bool blocked = wxPyBeginBlockThreads(); \ + wxPyBlock_t blocked = wxPyBeginBlockThreads(); \ bool found; \ if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \ PyObject* obj = wxPyMake_wxGridCellAttr(attr,false); \ @@ -142,7 +142,7 @@ wxPyMake_TEMPLATE(wxGridTableBase) #define PYCALLBACK__GCAINT(PCLASS, CBNAME) \ void CBNAME(wxGridCellAttr *attr, int val) { \ - bool blocked = wxPyBeginBlockThreads(); \ + wxPyBlock_t blocked = wxPyBeginBlockThreads(); \ bool found; \ if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \ PyObject* obj = wxPyMake_wxGridCellAttr(attr,false); \ @@ -161,7 +161,7 @@ wxPyMake_TEMPLATE(wxGridTableBase) #define PYCALLBACK_INT__pure(CBNAME) \ int CBNAME() { \ - bool blocked = wxPyBeginBlockThreads(); \ + wxPyBlock_t blocked = wxPyBeginBlockThreads(); \ int rval = 0; \ if (wxPyCBH_findCallback(m_myInst, #CBNAME)) \ rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("()")); \ @@ -173,7 +173,7 @@ wxPyMake_TEMPLATE(wxGridTableBase) #define PYCALLBACK_BOOL_INTINT_pure(CBNAME) \ bool CBNAME(int a, int b) { \ - bool blocked = wxPyBeginBlockThreads(); \ + wxPyBlock_t blocked = wxPyBeginBlockThreads(); \ bool rval = 0; \ if (wxPyCBH_findCallback(m_myInst, #CBNAME)) \ rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(ii)",a,b)); \ @@ -184,7 +184,7 @@ wxPyMake_TEMPLATE(wxGridTableBase) #define PYCALLBACK_STRING_INTINT_pure(CBNAME) \ wxString CBNAME(int a, int b) { \ - bool blocked = wxPyBeginBlockThreads(); \ + wxPyBlock_t blocked = wxPyBeginBlockThreads(); \ wxString rval; \ if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \ PyObject* ro; \ @@ -201,7 +201,7 @@ wxPyMake_TEMPLATE(wxGridTableBase) #define PYCALLBACK__INTINTSTRING_pure(CBNAME) \ void CBNAME(int a, int b, const wxString& c) { \ - bool blocked = wxPyBeginBlockThreads(); \ + wxPyBlock_t blocked = wxPyBeginBlockThreads(); \ if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \ PyObject* s = wx2PyString(c); \ rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iiO)",a,b,s));\ @@ -214,7 +214,7 @@ wxPyMake_TEMPLATE(wxGridTableBase) #define PYCALLBACK_STRING_INTINT(PCLASS, CBNAME) \ wxString CBNAME(int a, int b) { \ bool found; \ - bool blocked = wxPyBeginBlockThreads(); \ + wxPyBlock_t blocked = wxPyBeginBlockThreads(); \ wxString rval; \ if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \ PyObject* ro; \ @@ -238,7 +238,7 @@ wxPyMake_TEMPLATE(wxGridTableBase) bool CBNAME(int a, int b, const wxString& c) { \ bool rval = 0; \ bool found; \ - bool blocked = wxPyBeginBlockThreads(); \ + wxPyBlock_t blocked = wxPyBeginBlockThreads(); \ if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \ PyObject* s = wx2PyString(c); \ rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iiO)",a,b,s));\ @@ -260,7 +260,7 @@ wxPyMake_TEMPLATE(wxGridTableBase) long CBNAME(int a, int b) { \ long rval; \ bool found; \ - bool blocked = wxPyBeginBlockThreads(); \ + wxPyBlock_t blocked = wxPyBeginBlockThreads(); \ if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \ rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(ii)", a,b)); \ wxPyEndBlockThreads(blocked); \ @@ -278,7 +278,7 @@ wxPyMake_TEMPLATE(wxGridTableBase) bool CBNAME(int a, int b) { \ bool rval = 0; \ bool found; \ - bool blocked = wxPyBeginBlockThreads(); \ + wxPyBlock_t blocked = wxPyBeginBlockThreads(); \ if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \ rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(ii)", a,b)); \ wxPyEndBlockThreads(blocked); \ @@ -295,7 +295,7 @@ wxPyMake_TEMPLATE(wxGridTableBase) #define PYCALLBACK_DOUBLE_INTINT(PCLASS, CBNAME) \ double CBNAME(int a, int b) { \ bool found; \ - bool blocked = wxPyBeginBlockThreads(); \ + wxPyBlock_t blocked = wxPyBeginBlockThreads(); \ double rval; \ if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \ PyObject* ro; \ @@ -320,7 +320,7 @@ wxPyMake_TEMPLATE(wxGridTableBase) #define PYCALLBACK__(PCLASS, CBNAME) \ void CBNAME() { \ bool found; \ - bool blocked = wxPyBeginBlockThreads(); \ + wxPyBlock_t blocked = wxPyBeginBlockThreads(); \ if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \ wxPyCBH_callCallback(m_myInst, Py_BuildValue("()")); \ wxPyEndBlockThreads(blocked); \ @@ -338,7 +338,7 @@ wxPyMake_TEMPLATE(wxGridTableBase) bool CBNAME(size_t a, size_t b) { \ bool rval = 0; \ bool found; \ - bool blocked = wxPyBeginBlockThreads(); \ + wxPyBlock_t blocked = wxPyBeginBlockThreads(); \ if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \ rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(ii)", a,b)); \ wxPyEndBlockThreads(blocked); \ @@ -356,7 +356,7 @@ wxPyMake_TEMPLATE(wxGridTableBase) bool CBNAME(size_t a) { \ bool rval = 0; \ bool found; \ - bool blocked = wxPyBeginBlockThreads(); \ + wxPyBlock_t blocked = wxPyBeginBlockThreads(); \ if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \ rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(i)", a)); \ wxPyEndBlockThreads(blocked); \ @@ -372,7 +372,7 @@ wxPyMake_TEMPLATE(wxGridTableBase) #define PYCALLBACK_STRING_INT(PCLASS, CBNAME) \ wxString CBNAME(int a) { \ bool found; \ - bool blocked = wxPyBeginBlockThreads(); \ + wxPyBlock_t blocked = wxPyBeginBlockThreads(); \ wxString rval; \ if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \ PyObject* ro; \ @@ -395,7 +395,7 @@ wxPyMake_TEMPLATE(wxGridTableBase) #define PYCALLBACK__INTSTRING(PCLASS, CBNAME) \ void CBNAME(int a, const wxString& c) { \ bool found; \ - bool blocked = wxPyBeginBlockThreads(); \ + wxPyBlock_t blocked = wxPyBeginBlockThreads(); \ if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \ PyObject* s = wx2PyString(c); \ wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iO)",a,s)); \ @@ -416,7 +416,7 @@ wxPyMake_TEMPLATE(wxGridTableBase) bool CBNAME() { \ bool rval = 0; \ bool found; \ - bool blocked = wxPyBeginBlockThreads(); \ + wxPyBlock_t blocked = wxPyBeginBlockThreads(); \ if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \ rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("()")); \ wxPyEndBlockThreads(blocked); \ @@ -433,7 +433,7 @@ wxPyMake_TEMPLATE(wxGridTableBase) #define PYCALLBACK__SIZETINT(PCLASS, CBNAME) \ void CBNAME(size_t a, int b) { \ bool found; \ - bool blocked = wxPyBeginBlockThreads(); \ + wxPyBlock_t blocked = wxPyBeginBlockThreads(); \ if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \ wxPyCBH_callCallback(m_myInst, Py_BuildValue("(ii)", a,b)); \ wxPyEndBlockThreads(blocked); \ @@ -450,7 +450,7 @@ wxPyMake_TEMPLATE(wxGridTableBase) #define PYCALLBACK__INTINTLONG(PCLASS, CBNAME) \ void CBNAME(int a, int b, long c) { \ bool found; \ - bool blocked = wxPyBeginBlockThreads(); \ + wxPyBlock_t blocked = wxPyBeginBlockThreads(); \ if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \ wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iii)", a,b,c)); \ wxPyEndBlockThreads(blocked); \ @@ -467,7 +467,7 @@ wxPyMake_TEMPLATE(wxGridTableBase) #define PYCALLBACK__INTINTDOUBLE(PCLASS, CBNAME) \ void CBNAME(int a, int b, double c) { \ bool found; \ - bool blocked = wxPyBeginBlockThreads(); \ + wxPyBlock_t blocked = wxPyBeginBlockThreads(); \ if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \ wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iif)", a,b,c)); \ wxPyEndBlockThreads(blocked); \ @@ -483,7 +483,7 @@ wxPyMake_TEMPLATE(wxGridTableBase) #define PYCALLBACK__INTINTBOOL(PCLASS, CBNAME) \ void CBNAME(int a, int b, bool c) { \ bool found; \ - bool blocked = wxPyBeginBlockThreads(); \ + wxPyBlock_t blocked = wxPyBeginBlockThreads(); \ if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \ wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iii)", a,b,c)); \ wxPyEndBlockThreads(blocked); \ @@ -592,7 +592,7 @@ public: void Draw(wxGrid& grid, wxGridCellAttr& attr, wxDC& dc, const wxRect& rect, int row, int col, bool isSelected) { - bool blocked = wxPyBeginBlockThreads(); + wxPyBlock_t blocked = wxPyBeginBlockThreads(); if (wxPyCBH_findCallback(m_myInst, "Draw")) { PyObject* go = wxPyMake_wxObject(&grid,false); PyObject* dco = wxPyMake_wxObject(&dc,false); @@ -612,7 +612,7 @@ public: wxSize GetBestSize(wxGrid& grid, wxGridCellAttr& attr, wxDC& dc, int row, int col) { wxSize rval; - bool blocked = wxPyBeginBlockThreads(); + wxPyBlock_t blocked = wxPyBeginBlockThreads(); if (wxPyCBH_findCallback(m_myInst, "GetBestSize")) { PyObject* ro; wxSize* ptr; @@ -655,7 +655,7 @@ public: wxGridCellRenderer *Clone() const { wxGridCellRenderer* rval = NULL; - bool blocked = wxPyBeginBlockThreads(); + wxPyBlock_t blocked = wxPyBeginBlockThreads(); if (wxPyCBH_findCallback(m_myInst, "Clone")) { PyObject* ro; wxGridCellRenderer* ptr; @@ -809,7 +809,7 @@ public: wxPyGridCellEditor() : wxGridCellEditor() {} void Create(wxWindow* parent, wxWindowID id, wxEvtHandler* evtHandler) { - bool blocked = wxPyBeginBlockThreads(); + wxPyBlock_t blocked = wxPyBeginBlockThreads(); if (wxPyCBH_findCallback(m_myInst, "Create")) { PyObject* po = wxPyMake_wxObject(parent,false); PyObject* eo = wxPyMake_wxObject(evtHandler,false); @@ -823,7 +823,7 @@ public: void BeginEdit(int row, int col, wxGrid* grid) { - bool blocked = wxPyBeginBlockThreads(); + wxPyBlock_t blocked = wxPyBeginBlockThreads(); if (wxPyCBH_findCallback(m_myInst, "BeginEdit")) { PyObject* go = wxPyMake_wxObject(grid,false); wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iiO)", row, col, go)); @@ -835,7 +835,7 @@ public: bool EndEdit(int row, int col, wxGrid* grid) { bool rv = false; - bool blocked = wxPyBeginBlockThreads(); + wxPyBlock_t blocked = wxPyBeginBlockThreads(); if (wxPyCBH_findCallback(m_myInst, "EndEdit")) { PyObject* go = wxPyMake_wxObject(grid,false); rv = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iiO)", row, col, go)); @@ -848,7 +848,7 @@ public: wxGridCellEditor* Clone() const { wxGridCellEditor* rval = NULL; - bool blocked = wxPyBeginBlockThreads(); + wxPyBlock_t blocked = wxPyBeginBlockThreads(); if (wxPyCBH_findCallback(m_myInst, "Clone")) { PyObject* ro; wxGridCellEditor* ptr; @@ -866,7 +866,7 @@ public: void Show(bool show, wxGridCellAttr *attr) { bool found; - bool blocked = wxPyBeginBlockThreads(); + wxPyBlock_t blocked = wxPyBeginBlockThreads(); if ((found = wxPyCBH_findCallback(m_myInst, "Show"))) { PyObject* ao = wxPyMake_wxGridCellAttr(attr,false); wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iO)", show, ao)); @@ -883,7 +883,7 @@ public: void PaintBackground(const wxRect& rectCell, wxGridCellAttr *attr) { bool found; - bool blocked = wxPyBeginBlockThreads(); + wxPyBlock_t blocked = wxPyBeginBlockThreads(); if ((found = wxPyCBH_findCallback(m_myInst, "PaintBackground)"))) { PyObject* ao = wxPyMake_wxGridCellAttr(attr,false); PyObject* ro = wxPyConstructObject((void*)&rectCell, wxT("wxRect"), 0); @@ -1252,7 +1252,7 @@ public: wxString GetValue(int row, int col) { - bool blocked = wxPyBeginBlockThreads(); + wxPyBlock_t blocked = wxPyBeginBlockThreads(); wxString rval; if (wxPyCBH_findCallback(m_myInst, "GetValue")) { PyObject* ro; @@ -1272,7 +1272,7 @@ public: } void SetValue(int row, int col, const wxString& val) { - bool blocked = wxPyBeginBlockThreads(); + wxPyBlock_t blocked = wxPyBeginBlockThreads(); if (wxPyCBH_findCallback(m_myInst, "SetValue")) { PyObject* s = wx2PyString(val); wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iiO)",row,col,s)); @@ -1286,7 +1286,7 @@ public: // the GetValue and SetValue python methods. long GetValueAsLong( int row, int col ) { long rval = 0; - bool blocked = wxPyBeginBlockThreads(); + wxPyBlock_t blocked = wxPyBeginBlockThreads(); if (wxPyCBH_findCallback(m_myInst, "GetValue")) { PyObject* ro; PyObject* num; @@ -1306,7 +1306,7 @@ public: double GetValueAsDouble( int row, int col ) { double rval = 0.0; - bool blocked = wxPyBeginBlockThreads(); + wxPyBlock_t blocked = wxPyBeginBlockThreads(); if (wxPyCBH_findCallback(m_myInst, "GetValue")) { PyObject* ro; PyObject* num; @@ -1329,7 +1329,7 @@ public: } void SetValueAsLong( int row, int col, long value ) { - bool blocked = wxPyBeginBlockThreads(); + wxPyBlock_t blocked = wxPyBeginBlockThreads(); if (wxPyCBH_findCallback(m_myInst, "SetValue")) { wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iii)", row, col, value)); } @@ -1337,7 +1337,7 @@ public: } void SetValueAsDouble( int row, int col, double value ) { - bool blocked = wxPyBeginBlockThreads(); + wxPyBlock_t blocked = wxPyBeginBlockThreads(); if (wxPyCBH_findCallback(m_myInst, "SetValue")) { wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iid)", row, col, value)); } diff --git a/wxPython/src/helpers.cpp b/wxPython/src/helpers.cpp index c2857c87a0..9b7e3efb6d 100644 --- a/wxPython/src/helpers.cpp +++ b/wxPython/src/helpers.cpp @@ -61,6 +61,7 @@ bool wxPyDoingCleanup = false; #ifdef WXP_WITH_THREAD +#if !wxPyUSE_GIL_STATE struct wxPyThreadState { unsigned long tid; PyThreadState* tstate; @@ -76,8 +77,11 @@ WX_DEFINE_OBJARRAY(wxPyThreadStateArray); wxPyThreadStateArray* wxPyTStates = NULL; wxMutex* wxPyTMutex = NULL; + +#endif #endif + #define DEFAULTENCODING_SIZE 64 static char wxPyDefaultEncoding[DEFAULTENCODING_SIZE] = "ascii"; @@ -99,8 +103,8 @@ BOOL WINAPI DllMain( LPVOID lpvReserved // reserved ) { - // If wxPython is embedded in another wxWindows app then - // the inatance has already been set. + // If wxPython is embedded in another wxWidgets app then + // the instance has already been set. if (! wxGetInstance()) wxSetInstance(hinstDLL); return true; @@ -150,7 +154,7 @@ int wxPyApp::MainLoop() { bool wxPyApp::OnInitGui() { bool rval=true; wxApp::OnInitGui(); // in this case always call the base class version - bool blocked = wxPyBeginBlockThreads(); + wxPyBlock_t blocked = wxPyBeginBlockThreads(); if (wxPyCBH_findCallback(m_myInst, "OnInitGui")) rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("()")); wxPyEndBlockThreads(blocked); @@ -160,7 +164,7 @@ bool wxPyApp::OnInitGui() { int wxPyApp::OnExit() { int rval=0; - bool blocked = wxPyBeginBlockThreads(); + wxPyBlock_t blocked = wxPyBeginBlockThreads(); if (wxPyCBH_findCallback(m_myInst, "OnExit")) rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("()")); wxPyEndBlockThreads(blocked); @@ -191,7 +195,7 @@ void wxPyApp::OnAssert(const wxChar *file, // If the OnAssert is overloaded in the Python class then call it... bool found; - bool blocked = wxPyBeginBlockThreads(); + wxPyBlock_t blocked = wxPyBeginBlockThreads(); if ((found = wxPyCBH_findCallback(m_myInst, "OnAssert"))) { PyObject* fso = wx2PyString(file); PyObject* cso = wx2PyString(file); @@ -225,7 +229,7 @@ void wxPyApp::OnAssert(const wxChar *file, } // set the exception - bool blocked = wxPyBeginBlockThreads(); + wxPyBlock_t blocked = wxPyBeginBlockThreads(); PyObject* s = wx2PyString(buf); PyErr_SetObject(wxPyAssertionError, s); Py_DECREF(s); @@ -260,7 +264,7 @@ void wxPyApp::OnAssert(const wxChar *file, // For catching Apple Events void wxPyApp::MacOpenFile(const wxString &fileName) { - bool blocked = wxPyBeginBlockThreads(); + wxPyBlock_t blocked = wxPyBeginBlockThreads(); if (wxPyCBH_findCallback(m_myInst, "MacOpenFile")) { PyObject* s = wx2PyString(fileName); wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", s)); @@ -271,7 +275,7 @@ void wxPyApp::MacOpenFile(const wxString &fileName) void wxPyApp::MacPrintFile(const wxString &fileName) { - bool blocked = wxPyBeginBlockThreads(); + wxPyBlock_t blocked = wxPyBeginBlockThreads(); if (wxPyCBH_findCallback(m_myInst, "MacPrintFile")) { PyObject* s = wx2PyString(fileName); wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", s)); @@ -282,7 +286,7 @@ void wxPyApp::MacPrintFile(const wxString &fileName) void wxPyApp::MacNewFile() { - bool blocked = wxPyBeginBlockThreads(); + wxPyBlock_t blocked = wxPyBeginBlockThreads(); if (wxPyCBH_findCallback(m_myInst, "MacNewFile")) wxPyCBH_callCallback(m_myInst, Py_BuildValue("()")); wxPyEndBlockThreads(blocked); @@ -290,7 +294,7 @@ void wxPyApp::MacNewFile() void wxPyApp::MacReopenApp() { - bool blocked = wxPyBeginBlockThreads(); + wxPyBlock_t blocked = wxPyBeginBlockThreads(); if (wxPyCBH_findCallback(m_myInst, "MacReopenApp")) wxPyCBH_callCallback(m_myInst, Py_BuildValue("()")); wxPyEndBlockThreads(blocked); @@ -383,7 +387,8 @@ void wxPyApp::SetMacHelpMenuTitleName(const wxString& val) { void wxPyApp::_BootstrapApp() { static bool haveInitialized = false; - bool result, blocked; + bool result; + wxPyBlock_t blocked; PyObject* retval = NULL; PyObject* pyint = NULL; @@ -540,12 +545,14 @@ void __wxPyPreStart(PyObject* moduleDict) #ifdef WXP_WITH_THREAD PyEval_InitThreads(); +#if !wxPyUSE_GIL_STATE wxPyTStates = new wxPyThreadStateArray; wxPyTMutex = new wxMutex; // Save the current (main) thread state in our array PyThreadState* tstate = wxPyBeginAllowThreads(); wxPyEndAllowThreads(tstate); +#endif #endif // Ensure that the build options in the DLL (or whatever) match this build @@ -566,12 +573,14 @@ void __wxPyCleanup() { wxEntryCleanup(); } #ifdef WXP_WITH_THREAD +#if !wxPyUSE_GIL_STATE delete wxPyTMutex; wxPyTMutex = NULL; wxPyTStates->Empty(); delete wxPyTStates; wxPyTStates = NULL; #endif +#endif } @@ -868,7 +877,7 @@ bool wxPyCheckForApp() { void wxPyUserData_dtor(wxPyUserData* self) { if (! wxPyDoingCleanup) { - bool blocked = wxPyBeginBlockThreads(); + wxPyBlock_t blocked = wxPyBeginBlockThreads(); Py_DECREF(self->m_obj); self->m_obj = NULL; wxPyEndBlockThreads(blocked); @@ -880,7 +889,7 @@ void wxPyClientData_dtor(wxPyClientData* self) { if (! wxPyDoingCleanup) { // Don't do it during cleanup as Python // may have already garbage collected the object... if (self->m_incRef) { - bool blocked = wxPyBeginBlockThreads(); + wxPyBlock_t blocked = wxPyBeginBlockThreads(); Py_DECREF(self->m_obj); wxPyEndBlockThreads(blocked); } @@ -902,7 +911,7 @@ void wxPyOORClientData_dtor(wxPyOORClientData* self) { static PyObject* deadObjectClass = NULL; - bool blocked = wxPyBeginBlockThreads(); + wxPyBlock_t blocked = wxPyBeginBlockThreads(); if (deadObjectClass == NULL) { deadObjectClass = PyDict_GetItemString(wxPython_dict, "_wxPyDeadObject"); // TODO: Can not wxASSERT here because inside a wxPyBeginBlock Threads, @@ -1050,6 +1059,8 @@ PyObject* wxPyMake_wxSizer(wxSizer* source, bool setThisOwn) { #ifdef WXP_WITH_THREAD +#if !wxPyUSE_GIL_STATE + inline unsigned long wxPyGetCurrentThreadId() { return wxThread::GetCurrentId(); @@ -1110,6 +1121,7 @@ void wxPySaveThreadState(PyThreadState* tstate) { } #endif +#endif @@ -1119,7 +1131,9 @@ void wxPySaveThreadState(PyThreadState* tstate) { PyThreadState* wxPyBeginAllowThreads() { #ifdef WXP_WITH_THREAD PyThreadState* saved = PyEval_SaveThread(); // Py_BEGIN_ALLOW_THREADS; +#if !wxPyUSE_GIL_STATE wxPySaveThreadState(saved); +#endif return saved; #else return NULL; @@ -1137,17 +1151,18 @@ void wxPyEndAllowThreads(PyThreadState* saved) { // Calls from wxWindows back to Python code, or even any PyObject // manipulations, PyDECREF's and etc. are wrapped in calls to these functions: -bool wxPyBeginBlockThreads() { +wxPyBlock_t wxPyBeginBlockThreads() { #ifdef WXP_WITH_THREAD - // This works in for 2.3, maybe a good alternative to find the needed tstate? - // PyThreadState *check = PyGILState_GetThisThreadState(); - +#if wxPyUSE_GIL_STATE + PyGILState_STATE state = PyGILState_Ensure(); + return state; +#else PyThreadState *current = _PyThreadState_Current; // Only block if there wasn't already a tstate, or if the current one is // not the one we are wanting to change to. This should prevent deadlock // if there are nested calls to wxPyBeginBlockThreads - bool blocked = false; + wxPyBlock_t blocked = false; wxPyThreadState* tstate = wxPyGetThreadState(); if (current != tstate->tstate) { PyEval_RestoreThread(tstate->tstate); @@ -1155,11 +1170,17 @@ bool wxPyBeginBlockThreads() { } return blocked; #endif +#else + return false; +#endif } -void wxPyEndBlockThreads(bool blocked) { +void wxPyEndBlockThreads(wxPyBlock_t blocked) { #ifdef WXP_WITH_THREAD +#if wxPyUSE_GIL_STATE + PyGILState_Release(blocked); +#else // Only unblock if we blocked in the last call to wxPyBeginBlockThreads. // The value of blocked passed in needs to be the same as that returned // from wxPyBeginBlockThreads at the same nesting level. @@ -1167,6 +1188,7 @@ void wxPyEndBlockThreads(bool blocked) { PyEval_SaveThread(); } #endif +#endif } @@ -1204,7 +1226,7 @@ PyObject* wxPyInputStream::read(int size) { // check if we have a real wxInputStream to work with if (!m_wxis) { - bool blocked = wxPyBeginBlockThreads(); + wxPyBlock_t blocked = wxPyBeginBlockThreads(); PyErr_SetString(PyExc_IOError, "no valid C-wxInputStream"); wxPyEndBlockThreads(blocked); return NULL; @@ -1223,7 +1245,7 @@ PyObject* wxPyInputStream::read(int size) { } // error check - bool blocked = wxPyBeginBlockThreads(); + wxPyBlock_t blocked = wxPyBeginBlockThreads(); wxStreamError err = m_wxis->GetLastError(); if (err != wxSTREAM_NO_ERROR && err != wxSTREAM_EOF) { PyErr_SetString(PyExc_IOError,"IOError in wxInputStream"); @@ -1245,7 +1267,7 @@ PyObject* wxPyInputStream::readline(int size) { // check if we have a real wxInputStream to work with if (!m_wxis) { - bool blocked = wxPyBeginBlockThreads(); + wxPyBlock_t blocked = wxPyBeginBlockThreads(); PyErr_SetString(PyExc_IOError,"no valid C-wxInputStream"); wxPyEndBlockThreads(blocked); return NULL; @@ -1258,7 +1280,7 @@ PyObject* wxPyInputStream::readline(int size) { } // errorcheck - bool blocked = wxPyBeginBlockThreads(); + wxPyBlock_t blocked = wxPyBeginBlockThreads(); wxStreamError err = m_wxis->GetLastError(); if (err != wxSTREAM_NO_ERROR && err != wxSTREAM_EOF) { PyErr_SetString(PyExc_IOError,"IOError in wxInputStream"); @@ -1277,19 +1299,19 @@ PyObject* wxPyInputStream::readlines(int sizehint) { // check if we have a real wxInputStream to work with if (!m_wxis) { - bool blocked = wxPyBeginBlockThreads(); + wxPyBlock_t blocked = wxPyBeginBlockThreads(); PyErr_SetString(PyExc_IOError,"no valid C-wxInputStream"); wxPyEndBlockThreads(blocked); return NULL; } // init list - bool blocked = wxPyBeginBlockThreads(); + wxPyBlock_t blocked = wxPyBeginBlockThreads(); pylist = PyList_New(0); wxPyEndBlockThreads(blocked); if (!pylist) { - bool blocked = wxPyBeginBlockThreads(); + wxPyBlock_t blocked = wxPyBeginBlockThreads(); PyErr_NoMemory(); wxPyEndBlockThreads(blocked); return NULL; @@ -1300,12 +1322,12 @@ PyObject* wxPyInputStream::readlines(int sizehint) { for (i=0; (m_wxis->CanRead()) && ((sizehint < 0) || (i < sizehint));) { PyObject* s = this->readline(); if (s == NULL) { - bool blocked = wxPyBeginBlockThreads(); + wxPyBlock_t blocked = wxPyBeginBlockThreads(); Py_DECREF(pylist); wxPyEndBlockThreads(blocked); return NULL; } - bool blocked = wxPyBeginBlockThreads(); + wxPyBlock_t blocked = wxPyBeginBlockThreads(); PyList_Append(pylist, s); i += PyString_Size(s); wxPyEndBlockThreads(blocked); @@ -1314,7 +1336,7 @@ PyObject* wxPyInputStream::readlines(int sizehint) { // error check wxStreamError err = m_wxis->GetLastError(); if (err != wxSTREAM_NO_ERROR && err != wxSTREAM_EOF) { - bool blocked = wxPyBeginBlockThreads(); + wxPyBlock_t blocked = wxPyBeginBlockThreads(); Py_DECREF(pylist); PyErr_SetString(PyExc_IOError,"IOError in wxInputStream"); wxPyEndBlockThreads(blocked); @@ -1356,7 +1378,7 @@ wxPyCBInputStream::wxPyCBInputStream(const wxPyCBInputStream& other) wxPyCBInputStream::~wxPyCBInputStream() { - bool blocked=false; + wxPyBlock_t blocked; if (m_block) blocked = wxPyBeginBlockThreads(); Py_XDECREF(m_read); Py_XDECREF(m_seek); @@ -1366,7 +1388,7 @@ wxPyCBInputStream::~wxPyCBInputStream() { wxPyCBInputStream* wxPyCBInputStream::create(PyObject *py, bool block) { - bool blocked=false; + wxPyBlock_t blocked; if (block) blocked = wxPyBeginBlockThreads(); PyObject* read = getMethod(py, "read"); @@ -1424,7 +1446,7 @@ size_t wxPyCBInputStream::OnSysRead(void *buffer, size_t bufsize) { if (bufsize == 0) return 0; - bool blocked = wxPyBeginBlockThreads(); + wxPyBlock_t blocked = wxPyBeginBlockThreads(); PyObject* arglist = Py_BuildValue("(i)", bufsize); PyObject* result = PyEval_CallObject(m_read, arglist); Py_DECREF(arglist); @@ -1453,7 +1475,7 @@ size_t wxPyCBInputStream::OnSysWrite(const void *buffer, size_t bufsize) { wxFileOffset wxPyCBInputStream::OnSysSeek(wxFileOffset off, wxSeekMode mode) { - bool blocked = wxPyBeginBlockThreads(); + wxPyBlock_t blocked = wxPyBeginBlockThreads(); PyObject* arglist = PyTuple_New(2); if (sizeof(wxFileOffset) > sizeof(long)) @@ -1474,7 +1496,7 @@ wxFileOffset wxPyCBInputStream::OnSysSeek(wxFileOffset off, wxSeekMode mode) { wxFileOffset wxPyCBInputStream::OnSysTell() const { - bool blocked = wxPyBeginBlockThreads(); + wxPyBlock_t blocked = wxPyBeginBlockThreads(); PyObject* arglist = Py_BuildValue("()"); PyObject* result = PyEval_CallObject(m_tell, arglist); Py_DECREF(arglist); @@ -1505,7 +1527,7 @@ wxPyCallback::wxPyCallback(const wxPyCallback& other) { } wxPyCallback::~wxPyCallback() { - bool blocked = wxPyBeginBlockThreads(); + wxPyBlock_t blocked = wxPyBeginBlockThreads(); Py_DECREF(m_func); wxPyEndBlockThreads(blocked); } @@ -1523,7 +1545,7 @@ void wxPyCallback::EventThunker(wxEvent& event) { PyObject* tuple; bool checkSkip = false; - bool blocked = wxPyBeginBlockThreads(); + wxPyBlock_t blocked = wxPyBeginBlockThreads(); wxString className = event.GetClassInfo()->GetClassName(); // If the event is one of these types then pass the original @@ -1783,7 +1805,7 @@ PyObject* wxPyCBH_callCallbackObj(const wxPyCallbackHelper& cbh, PyObject* argTu void wxPyCBH_delete(wxPyCallbackHelper* cbh) { if (cbh->m_incRef) { - bool blocked = wxPyBeginBlockThreads(); + wxPyBlock_t blocked = wxPyBeginBlockThreads(); Py_XDECREF(cbh->m_self); Py_XDECREF(cbh->m_class); wxPyEndBlockThreads(blocked); @@ -1804,14 +1826,14 @@ wxPyEvtSelfRef::wxPyEvtSelfRef() { } wxPyEvtSelfRef::~wxPyEvtSelfRef() { - bool blocked = wxPyBeginBlockThreads(); + wxPyBlock_t blocked = wxPyBeginBlockThreads(); if (m_cloned) Py_DECREF(m_self); wxPyEndBlockThreads(blocked); } void wxPyEvtSelfRef::SetSelf(PyObject* self, bool clone) { - bool blocked = wxPyBeginBlockThreads(); + wxPyBlock_t blocked = wxPyBeginBlockThreads(); if (m_cloned) Py_DECREF(m_self); m_self = self; @@ -1878,7 +1900,7 @@ PyObject* wxPy_ConvertList(wxListBase* listbase) { wxObject* wxObj; wxNode* node = list->GetFirst(); - bool blocked = wxPyBeginBlockThreads(); + wxPyBlock_t blocked = wxPyBeginBlockThreads(); pyList = PyList_New(0); while (node) { wxObj = node->GetData(); diff --git a/wxPython/src/html.i b/wxPython/src/html.i index 85d6423e48..8fa832053a 100644 --- a/wxPython/src/html.i +++ b/wxPython/src/html.i @@ -329,7 +329,7 @@ public: } void OnExit() { - bool blocked = wxPyBeginBlockThreads(); + wxPyBlock_t blocked = wxPyBeginBlockThreads(); Py_DECREF(m_tagHandlerClass); m_tagHandlerClass = NULL; for (size_t x=0; x < m_objArray.GetCount(); x++) { @@ -343,7 +343,7 @@ public: // Wave our magic wand... (if it works it's a miracle! ;-) // First, make a new instance of the tag handler - bool blocked = wxPyBeginBlockThreads(); + wxPyBlock_t blocked = wxPyBeginBlockThreads(); PyObject* arg = PyTuple_New(0); PyObject* obj = PyObject_CallObject(m_tagHandlerClass, arg); Py_DECREF(arg); @@ -647,7 +647,7 @@ public: virtual bool CanRead(const wxFSFile& file) const { bool rval = false; bool found; - bool blocked = wxPyBeginBlockThreads(); + wxPyBlock_t blocked = wxPyBeginBlockThreads(); if ((found = wxPyCBH_findCallback(m_myInst, "CanRead"))) { PyObject* obj = wxPyMake_wxObject((wxFSFile*)&file,false); // cast away const rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", obj)); @@ -663,7 +663,7 @@ public: virtual wxString ReadFile(const wxFSFile& file) const { wxString rval; bool found; - bool blocked = wxPyBeginBlockThreads(); + wxPyBlock_t blocked = wxPyBeginBlockThreads(); if ((found = wxPyCBH_findCallback(m_myInst, "ReadFile"))) { PyObject* obj = wxPyMake_wxObject((wxFSFile*)&file,false); // cast away const PyObject* ro; @@ -747,7 +747,7 @@ IMP_PYCALLBACK__CELLINTINTME(wxPyHtmlWindow, wxHtmlWindow, OnCellClicked); void wxPyHtmlWindow::OnLinkClicked(const wxHtmlLinkInfo& link) { bool found; - bool blocked = wxPyBeginBlockThreads(); + wxPyBlock_t blocked = wxPyBeginBlockThreads(); if ((found = wxPyCBH_findCallback(m_myInst, "OnLinkClicked"))) { PyObject* obj = wxPyConstructObject((void*)&link, wxT("wxHtmlLinkInfo"), 0); wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", obj)); @@ -767,7 +767,7 @@ wxHtmlOpeningStatus wxPyHtmlWindow::OnOpeningURL(wxHtmlURLType type, wxString *redirect) const { bool found; wxHtmlOpeningStatus rval; - bool blocked = wxPyBeginBlockThreads(); + wxPyBlock_t blocked = wxPyBeginBlockThreads(); if ((found = wxPyCBH_findCallback(m_myInst, "OnOpeningURL"))) { PyObject* ro; PyObject* s = wx2PyString(url); -- 2.45.2