Changed (again) how the GIL is aquired and the tstate restored. This
time it's simpler, better, and handles the case where there is a wx calback/event while the GIL has been released by a non-wxPython extension module. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@26324 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -272,7 +272,7 @@ public:
|
|||||||
|
|
||||||
virtual void DrawItem(wxDC& dc, wxTreeItemId id, const wxRect& rect) {
|
virtual void DrawItem(wxDC& dc, wxTreeItemId id, const wxRect& rect) {
|
||||||
bool found;
|
bool found;
|
||||||
wxPyBeginBlockThreads();
|
bool blocked = wxPyBeginBlockThreads();
|
||||||
if ((found = wxPyCBH_findCallback(m_myInst, "DrawItem"))) {
|
if ((found = wxPyCBH_findCallback(m_myInst, "DrawItem"))) {
|
||||||
PyObject* dcobj = wxPyMake_wxObject(&dc);
|
PyObject* dcobj = wxPyMake_wxObject(&dc);
|
||||||
PyObject* idobj = wxPyConstructObject((void*)&id, wxT("wxTreeItemId"), False);
|
PyObject* idobj = wxPyConstructObject((void*)&id, wxT("wxTreeItemId"), False);
|
||||||
@@ -282,7 +282,7 @@ public:
|
|||||||
Py_DECREF(idobj);
|
Py_DECREF(idobj);
|
||||||
Py_DECREF(recobj);
|
Py_DECREF(recobj);
|
||||||
}
|
}
|
||||||
wxPyEndBlockThreads();
|
wxPyEndBlockThreads(blocked);
|
||||||
if (! found)
|
if (! found)
|
||||||
wxTreeCompanionWindow::DrawItem(dc, id, rect);
|
wxTreeCompanionWindow::DrawItem(dc, id, rect);
|
||||||
}
|
}
|
||||||
@@ -457,7 +457,7 @@ public:
|
|||||||
const wxTreeItemId& item2) {
|
const wxTreeItemId& item2) {
|
||||||
int rval = 0;
|
int rval = 0;
|
||||||
bool found;
|
bool found;
|
||||||
wxPyBeginBlockThreads();
|
bool blocked = wxPyBeginBlockThreads();
|
||||||
if ((found = wxPyCBH_findCallback(m_myInst, "OnCompareItems"))) {
|
if ((found = wxPyCBH_findCallback(m_myInst, "OnCompareItems"))) {
|
||||||
PyObject *o1 = wxPyConstructObject((void*)&item1, wxT("wxTreeItemId"), 0);
|
PyObject *o1 = wxPyConstructObject((void*)&item1, wxT("wxTreeItemId"), 0);
|
||||||
PyObject *o2 = wxPyConstructObject((void*)&item2, wxT("wxTreeItemId"), 0);
|
PyObject *o2 = wxPyConstructObject((void*)&item2, wxT("wxTreeItemId"), 0);
|
||||||
@@ -465,7 +465,7 @@ public:
|
|||||||
Py_DECREF(o1);
|
Py_DECREF(o1);
|
||||||
Py_DECREF(o2);
|
Py_DECREF(o2);
|
||||||
}
|
}
|
||||||
wxPyEndBlockThreads();
|
wxPyEndBlockThreads(blocked);
|
||||||
if (! found)
|
if (! found)
|
||||||
rval = wxTreeListCtrl::OnCompareItems(item1, item2);
|
rval = wxTreeListCtrl::OnCompareItems(item1, item2);
|
||||||
return rval;
|
return rval;
|
||||||
@@ -715,7 +715,7 @@ public:
|
|||||||
//size_t GetSelections(wxArrayTreeItemIds&) const;
|
//size_t GetSelections(wxArrayTreeItemIds&) const;
|
||||||
%extend {
|
%extend {
|
||||||
PyObject* GetSelections() {
|
PyObject* GetSelections() {
|
||||||
wxPyBeginBlockThreads();
|
bool blocked = wxPyBeginBlockThreads();
|
||||||
PyObject* rval = PyList_New(0);
|
PyObject* rval = PyList_New(0);
|
||||||
wxArrayTreeItemIds array;
|
wxArrayTreeItemIds array;
|
||||||
size_t num, x;
|
size_t num, x;
|
||||||
@@ -725,7 +725,7 @@ public:
|
|||||||
PyObject* item = wxPyConstructObject((void*)tii, wxT("wxTreeItemId"), True);
|
PyObject* item = wxPyConstructObject((void*)tii, wxT("wxTreeItemId"), True);
|
||||||
PyList_Append(rval, item);
|
PyList_Append(rval, item);
|
||||||
}
|
}
|
||||||
wxPyEndBlockThreads();
|
wxPyEndBlockThreads(blocked);
|
||||||
return rval;
|
return rval;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -749,11 +749,11 @@ public:
|
|||||||
PyObject* GetFirstChild(const wxTreeItemId& item) {
|
PyObject* GetFirstChild(const wxTreeItemId& item) {
|
||||||
long cookie = 0;
|
long cookie = 0;
|
||||||
wxTreeItemId ritem = self->GetFirstChild(item, cookie);
|
wxTreeItemId ritem = self->GetFirstChild(item, cookie);
|
||||||
wxPyBeginBlockThreads();
|
bool blocked = wxPyBeginBlockThreads();
|
||||||
PyObject* tup = PyTuple_New(2);
|
PyObject* tup = PyTuple_New(2);
|
||||||
PyTuple_SET_ITEM(tup, 0, wxPyConstructObject(&ritem, wxT("wxTreeItemId"), true));
|
PyTuple_SET_ITEM(tup, 0, wxPyConstructObject(&ritem, wxT("wxTreeItemId"), true));
|
||||||
PyTuple_SET_ITEM(tup, 1, PyInt_FromLong(cookie));
|
PyTuple_SET_ITEM(tup, 1, PyInt_FromLong(cookie));
|
||||||
wxPyEndBlockThreads();
|
wxPyEndBlockThreads(blocked);
|
||||||
return tup;
|
return tup;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -764,11 +764,11 @@ public:
|
|||||||
// passed to GetNextChild in order to continue the search.
|
// passed to GetNextChild in order to continue the search.
|
||||||
PyObject* GetNextChild(const wxTreeItemId& item, long cookie) {
|
PyObject* GetNextChild(const wxTreeItemId& item, long cookie) {
|
||||||
wxTreeItemId ritem = self->GetNextChild(item, cookie);
|
wxTreeItemId ritem = self->GetNextChild(item, cookie);
|
||||||
wxPyBeginBlockThreads();
|
bool blocked = wxPyBeginBlockThreads();
|
||||||
PyObject* tup = PyTuple_New(2);
|
PyObject* tup = PyTuple_New(2);
|
||||||
PyTuple_SET_ITEM(tup, 0, wxPyConstructObject(&ritem, wxT("wxTreeItemId"), true));
|
PyTuple_SET_ITEM(tup, 0, wxPyConstructObject(&ritem, wxT("wxTreeItemId"), true));
|
||||||
PyTuple_SET_ITEM(tup, 1, PyInt_FromLong(cookie));
|
PyTuple_SET_ITEM(tup, 1, PyInt_FromLong(cookie));
|
||||||
wxPyEndBlockThreads();
|
wxPyEndBlockThreads(blocked);
|
||||||
return tup;
|
return tup;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -877,10 +877,10 @@ public:
|
|||||||
PyObject* GetBoundingRect(const wxTreeItemId& item, bool textOnly = False) {
|
PyObject* GetBoundingRect(const wxTreeItemId& item, bool textOnly = False) {
|
||||||
wxRect rect;
|
wxRect rect;
|
||||||
if (self->GetBoundingRect(item, rect, textOnly)) {
|
if (self->GetBoundingRect(item, rect, textOnly)) {
|
||||||
wxPyBeginBlockThreads();
|
bool blocked = wxPyBeginBlockThreads();
|
||||||
wxRect* r = new wxRect(rect);
|
wxRect* r = new wxRect(rect);
|
||||||
PyObject* val = wxPyConstructObject((void*)r, wxT("wxRect"), 1);
|
PyObject* val = wxPyConstructObject((void*)r, wxT("wxRect"), 1);
|
||||||
wxPyEndBlockThreads();
|
wxPyEndBlockThreads(blocked);
|
||||||
return val;
|
return val;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
@@ -287,7 +287,7 @@ public:
|
|||||||
wxObject* wxObj;
|
wxObject* wxObj;
|
||||||
wxNode* node = list->GetFirst();
|
wxNode* node = list->GetFirst();
|
||||||
|
|
||||||
wxPyBeginBlockThreads();
|
bool blocked = wxPyBeginBlockThreads();
|
||||||
pyList = PyList_New(0);
|
pyList = PyList_New(0);
|
||||||
while (node) {
|
while (node) {
|
||||||
wxObj = node->GetData();
|
wxObj = node->GetData();
|
||||||
@@ -295,7 +295,7 @@ public:
|
|||||||
PyList_Append(pyList, pyObj);
|
PyList_Append(pyList, pyObj);
|
||||||
node = node->GetNext();
|
node = node->GetNext();
|
||||||
}
|
}
|
||||||
wxPyEndBlockThreads();
|
wxPyEndBlockThreads(blocked);
|
||||||
return pyList;
|
return pyList;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -306,7 +306,7 @@ public:
|
|||||||
wxObject* wxObj;
|
wxObject* wxObj;
|
||||||
wxNode* node = list->GetFirst();
|
wxNode* node = list->GetFirst();
|
||||||
|
|
||||||
wxPyBeginBlockThreads();
|
bool blocked = wxPyBeginBlockThreads();
|
||||||
pyList = PyList_New(0);
|
pyList = PyList_New(0);
|
||||||
while (node) {
|
while (node) {
|
||||||
wxObj = node->GetData();
|
wxObj = node->GetData();
|
||||||
@@ -314,7 +314,7 @@ public:
|
|||||||
PyList_Append(pyList, pyObj);
|
PyList_Append(pyList, pyObj);
|
||||||
node = node->GetNext();
|
node = node->GetNext();
|
||||||
}
|
}
|
||||||
wxPyEndBlockThreads();
|
wxPyEndBlockThreads(blocked);
|
||||||
return pyList;
|
return pyList;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -157,17 +157,17 @@ void wxOGLCleanUp();
|
|||||||
// work for any class for the VERY generic cases, but beyond that the helper
|
// work for any class for the VERY generic cases, but beyond that the helper
|
||||||
// needs to know more about the type.
|
// needs to know more about the type.
|
||||||
wxList* wxPy_wxListHelper(PyObject* pyList, const wxChar* className) {
|
wxList* wxPy_wxListHelper(PyObject* pyList, const wxChar* className) {
|
||||||
wxPyBeginBlockThreads();
|
bool blocked = wxPyBeginBlockThreads();
|
||||||
if (!PyList_Check(pyList)) {
|
if (!PyList_Check(pyList)) {
|
||||||
PyErr_SetString(PyExc_TypeError, "Expected a list object.");
|
PyErr_SetString(PyExc_TypeError, "Expected a list object.");
|
||||||
wxPyEndBlockThreads();
|
wxPyEndBlockThreads(blocked);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
int count = PyList_Size(pyList);
|
int count = PyList_Size(pyList);
|
||||||
wxList* list = new wxList;
|
wxList* list = new wxList;
|
||||||
if (! list) {
|
if (! list) {
|
||||||
PyErr_SetString(PyExc_MemoryError, "Unable to allocate wxList object");
|
PyErr_SetString(PyExc_MemoryError, "Unable to allocate wxList object");
|
||||||
wxPyEndBlockThreads();
|
wxPyEndBlockThreads(blocked);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
for (int x=0; x<count; x++) {
|
for (int x=0; x<count; x++) {
|
||||||
@@ -178,29 +178,29 @@ wxList* wxPy_wxListHelper(PyObject* pyList, const wxChar* className) {
|
|||||||
wxString errmsg;
|
wxString errmsg;
|
||||||
errmsg.Printf(wxT("Type error, expected list of %s objects"), className);
|
errmsg.Printf(wxT("Type error, expected list of %s objects"), className);
|
||||||
PyErr_SetString(PyExc_TypeError, errmsg.mb_str());
|
PyErr_SetString(PyExc_TypeError, errmsg.mb_str());
|
||||||
wxPyEndBlockThreads();
|
wxPyEndBlockThreads(blocked);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
list->Append(wxo);
|
list->Append(wxo);
|
||||||
}
|
}
|
||||||
wxPyEndBlockThreads();
|
wxPyEndBlockThreads(blocked);
|
||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
|
||||||
wxList* wxPy_wxRealPoint_ListHelper(PyObject* pyList) {
|
wxList* wxPy_wxRealPoint_ListHelper(PyObject* pyList) {
|
||||||
wxPyBeginBlockThreads();
|
bool blocked = wxPyBeginBlockThreads();
|
||||||
if (!PyList_Check(pyList)) {
|
if (!PyList_Check(pyList)) {
|
||||||
PyErr_SetString(PyExc_TypeError, "Expected a list object.");
|
PyErr_SetString(PyExc_TypeError, "Expected a list object.");
|
||||||
wxPyEndBlockThreads();
|
wxPyEndBlockThreads(blocked);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
int count = PyList_Size(pyList);
|
int count = PyList_Size(pyList);
|
||||||
wxList* list = new wxList;
|
wxList* list = new wxList;
|
||||||
if (! list) {
|
if (! list) {
|
||||||
PyErr_SetString(PyExc_MemoryError, "Unable to allocate wxList object");
|
PyErr_SetString(PyExc_MemoryError, "Unable to allocate wxList object");
|
||||||
wxPyEndBlockThreads();
|
wxPyEndBlockThreads(blocked);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
for (int x=0; x<count; x++) {
|
for (int x=0; x<count; x++) {
|
||||||
@@ -219,13 +219,13 @@ wxList* wxPy_wxRealPoint_ListHelper(PyObject* pyList) {
|
|||||||
wxRealPoint* wxo = NULL;
|
wxRealPoint* wxo = NULL;
|
||||||
if (wxPyConvertSwigPtr(pyo, (void **)&wxo, wxT("wxRealPoint"))) {
|
if (wxPyConvertSwigPtr(pyo, (void **)&wxo, wxT("wxRealPoint"))) {
|
||||||
PyErr_SetString(PyExc_TypeError, "Type error, expected list of wxRealPoint objects or 2-tuples");
|
PyErr_SetString(PyExc_TypeError, "Type error, expected list of wxRealPoint objects or 2-tuples");
|
||||||
wxPyEndBlockThreads();
|
wxPyEndBlockThreads(blocked);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
list->Append((wxObject*) new wxRealPoint(*wxo));
|
list->Append((wxObject*) new wxRealPoint(*wxo));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
wxPyEndBlockThreads();
|
wxPyEndBlockThreads(blocked);
|
||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -262,7 +262,7 @@ PyObject* wxPy_ConvertShapeList(wxListBase* listbase) {
|
|||||||
wxObject* wxObj;
|
wxObject* wxObj;
|
||||||
wxNode* node = list->GetFirst();
|
wxNode* node = list->GetFirst();
|
||||||
|
|
||||||
wxPyBeginBlockThreads();
|
bool blocked = wxPyBeginBlockThreads();
|
||||||
pyList = PyList_New(0);
|
pyList = PyList_New(0);
|
||||||
while (node) {
|
while (node) {
|
||||||
wxObj = node->GetData();
|
wxObj = node->GetData();
|
||||||
@@ -270,7 +270,7 @@ PyObject* wxPy_ConvertShapeList(wxListBase* listbase) {
|
|||||||
PyList_Append(pyList, pyObj);
|
PyList_Append(pyList, pyObj);
|
||||||
node = node->GetNext();
|
node = node->GetNext();
|
||||||
}
|
}
|
||||||
wxPyEndBlockThreads();
|
wxPyEndBlockThreads(blocked);
|
||||||
return pyList;
|
return pyList;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -45,7 +45,7 @@ public:
|
|||||||
wxPyValidator* ptr = NULL;
|
wxPyValidator* ptr = NULL;
|
||||||
wxPyValidator* self = (wxPyValidator*)this;
|
wxPyValidator* self = (wxPyValidator*)this;
|
||||||
|
|
||||||
wxPyBeginBlockThreads();
|
bool blocked = wxPyBeginBlockThreads();
|
||||||
if (wxPyCBH_findCallback(self->m_myInst, "Clone")) {
|
if (wxPyCBH_findCallback(self->m_myInst, "Clone")) {
|
||||||
PyObject* ro;
|
PyObject* ro;
|
||||||
ro = wxPyCBH_callCallbackObj(self->m_myInst, Py_BuildValue("()"));
|
ro = wxPyCBH_callCallbackObj(self->m_myInst, Py_BuildValue("()"));
|
||||||
@@ -54,7 +54,7 @@ public:
|
|||||||
Py_DECREF(ro);
|
Py_DECREF(ro);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
wxPyEndBlockThreads();
|
wxPyEndBlockThreads(blocked);
|
||||||
|
|
||||||
// This is very dangerous!!! But is the only way I could find
|
// This is very dangerous!!! But is the only way I could find
|
||||||
// to squash a memory leak. Currently it is okay, but if the
|
// to squash a memory leak. Currently it is okay, but if the
|
||||||
|
@@ -25,9 +25,9 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
~wxPyTreeItemData() {
|
~wxPyTreeItemData() {
|
||||||
wxPyBeginBlockThreads();
|
bool blocked = wxPyBeginBlockThreads();
|
||||||
Py_DECREF(m_obj);
|
Py_DECREF(m_obj);
|
||||||
wxPyEndBlockThreads();
|
wxPyEndBlockThreads(blocked);
|
||||||
}
|
}
|
||||||
|
|
||||||
PyObject* GetData() {
|
PyObject* GetData() {
|
||||||
@@ -36,9 +36,9 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
void SetData(PyObject* obj) {
|
void SetData(PyObject* obj) {
|
||||||
wxPyBeginBlockThreads();
|
bool blocked = wxPyBeginBlockThreads();
|
||||||
Py_DECREF(m_obj);
|
Py_DECREF(m_obj);
|
||||||
wxPyEndBlockThreads();
|
wxPyEndBlockThreads(blocked);
|
||||||
m_obj = obj;
|
m_obj = obj;
|
||||||
Py_INCREF(obj);
|
Py_INCREF(obj);
|
||||||
}
|
}
|
||||||
|
@@ -63,7 +63,7 @@ static void wxPyCoreAPI_IMPORT() {
|
|||||||
#define wxPyBeginAllowThreads() (wxPyCoreAPIPtr->p_wxPyBeginAllowThreads())
|
#define wxPyBeginAllowThreads() (wxPyCoreAPIPtr->p_wxPyBeginAllowThreads())
|
||||||
#define wxPyEndAllowThreads(a) (wxPyCoreAPIPtr->p_wxPyEndAllowThreads(a))
|
#define wxPyEndAllowThreads(a) (wxPyCoreAPIPtr->p_wxPyEndAllowThreads(a))
|
||||||
#define wxPyBeginBlockThreads() (wxPyCoreAPIPtr->p_wxPyBeginBlockThreads())
|
#define wxPyBeginBlockThreads() (wxPyCoreAPIPtr->p_wxPyBeginBlockThreads())
|
||||||
#define wxPyEndBlockThreads() (wxPyCoreAPIPtr->p_wxPyEndBlockThreads())
|
#define wxPyEndBlockThreads(a) (wxPyCoreAPIPtr->p_wxPyEndBlockThreads(a))
|
||||||
|
|
||||||
#define wxPyConstructObject(a,b,c) (wxPyCoreAPIPtr->p_wxPyConstructObject(a,b,c))
|
#define wxPyConstructObject(a,b,c) (wxPyCoreAPIPtr->p_wxPyConstructObject(a,b,c))
|
||||||
#define wxPy_ConvertList(a) (wxPyCoreAPIPtr->p_wxPy_ConvertList(a))
|
#define wxPy_ConvertList(a) (wxPyCoreAPIPtr->p_wxPy_ConvertList(a))
|
||||||
|
File diff suppressed because it is too large
Load Diff
@@ -41,8 +41,6 @@ public:
|
|||||||
virtual bool OnInit();
|
virtual bool OnInit();
|
||||||
virtual ~MyApp();
|
virtual ~MyApp();
|
||||||
void Init_wxPython();
|
void Init_wxPython();
|
||||||
private:
|
|
||||||
PyThreadState* m_mainTState;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@@ -91,14 +89,14 @@ void MyApp::Init_wxPython()
|
|||||||
|
|
||||||
// Save the current Python thread state and release the
|
// Save the current Python thread state and release the
|
||||||
// Global Interpreter Lock.
|
// Global Interpreter Lock.
|
||||||
m_mainTState = wxPyBeginAllowThreads();
|
wxPyBeginAllowThreads();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
MyApp::~MyApp()
|
MyApp::~MyApp()
|
||||||
{
|
{
|
||||||
// Restore the thread state and tell Python to cleanup after itself.
|
// Restore the thread state and tell Python to cleanup after itself.
|
||||||
wxPyEndAllowThreads(m_mainTState);
|
wxPyEndAllowThreads(true);
|
||||||
Py_Finalize();
|
Py_Finalize();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -176,13 +174,13 @@ void MyFrame::OnPyFrame(wxCommandEvent& event)
|
|||||||
// First, whenever you do anyting with Python objects or code, you
|
// First, whenever you do anyting with Python objects or code, you
|
||||||
// *MUST* aquire the Global Interpreter Lock and block other
|
// *MUST* aquire the Global Interpreter Lock and block other
|
||||||
// Python threads from running.
|
// Python threads from running.
|
||||||
wxPyBeginBlockThreads();
|
bool blocked = wxPyBeginBlockThreads();
|
||||||
|
|
||||||
// Execute the code in the __main__ module
|
// Execute the code in the __main__ module
|
||||||
PyRun_SimpleString(python_code1);
|
PyRun_SimpleString(python_code1);
|
||||||
|
|
||||||
// Finally, release the GIL and let other Python threads run.
|
// Finally, release the GIL and let other Python threads run.
|
||||||
wxPyEndBlockThreads();
|
wxPyEndBlockThreads(blocked);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -197,9 +195,9 @@ from wxPython.wx import wxPyOnDemandOutputWindow\n\
|
|||||||
output = wxPyOnDemandOutputWindow()\n\
|
output = wxPyOnDemandOutputWindow()\n\
|
||||||
sys.stdin = sys.stderr = output\n\
|
sys.stdin = sys.stderr = output\n\
|
||||||
";
|
";
|
||||||
wxPyBeginBlockThreads();
|
bool blocked = wxPyBeginBlockThreads();
|
||||||
PyRun_SimpleString(python_redirect);
|
PyRun_SimpleString(python_redirect);
|
||||||
wxPyEndBlockThreads();
|
wxPyEndBlockThreads(blocked);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -226,7 +224,7 @@ wxWindow* MyFrame::DoPythonStuff(wxWindow* parent)
|
|||||||
PyObject* result;
|
PyObject* result;
|
||||||
|
|
||||||
// As always, first grab the GIL
|
// As always, first grab the GIL
|
||||||
wxPyBeginBlockThreads();
|
bool blocked = wxPyBeginBlockThreads();
|
||||||
|
|
||||||
// Now make a dictionary to serve as the global namespace when the code is
|
// 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
|
// executed. Put a reference to the builtins module in it. (Yes, the
|
||||||
@@ -277,7 +275,7 @@ wxWindow* MyFrame::DoPythonStuff(wxWindow* parent)
|
|||||||
Py_DECREF(tuple);
|
Py_DECREF(tuple);
|
||||||
|
|
||||||
// Finally, after all Python stuff is done, release the GIL
|
// Finally, after all Python stuff is done, release the GIL
|
||||||
wxPyEndBlockThreads();
|
wxPyEndBlockThreads(blocked);
|
||||||
|
|
||||||
return window;
|
return window;
|
||||||
}
|
}
|
||||||
|
@@ -75,7 +75,7 @@ public:
|
|||||||
const wxArtClient& client,
|
const wxArtClient& client,
|
||||||
const wxSize& size) {
|
const wxSize& size) {
|
||||||
wxBitmap rval = wxNullBitmap;
|
wxBitmap rval = wxNullBitmap;
|
||||||
wxPyBeginBlockThreads();
|
bool blocked = wxPyBeginBlockThreads();
|
||||||
if ((wxPyCBH_findCallback(m_myInst, "CreateBitmap"))) {
|
if ((wxPyCBH_findCallback(m_myInst, "CreateBitmap"))) {
|
||||||
PyObject* so = wxPyConstructObject((void*)&size, wxT("wxSize"), 0);
|
PyObject* so = wxPyConstructObject((void*)&size, wxT("wxSize"), 0);
|
||||||
PyObject* ro;
|
PyObject* ro;
|
||||||
@@ -93,7 +93,7 @@ public:
|
|||||||
Py_DECREF(ro);
|
Py_DECREF(ro);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
wxPyEndBlockThreads();
|
wxPyEndBlockThreads(blocked);
|
||||||
return rval;
|
return rval;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -238,7 +238,7 @@ bool wxPyDataObjectSimple::GetDataHere(void *buf) const {
|
|||||||
// C++ version.
|
// C++ version.
|
||||||
|
|
||||||
bool rval = False;
|
bool rval = False;
|
||||||
wxPyBeginBlockThreads();
|
bool blocked = wxPyBeginBlockThreads();
|
||||||
if (wxPyCBH_findCallback(m_myInst, "GetDataHere")) {
|
if (wxPyCBH_findCallback(m_myInst, "GetDataHere")) {
|
||||||
PyObject* ro;
|
PyObject* ro;
|
||||||
ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("()"));
|
ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("()"));
|
||||||
@@ -249,7 +249,7 @@ bool wxPyDataObjectSimple::GetDataHere(void *buf) const {
|
|||||||
Py_DECREF(ro);
|
Py_DECREF(ro);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
wxPyEndBlockThreads();
|
wxPyEndBlockThreads(blocked);
|
||||||
return rval;
|
return rval;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -257,13 +257,13 @@ bool wxPyDataObjectSimple::SetData(size_t len, const void *buf) const{
|
|||||||
// For this one we simply need to make a string from buf and len
|
// For this one we simply need to make a string from buf and len
|
||||||
// and send it to the Python method.
|
// and send it to the Python method.
|
||||||
bool rval = False;
|
bool rval = False;
|
||||||
wxPyBeginBlockThreads();
|
bool blocked = wxPyBeginBlockThreads();
|
||||||
if (wxPyCBH_findCallback(m_myInst, "SetData")) {
|
if (wxPyCBH_findCallback(m_myInst, "SetData")) {
|
||||||
PyObject* data = PyString_FromStringAndSize((char*)buf, len);
|
PyObject* data = PyString_FromStringAndSize((char*)buf, len);
|
||||||
rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", data));
|
rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", data));
|
||||||
Py_DECREF(data);
|
Py_DECREF(data);
|
||||||
}
|
}
|
||||||
wxPyEndBlockThreads();
|
wxPyEndBlockThreads(blocked);
|
||||||
return rval;
|
return rval;
|
||||||
}
|
}
|
||||||
%}
|
%}
|
||||||
@@ -364,7 +364,7 @@ public:
|
|||||||
|
|
||||||
wxBitmap wxPyBitmapDataObject::GetBitmap() const {
|
wxBitmap wxPyBitmapDataObject::GetBitmap() const {
|
||||||
wxBitmap* rval = &wxNullBitmap;
|
wxBitmap* rval = &wxNullBitmap;
|
||||||
wxPyBeginBlockThreads();
|
bool blocked = wxPyBeginBlockThreads();
|
||||||
if (wxPyCBH_findCallback(m_myInst, "GetBitmap")) {
|
if (wxPyCBH_findCallback(m_myInst, "GetBitmap")) {
|
||||||
PyObject* ro;
|
PyObject* ro;
|
||||||
wxBitmap* ptr;
|
wxBitmap* ptr;
|
||||||
@@ -375,18 +375,18 @@ wxBitmap wxPyBitmapDataObject::GetBitmap() const {
|
|||||||
Py_DECREF(ro);
|
Py_DECREF(ro);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
wxPyEndBlockThreads();
|
wxPyEndBlockThreads(blocked);
|
||||||
return *rval;
|
return *rval;
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxPyBitmapDataObject::SetBitmap(const wxBitmap& bitmap) {
|
void wxPyBitmapDataObject::SetBitmap(const wxBitmap& bitmap) {
|
||||||
wxPyBeginBlockThreads();
|
bool blocked = wxPyBeginBlockThreads();
|
||||||
if (wxPyCBH_findCallback(m_myInst, "SetBitmap")) {
|
if (wxPyCBH_findCallback(m_myInst, "SetBitmap")) {
|
||||||
PyObject* bo = wxPyConstructObject((void*)&bitmap, wxT("wxBitmap"), False);
|
PyObject* bo = wxPyConstructObject((void*)&bitmap, wxT("wxBitmap"), False);
|
||||||
wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", bo));
|
wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", bo));
|
||||||
Py_DECREF(bo);
|
Py_DECREF(bo);
|
||||||
}
|
}
|
||||||
wxPyEndBlockThreads();
|
wxPyEndBlockThreads(blocked);
|
||||||
}
|
}
|
||||||
%}
|
%}
|
||||||
|
|
||||||
|
@@ -163,14 +163,14 @@ platform.");
|
|||||||
PyObject* GetModes(const wxVideoMode& mode = wxDefaultVideoMode) {
|
PyObject* GetModes(const wxVideoMode& mode = wxDefaultVideoMode) {
|
||||||
PyObject* pyList = NULL;
|
PyObject* pyList = NULL;
|
||||||
wxArrayVideoModes arr = self->GetModes(mode);
|
wxArrayVideoModes arr = self->GetModes(mode);
|
||||||
wxPyBeginBlockThreads();
|
bool blocked = wxPyBeginBlockThreads();
|
||||||
pyList = PyList_New(0);
|
pyList = PyList_New(0);
|
||||||
for (int i=0; i < arr.GetCount(); i++) {
|
for (int i=0; i < arr.GetCount(); i++) {
|
||||||
wxVideoMode* m = new wxVideoMode(arr.Item(i));
|
wxVideoMode* m = new wxVideoMode(arr.Item(i));
|
||||||
PyObject* pyObj = wxPyConstructObject(m, wxT("wxVideoMode"), true);
|
PyObject* pyObj = wxPyConstructObject(m, wxT("wxVideoMode"), true);
|
||||||
PyList_Append(pyList, pyObj);
|
PyList_Append(pyList, pyObj);
|
||||||
}
|
}
|
||||||
wxPyEndBlockThreads();
|
wxPyEndBlockThreads(blocked);
|
||||||
return pyList;
|
return pyList;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -217,13 +217,13 @@ public:
|
|||||||
bool wxPyFileDropTarget::OnDropFiles(wxCoord x, wxCoord y,
|
bool wxPyFileDropTarget::OnDropFiles(wxCoord x, wxCoord y,
|
||||||
const wxArrayString& filenames) {
|
const wxArrayString& filenames) {
|
||||||
bool rval = False;
|
bool rval = False;
|
||||||
wxPyBeginBlockThreads();
|
bool blocked = wxPyBeginBlockThreads();
|
||||||
if (wxPyCBH_findCallback(m_myInst, "OnDropFiles")) {
|
if (wxPyCBH_findCallback(m_myInst, "OnDropFiles")) {
|
||||||
PyObject* list = wxArrayString2PyList_helper(filenames);
|
PyObject* list = wxArrayString2PyList_helper(filenames);
|
||||||
rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iiO)",x,y,list));
|
rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iiO)",x,y,list));
|
||||||
Py_DECREF(list);
|
Py_DECREF(list);
|
||||||
}
|
}
|
||||||
wxPyEndBlockThreads();
|
wxPyEndBlockThreads(blocked);
|
||||||
return rval;
|
return rval;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -88,11 +88,11 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
PyObject* Get() {
|
PyObject* Get() {
|
||||||
wxPyBeginBlockThreads();
|
bool blocked = wxPyBeginBlockThreads();
|
||||||
PyObject* tup = PyTuple_New(2);
|
PyObject* tup = PyTuple_New(2);
|
||||||
PyTuple_SET_ITEM(tup, 0, PyInt_FromLong(self->GetRow()));
|
PyTuple_SET_ITEM(tup, 0, PyInt_FromLong(self->GetRow()));
|
||||||
PyTuple_SET_ITEM(tup, 1, PyInt_FromLong(self->GetCol()));
|
PyTuple_SET_ITEM(tup, 1, PyInt_FromLong(self->GetCol()));
|
||||||
wxPyEndBlockThreads();
|
wxPyEndBlockThreads(blocked);
|
||||||
return tup;
|
return tup;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -145,11 +145,11 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
PyObject* Get() {
|
PyObject* Get() {
|
||||||
wxPyBeginBlockThreads();
|
bool blocked = wxPyBeginBlockThreads();
|
||||||
PyObject* tup = PyTuple_New(2);
|
PyObject* tup = PyTuple_New(2);
|
||||||
PyTuple_SET_ITEM(tup, 0, PyInt_FromLong(self->GetRowspan()));
|
PyTuple_SET_ITEM(tup, 0, PyInt_FromLong(self->GetRowspan()));
|
||||||
PyTuple_SET_ITEM(tup, 1, PyInt_FromLong(self->GetColspan()));
|
PyTuple_SET_ITEM(tup, 1, PyInt_FromLong(self->GetColspan()));
|
||||||
wxPyEndBlockThreads();
|
wxPyEndBlockThreads(blocked);
|
||||||
return tup;
|
return tup;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -268,11 +268,11 @@ public:
|
|||||||
PyObject* userData = NULL ) {
|
PyObject* userData = NULL ) {
|
||||||
|
|
||||||
wxPyUserData* data = NULL;
|
wxPyUserData* data = NULL;
|
||||||
wxPyBeginBlockThreads();
|
bool blocked = wxPyBeginBlockThreads();
|
||||||
wxPySizerItemInfo info = wxPySizerItemTypeHelper(item, True, False);
|
wxPySizerItemInfo info = wxPySizerItemTypeHelper(item, True, False);
|
||||||
if ( userData && (info.window || info.sizer || info.gotSize) )
|
if ( userData && (info.window || info.sizer || info.gotSize) )
|
||||||
data = new wxPyUserData(userData);
|
data = new wxPyUserData(userData);
|
||||||
wxPyEndBlockThreads();
|
wxPyEndBlockThreads(blocked);
|
||||||
|
|
||||||
// Now call the real Add method if a valid item type was found
|
// Now call the real Add method if a valid item type was found
|
||||||
if ( info.window )
|
if ( info.window )
|
||||||
|
@@ -178,11 +178,11 @@ public:
|
|||||||
"Get() -> (width,height)",
|
"Get() -> (width,height)",
|
||||||
"Returns the width and height properties as a tuple.");
|
"Returns the width and height properties as a tuple.");
|
||||||
PyObject* Get() {
|
PyObject* Get() {
|
||||||
wxPyBeginBlockThreads();
|
bool blocked = wxPyBeginBlockThreads();
|
||||||
PyObject* tup = PyTuple_New(2);
|
PyObject* tup = PyTuple_New(2);
|
||||||
PyTuple_SET_ITEM(tup, 0, PyInt_FromLong(self->x));
|
PyTuple_SET_ITEM(tup, 0, PyInt_FromLong(self->x));
|
||||||
PyTuple_SET_ITEM(tup, 1, PyInt_FromLong(self->y));
|
PyTuple_SET_ITEM(tup, 1, PyInt_FromLong(self->y));
|
||||||
wxPyEndBlockThreads();
|
wxPyEndBlockThreads(blocked);
|
||||||
return tup;
|
return tup;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -251,11 +251,11 @@ public:
|
|||||||
"Get() -> (x,y)",
|
"Get() -> (x,y)",
|
||||||
"Return the x and y properties as a tuple. ");
|
"Return the x and y properties as a tuple. ");
|
||||||
PyObject* Get() {
|
PyObject* Get() {
|
||||||
wxPyBeginBlockThreads();
|
bool blocked = wxPyBeginBlockThreads();
|
||||||
PyObject* tup = PyTuple_New(2);
|
PyObject* tup = PyTuple_New(2);
|
||||||
PyTuple_SET_ITEM(tup, 0, PyFloat_FromDouble(self->x));
|
PyTuple_SET_ITEM(tup, 0, PyFloat_FromDouble(self->x));
|
||||||
PyTuple_SET_ITEM(tup, 1, PyFloat_FromDouble(self->y));
|
PyTuple_SET_ITEM(tup, 1, PyFloat_FromDouble(self->y));
|
||||||
wxPyEndBlockThreads();
|
wxPyEndBlockThreads(blocked);
|
||||||
return tup;
|
return tup;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -364,11 +364,11 @@ public:
|
|||||||
"Get() -> (x,y)",
|
"Get() -> (x,y)",
|
||||||
"Return the x and y properties as a tuple. ");
|
"Return the x and y properties as a tuple. ");
|
||||||
PyObject* Get() {
|
PyObject* Get() {
|
||||||
wxPyBeginBlockThreads();
|
bool blocked = wxPyBeginBlockThreads();
|
||||||
PyObject* tup = PyTuple_New(2);
|
PyObject* tup = PyTuple_New(2);
|
||||||
PyTuple_SET_ITEM(tup, 0, PyInt_FromLong(self->x));
|
PyTuple_SET_ITEM(tup, 0, PyInt_FromLong(self->x));
|
||||||
PyTuple_SET_ITEM(tup, 1, PyInt_FromLong(self->y));
|
PyTuple_SET_ITEM(tup, 1, PyInt_FromLong(self->y));
|
||||||
wxPyEndBlockThreads();
|
wxPyEndBlockThreads(blocked);
|
||||||
return tup;
|
return tup;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -532,13 +532,13 @@ public:
|
|||||||
"Get() -> (x,y,width,height)",
|
"Get() -> (x,y,width,height)",
|
||||||
"Return the rectangle properties as a tuple.");
|
"Return the rectangle properties as a tuple.");
|
||||||
PyObject* Get() {
|
PyObject* Get() {
|
||||||
wxPyBeginBlockThreads();
|
bool blocked = wxPyBeginBlockThreads();
|
||||||
PyObject* tup = PyTuple_New(4);
|
PyObject* tup = PyTuple_New(4);
|
||||||
PyTuple_SET_ITEM(tup, 0, PyInt_FromLong(self->x));
|
PyTuple_SET_ITEM(tup, 0, PyInt_FromLong(self->x));
|
||||||
PyTuple_SET_ITEM(tup, 1, PyInt_FromLong(self->y));
|
PyTuple_SET_ITEM(tup, 1, PyInt_FromLong(self->y));
|
||||||
PyTuple_SET_ITEM(tup, 2, PyInt_FromLong(self->width));
|
PyTuple_SET_ITEM(tup, 2, PyInt_FromLong(self->width));
|
||||||
PyTuple_SET_ITEM(tup, 3, PyInt_FromLong(self->height));
|
PyTuple_SET_ITEM(tup, 3, PyInt_FromLong(self->height));
|
||||||
wxPyEndBlockThreads();
|
wxPyEndBlockThreads(blocked);
|
||||||
return tup;
|
return tup;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -576,10 +576,10 @@ DocAStr(wxIntersectRect,
|
|||||||
dest = reg1.GetBox();
|
dest = reg1.GetBox();
|
||||||
|
|
||||||
if (dest != wxRect(0,0,0,0)) {
|
if (dest != wxRect(0,0,0,0)) {
|
||||||
wxPyBeginBlockThreads();
|
bool blocked = wxPyBeginBlockThreads();
|
||||||
wxRect* newRect = new wxRect(dest);
|
wxRect* newRect = new wxRect(dest);
|
||||||
obj = wxPyConstructObject((void*)newRect, wxT("wxRect"), True);
|
obj = wxPyConstructObject((void*)newRect, wxT("wxRect"), True);
|
||||||
wxPyEndBlockThreads();
|
wxPyEndBlockThreads(blocked);
|
||||||
return obj;
|
return obj;
|
||||||
}
|
}
|
||||||
Py_INCREF(Py_None);
|
Py_INCREF(Py_None);
|
||||||
@@ -663,11 +663,11 @@ public:
|
|||||||
"Get() -> (x,y)",
|
"Get() -> (x,y)",
|
||||||
"Return x and y properties as a tuple.");
|
"Return x and y properties as a tuple.");
|
||||||
PyObject* Get() {
|
PyObject* Get() {
|
||||||
wxPyBeginBlockThreads();
|
bool blocked = wxPyBeginBlockThreads();
|
||||||
PyObject* tup = PyTuple_New(2);
|
PyObject* tup = PyTuple_New(2);
|
||||||
PyTuple_SET_ITEM(tup, 0, PyFloat_FromDouble(self->m_x));
|
PyTuple_SET_ITEM(tup, 0, PyFloat_FromDouble(self->m_x));
|
||||||
PyTuple_SET_ITEM(tup, 1, PyFloat_FromDouble(self->m_y));
|
PyTuple_SET_ITEM(tup, 1, PyFloat_FromDouble(self->m_y));
|
||||||
wxPyEndBlockThreads();
|
wxPyEndBlockThreads(blocked);
|
||||||
return tup;
|
return tup;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -204,7 +204,7 @@ public:
|
|||||||
unsigned char* buffer;
|
unsigned char* buffer;
|
||||||
int size;
|
int size;
|
||||||
|
|
||||||
wxPyBeginBlockThreads();
|
bool blocked = wxPyBeginBlockThreads();
|
||||||
if (!PyArg_Parse(data, "t#", &buffer, &size))
|
if (!PyArg_Parse(data, "t#", &buffer, &size))
|
||||||
goto done;
|
goto done;
|
||||||
|
|
||||||
@@ -214,7 +214,7 @@ public:
|
|||||||
}
|
}
|
||||||
self->SetData(buffer);
|
self->SetData(buffer);
|
||||||
done:
|
done:
|
||||||
wxPyEndBlockThreads();
|
wxPyEndBlockThreads(blocked);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -258,7 +258,7 @@ public:
|
|||||||
unsigned char* buffer;
|
unsigned char* buffer;
|
||||||
int size;
|
int size;
|
||||||
|
|
||||||
wxPyBeginBlockThreads();
|
bool blocked = wxPyBeginBlockThreads();
|
||||||
if (!PyArg_Parse(data, "t#", &buffer, &size))
|
if (!PyArg_Parse(data, "t#", &buffer, &size))
|
||||||
goto done;
|
goto done;
|
||||||
|
|
||||||
@@ -268,7 +268,7 @@ public:
|
|||||||
}
|
}
|
||||||
self->SetAlpha(buffer);
|
self->SetAlpha(buffer);
|
||||||
done:
|
done:
|
||||||
wxPyEndBlockThreads();
|
wxPyEndBlockThreads(blocked);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -48,10 +48,10 @@ enum
|
|||||||
class wxJoystick : public wxObject {
|
class wxJoystick : public wxObject {
|
||||||
public:
|
public:
|
||||||
wxJoystick(int joystick = wxJOYSTICK1) {
|
wxJoystick(int joystick = wxJOYSTICK1) {
|
||||||
wxPyBeginBlockThreads();
|
bool blocked = wxPyBeginBlockThreads();
|
||||||
PyErr_SetString(PyExc_NotImplementedError,
|
PyErr_SetString(PyExc_NotImplementedError,
|
||||||
"wxJoystick is not available on this platform.");
|
"wxJoystick is not available on this platform.");
|
||||||
wxPyEndBlockThreads();
|
wxPyEndBlockThreads(blocked);
|
||||||
}
|
}
|
||||||
wxPoint GetPosition() { return wxPoint(-1,-1); }
|
wxPoint GetPosition() { return wxPoint(-1,-1); }
|
||||||
int GetZPosition() { return -1; }
|
int GetZPosition() { return -1; }
|
||||||
|
@@ -341,7 +341,7 @@ EVT_LIST_ITEM_FOCUSED = wx.PyEventBinder(wxEVT_COMMAND_LIST_ITEM_FOCUSED
|
|||||||
static int wxCALLBACK wxPyListCtrl_SortItems(long item1, long item2, long funcPtr) {
|
static int wxCALLBACK wxPyListCtrl_SortItems(long item1, long item2, long funcPtr) {
|
||||||
int retval = 0;
|
int retval = 0;
|
||||||
PyObject* func = (PyObject*)funcPtr;
|
PyObject* func = (PyObject*)funcPtr;
|
||||||
wxPyBeginBlockThreads();
|
bool blocked = wxPyBeginBlockThreads();
|
||||||
|
|
||||||
PyObject* args = Py_BuildValue("(ii)", item1, item2);
|
PyObject* args = Py_BuildValue("(ii)", item1, item2);
|
||||||
PyObject* result = PyEval_CallObject(func, args);
|
PyObject* result = PyEval_CallObject(func, args);
|
||||||
@@ -351,7 +351,7 @@ EVT_LIST_ITEM_FOCUSED = wx.PyEventBinder(wxEVT_COMMAND_LIST_ITEM_FOCUSED
|
|||||||
Py_DECREF(result);
|
Py_DECREF(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
wxPyEndBlockThreads();
|
wxPyEndBlockThreads(blocked);
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
%}
|
%}
|
||||||
|
@@ -250,26 +250,26 @@ public:
|
|||||||
|
|
||||||
virtual void DoLog(wxLogLevel level, const wxChar *szString, time_t t) {
|
virtual void DoLog(wxLogLevel level, const wxChar *szString, time_t t) {
|
||||||
bool found;
|
bool found;
|
||||||
wxPyBeginBlockThreads();
|
bool blocked = wxPyBeginBlockThreads();
|
||||||
if ((found = wxPyCBH_findCallback(m_myInst, "DoLog"))) {
|
if ((found = wxPyCBH_findCallback(m_myInst, "DoLog"))) {
|
||||||
PyObject* s = wx2PyString(szString);
|
PyObject* s = wx2PyString(szString);
|
||||||
wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iOi)", level, s, t));
|
wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iOi)", level, s, t));
|
||||||
Py_DECREF(s);
|
Py_DECREF(s);
|
||||||
}
|
}
|
||||||
wxPyEndBlockThreads();
|
wxPyEndBlockThreads(blocked);
|
||||||
if (! found)
|
if (! found)
|
||||||
wxLog::DoLog(level, szString, t);
|
wxLog::DoLog(level, szString, t);
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void DoLogString(const wxChar *szString, time_t t) {
|
virtual void DoLogString(const wxChar *szString, time_t t) {
|
||||||
bool found;
|
bool found;
|
||||||
wxPyBeginBlockThreads();
|
bool blocked = wxPyBeginBlockThreads();
|
||||||
if ((found = wxPyCBH_findCallback(m_myInst, "DoLogString"))) {
|
if ((found = wxPyCBH_findCallback(m_myInst, "DoLogString"))) {
|
||||||
PyObject* s = wx2PyString(szString);
|
PyObject* s = wx2PyString(szString);
|
||||||
wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Oi)", s, t));
|
wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Oi)", s, t));
|
||||||
Py_DECREF(s);
|
Py_DECREF(s);
|
||||||
}
|
}
|
||||||
wxPyEndBlockThreads();
|
wxPyEndBlockThreads(blocked);
|
||||||
if (! found)
|
if (! found)
|
||||||
wxLog::DoLogString(szString, t);
|
wxLog::DoLogString(szString, t);
|
||||||
}
|
}
|
||||||
|
@@ -190,13 +190,13 @@ public:
|
|||||||
iconIndex = loc.GetIndex();
|
iconIndex = loc.GetIndex();
|
||||||
#endif
|
#endif
|
||||||
// Make a tuple and put the values in it
|
// Make a tuple and put the values in it
|
||||||
wxPyBeginBlockThreads();
|
bool blocked = wxPyBeginBlockThreads();
|
||||||
PyObject* tuple = PyTuple_New(3);
|
PyObject* tuple = PyTuple_New(3);
|
||||||
PyTuple_SetItem(tuple, 0, wxPyConstructObject(new wxIcon(loc),
|
PyTuple_SetItem(tuple, 0, wxPyConstructObject(new wxIcon(loc),
|
||||||
wxT("wxIcon"), True));
|
wxT("wxIcon"), True));
|
||||||
PyTuple_SetItem(tuple, 1, wx2PyString(iconFile));
|
PyTuple_SetItem(tuple, 1, wx2PyString(iconFile));
|
||||||
PyTuple_SetItem(tuple, 2, PyInt_FromLong(iconIndex));
|
PyTuple_SetItem(tuple, 2, PyInt_FromLong(iconIndex));
|
||||||
wxPyEndBlockThreads();
|
wxPyEndBlockThreads(blocked);
|
||||||
return tuple;
|
return tuple;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -250,11 +250,11 @@ public:
|
|||||||
wxArrayString commands;
|
wxArrayString commands;
|
||||||
if (self->GetAllCommands(&verbs, &commands,
|
if (self->GetAllCommands(&verbs, &commands,
|
||||||
wxFileType::MessageParameters(filename, mimetype))) {
|
wxFileType::MessageParameters(filename, mimetype))) {
|
||||||
wxPyBeginBlockThreads();
|
bool blocked = wxPyBeginBlockThreads();
|
||||||
PyObject* tuple = PyTuple_New(2);
|
PyObject* tuple = PyTuple_New(2);
|
||||||
PyTuple_SetItem(tuple, 0, wxArrayString2PyList_helper(verbs));
|
PyTuple_SetItem(tuple, 0, wxArrayString2PyList_helper(verbs));
|
||||||
PyTuple_SetItem(tuple, 1, wxArrayString2PyList_helper(commands));
|
PyTuple_SetItem(tuple, 1, wxArrayString2PyList_helper(commands));
|
||||||
wxPyEndBlockThreads();
|
wxPyEndBlockThreads(blocked);
|
||||||
return tuple;
|
return tuple;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@@ -54,11 +54,11 @@ public:
|
|||||||
PyObject* GetDashes() {
|
PyObject* GetDashes() {
|
||||||
wxDash* dashes;
|
wxDash* dashes;
|
||||||
int count = self->GetDashes(&dashes);
|
int count = self->GetDashes(&dashes);
|
||||||
wxPyBeginBlockThreads();
|
bool blocked = wxPyBeginBlockThreads();
|
||||||
PyObject* retval = PyList_New(0);
|
PyObject* retval = PyList_New(0);
|
||||||
for (int x=0; x<count; x++)
|
for (int x=0; x<count; x++)
|
||||||
PyList_Append(retval, PyInt_FromLong(dashes[x]));
|
PyList_Append(retval, PyInt_FromLong(dashes[x]));
|
||||||
wxPyEndBlockThreads();
|
wxPyEndBlockThreads(blocked);
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -270,7 +270,7 @@ void wxPyPrintout::GetPageInfo(int *minPage, int *maxPage, int *pageFrom, int *p
|
|||||||
bool hadErr = False;
|
bool hadErr = False;
|
||||||
bool found;
|
bool found;
|
||||||
|
|
||||||
wxPyBeginBlockThreads();
|
bool blocked = wxPyBeginBlockThreads();
|
||||||
if ((found = wxPyCBH_findCallback(m_myInst, "GetPageInfo"))) {
|
if ((found = wxPyCBH_findCallback(m_myInst, "GetPageInfo"))) {
|
||||||
PyObject* result = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("()"));
|
PyObject* result = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("()"));
|
||||||
if (result && PyTuple_Check(result) && PyTuple_Size(result) == 4) {
|
if (result && PyTuple_Check(result) && PyTuple_Size(result) == 4) {
|
||||||
@@ -301,7 +301,7 @@ void wxPyPrintout::GetPageInfo(int *minPage, int *maxPage, int *pageFrom, int *p
|
|||||||
}
|
}
|
||||||
Py_DECREF(result);
|
Py_DECREF(result);
|
||||||
}
|
}
|
||||||
wxPyEndBlockThreads();
|
wxPyEndBlockThreads(blocked);
|
||||||
if (! found)
|
if (! found)
|
||||||
wxPrintout::GetPageInfo(minPage, maxPage, pageFrom, pageTo);
|
wxPrintout::GetPageInfo(minPage, maxPage, pageFrom, pageTo);
|
||||||
}
|
}
|
||||||
@@ -527,7 +527,7 @@ public:
|
|||||||
bool CLASS::CBNAME(wxPreviewCanvas* a, wxDC& b) { \
|
bool CLASS::CBNAME(wxPreviewCanvas* a, wxDC& b) { \
|
||||||
bool rval=False; \
|
bool rval=False; \
|
||||||
bool found; \
|
bool found; \
|
||||||
wxPyBeginBlockThreads(); \
|
bool blocked = wxPyBeginBlockThreads(); \
|
||||||
if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
|
if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
|
||||||
PyObject* win = wxPyMake_wxObject(a); \
|
PyObject* win = wxPyMake_wxObject(a); \
|
||||||
PyObject* dc = wxPyMake_wxObject(&b); \
|
PyObject* dc = wxPyMake_wxObject(&b); \
|
||||||
@@ -535,7 +535,7 @@ public:
|
|||||||
Py_DECREF(win); \
|
Py_DECREF(win); \
|
||||||
Py_DECREF(dc); \
|
Py_DECREF(dc); \
|
||||||
} \
|
} \
|
||||||
wxPyEndBlockThreads(); \
|
wxPyEndBlockThreads(blocked); \
|
||||||
if (! found) \
|
if (! found) \
|
||||||
rval = PCLASS::CBNAME(a, b); \
|
rval = PCLASS::CBNAME(a, b); \
|
||||||
return rval; \
|
return rval; \
|
||||||
|
@@ -176,11 +176,11 @@ public:
|
|||||||
PyObject* userData=NULL) {
|
PyObject* userData=NULL) {
|
||||||
|
|
||||||
wxPyUserData* data = NULL;
|
wxPyUserData* data = NULL;
|
||||||
wxPyBeginBlockThreads();
|
bool blocked = wxPyBeginBlockThreads();
|
||||||
wxPySizerItemInfo info = wxPySizerItemTypeHelper(item, True, False);
|
wxPySizerItemInfo info = wxPySizerItemTypeHelper(item, True, False);
|
||||||
if ( userData && (info.window || info.sizer || info.gotSize) )
|
if ( userData && (info.window || info.sizer || info.gotSize) )
|
||||||
data = new wxPyUserData(userData);
|
data = new wxPyUserData(userData);
|
||||||
wxPyEndBlockThreads();
|
wxPyEndBlockThreads(blocked);
|
||||||
|
|
||||||
// Now call the real Add method if a valid item type was found
|
// Now call the real Add method if a valid item type was found
|
||||||
if ( info.window )
|
if ( info.window )
|
||||||
@@ -197,11 +197,11 @@ public:
|
|||||||
int border=0, PyObject* userData=NULL) {
|
int border=0, PyObject* userData=NULL) {
|
||||||
|
|
||||||
wxPyUserData* data = NULL;
|
wxPyUserData* data = NULL;
|
||||||
wxPyBeginBlockThreads();
|
bool blocked = wxPyBeginBlockThreads();
|
||||||
wxPySizerItemInfo info = wxPySizerItemTypeHelper(item, True, False);
|
wxPySizerItemInfo info = wxPySizerItemTypeHelper(item, True, False);
|
||||||
if ( userData && (info.window || info.sizer || info.gotSize) )
|
if ( userData && (info.window || info.sizer || info.gotSize) )
|
||||||
data = new wxPyUserData(userData);
|
data = new wxPyUserData(userData);
|
||||||
wxPyEndBlockThreads();
|
wxPyEndBlockThreads(blocked);
|
||||||
|
|
||||||
// Now call the real Insert method if a valid item type was found
|
// Now call the real Insert method if a valid item type was found
|
||||||
if ( info.window )
|
if ( info.window )
|
||||||
@@ -219,11 +219,11 @@ public:
|
|||||||
PyObject* userData=NULL) {
|
PyObject* userData=NULL) {
|
||||||
|
|
||||||
wxPyUserData* data = NULL;
|
wxPyUserData* data = NULL;
|
||||||
wxPyBeginBlockThreads();
|
bool blocked = wxPyBeginBlockThreads();
|
||||||
wxPySizerItemInfo info = wxPySizerItemTypeHelper(item, True, False);
|
wxPySizerItemInfo info = wxPySizerItemTypeHelper(item, True, False);
|
||||||
if ( userData && (info.window || info.sizer || info.gotSize) )
|
if ( userData && (info.window || info.sizer || info.gotSize) )
|
||||||
data = new wxPyUserData(userData);
|
data = new wxPyUserData(userData);
|
||||||
wxPyEndBlockThreads();
|
wxPyEndBlockThreads(blocked);
|
||||||
|
|
||||||
// Now call the real Prepend method if a valid item type was found
|
// Now call the real Prepend method if a valid item type was found
|
||||||
if ( info.window )
|
if ( info.window )
|
||||||
@@ -237,9 +237,9 @@ public:
|
|||||||
|
|
||||||
|
|
||||||
bool Remove(PyObject* item) {
|
bool Remove(PyObject* item) {
|
||||||
wxPyBeginBlockThreads();
|
bool blocked = wxPyBeginBlockThreads();
|
||||||
wxPySizerItemInfo info = wxPySizerItemTypeHelper(item, False, True);
|
wxPySizerItemInfo info = wxPySizerItemTypeHelper(item, False, True);
|
||||||
wxPyEndBlockThreads();
|
wxPyEndBlockThreads(blocked);
|
||||||
if ( info.window )
|
if ( info.window )
|
||||||
return self->Remove(info.window);
|
return self->Remove(info.window);
|
||||||
else if ( info.sizer )
|
else if ( info.sizer )
|
||||||
@@ -252,9 +252,9 @@ public:
|
|||||||
|
|
||||||
|
|
||||||
void _SetItemMinSize(PyObject* item, const wxSize& size) {
|
void _SetItemMinSize(PyObject* item, const wxSize& size) {
|
||||||
wxPyBeginBlockThreads();
|
bool blocked = wxPyBeginBlockThreads();
|
||||||
wxPySizerItemInfo info = wxPySizerItemTypeHelper(item, False, True);
|
wxPySizerItemInfo info = wxPySizerItemTypeHelper(item, False, True);
|
||||||
wxPyEndBlockThreads();
|
wxPyEndBlockThreads(blocked);
|
||||||
if ( info.window )
|
if ( info.window )
|
||||||
self->SetItemMinSize(info.window, size);
|
self->SetItemMinSize(info.window, size);
|
||||||
else if ( info.sizer )
|
else if ( info.sizer )
|
||||||
|
@@ -38,22 +38,22 @@ class wxSound : public wxObject
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
wxSound() {
|
wxSound() {
|
||||||
wxPyBeginBlockThreads();
|
bool blocked = wxPyBeginBlockThreads();
|
||||||
PyErr_SetString(PyExc_NotImplementedError,
|
PyErr_SetString(PyExc_NotImplementedError,
|
||||||
"wxSound is not available on this platform.");
|
"wxSound is not available on this platform.");
|
||||||
wxPyEndBlockThreads();
|
wxPyEndBlockThreads(blocked);
|
||||||
}
|
}
|
||||||
wxSound(const wxString&, bool) {
|
wxSound(const wxString&, bool) {
|
||||||
wxPyBeginBlockThreads();
|
bool blocked = wxPyBeginBlockThreads();
|
||||||
PyErr_SetString(PyExc_NotImplementedError,
|
PyErr_SetString(PyExc_NotImplementedError,
|
||||||
"wxSound is not available on this platform.");
|
"wxSound is not available on this platform.");
|
||||||
wxPyEndBlockThreads();
|
wxPyEndBlockThreads(blocked);
|
||||||
}
|
}
|
||||||
wxSound(int, const wxByte*) {
|
wxSound(int, const wxByte*) {
|
||||||
wxPyBeginBlockThreads();
|
bool blocked = wxPyBeginBlockThreads();
|
||||||
PyErr_SetString(PyExc_NotImplementedError,
|
PyErr_SetString(PyExc_NotImplementedError,
|
||||||
"wxSound is not available on this platform.");
|
"wxSound is not available on this platform.");
|
||||||
wxPyEndBlockThreads();
|
wxPyEndBlockThreads(blocked);
|
||||||
}
|
}
|
||||||
|
|
||||||
~wxSound() {};
|
~wxSound() {};
|
||||||
@@ -92,10 +92,10 @@ public:
|
|||||||
#else
|
#else
|
||||||
%extend {
|
%extend {
|
||||||
bool Create(int size, const wxByte* data) {
|
bool Create(int size, const wxByte* data) {
|
||||||
wxPyBeginBlockThreads();
|
bool blocked = wxPyBeginBlockThreads();
|
||||||
PyErr_SetString(PyExc_NotImplementedError,
|
PyErr_SetString(PyExc_NotImplementedError,
|
||||||
"Create from data is not available on this platform.");
|
"Create from data is not available on this platform.");
|
||||||
wxPyEndBlockThreads();
|
wxPyEndBlockThreads(blocked);
|
||||||
return False;
|
return False;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -36,10 +36,10 @@ enum {
|
|||||||
|
|
||||||
void wxPyTimer::Notify() {
|
void wxPyTimer::Notify() {
|
||||||
bool found;
|
bool found;
|
||||||
wxPyBeginBlockThreads();
|
bool blocked = wxPyBeginBlockThreads();
|
||||||
if ((found = wxPyCBH_findCallback(m_myInst, "Notify")))
|
if ((found = wxPyCBH_findCallback(m_myInst, "Notify")))
|
||||||
wxPyCBH_callCallback(m_myInst, Py_BuildValue("()"));
|
wxPyCBH_callCallback(m_myInst, Py_BuildValue("()"));
|
||||||
wxPyEndBlockThreads();
|
wxPyEndBlockThreads(blocked);
|
||||||
if (! found)
|
if (! found)
|
||||||
wxTimer::Notify();
|
wxTimer::Notify();
|
||||||
}
|
}
|
||||||
|
@@ -286,7 +286,7 @@ public:
|
|||||||
const wxTreeItemId& item2) {
|
const wxTreeItemId& item2) {
|
||||||
int rval = 0;
|
int rval = 0;
|
||||||
bool found;
|
bool found;
|
||||||
wxPyBeginBlockThreads();
|
bool blocked = wxPyBeginBlockThreads();
|
||||||
if ((found = wxPyCBH_findCallback(m_myInst, "OnCompareItems"))) {
|
if ((found = wxPyCBH_findCallback(m_myInst, "OnCompareItems"))) {
|
||||||
PyObject *o1 = wxPyConstructObject((void*)&item1, wxT("wxTreeItemId"), False);
|
PyObject *o1 = wxPyConstructObject((void*)&item1, wxT("wxTreeItemId"), False);
|
||||||
PyObject *o2 = wxPyConstructObject((void*)&item2, wxT("wxTreeItemId"), False);
|
PyObject *o2 = wxPyConstructObject((void*)&item2, wxT("wxTreeItemId"), False);
|
||||||
@@ -294,7 +294,7 @@ public:
|
|||||||
Py_DECREF(o1);
|
Py_DECREF(o1);
|
||||||
Py_DECREF(o2);
|
Py_DECREF(o2);
|
||||||
}
|
}
|
||||||
wxPyEndBlockThreads();
|
wxPyEndBlockThreads(blocked);
|
||||||
if (! found)
|
if (! found)
|
||||||
rval = wxTreeCtrl::OnCompareItems(item1, item2);
|
rval = wxTreeCtrl::OnCompareItems(item1, item2);
|
||||||
return rval;
|
return rval;
|
||||||
@@ -501,7 +501,7 @@ public:
|
|||||||
// NB: this operation is expensive and can take a long time for a
|
// NB: this operation is expensive and can take a long time for a
|
||||||
// control with a lot of items (~ O(number of items)).
|
// control with a lot of items (~ O(number of items)).
|
||||||
PyObject* GetSelections() {
|
PyObject* GetSelections() {
|
||||||
wxPyBeginBlockThreads();
|
bool blocked = wxPyBeginBlockThreads();
|
||||||
PyObject* rval = PyList_New(0);
|
PyObject* rval = PyList_New(0);
|
||||||
wxArrayTreeItemIds array;
|
wxArrayTreeItemIds array;
|
||||||
size_t num, x;
|
size_t num, x;
|
||||||
@@ -511,7 +511,7 @@ public:
|
|||||||
PyObject* item = wxPyConstructObject((void*)tii, wxT("wxTreeItemId"), True);
|
PyObject* item = wxPyConstructObject((void*)tii, wxT("wxTreeItemId"), True);
|
||||||
PyList_Append(rval, item);
|
PyList_Append(rval, item);
|
||||||
}
|
}
|
||||||
wxPyEndBlockThreads();
|
wxPyEndBlockThreads(blocked);
|
||||||
return rval;
|
return rval;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -528,11 +528,11 @@ public:
|
|||||||
PyObject* GetFirstChild(const wxTreeItemId& item) {
|
PyObject* GetFirstChild(const wxTreeItemId& item) {
|
||||||
void* cookie = 0;
|
void* cookie = 0;
|
||||||
wxTreeItemId* ritem = new wxTreeItemId(self->GetFirstChild(item, cookie));
|
wxTreeItemId* ritem = new wxTreeItemId(self->GetFirstChild(item, cookie));
|
||||||
wxPyBeginBlockThreads();
|
bool blocked = wxPyBeginBlockThreads();
|
||||||
PyObject* tup = PyTuple_New(2);
|
PyObject* tup = PyTuple_New(2);
|
||||||
PyTuple_SET_ITEM(tup, 0, wxPyConstructObject(ritem, wxT("wxTreeItemId"), True));
|
PyTuple_SET_ITEM(tup, 0, wxPyConstructObject(ritem, wxT("wxTreeItemId"), True));
|
||||||
PyTuple_SET_ITEM(tup, 1, wxPyMakeSwigPtr(cookie, wxT("void")));
|
PyTuple_SET_ITEM(tup, 1, wxPyMakeSwigPtr(cookie, wxT("void")));
|
||||||
wxPyEndBlockThreads();
|
wxPyEndBlockThreads(blocked);
|
||||||
return tup;
|
return tup;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -543,11 +543,11 @@ public:
|
|||||||
// passed to GetNextChild in order to continue the search.
|
// passed to GetNextChild in order to continue the search.
|
||||||
PyObject* GetNextChild(const wxTreeItemId& item, void* cookie) {
|
PyObject* GetNextChild(const wxTreeItemId& item, void* cookie) {
|
||||||
wxTreeItemId* ritem = new wxTreeItemId(self->GetNextChild(item, cookie));
|
wxTreeItemId* ritem = new wxTreeItemId(self->GetNextChild(item, cookie));
|
||||||
wxPyBeginBlockThreads();
|
bool blocked = wxPyBeginBlockThreads();
|
||||||
PyObject* tup = PyTuple_New(2);
|
PyObject* tup = PyTuple_New(2);
|
||||||
PyTuple_SET_ITEM(tup, 0, wxPyConstructObject(ritem, wxT("wxTreeItemId"), True));
|
PyTuple_SET_ITEM(tup, 0, wxPyConstructObject(ritem, wxT("wxTreeItemId"), True));
|
||||||
PyTuple_SET_ITEM(tup, 1, wxPyMakeSwigPtr(cookie, wxT("void")));
|
PyTuple_SET_ITEM(tup, 1, wxPyMakeSwigPtr(cookie, wxT("void")));
|
||||||
wxPyEndBlockThreads();
|
wxPyEndBlockThreads(blocked);
|
||||||
return tup;
|
return tup;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -696,10 +696,10 @@ public:
|
|||||||
PyObject* GetBoundingRect(const wxTreeItemId& item, bool textOnly = False) {
|
PyObject* GetBoundingRect(const wxTreeItemId& item, bool textOnly = False) {
|
||||||
wxRect rect;
|
wxRect rect;
|
||||||
if (self->GetBoundingRect(item, rect, textOnly)) {
|
if (self->GetBoundingRect(item, rect, textOnly)) {
|
||||||
wxPyBeginBlockThreads();
|
bool blocked = wxPyBeginBlockThreads();
|
||||||
wxRect* r = new wxRect(rect);
|
wxRect* r = new wxRect(rect);
|
||||||
PyObject* val = wxPyConstructObject((void*)r, wxT("wxRect"), True);
|
PyObject* val = wxPyConstructObject((void*)r, wxT("wxRect"), True);
|
||||||
wxPyEndBlockThreads();
|
wxPyEndBlockThreads(blocked);
|
||||||
return val;
|
return val;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@@ -352,12 +352,12 @@ validity of the remaining two values. The result codes are:
|
|||||||
wxDateTime* date = new wxDateTime;
|
wxDateTime* date = new wxDateTime;
|
||||||
wxDateTime::WeekDay wd;
|
wxDateTime::WeekDay wd;
|
||||||
wxCalendarHitTestResult result = self->HitTest(pos, date, &wd);
|
wxCalendarHitTestResult result = self->HitTest(pos, date, &wd);
|
||||||
wxPyBeginBlockThreads();
|
bool blocked = wxPyBeginBlockThreads();
|
||||||
PyObject* tup = PyTuple_New(3);
|
PyObject* tup = PyTuple_New(3);
|
||||||
PyTuple_SET_ITEM(tup, 0, PyInt_FromLong(result));
|
PyTuple_SET_ITEM(tup, 0, PyInt_FromLong(result));
|
||||||
PyTuple_SET_ITEM(tup, 1, wxPyConstructObject(date, wxT("wxDateTime"), 1));
|
PyTuple_SET_ITEM(tup, 1, wxPyConstructObject(date, wxT("wxDateTime"), 1));
|
||||||
PyTuple_SET_ITEM(tup, 2, PyInt_FromLong(wd));
|
PyTuple_SET_ITEM(tup, 2, PyInt_FromLong(wd));
|
||||||
wxPyEndBlockThreads();
|
wxPyEndBlockThreads(blocked);
|
||||||
return tup;
|
return tup;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -30,7 +30,7 @@ void wxPyDrawList_SetAPIPtr()
|
|||||||
PyObject* wxPyDrawXXXList(wxDC& dc, wxPyDrawListOp_t doDraw,
|
PyObject* wxPyDrawXXXList(wxDC& dc, wxPyDrawListOp_t doDraw,
|
||||||
PyObject* pyCoords, PyObject* pyPens, PyObject* pyBrushes)
|
PyObject* pyCoords, PyObject* pyPens, PyObject* pyBrushes)
|
||||||
{
|
{
|
||||||
wxPyBeginBlockThreads();
|
bool blocked = wxPyBeginBlockThreads();
|
||||||
|
|
||||||
bool isFastSeq = PyList_Check(pyCoords) || PyTuple_Check(pyCoords);
|
bool isFastSeq = PyList_Check(pyCoords) || PyTuple_Check(pyCoords);
|
||||||
bool isFastPens = PyList_Check(pyPens) || PyTuple_Check(pyPens);
|
bool isFastPens = PyList_Check(pyPens) || PyTuple_Check(pyPens);
|
||||||
@@ -138,7 +138,7 @@ PyObject* wxPyDrawXXXList(wxDC& dc, wxPyDrawListOp_t doDraw,
|
|||||||
|
|
||||||
|
|
||||||
exit:
|
exit:
|
||||||
wxPyEndBlockThreads();
|
wxPyEndBlockThreads(blocked);
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -214,7 +214,7 @@ bool wxPyDrawXXXPolygon(wxDC& dc, PyObject* coords)
|
|||||||
|
|
||||||
PyObject* wxPyDrawTextList(wxDC& dc, PyObject* textList, PyObject* pyPoints, PyObject* foregroundList, PyObject* backgroundList)
|
PyObject* wxPyDrawTextList(wxDC& dc, PyObject* textList, PyObject* pyPoints, PyObject* foregroundList, PyObject* backgroundList)
|
||||||
{
|
{
|
||||||
wxPyBeginBlockThreads();
|
bool blocked = wxPyBeginBlockThreads();
|
||||||
|
|
||||||
bool isFastSeq = PyList_Check(pyPoints) || PyTuple_Check(pyPoints);
|
bool isFastSeq = PyList_Check(pyPoints) || PyTuple_Check(pyPoints);
|
||||||
bool isFastText = PyList_Check(textList) || PyTuple_Check(textList);
|
bool isFastText = PyList_Check(textList) || PyTuple_Check(textList);
|
||||||
@@ -353,7 +353,7 @@ PyObject* wxPyDrawTextList(wxDC& dc, PyObject* textList, PyObject* pyPoints, PyO
|
|||||||
goto exit;
|
goto exit;
|
||||||
|
|
||||||
exit:
|
exit:
|
||||||
wxPyEndBlockThreads();
|
wxPyEndBlockThreads(blocked);
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -93,7 +93,7 @@ wxPyMake_TEMPLATE(wxGridTableBase)
|
|||||||
wxGridCellAttr* CBNAME(int a, int b, wxGridCellAttr::wxAttrKind c) { \
|
wxGridCellAttr* CBNAME(int a, int b, wxGridCellAttr::wxAttrKind c) { \
|
||||||
wxGridCellAttr* rval = NULL; \
|
wxGridCellAttr* rval = NULL; \
|
||||||
bool found; \
|
bool found; \
|
||||||
wxPyBeginBlockThreads(); \
|
bool blocked = wxPyBeginBlockThreads(); \
|
||||||
if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
|
if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
|
||||||
PyObject* ro; \
|
PyObject* ro; \
|
||||||
wxGridCellAttr* ptr; \
|
wxGridCellAttr* ptr; \
|
||||||
@@ -104,7 +104,7 @@ wxPyMake_TEMPLATE(wxGridTableBase)
|
|||||||
Py_DECREF(ro); \
|
Py_DECREF(ro); \
|
||||||
} \
|
} \
|
||||||
} \
|
} \
|
||||||
wxPyEndBlockThreads(); \
|
wxPyEndBlockThreads(blocked); \
|
||||||
if (! found) \
|
if (! found) \
|
||||||
rval = PCLASS::CBNAME(a, b, c); \
|
rval = PCLASS::CBNAME(a, b, c); \
|
||||||
return rval; \
|
return rval; \
|
||||||
@@ -117,14 +117,14 @@ wxPyMake_TEMPLATE(wxGridTableBase)
|
|||||||
|
|
||||||
#define PYCALLBACK__GCAINTINT(PCLASS, CBNAME) \
|
#define PYCALLBACK__GCAINTINT(PCLASS, CBNAME) \
|
||||||
void CBNAME(wxGridCellAttr *attr, int a, int b) { \
|
void CBNAME(wxGridCellAttr *attr, int a, int b) { \
|
||||||
wxPyBeginBlockThreads(); \
|
bool blocked = wxPyBeginBlockThreads(); \
|
||||||
bool found; \
|
bool found; \
|
||||||
if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
|
if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
|
||||||
PyObject* obj = wxPyMake_wxGridCellAttr(attr); \
|
PyObject* obj = wxPyMake_wxGridCellAttr(attr); \
|
||||||
wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Oii)", obj, a, b)); \
|
wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Oii)", obj, a, b)); \
|
||||||
Py_DECREF(obj); \
|
Py_DECREF(obj); \
|
||||||
} \
|
} \
|
||||||
wxPyEndBlockThreads(); \
|
wxPyEndBlockThreads(blocked); \
|
||||||
if (! found) \
|
if (! found) \
|
||||||
PCLASS::CBNAME(attr, a, b); \
|
PCLASS::CBNAME(attr, a, b); \
|
||||||
} \
|
} \
|
||||||
@@ -136,14 +136,14 @@ wxPyMake_TEMPLATE(wxGridTableBase)
|
|||||||
|
|
||||||
#define PYCALLBACK__GCAINT(PCLASS, CBNAME) \
|
#define PYCALLBACK__GCAINT(PCLASS, CBNAME) \
|
||||||
void CBNAME(wxGridCellAttr *attr, int val) { \
|
void CBNAME(wxGridCellAttr *attr, int val) { \
|
||||||
wxPyBeginBlockThreads(); \
|
bool blocked = wxPyBeginBlockThreads(); \
|
||||||
bool found; \
|
bool found; \
|
||||||
if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
|
if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
|
||||||
PyObject* obj = wxPyMake_wxGridCellAttr(attr); \
|
PyObject* obj = wxPyMake_wxGridCellAttr(attr); \
|
||||||
wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Oi)", obj, val)); \
|
wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Oi)", obj, val)); \
|
||||||
Py_DECREF(obj); \
|
Py_DECREF(obj); \
|
||||||
} \
|
} \
|
||||||
wxPyEndBlockThreads(); \
|
wxPyEndBlockThreads(blocked); \
|
||||||
if (! found) \
|
if (! found) \
|
||||||
PCLASS::CBNAME(attr, val); \
|
PCLASS::CBNAME(attr, val); \
|
||||||
} \
|
} \
|
||||||
@@ -155,11 +155,11 @@ wxPyMake_TEMPLATE(wxGridTableBase)
|
|||||||
|
|
||||||
#define PYCALLBACK_INT__pure(CBNAME) \
|
#define PYCALLBACK_INT__pure(CBNAME) \
|
||||||
int CBNAME() { \
|
int CBNAME() { \
|
||||||
wxPyBeginBlockThreads(); \
|
bool blocked = wxPyBeginBlockThreads(); \
|
||||||
int rval = 0; \
|
int rval = 0; \
|
||||||
if (wxPyCBH_findCallback(m_myInst, #CBNAME)) \
|
if (wxPyCBH_findCallback(m_myInst, #CBNAME)) \
|
||||||
rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("()")); \
|
rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("()")); \
|
||||||
wxPyEndBlockThreads(); \
|
wxPyEndBlockThreads(blocked); \
|
||||||
return rval; \
|
return rval; \
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -167,18 +167,18 @@ wxPyMake_TEMPLATE(wxGridTableBase)
|
|||||||
|
|
||||||
#define PYCALLBACK_BOOL_INTINT_pure(CBNAME) \
|
#define PYCALLBACK_BOOL_INTINT_pure(CBNAME) \
|
||||||
bool CBNAME(int a, int b) { \
|
bool CBNAME(int a, int b) { \
|
||||||
wxPyBeginBlockThreads(); \
|
bool blocked = wxPyBeginBlockThreads(); \
|
||||||
bool rval = 0; \
|
bool rval = 0; \
|
||||||
if (wxPyCBH_findCallback(m_myInst, #CBNAME)) \
|
if (wxPyCBH_findCallback(m_myInst, #CBNAME)) \
|
||||||
rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(ii)",a,b)); \
|
rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(ii)",a,b)); \
|
||||||
wxPyEndBlockThreads(); \
|
wxPyEndBlockThreads(blocked); \
|
||||||
return rval; \
|
return rval; \
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#define PYCALLBACK_STRING_INTINT_pure(CBNAME) \
|
#define PYCALLBACK_STRING_INTINT_pure(CBNAME) \
|
||||||
wxString CBNAME(int a, int b) { \
|
wxString CBNAME(int a, int b) { \
|
||||||
wxPyBeginBlockThreads(); \
|
bool blocked = wxPyBeginBlockThreads(); \
|
||||||
wxString rval; \
|
wxString rval; \
|
||||||
if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
|
if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
|
||||||
PyObject* ro; \
|
PyObject* ro; \
|
||||||
@@ -188,27 +188,27 @@ wxPyMake_TEMPLATE(wxGridTableBase)
|
|||||||
Py_DECREF(ro); \
|
Py_DECREF(ro); \
|
||||||
} \
|
} \
|
||||||
} \
|
} \
|
||||||
wxPyEndBlockThreads(); \
|
wxPyEndBlockThreads(blocked); \
|
||||||
return rval; \
|
return rval; \
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#define PYCALLBACK__INTINTSTRING_pure(CBNAME) \
|
#define PYCALLBACK__INTINTSTRING_pure(CBNAME) \
|
||||||
void CBNAME(int a, int b, const wxString& c) { \
|
void CBNAME(int a, int b, const wxString& c) { \
|
||||||
wxPyBeginBlockThreads(); \
|
bool blocked = wxPyBeginBlockThreads(); \
|
||||||
if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
|
if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
|
||||||
PyObject* s = wx2PyString(c); \
|
PyObject* s = wx2PyString(c); \
|
||||||
rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iiO)",a,b,s));\
|
rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iiO)",a,b,s));\
|
||||||
Py_DECREF(s); \
|
Py_DECREF(s); \
|
||||||
} \
|
} \
|
||||||
wxPyEndBlockThreads(); \
|
wxPyEndBlockThreads(blocked); \
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#define PYCALLBACK_STRING_INTINT(PCLASS, CBNAME) \
|
#define PYCALLBACK_STRING_INTINT(PCLASS, CBNAME) \
|
||||||
wxString CBNAME(int a, int b) { \
|
wxString CBNAME(int a, int b) { \
|
||||||
bool found; \
|
bool found; \
|
||||||
wxPyBeginBlockThreads(); \
|
bool blocked = wxPyBeginBlockThreads(); \
|
||||||
wxString rval; \
|
wxString rval; \
|
||||||
if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
|
if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
|
||||||
PyObject* ro; \
|
PyObject* ro; \
|
||||||
@@ -218,7 +218,7 @@ wxPyMake_TEMPLATE(wxGridTableBase)
|
|||||||
Py_DECREF(ro); \
|
Py_DECREF(ro); \
|
||||||
} \
|
} \
|
||||||
} \
|
} \
|
||||||
wxPyEndBlockThreads(); \
|
wxPyEndBlockThreads(blocked); \
|
||||||
if (! found) \
|
if (! found) \
|
||||||
rval = PCLASS::CBNAME(a, b); \
|
rval = PCLASS::CBNAME(a, b); \
|
||||||
return rval; \
|
return rval; \
|
||||||
@@ -232,13 +232,13 @@ wxPyMake_TEMPLATE(wxGridTableBase)
|
|||||||
bool CBNAME(int a, int b, const wxString& c) { \
|
bool CBNAME(int a, int b, const wxString& c) { \
|
||||||
bool rval = 0; \
|
bool rval = 0; \
|
||||||
bool found; \
|
bool found; \
|
||||||
wxPyBeginBlockThreads(); \
|
bool blocked = wxPyBeginBlockThreads(); \
|
||||||
if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
|
if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
|
||||||
PyObject* s = wx2PyString(c); \
|
PyObject* s = wx2PyString(c); \
|
||||||
rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iiO)",a,b,s));\
|
rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iiO)",a,b,s));\
|
||||||
Py_DECREF(s); \
|
Py_DECREF(s); \
|
||||||
} \
|
} \
|
||||||
wxPyEndBlockThreads(); \
|
wxPyEndBlockThreads(blocked); \
|
||||||
if (! found) \
|
if (! found) \
|
||||||
rval = PCLASS::CBNAME(a,b,c); \
|
rval = PCLASS::CBNAME(a,b,c); \
|
||||||
return rval; \
|
return rval; \
|
||||||
@@ -254,10 +254,10 @@ wxPyMake_TEMPLATE(wxGridTableBase)
|
|||||||
long CBNAME(int a, int b) { \
|
long CBNAME(int a, int b) { \
|
||||||
long rval; \
|
long rval; \
|
||||||
bool found; \
|
bool found; \
|
||||||
wxPyBeginBlockThreads(); \
|
bool blocked = wxPyBeginBlockThreads(); \
|
||||||
if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
|
if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
|
||||||
rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(ii)", a,b)); \
|
rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(ii)", a,b)); \
|
||||||
wxPyEndBlockThreads(); \
|
wxPyEndBlockThreads(blocked); \
|
||||||
if (! found) \
|
if (! found) \
|
||||||
rval = PCLASS::CBNAME(a,b); \
|
rval = PCLASS::CBNAME(a,b); \
|
||||||
return rval; \
|
return rval; \
|
||||||
@@ -272,10 +272,10 @@ wxPyMake_TEMPLATE(wxGridTableBase)
|
|||||||
bool CBNAME(int a, int b) { \
|
bool CBNAME(int a, int b) { \
|
||||||
bool rval = 0; \
|
bool rval = 0; \
|
||||||
bool found; \
|
bool found; \
|
||||||
wxPyBeginBlockThreads(); \
|
bool blocked = wxPyBeginBlockThreads(); \
|
||||||
if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
|
if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
|
||||||
rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(ii)", a,b)); \
|
rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(ii)", a,b)); \
|
||||||
wxPyEndBlockThreads(); \
|
wxPyEndBlockThreads(blocked); \
|
||||||
if (! found) \
|
if (! found) \
|
||||||
rval = PCLASS::CBNAME(a,b); \
|
rval = PCLASS::CBNAME(a,b); \
|
||||||
return rval; \
|
return rval; \
|
||||||
@@ -289,7 +289,7 @@ wxPyMake_TEMPLATE(wxGridTableBase)
|
|||||||
#define PYCALLBACK_DOUBLE_INTINT(PCLASS, CBNAME) \
|
#define PYCALLBACK_DOUBLE_INTINT(PCLASS, CBNAME) \
|
||||||
double CBNAME(int a, int b) { \
|
double CBNAME(int a, int b) { \
|
||||||
bool found; \
|
bool found; \
|
||||||
wxPyBeginBlockThreads(); \
|
bool blocked = wxPyBeginBlockThreads(); \
|
||||||
double rval; \
|
double rval; \
|
||||||
if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
|
if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
|
||||||
PyObject* ro; \
|
PyObject* ro; \
|
||||||
@@ -300,7 +300,7 @@ wxPyMake_TEMPLATE(wxGridTableBase)
|
|||||||
Py_DECREF(ro); Py_DECREF(str); \
|
Py_DECREF(ro); Py_DECREF(str); \
|
||||||
} \
|
} \
|
||||||
} \
|
} \
|
||||||
wxPyEndBlockThreads(); \
|
wxPyEndBlockThreads(blocked); \
|
||||||
if (! found) \
|
if (! found) \
|
||||||
rval = PCLASS::CBNAME(a, b); \
|
rval = PCLASS::CBNAME(a, b); \
|
||||||
return rval; \
|
return rval; \
|
||||||
@@ -314,10 +314,10 @@ wxPyMake_TEMPLATE(wxGridTableBase)
|
|||||||
#define PYCALLBACK__(PCLASS, CBNAME) \
|
#define PYCALLBACK__(PCLASS, CBNAME) \
|
||||||
void CBNAME() { \
|
void CBNAME() { \
|
||||||
bool found; \
|
bool found; \
|
||||||
wxPyBeginBlockThreads(); \
|
bool blocked = wxPyBeginBlockThreads(); \
|
||||||
if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
|
if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
|
||||||
wxPyCBH_callCallback(m_myInst, Py_BuildValue("()")); \
|
wxPyCBH_callCallback(m_myInst, Py_BuildValue("()")); \
|
||||||
wxPyEndBlockThreads(); \
|
wxPyEndBlockThreads(blocked); \
|
||||||
if (! found) \
|
if (! found) \
|
||||||
PCLASS::CBNAME(); \
|
PCLASS::CBNAME(); \
|
||||||
} \
|
} \
|
||||||
@@ -332,10 +332,10 @@ wxPyMake_TEMPLATE(wxGridTableBase)
|
|||||||
bool CBNAME(size_t a, size_t b) { \
|
bool CBNAME(size_t a, size_t b) { \
|
||||||
bool rval = 0; \
|
bool rval = 0; \
|
||||||
bool found; \
|
bool found; \
|
||||||
wxPyBeginBlockThreads(); \
|
bool blocked = wxPyBeginBlockThreads(); \
|
||||||
if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
|
if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
|
||||||
rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(ii)", a,b)); \
|
rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(ii)", a,b)); \
|
||||||
wxPyEndBlockThreads(); \
|
wxPyEndBlockThreads(blocked); \
|
||||||
if (! found) \
|
if (! found) \
|
||||||
rval = PCLASS::CBNAME(a,b); \
|
rval = PCLASS::CBNAME(a,b); \
|
||||||
return rval; \
|
return rval; \
|
||||||
@@ -350,10 +350,10 @@ wxPyMake_TEMPLATE(wxGridTableBase)
|
|||||||
bool CBNAME(size_t a) { \
|
bool CBNAME(size_t a) { \
|
||||||
bool rval = 0; \
|
bool rval = 0; \
|
||||||
bool found; \
|
bool found; \
|
||||||
wxPyBeginBlockThreads(); \
|
bool blocked = wxPyBeginBlockThreads(); \
|
||||||
if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
|
if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
|
||||||
rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(i)", a)); \
|
rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(i)", a)); \
|
||||||
wxPyEndBlockThreads(); \
|
wxPyEndBlockThreads(blocked); \
|
||||||
if (! found) \
|
if (! found) \
|
||||||
rval = PCLASS::CBNAME(a); \
|
rval = PCLASS::CBNAME(a); \
|
||||||
return rval; \
|
return rval; \
|
||||||
@@ -366,7 +366,7 @@ wxPyMake_TEMPLATE(wxGridTableBase)
|
|||||||
#define PYCALLBACK_STRING_INT(PCLASS, CBNAME) \
|
#define PYCALLBACK_STRING_INT(PCLASS, CBNAME) \
|
||||||
wxString CBNAME(int a) { \
|
wxString CBNAME(int a) { \
|
||||||
bool found; \
|
bool found; \
|
||||||
wxPyBeginBlockThreads(); \
|
bool blocked = wxPyBeginBlockThreads(); \
|
||||||
wxString rval; \
|
wxString rval; \
|
||||||
if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
|
if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
|
||||||
PyObject* ro; \
|
PyObject* ro; \
|
||||||
@@ -376,7 +376,7 @@ wxPyMake_TEMPLATE(wxGridTableBase)
|
|||||||
Py_DECREF(ro); \
|
Py_DECREF(ro); \
|
||||||
} \
|
} \
|
||||||
} \
|
} \
|
||||||
wxPyEndBlockThreads(); \
|
wxPyEndBlockThreads(blocked); \
|
||||||
if (! found) \
|
if (! found) \
|
||||||
rval = PCLASS::CBNAME(a); \
|
rval = PCLASS::CBNAME(a); \
|
||||||
return rval; \
|
return rval; \
|
||||||
@@ -389,13 +389,13 @@ wxPyMake_TEMPLATE(wxGridTableBase)
|
|||||||
#define PYCALLBACK__INTSTRING(PCLASS, CBNAME) \
|
#define PYCALLBACK__INTSTRING(PCLASS, CBNAME) \
|
||||||
void CBNAME(int a, const wxString& c) { \
|
void CBNAME(int a, const wxString& c) { \
|
||||||
bool found; \
|
bool found; \
|
||||||
wxPyBeginBlockThreads(); \
|
bool blocked = wxPyBeginBlockThreads(); \
|
||||||
if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
|
if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
|
||||||
PyObject* s = wx2PyString(c); \
|
PyObject* s = wx2PyString(c); \
|
||||||
wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iO)",a,s)); \
|
wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iO)",a,s)); \
|
||||||
Py_DECREF(s); \
|
Py_DECREF(s); \
|
||||||
} \
|
} \
|
||||||
wxPyEndBlockThreads(); \
|
wxPyEndBlockThreads(blocked); \
|
||||||
if (! found) \
|
if (! found) \
|
||||||
PCLASS::CBNAME(a,c); \
|
PCLASS::CBNAME(a,c); \
|
||||||
} \
|
} \
|
||||||
@@ -410,10 +410,10 @@ wxPyMake_TEMPLATE(wxGridTableBase)
|
|||||||
bool CBNAME() { \
|
bool CBNAME() { \
|
||||||
bool rval = 0; \
|
bool rval = 0; \
|
||||||
bool found; \
|
bool found; \
|
||||||
wxPyBeginBlockThreads(); \
|
bool blocked = wxPyBeginBlockThreads(); \
|
||||||
if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
|
if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
|
||||||
rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("()")); \
|
rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("()")); \
|
||||||
wxPyEndBlockThreads(); \
|
wxPyEndBlockThreads(blocked); \
|
||||||
if (! found) \
|
if (! found) \
|
||||||
rval = PCLASS::CBNAME(); \
|
rval = PCLASS::CBNAME(); \
|
||||||
return rval; \
|
return rval; \
|
||||||
@@ -427,10 +427,10 @@ wxPyMake_TEMPLATE(wxGridTableBase)
|
|||||||
#define PYCALLBACK__SIZETINT(PCLASS, CBNAME) \
|
#define PYCALLBACK__SIZETINT(PCLASS, CBNAME) \
|
||||||
void CBNAME(size_t a, int b) { \
|
void CBNAME(size_t a, int b) { \
|
||||||
bool found; \
|
bool found; \
|
||||||
wxPyBeginBlockThreads(); \
|
bool blocked = wxPyBeginBlockThreads(); \
|
||||||
if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
|
if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
|
||||||
wxPyCBH_callCallback(m_myInst, Py_BuildValue("(ii)", a,b)); \
|
wxPyCBH_callCallback(m_myInst, Py_BuildValue("(ii)", a,b)); \
|
||||||
wxPyEndBlockThreads(); \
|
wxPyEndBlockThreads(blocked); \
|
||||||
if (! found) \
|
if (! found) \
|
||||||
PCLASS::CBNAME(a,b); \
|
PCLASS::CBNAME(a,b); \
|
||||||
} \
|
} \
|
||||||
@@ -444,10 +444,10 @@ wxPyMake_TEMPLATE(wxGridTableBase)
|
|||||||
#define PYCALLBACK__INTINTLONG(PCLASS, CBNAME) \
|
#define PYCALLBACK__INTINTLONG(PCLASS, CBNAME) \
|
||||||
void CBNAME(int a, int b, long c) { \
|
void CBNAME(int a, int b, long c) { \
|
||||||
bool found; \
|
bool found; \
|
||||||
wxPyBeginBlockThreads(); \
|
bool blocked = wxPyBeginBlockThreads(); \
|
||||||
if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
|
if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
|
||||||
wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iii)", a,b,c)); \
|
wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iii)", a,b,c)); \
|
||||||
wxPyEndBlockThreads(); \
|
wxPyEndBlockThreads(blocked); \
|
||||||
if (! found) \
|
if (! found) \
|
||||||
PCLASS::CBNAME(a,b,c); \
|
PCLASS::CBNAME(a,b,c); \
|
||||||
} \
|
} \
|
||||||
@@ -461,10 +461,10 @@ wxPyMake_TEMPLATE(wxGridTableBase)
|
|||||||
#define PYCALLBACK__INTINTDOUBLE(PCLASS, CBNAME) \
|
#define PYCALLBACK__INTINTDOUBLE(PCLASS, CBNAME) \
|
||||||
void CBNAME(int a, int b, double c) { \
|
void CBNAME(int a, int b, double c) { \
|
||||||
bool found; \
|
bool found; \
|
||||||
wxPyBeginBlockThreads(); \
|
bool blocked = wxPyBeginBlockThreads(); \
|
||||||
if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
|
if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
|
||||||
wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iif)", a,b,c)); \
|
wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iif)", a,b,c)); \
|
||||||
wxPyEndBlockThreads(); \
|
wxPyEndBlockThreads(blocked); \
|
||||||
if (! found) \
|
if (! found) \
|
||||||
PCLASS::CBNAME(a,b,c); \
|
PCLASS::CBNAME(a,b,c); \
|
||||||
} \
|
} \
|
||||||
@@ -477,10 +477,10 @@ wxPyMake_TEMPLATE(wxGridTableBase)
|
|||||||
#define PYCALLBACK__INTINTBOOL(PCLASS, CBNAME) \
|
#define PYCALLBACK__INTINTBOOL(PCLASS, CBNAME) \
|
||||||
void CBNAME(int a, int b, bool c) { \
|
void CBNAME(int a, int b, bool c) { \
|
||||||
bool found; \
|
bool found; \
|
||||||
wxPyBeginBlockThreads(); \
|
bool blocked = wxPyBeginBlockThreads(); \
|
||||||
if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
|
if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
|
||||||
wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iii)", a,b,c)); \
|
wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iii)", a,b,c)); \
|
||||||
wxPyEndBlockThreads(); \
|
wxPyEndBlockThreads(blocked); \
|
||||||
if (! found) \
|
if (! found) \
|
||||||
PCLASS::CBNAME(a,b,c); \
|
PCLASS::CBNAME(a,b,c); \
|
||||||
} \
|
} \
|
||||||
@@ -558,7 +558,7 @@ public:
|
|||||||
void Draw(wxGrid& grid, wxGridCellAttr& attr,
|
void Draw(wxGrid& grid, wxGridCellAttr& attr,
|
||||||
wxDC& dc, const wxRect& rect,
|
wxDC& dc, const wxRect& rect,
|
||||||
int row, int col, bool isSelected) {
|
int row, int col, bool isSelected) {
|
||||||
wxPyBeginBlockThreads();
|
bool blocked = wxPyBeginBlockThreads();
|
||||||
if (wxPyCBH_findCallback(m_myInst, "Draw")) {
|
if (wxPyCBH_findCallback(m_myInst, "Draw")) {
|
||||||
PyObject* go = wxPyMake_wxObject(&grid);
|
PyObject* go = wxPyMake_wxObject(&grid);
|
||||||
PyObject* dco = wxPyMake_wxObject(&dc);
|
PyObject* dco = wxPyMake_wxObject(&dc);
|
||||||
@@ -572,13 +572,13 @@ public:
|
|||||||
Py_DECREF(dco);
|
Py_DECREF(dco);
|
||||||
Py_DECREF(ro);
|
Py_DECREF(ro);
|
||||||
}
|
}
|
||||||
wxPyEndBlockThreads();
|
wxPyEndBlockThreads(blocked);
|
||||||
}
|
}
|
||||||
|
|
||||||
wxSize GetBestSize(wxGrid& grid, wxGridCellAttr& attr, wxDC& dc,
|
wxSize GetBestSize(wxGrid& grid, wxGridCellAttr& attr, wxDC& dc,
|
||||||
int row, int col) {
|
int row, int col) {
|
||||||
wxSize rval;
|
wxSize rval;
|
||||||
wxPyBeginBlockThreads();
|
bool blocked = wxPyBeginBlockThreads();
|
||||||
if (wxPyCBH_findCallback(m_myInst, "GetBestSize")) {
|
if (wxPyCBH_findCallback(m_myInst, "GetBestSize")) {
|
||||||
PyObject* ro;
|
PyObject* ro;
|
||||||
wxSize* ptr;
|
wxSize* ptr;
|
||||||
@@ -614,14 +614,14 @@ public:
|
|||||||
Py_DECREF(ro);
|
Py_DECREF(ro);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
wxPyEndBlockThreads();
|
wxPyEndBlockThreads(blocked);
|
||||||
return rval;
|
return rval;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
wxGridCellRenderer *Clone() const {
|
wxGridCellRenderer *Clone() const {
|
||||||
wxGridCellRenderer* rval = NULL;
|
wxGridCellRenderer* rval = NULL;
|
||||||
wxPyBeginBlockThreads();
|
bool blocked = wxPyBeginBlockThreads();
|
||||||
if (wxPyCBH_findCallback(m_myInst, "Clone")) {
|
if (wxPyCBH_findCallback(m_myInst, "Clone")) {
|
||||||
PyObject* ro;
|
PyObject* ro;
|
||||||
wxGridCellRenderer* ptr;
|
wxGridCellRenderer* ptr;
|
||||||
@@ -632,7 +632,7 @@ public:
|
|||||||
Py_DECREF(ro);
|
Py_DECREF(ro);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
wxPyEndBlockThreads();
|
wxPyEndBlockThreads(blocked);
|
||||||
return rval;
|
return rval;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -774,7 +774,7 @@ public:
|
|||||||
wxPyGridCellEditor() : wxGridCellEditor() {}
|
wxPyGridCellEditor() : wxGridCellEditor() {}
|
||||||
|
|
||||||
void Create(wxWindow* parent, wxWindowID id, wxEvtHandler* evtHandler) {
|
void Create(wxWindow* parent, wxWindowID id, wxEvtHandler* evtHandler) {
|
||||||
wxPyBeginBlockThreads();
|
bool blocked = wxPyBeginBlockThreads();
|
||||||
if (wxPyCBH_findCallback(m_myInst, "Create")) {
|
if (wxPyCBH_findCallback(m_myInst, "Create")) {
|
||||||
PyObject* po = wxPyMake_wxObject(parent);
|
PyObject* po = wxPyMake_wxObject(parent);
|
||||||
PyObject* eo = wxPyMake_wxObject(evtHandler);
|
PyObject* eo = wxPyMake_wxObject(evtHandler);
|
||||||
@@ -783,37 +783,37 @@ public:
|
|||||||
Py_DECREF(po);
|
Py_DECREF(po);
|
||||||
Py_DECREF(eo);
|
Py_DECREF(eo);
|
||||||
}
|
}
|
||||||
wxPyEndBlockThreads();
|
wxPyEndBlockThreads(blocked);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void BeginEdit(int row, int col, wxGrid* grid) {
|
void BeginEdit(int row, int col, wxGrid* grid) {
|
||||||
wxPyBeginBlockThreads();
|
bool blocked = wxPyBeginBlockThreads();
|
||||||
if (wxPyCBH_findCallback(m_myInst, "BeginEdit")) {
|
if (wxPyCBH_findCallback(m_myInst, "BeginEdit")) {
|
||||||
PyObject* go = wxPyMake_wxObject(grid);
|
PyObject* go = wxPyMake_wxObject(grid);
|
||||||
wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iiO)", row, col, go));
|
wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iiO)", row, col, go));
|
||||||
Py_DECREF(go);
|
Py_DECREF(go);
|
||||||
}
|
}
|
||||||
wxPyEndBlockThreads();
|
wxPyEndBlockThreads(blocked);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool EndEdit(int row, int col, wxGrid* grid) {
|
bool EndEdit(int row, int col, wxGrid* grid) {
|
||||||
bool rv = False;
|
bool rv = False;
|
||||||
wxPyBeginBlockThreads();
|
bool blocked = wxPyBeginBlockThreads();
|
||||||
if (wxPyCBH_findCallback(m_myInst, "EndEdit")) {
|
if (wxPyCBH_findCallback(m_myInst, "EndEdit")) {
|
||||||
PyObject* go = wxPyMake_wxObject(grid);
|
PyObject* go = wxPyMake_wxObject(grid);
|
||||||
rv = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iiO)", row, col, go));
|
rv = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iiO)", row, col, go));
|
||||||
Py_DECREF(go);
|
Py_DECREF(go);
|
||||||
}
|
}
|
||||||
wxPyEndBlockThreads();
|
wxPyEndBlockThreads(blocked);
|
||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
wxGridCellEditor* Clone() const {
|
wxGridCellEditor* Clone() const {
|
||||||
wxGridCellEditor* rval = NULL;
|
wxGridCellEditor* rval = NULL;
|
||||||
wxPyBeginBlockThreads();
|
bool blocked = wxPyBeginBlockThreads();
|
||||||
if (wxPyCBH_findCallback(m_myInst, "Clone")) {
|
if (wxPyCBH_findCallback(m_myInst, "Clone")) {
|
||||||
PyObject* ro;
|
PyObject* ro;
|
||||||
wxGridCellEditor* ptr;
|
wxGridCellEditor* ptr;
|
||||||
@@ -824,20 +824,20 @@ public:
|
|||||||
Py_DECREF(ro);
|
Py_DECREF(ro);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
wxPyEndBlockThreads();
|
wxPyEndBlockThreads(blocked);
|
||||||
return rval;
|
return rval;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Show(bool show, wxGridCellAttr *attr) {
|
void Show(bool show, wxGridCellAttr *attr) {
|
||||||
bool found;
|
bool found;
|
||||||
wxPyBeginBlockThreads();
|
bool blocked = wxPyBeginBlockThreads();
|
||||||
if ((found = wxPyCBH_findCallback(m_myInst, "Show"))) {
|
if ((found = wxPyCBH_findCallback(m_myInst, "Show"))) {
|
||||||
PyObject* ao = wxPyMake_wxGridCellAttr(attr);
|
PyObject* ao = wxPyMake_wxGridCellAttr(attr);
|
||||||
wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iO)", show, ao));
|
wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iO)", show, ao));
|
||||||
Py_DECREF(ao);
|
Py_DECREF(ao);
|
||||||
}
|
}
|
||||||
wxPyEndBlockThreads();
|
wxPyEndBlockThreads(blocked);
|
||||||
if (! found)
|
if (! found)
|
||||||
wxGridCellEditor::Show(show, attr);
|
wxGridCellEditor::Show(show, attr);
|
||||||
}
|
}
|
||||||
@@ -848,7 +848,7 @@ public:
|
|||||||
|
|
||||||
void PaintBackground(const wxRect& rectCell, wxGridCellAttr *attr) {
|
void PaintBackground(const wxRect& rectCell, wxGridCellAttr *attr) {
|
||||||
bool found;
|
bool found;
|
||||||
wxPyBeginBlockThreads();
|
bool blocked = wxPyBeginBlockThreads();
|
||||||
if ((found = wxPyCBH_findCallback(m_myInst, "PaintBackground)"))) {
|
if ((found = wxPyCBH_findCallback(m_myInst, "PaintBackground)"))) {
|
||||||
PyObject* ao = wxPyMake_wxGridCellAttr(attr);
|
PyObject* ao = wxPyMake_wxGridCellAttr(attr);
|
||||||
PyObject* ro = wxPyConstructObject((void*)&rectCell, wxT("wxRect"), 0);
|
PyObject* ro = wxPyConstructObject((void*)&rectCell, wxT("wxRect"), 0);
|
||||||
@@ -858,7 +858,7 @@ public:
|
|||||||
Py_DECREF(ro);
|
Py_DECREF(ro);
|
||||||
Py_DECREF(ao);
|
Py_DECREF(ao);
|
||||||
}
|
}
|
||||||
wxPyEndBlockThreads();
|
wxPyEndBlockThreads(blocked);
|
||||||
if (! found)
|
if (! found)
|
||||||
wxGridCellEditor::PaintBackground(rectCell, attr);
|
wxGridCellEditor::PaintBackground(rectCell, attr);
|
||||||
}
|
}
|
||||||
@@ -1213,7 +1213,7 @@ public:
|
|||||||
|
|
||||||
|
|
||||||
wxString GetValue(int row, int col) {
|
wxString GetValue(int row, int col) {
|
||||||
wxPyBeginBlockThreads();
|
bool blocked = wxPyBeginBlockThreads();
|
||||||
wxString rval;
|
wxString rval;
|
||||||
if (wxPyCBH_findCallback(m_myInst, "GetValue")) {
|
if (wxPyCBH_findCallback(m_myInst, "GetValue")) {
|
||||||
PyObject* ro;
|
PyObject* ro;
|
||||||
@@ -1223,18 +1223,18 @@ public:
|
|||||||
Py_DECREF(ro);
|
Py_DECREF(ro);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
wxPyEndBlockThreads();
|
wxPyEndBlockThreads(blocked);
|
||||||
return rval;
|
return rval;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SetValue(int row, int col, const wxString& val) {
|
void SetValue(int row, int col, const wxString& val) {
|
||||||
wxPyBeginBlockThreads();
|
bool blocked = wxPyBeginBlockThreads();
|
||||||
if (wxPyCBH_findCallback(m_myInst, "SetValue")) {
|
if (wxPyCBH_findCallback(m_myInst, "SetValue")) {
|
||||||
PyObject* s = wx2PyString(val);
|
PyObject* s = wx2PyString(val);
|
||||||
wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iiO)",row,col,s));
|
wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iiO)",row,col,s));
|
||||||
Py_DECREF(s);
|
Py_DECREF(s);
|
||||||
}
|
}
|
||||||
wxPyEndBlockThreads();
|
wxPyEndBlockThreads(blocked);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -1242,7 +1242,7 @@ public:
|
|||||||
// the GetValue and SetValue python methods.
|
// the GetValue and SetValue python methods.
|
||||||
long GetValueAsLong( int row, int col ) {
|
long GetValueAsLong( int row, int col ) {
|
||||||
long rval = 0;
|
long rval = 0;
|
||||||
wxPyBeginBlockThreads();
|
bool blocked = wxPyBeginBlockThreads();
|
||||||
if (wxPyCBH_findCallback(m_myInst, "GetValue")) {
|
if (wxPyCBH_findCallback(m_myInst, "GetValue")) {
|
||||||
PyObject* ro;
|
PyObject* ro;
|
||||||
PyObject* num;
|
PyObject* num;
|
||||||
@@ -1256,13 +1256,13 @@ public:
|
|||||||
Py_DECREF(ro);
|
Py_DECREF(ro);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
wxPyEndBlockThreads();
|
wxPyEndBlockThreads(blocked);
|
||||||
return rval;
|
return rval;
|
||||||
}
|
}
|
||||||
|
|
||||||
double GetValueAsDouble( int row, int col ) {
|
double GetValueAsDouble( int row, int col ) {
|
||||||
double rval = 0.0;
|
double rval = 0.0;
|
||||||
wxPyBeginBlockThreads();
|
bool blocked = wxPyBeginBlockThreads();
|
||||||
if (wxPyCBH_findCallback(m_myInst, "GetValue")) {
|
if (wxPyCBH_findCallback(m_myInst, "GetValue")) {
|
||||||
PyObject* ro;
|
PyObject* ro;
|
||||||
PyObject* num;
|
PyObject* num;
|
||||||
@@ -1276,7 +1276,7 @@ public:
|
|||||||
Py_DECREF(ro);
|
Py_DECREF(ro);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
wxPyEndBlockThreads();
|
wxPyEndBlockThreads(blocked);
|
||||||
return rval;
|
return rval;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1285,19 +1285,19 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
void SetValueAsLong( int row, int col, long value ) {
|
void SetValueAsLong( int row, int col, long value ) {
|
||||||
wxPyBeginBlockThreads();
|
bool blocked = wxPyBeginBlockThreads();
|
||||||
if (wxPyCBH_findCallback(m_myInst, "SetValue")) {
|
if (wxPyCBH_findCallback(m_myInst, "SetValue")) {
|
||||||
wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iii)", row, col, value));
|
wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iii)", row, col, value));
|
||||||
}
|
}
|
||||||
wxPyEndBlockThreads();
|
wxPyEndBlockThreads(blocked);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SetValueAsDouble( int row, int col, double value ) {
|
void SetValueAsDouble( int row, int col, double value ) {
|
||||||
wxPyBeginBlockThreads();
|
bool blocked = wxPyBeginBlockThreads();
|
||||||
if (wxPyCBH_findCallback(m_myInst, "SetValue")) {
|
if (wxPyCBH_findCallback(m_myInst, "SetValue")) {
|
||||||
wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iid)", row, col, value));
|
wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iid)", row, col, value));
|
||||||
}
|
}
|
||||||
wxPyEndBlockThreads();
|
wxPyEndBlockThreads(blocked);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SetValueAsBool( int row, int col, bool value ) {
|
void SetValueAsBool( int row, int col, bool value ) {
|
||||||
|
@@ -53,10 +53,9 @@ bool wxPyDoingCleanup = False;
|
|||||||
struct wxPyThreadState {
|
struct wxPyThreadState {
|
||||||
unsigned long tid;
|
unsigned long tid;
|
||||||
PyThreadState* tstate;
|
PyThreadState* tstate;
|
||||||
int blocked;
|
|
||||||
|
|
||||||
wxPyThreadState(unsigned long _tid=0, PyThreadState* _tstate=NULL)
|
wxPyThreadState(unsigned long _tid=0, PyThreadState* _tstate=NULL)
|
||||||
: tid(_tid), tstate(_tstate), blocked(1) {}
|
: tid(_tid), tstate(_tstate) {}
|
||||||
};
|
};
|
||||||
|
|
||||||
#include <wx/dynarray.h>
|
#include <wx/dynarray.h>
|
||||||
@@ -137,20 +136,20 @@ int wxPyApp::MainLoop() {
|
|||||||
bool wxPyApp::OnInitGui() {
|
bool wxPyApp::OnInitGui() {
|
||||||
bool rval=True;
|
bool rval=True;
|
||||||
wxApp::OnInitGui(); // in this case always call the base class version
|
wxApp::OnInitGui(); // in this case always call the base class version
|
||||||
wxPyBeginBlockThreads();
|
bool blocked = wxPyBeginBlockThreads();
|
||||||
if (wxPyCBH_findCallback(m_myInst, "OnInitGui"))
|
if (wxPyCBH_findCallback(m_myInst, "OnInitGui"))
|
||||||
rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("()"));
|
rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("()"));
|
||||||
wxPyEndBlockThreads();
|
wxPyEndBlockThreads(blocked);
|
||||||
return rval;
|
return rval;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int wxPyApp::OnExit() {
|
int wxPyApp::OnExit() {
|
||||||
int rval=0;
|
int rval=0;
|
||||||
wxPyBeginBlockThreads();
|
bool blocked = wxPyBeginBlockThreads();
|
||||||
if (wxPyCBH_findCallback(m_myInst, "OnExit"))
|
if (wxPyCBH_findCallback(m_myInst, "OnExit"))
|
||||||
rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("()"));
|
rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("()"));
|
||||||
wxPyEndBlockThreads();
|
wxPyEndBlockThreads(blocked);
|
||||||
wxApp::OnExit(); // in this case always call the base class version
|
wxApp::OnExit(); // in this case always call the base class version
|
||||||
return rval;
|
return rval;
|
||||||
}
|
}
|
||||||
@@ -178,7 +177,7 @@ void wxPyApp::OnAssert(const wxChar *file,
|
|||||||
|
|
||||||
// If the OnAssert is overloaded in the Python class then call it...
|
// If the OnAssert is overloaded in the Python class then call it...
|
||||||
bool found;
|
bool found;
|
||||||
wxPyBeginBlockThreads();
|
bool blocked = wxPyBeginBlockThreads();
|
||||||
if ((found = wxPyCBH_findCallback(m_myInst, "OnAssert"))) {
|
if ((found = wxPyCBH_findCallback(m_myInst, "OnAssert"))) {
|
||||||
PyObject* fso = wx2PyString(file);
|
PyObject* fso = wx2PyString(file);
|
||||||
PyObject* cso = wx2PyString(file);
|
PyObject* cso = wx2PyString(file);
|
||||||
@@ -193,7 +192,7 @@ void wxPyApp::OnAssert(const wxChar *file,
|
|||||||
Py_DECREF(cso);
|
Py_DECREF(cso);
|
||||||
Py_DECREF(mso);
|
Py_DECREF(mso);
|
||||||
}
|
}
|
||||||
wxPyEndBlockThreads();
|
wxPyEndBlockThreads(blocked);
|
||||||
|
|
||||||
// ...otherwise do our own thing with it
|
// ...otherwise do our own thing with it
|
||||||
if (! found) {
|
if (! found) {
|
||||||
@@ -212,11 +211,11 @@ void wxPyApp::OnAssert(const wxChar *file,
|
|||||||
}
|
}
|
||||||
|
|
||||||
// set the exception
|
// set the exception
|
||||||
wxPyBeginBlockThreads();
|
bool blocked = wxPyBeginBlockThreads();
|
||||||
PyObject* s = wx2PyString(buf);
|
PyObject* s = wx2PyString(buf);
|
||||||
PyErr_SetObject(wxPyAssertionError, s);
|
PyErr_SetObject(wxPyAssertionError, s);
|
||||||
Py_DECREF(s);
|
Py_DECREF(s);
|
||||||
wxPyEndBlockThreads();
|
wxPyEndBlockThreads(blocked);
|
||||||
|
|
||||||
// Now when control returns to whatever API wrapper was called from
|
// Now when control returns to whatever API wrapper was called from
|
||||||
// Python it should detect that an exception is set and will return
|
// Python it should detect that an exception is set and will return
|
||||||
@@ -247,40 +246,40 @@ void wxPyApp::OnAssert(const wxChar *file,
|
|||||||
// For catching Apple Events
|
// For catching Apple Events
|
||||||
void wxPyApp::MacOpenFile(const wxString &fileName)
|
void wxPyApp::MacOpenFile(const wxString &fileName)
|
||||||
{
|
{
|
||||||
wxPyBeginBlockThreads();
|
bool blocked = wxPyBeginBlockThreads();
|
||||||
if (wxPyCBH_findCallback(m_myInst, "MacOpenFile")) {
|
if (wxPyCBH_findCallback(m_myInst, "MacOpenFile")) {
|
||||||
PyObject* s = wx2PyString(fileName);
|
PyObject* s = wx2PyString(fileName);
|
||||||
wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", s));
|
wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", s));
|
||||||
Py_DECREF(s);
|
Py_DECREF(s);
|
||||||
}
|
}
|
||||||
wxPyEndBlockThreads();
|
wxPyEndBlockThreads(blocked);
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxPyApp::MacPrintFile(const wxString &fileName)
|
void wxPyApp::MacPrintFile(const wxString &fileName)
|
||||||
{
|
{
|
||||||
wxPyBeginBlockThreads();
|
bool blocked = wxPyBeginBlockThreads();
|
||||||
if (wxPyCBH_findCallback(m_myInst, "MacPrintFile")) {
|
if (wxPyCBH_findCallback(m_myInst, "MacPrintFile")) {
|
||||||
PyObject* s = wx2PyString(fileName);
|
PyObject* s = wx2PyString(fileName);
|
||||||
wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", s));
|
wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", s));
|
||||||
Py_DECREF(s);
|
Py_DECREF(s);
|
||||||
}
|
}
|
||||||
wxPyEndBlockThreads();
|
wxPyEndBlockThreads(blocked);
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxPyApp::MacNewFile()
|
void wxPyApp::MacNewFile()
|
||||||
{
|
{
|
||||||
wxPyBeginBlockThreads();
|
bool blocked = wxPyBeginBlockThreads();
|
||||||
if (wxPyCBH_findCallback(m_myInst, "MacNewFile"))
|
if (wxPyCBH_findCallback(m_myInst, "MacNewFile"))
|
||||||
wxPyCBH_callCallback(m_myInst, Py_BuildValue("()"));
|
wxPyCBH_callCallback(m_myInst, Py_BuildValue("()"));
|
||||||
wxPyEndBlockThreads();
|
wxPyEndBlockThreads(blocked);
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxPyApp::MacReopenApp()
|
void wxPyApp::MacReopenApp()
|
||||||
{
|
{
|
||||||
wxPyBeginBlockThreads();
|
bool blocked = wxPyBeginBlockThreads();
|
||||||
if (wxPyCBH_findCallback(m_myInst, "MacReopenApp"))
|
if (wxPyCBH_findCallback(m_myInst, "MacReopenApp"))
|
||||||
wxPyCBH_callCallback(m_myInst, Py_BuildValue("()"));
|
wxPyCBH_callCallback(m_myInst, Py_BuildValue("()"));
|
||||||
wxPyEndBlockThreads();
|
wxPyEndBlockThreads(blocked);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -377,7 +376,7 @@ void wxPyApp::_BootstrapApp()
|
|||||||
// Get any command-line args passed to this program from the sys module
|
// Get any command-line args passed to this program from the sys module
|
||||||
int argc = 0;
|
int argc = 0;
|
||||||
char** argv = NULL;
|
char** argv = NULL;
|
||||||
wxPyBeginBlockThreads();
|
bool blocked = wxPyBeginBlockThreads();
|
||||||
PyObject* sysargv = PySys_GetObject("argv");
|
PyObject* sysargv = PySys_GetObject("argv");
|
||||||
if (sysargv != NULL) {
|
if (sysargv != NULL) {
|
||||||
argc = PyList_Size(sysargv);
|
argc = PyList_Size(sysargv);
|
||||||
@@ -389,12 +388,12 @@ void wxPyApp::_BootstrapApp()
|
|||||||
}
|
}
|
||||||
argv[argc] = NULL;
|
argv[argc] = NULL;
|
||||||
}
|
}
|
||||||
wxPyEndBlockThreads();
|
wxPyEndBlockThreads(blocked);
|
||||||
|
|
||||||
result = wxEntryStart(argc, argv);
|
result = wxEntryStart(argc, argv);
|
||||||
delete [] argv;
|
delete [] argv;
|
||||||
|
|
||||||
wxPyBeginBlockThreads();
|
blocked = wxPyBeginBlockThreads();
|
||||||
if (! result) {
|
if (! result) {
|
||||||
PyErr_SetString(PyExc_SystemError, "wxEntryStart failed!");
|
PyErr_SetString(PyExc_SystemError, "wxEntryStart failed!");
|
||||||
goto error;
|
goto error;
|
||||||
@@ -439,7 +438,7 @@ void wxPyApp::_BootstrapApp()
|
|||||||
Py_XDECREF(retval);
|
Py_XDECREF(retval);
|
||||||
Py_XDECREF(pyint);
|
Py_XDECREF(pyint);
|
||||||
|
|
||||||
wxPyEndBlockThreads();
|
wxPyEndBlockThreads(blocked);
|
||||||
};
|
};
|
||||||
|
|
||||||
//---------------------------------------------------------------------
|
//---------------------------------------------------------------------
|
||||||
@@ -793,19 +792,19 @@ void wxPy_ReinitStockObjects(int pass)
|
|||||||
void wxPyClientData_dtor(wxPyClientData* self) {
|
void wxPyClientData_dtor(wxPyClientData* self) {
|
||||||
if (! wxPyDoingCleanup) { // Don't do it during cleanup as Python
|
if (! wxPyDoingCleanup) { // Don't do it during cleanup as Python
|
||||||
// may have already garbage collected the object...
|
// may have already garbage collected the object...
|
||||||
wxPyBeginBlockThreads();
|
bool blocked = wxPyBeginBlockThreads();
|
||||||
Py_DECREF(self->m_obj);
|
Py_DECREF(self->m_obj);
|
||||||
self->m_obj = NULL;
|
self->m_obj = NULL;
|
||||||
wxPyEndBlockThreads();
|
wxPyEndBlockThreads(blocked);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxPyUserData_dtor(wxPyUserData* self) {
|
void wxPyUserData_dtor(wxPyUserData* self) {
|
||||||
if (! wxPyDoingCleanup) {
|
if (! wxPyDoingCleanup) {
|
||||||
wxPyBeginBlockThreads();
|
bool blocked = wxPyBeginBlockThreads();
|
||||||
Py_DECREF(self->m_obj);
|
Py_DECREF(self->m_obj);
|
||||||
self->m_obj = NULL;
|
self->m_obj = NULL;
|
||||||
wxPyEndBlockThreads();
|
wxPyEndBlockThreads(blocked);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -822,7 +821,7 @@ void wxPyOORClientData_dtor(wxPyOORClientData* self) {
|
|||||||
|
|
||||||
static PyObject* deadObjectClass = NULL;
|
static PyObject* deadObjectClass = NULL;
|
||||||
|
|
||||||
wxPyBeginBlockThreads();
|
bool blocked = wxPyBeginBlockThreads();
|
||||||
if (deadObjectClass == NULL) {
|
if (deadObjectClass == NULL) {
|
||||||
deadObjectClass = PyDict_GetItemString(wxPython_dict, "_wxPyDeadObject");
|
deadObjectClass = PyDict_GetItemString(wxPython_dict, "_wxPyDeadObject");
|
||||||
// TODO: Can not wxASSERT here because inside a wxPyBeginBlock Threads,
|
// TODO: Can not wxASSERT here because inside a wxPyBeginBlock Threads,
|
||||||
@@ -867,7 +866,7 @@ void wxPyOORClientData_dtor(wxPyOORClientData* self) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// m_obj is DECREF'd in the base class dtor...
|
// m_obj is DECREF'd in the base class dtor...
|
||||||
wxPyEndBlockThreads();
|
wxPyEndBlockThreads(blocked);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -1038,7 +1037,6 @@ PyThreadState* wxPyBeginAllowThreads() {
|
|||||||
#ifdef WXP_WITH_THREAD
|
#ifdef WXP_WITH_THREAD
|
||||||
PyThreadState* saved = PyEval_SaveThread(); // Py_BEGIN_ALLOW_THREADS;
|
PyThreadState* saved = PyEval_SaveThread(); // Py_BEGIN_ALLOW_THREADS;
|
||||||
wxPySaveThreadState(saved);
|
wxPySaveThreadState(saved);
|
||||||
wxPyGetThreadState()->blocked -= 1;
|
|
||||||
return saved;
|
return saved;
|
||||||
#else
|
#else
|
||||||
return NULL;
|
return NULL;
|
||||||
@@ -1047,7 +1045,6 @@ PyThreadState* wxPyBeginAllowThreads() {
|
|||||||
|
|
||||||
void wxPyEndAllowThreads(PyThreadState* saved) {
|
void wxPyEndAllowThreads(PyThreadState* saved) {
|
||||||
#ifdef WXP_WITH_THREAD
|
#ifdef WXP_WITH_THREAD
|
||||||
wxPyGetThreadState()->blocked += 1;
|
|
||||||
PyEval_RestoreThread(saved); // Py_END_ALLOW_THREADS;
|
PyEval_RestoreThread(saved); // Py_END_ALLOW_THREADS;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
@@ -1057,21 +1054,34 @@ void wxPyEndAllowThreads(PyThreadState* saved) {
|
|||||||
// Calls from wxWindows back to Python code, or even any PyObject
|
// Calls from wxWindows back to Python code, or even any PyObject
|
||||||
// manipulations, PyDECREF's and etc. are wrapped in calls to these functions:
|
// manipulations, PyDECREF's and etc. are wrapped in calls to these functions:
|
||||||
|
|
||||||
void wxPyBeginBlockThreads() {
|
bool wxPyBeginBlockThreads() {
|
||||||
#ifdef WXP_WITH_THREAD
|
#ifdef WXP_WITH_THREAD
|
||||||
|
// This works in for 2.3, maybe a good alternative to find the needed tstate?
|
||||||
|
// PyThreadState *check = PyGILState_GetThisThreadState();
|
||||||
|
|
||||||
|
// get the currect tstate by swapping in NULL and then putting it back.
|
||||||
|
PyThreadState *current = PyThreadState_Swap(NULL);
|
||||||
|
PyThreadState_Swap(current);
|
||||||
|
|
||||||
|
// Only block if there wasn't alrady a tstate. This cen happen with
|
||||||
|
// nested calls to wxPyBeginBlockThreads
|
||||||
|
bool blocked = false;
|
||||||
|
if (current == NULL) {
|
||||||
wxPyThreadState* tstate = wxPyGetThreadState();
|
wxPyThreadState* tstate = wxPyGetThreadState();
|
||||||
if (tstate->blocked++ == 0) { // if nested calls then do nothing
|
|
||||||
PyEval_RestoreThread(tstate->tstate);
|
PyEval_RestoreThread(tstate->tstate);
|
||||||
|
blocked = true;
|
||||||
}
|
}
|
||||||
|
return blocked;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void wxPyEndBlockThreads() {
|
void wxPyEndBlockThreads(bool blocked) {
|
||||||
#ifdef WXP_WITH_THREAD
|
#ifdef WXP_WITH_THREAD
|
||||||
wxPyThreadState* tstate = wxPyGetThreadState();
|
// Only unblock if we blocked in the last call to wxPyBeginBlockThreads.
|
||||||
tstate->blocked -= 1;
|
// The value of blocked passed in needs to be the same as that returned
|
||||||
if ( tstate->blocked == 0) { // if nested calls then do nothing
|
// from wxPyBeginBlockThreads at the same nesting level.
|
||||||
|
if ( blocked ) {
|
||||||
PyEval_SaveThread();
|
PyEval_SaveThread();
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@@ -1111,9 +1121,9 @@ PyObject* wxPyInputStream::read(int size) {
|
|||||||
|
|
||||||
// check if we have a real wxInputStream to work with
|
// check if we have a real wxInputStream to work with
|
||||||
if (!m_wxis) {
|
if (!m_wxis) {
|
||||||
wxPyBeginBlockThreads();
|
bool blocked = wxPyBeginBlockThreads();
|
||||||
PyErr_SetString(PyExc_IOError, "no valid C-wxInputStream");
|
PyErr_SetString(PyExc_IOError, "no valid C-wxInputStream");
|
||||||
wxPyEndBlockThreads();
|
wxPyEndBlockThreads(blocked);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1130,7 +1140,7 @@ PyObject* wxPyInputStream::read(int size) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// error check
|
// error check
|
||||||
wxPyBeginBlockThreads();
|
bool blocked = wxPyBeginBlockThreads();
|
||||||
wxStreamError err = m_wxis->GetLastError();
|
wxStreamError err = m_wxis->GetLastError();
|
||||||
if (err != wxSTREAM_NO_ERROR && err != wxSTREAM_EOF) {
|
if (err != wxSTREAM_NO_ERROR && err != wxSTREAM_EOF) {
|
||||||
PyErr_SetString(PyExc_IOError,"IOError in wxInputStream");
|
PyErr_SetString(PyExc_IOError,"IOError in wxInputStream");
|
||||||
@@ -1139,7 +1149,7 @@ PyObject* wxPyInputStream::read(int size) {
|
|||||||
// We use only strings for the streams, not unicode
|
// We use only strings for the streams, not unicode
|
||||||
obj = PyString_FromStringAndSize(buf, buf.GetDataLen());
|
obj = PyString_FromStringAndSize(buf, buf.GetDataLen());
|
||||||
}
|
}
|
||||||
wxPyEndBlockThreads();
|
wxPyEndBlockThreads(blocked);
|
||||||
return obj;
|
return obj;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1152,9 +1162,9 @@ PyObject* wxPyInputStream::readline(int size) {
|
|||||||
|
|
||||||
// check if we have a real wxInputStream to work with
|
// check if we have a real wxInputStream to work with
|
||||||
if (!m_wxis) {
|
if (!m_wxis) {
|
||||||
wxPyBeginBlockThreads();
|
bool blocked = wxPyBeginBlockThreads();
|
||||||
PyErr_SetString(PyExc_IOError,"no valid C-wxInputStream");
|
PyErr_SetString(PyExc_IOError,"no valid C-wxInputStream");
|
||||||
wxPyEndBlockThreads();
|
wxPyEndBlockThreads(blocked);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1165,7 +1175,7 @@ PyObject* wxPyInputStream::readline(int size) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// errorcheck
|
// errorcheck
|
||||||
wxPyBeginBlockThreads();
|
bool blocked = wxPyBeginBlockThreads();
|
||||||
wxStreamError err = m_wxis->GetLastError();
|
wxStreamError err = m_wxis->GetLastError();
|
||||||
if (err != wxSTREAM_NO_ERROR && err != wxSTREAM_EOF) {
|
if (err != wxSTREAM_NO_ERROR && err != wxSTREAM_EOF) {
|
||||||
PyErr_SetString(PyExc_IOError,"IOError in wxInputStream");
|
PyErr_SetString(PyExc_IOError,"IOError in wxInputStream");
|
||||||
@@ -1174,7 +1184,7 @@ PyObject* wxPyInputStream::readline(int size) {
|
|||||||
// We use only strings for the streams, not unicode
|
// We use only strings for the streams, not unicode
|
||||||
obj = PyString_FromStringAndSize((char*)buf.GetData(), buf.GetDataLen());
|
obj = PyString_FromStringAndSize((char*)buf.GetData(), buf.GetDataLen());
|
||||||
}
|
}
|
||||||
wxPyEndBlockThreads();
|
wxPyEndBlockThreads(blocked);
|
||||||
return obj;
|
return obj;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1184,19 +1194,21 @@ PyObject* wxPyInputStream::readlines(int sizehint) {
|
|||||||
|
|
||||||
// check if we have a real wxInputStream to work with
|
// check if we have a real wxInputStream to work with
|
||||||
if (!m_wxis) {
|
if (!m_wxis) {
|
||||||
wxPyBeginBlockThreads();
|
bool blocked = wxPyBeginBlockThreads();
|
||||||
PyErr_SetString(PyExc_IOError,"no valid C-wxInputStream");
|
PyErr_SetString(PyExc_IOError,"no valid C-wxInputStream");
|
||||||
wxPyEndBlockThreads();
|
wxPyEndBlockThreads(blocked);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
// init list
|
// init list
|
||||||
wxPyBeginBlockThreads();
|
bool blocked = wxPyBeginBlockThreads();
|
||||||
pylist = PyList_New(0);
|
pylist = PyList_New(0);
|
||||||
|
wxPyEndBlockThreads(blocked);
|
||||||
|
|
||||||
if (!pylist) {
|
if (!pylist) {
|
||||||
wxPyBeginBlockThreads();
|
bool blocked = wxPyBeginBlockThreads();
|
||||||
PyErr_NoMemory();
|
PyErr_NoMemory();
|
||||||
wxPyEndBlockThreads();
|
wxPyEndBlockThreads(blocked);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1205,24 +1217,24 @@ PyObject* wxPyInputStream::readlines(int sizehint) {
|
|||||||
for (i=0; (m_wxis->CanRead()) && ((sizehint < 0) || (i < sizehint));) {
|
for (i=0; (m_wxis->CanRead()) && ((sizehint < 0) || (i < sizehint));) {
|
||||||
PyObject* s = this->readline();
|
PyObject* s = this->readline();
|
||||||
if (s == NULL) {
|
if (s == NULL) {
|
||||||
wxPyBeginBlockThreads();
|
bool blocked = wxPyBeginBlockThreads();
|
||||||
Py_DECREF(pylist);
|
Py_DECREF(pylist);
|
||||||
wxPyEndBlockThreads();
|
wxPyEndBlockThreads(blocked);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
wxPyBeginBlockThreads();
|
bool blocked = wxPyBeginBlockThreads();
|
||||||
PyList_Append(pylist, s);
|
PyList_Append(pylist, s);
|
||||||
i += PyString_Size(s);
|
i += PyString_Size(s);
|
||||||
wxPyEndBlockThreads();
|
wxPyEndBlockThreads(blocked);
|
||||||
}
|
}
|
||||||
|
|
||||||
// error check
|
// error check
|
||||||
wxStreamError err = m_wxis->GetLastError();
|
wxStreamError err = m_wxis->GetLastError();
|
||||||
if (err != wxSTREAM_NO_ERROR && err != wxSTREAM_EOF) {
|
if (err != wxSTREAM_NO_ERROR && err != wxSTREAM_EOF) {
|
||||||
wxPyBeginBlockThreads();
|
bool blocked = wxPyBeginBlockThreads();
|
||||||
Py_DECREF(pylist);
|
Py_DECREF(pylist);
|
||||||
PyErr_SetString(PyExc_IOError,"IOError in wxInputStream");
|
PyErr_SetString(PyExc_IOError,"IOError in wxInputStream");
|
||||||
wxPyEndBlockThreads();
|
wxPyEndBlockThreads(blocked);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1250,16 +1262,18 @@ wxPyCBInputStream::wxPyCBInputStream(PyObject *r, PyObject *s, PyObject *t, bool
|
|||||||
|
|
||||||
|
|
||||||
wxPyCBInputStream::~wxPyCBInputStream() {
|
wxPyCBInputStream::~wxPyCBInputStream() {
|
||||||
if (m_block) wxPyBeginBlockThreads();
|
bool blocked;
|
||||||
|
if (m_block) blocked = wxPyBeginBlockThreads();
|
||||||
Py_XDECREF(m_read);
|
Py_XDECREF(m_read);
|
||||||
Py_XDECREF(m_seek);
|
Py_XDECREF(m_seek);
|
||||||
Py_XDECREF(m_tell);
|
Py_XDECREF(m_tell);
|
||||||
if (m_block) wxPyEndBlockThreads();
|
if (m_block) wxPyEndBlockThreads(blocked);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
wxPyCBInputStream* wxPyCBInputStream::create(PyObject *py, bool block) {
|
wxPyCBInputStream* wxPyCBInputStream::create(PyObject *py, bool block) {
|
||||||
if (block) wxPyBeginBlockThreads();
|
bool blocked;
|
||||||
|
if (block) blocked = wxPyBeginBlockThreads();
|
||||||
|
|
||||||
PyObject* read = getMethod(py, "read");
|
PyObject* read = getMethod(py, "read");
|
||||||
PyObject* seek = getMethod(py, "seek");
|
PyObject* seek = getMethod(py, "seek");
|
||||||
@@ -1270,11 +1284,11 @@ wxPyCBInputStream* wxPyCBInputStream::create(PyObject *py, bool block) {
|
|||||||
Py_XDECREF(read);
|
Py_XDECREF(read);
|
||||||
Py_XDECREF(seek);
|
Py_XDECREF(seek);
|
||||||
Py_XDECREF(tell);
|
Py_XDECREF(tell);
|
||||||
if (block) wxPyEndBlockThreads();
|
if (block) wxPyEndBlockThreads(blocked);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (block) wxPyEndBlockThreads();
|
if (block) wxPyEndBlockThreads(blocked);
|
||||||
return new wxPyCBInputStream(read, seek, tell, block);
|
return new wxPyCBInputStream(read, seek, tell, block);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1312,7 +1326,7 @@ size_t wxPyCBInputStream::OnSysRead(void *buffer, size_t bufsize) {
|
|||||||
if (bufsize == 0)
|
if (bufsize == 0)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
wxPyBeginBlockThreads();
|
bool blocked = wxPyBeginBlockThreads();
|
||||||
PyObject* arglist = Py_BuildValue("(i)", bufsize);
|
PyObject* arglist = Py_BuildValue("(i)", bufsize);
|
||||||
PyObject* result = PyEval_CallObject(m_read, arglist);
|
PyObject* result = PyEval_CallObject(m_read, arglist);
|
||||||
Py_DECREF(arglist);
|
Py_DECREF(arglist);
|
||||||
@@ -1330,7 +1344,7 @@ size_t wxPyCBInputStream::OnSysRead(void *buffer, size_t bufsize) {
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
m_lasterror = wxSTREAM_READ_ERROR;
|
m_lasterror = wxSTREAM_READ_ERROR;
|
||||||
wxPyEndBlockThreads();
|
wxPyEndBlockThreads(blocked);
|
||||||
return o;
|
return o;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1340,7 +1354,7 @@ size_t wxPyCBInputStream::OnSysWrite(const void *buffer, size_t bufsize) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
off_t wxPyCBInputStream::OnSysSeek(off_t off, wxSeekMode mode) {
|
off_t wxPyCBInputStream::OnSysSeek(off_t off, wxSeekMode mode) {
|
||||||
wxPyBeginBlockThreads();
|
bool blocked = wxPyBeginBlockThreads();
|
||||||
#ifdef _LARGE_FILES
|
#ifdef _LARGE_FILES
|
||||||
// off_t is a 64-bit value...
|
// off_t is a 64-bit value...
|
||||||
PyObject* arglist = Py_BuildValue("(Li)", off, mode);
|
PyObject* arglist = Py_BuildValue("(Li)", off, mode);
|
||||||
@@ -1350,13 +1364,13 @@ off_t wxPyCBInputStream::OnSysSeek(off_t off, wxSeekMode mode) {
|
|||||||
PyObject* result = PyEval_CallObject(m_seek, arglist);
|
PyObject* result = PyEval_CallObject(m_seek, arglist);
|
||||||
Py_DECREF(arglist);
|
Py_DECREF(arglist);
|
||||||
Py_XDECREF(result);
|
Py_XDECREF(result);
|
||||||
wxPyEndBlockThreads();
|
wxPyEndBlockThreads(blocked);
|
||||||
return OnSysTell();
|
return OnSysTell();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
off_t wxPyCBInputStream::OnSysTell() const {
|
off_t wxPyCBInputStream::OnSysTell() const {
|
||||||
wxPyBeginBlockThreads();
|
bool blocked = wxPyBeginBlockThreads();
|
||||||
PyObject* arglist = Py_BuildValue("()");
|
PyObject* arglist = Py_BuildValue("()");
|
||||||
PyObject* result = PyEval_CallObject(m_tell, arglist);
|
PyObject* result = PyEval_CallObject(m_tell, arglist);
|
||||||
Py_DECREF(arglist);
|
Py_DECREF(arglist);
|
||||||
@@ -1370,7 +1384,7 @@ off_t wxPyCBInputStream::OnSysTell() const {
|
|||||||
o = PyInt_AsLong(result);
|
o = PyInt_AsLong(result);
|
||||||
Py_DECREF(result);
|
Py_DECREF(result);
|
||||||
};
|
};
|
||||||
wxPyEndBlockThreads();
|
wxPyEndBlockThreads(blocked);
|
||||||
return o;
|
return o;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1389,12 +1403,14 @@ wxPyCallback::wxPyCallback(const wxPyCallback& other) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
wxPyCallback::~wxPyCallback() {
|
wxPyCallback::~wxPyCallback() {
|
||||||
wxPyBeginBlockThreads();
|
bool blocked = wxPyBeginBlockThreads();
|
||||||
Py_DECREF(m_func);
|
Py_DECREF(m_func);
|
||||||
wxPyEndBlockThreads();
|
wxPyEndBlockThreads(blocked);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#define wxPy_PRECALLINIT "_preCallInit"
|
||||||
|
#define wxPy_POSTCALLCLEANUP "_postCallCleanup"
|
||||||
|
|
||||||
// This function is used for all events destined for Python event handlers.
|
// This function is used for all events destined for Python event handlers.
|
||||||
void wxPyCallback::EventThunker(wxEvent& event) {
|
void wxPyCallback::EventThunker(wxEvent& event) {
|
||||||
@@ -1405,7 +1421,7 @@ void wxPyCallback::EventThunker(wxEvent& event) {
|
|||||||
PyObject* tuple;
|
PyObject* tuple;
|
||||||
bool checkSkip = False;
|
bool checkSkip = False;
|
||||||
|
|
||||||
wxPyBeginBlockThreads();
|
bool blocked = wxPyBeginBlockThreads();
|
||||||
wxString className = event.GetClassInfo()->GetClassName();
|
wxString className = event.GetClassInfo()->GetClassName();
|
||||||
|
|
||||||
// If the event is one of these types then pass the original
|
// If the event is one of these types then pass the original
|
||||||
@@ -1425,9 +1441,17 @@ void wxPyCallback::EventThunker(wxEvent& event) {
|
|||||||
if (!arg) {
|
if (!arg) {
|
||||||
PyErr_Print();
|
PyErr_Print();
|
||||||
} else {
|
} else {
|
||||||
|
// "intern" the pre/post method names to speed up the HasAttr
|
||||||
|
static PyObject* s_preName = NULL;
|
||||||
|
static PyObject* s_postName = NULL;
|
||||||
|
if (s_preName == NULL) {
|
||||||
|
s_preName = PyString_FromString(wxPy_PRECALLINIT);
|
||||||
|
s_postName = PyString_FromString(wxPy_POSTCALLCLEANUP);
|
||||||
|
}
|
||||||
|
|
||||||
// Check if the event object needs some preinitialization
|
// Check if the event object needs some preinitialization
|
||||||
if (PyObject_HasAttrString(arg, "_preInit")) {
|
if (PyObject_HasAttr(arg, s_preName)) {
|
||||||
result = PyObject_CallMethod(arg, "_preInit", "O", arg);
|
result = PyObject_CallMethodObjArgs(arg, s_preName, arg, NULL);
|
||||||
if ( result ) {
|
if ( result ) {
|
||||||
Py_DECREF(result); // result is ignored, but we still need to decref it
|
Py_DECREF(result); // result is ignored, but we still need to decref it
|
||||||
PyErr_Clear(); // Just in case...
|
PyErr_Clear(); // Just in case...
|
||||||
@@ -1447,6 +1471,17 @@ void wxPyCallback::EventThunker(wxEvent& event) {
|
|||||||
PyErr_Print();
|
PyErr_Print();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Check if the event object needs some post cleanup
|
||||||
|
if (PyObject_HasAttr(arg, s_postName)) {
|
||||||
|
result = PyObject_CallMethodObjArgs(arg, s_postName, arg, NULL);
|
||||||
|
if ( result ) {
|
||||||
|
Py_DECREF(result); // result is ignored, but we still need to decref it
|
||||||
|
PyErr_Clear(); // Just in case...
|
||||||
|
} else {
|
||||||
|
PyErr_Print();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if ( checkSkip ) {
|
if ( checkSkip ) {
|
||||||
// if the event object was one of our special types and
|
// if the event object was one of our special types and
|
||||||
// it had been cloned, then we need to extract the Skipped
|
// it had been cloned, then we need to extract the Skipped
|
||||||
@@ -1461,7 +1496,7 @@ void wxPyCallback::EventThunker(wxEvent& event) {
|
|||||||
}
|
}
|
||||||
Py_DECREF(tuple);
|
Py_DECREF(tuple);
|
||||||
}
|
}
|
||||||
wxPyEndBlockThreads();
|
wxPyEndBlockThreads(blocked);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -1646,10 +1681,10 @@ PyObject* wxPyCBH_callCallbackObj(const wxPyCallbackHelper& cbh, PyObject* argTu
|
|||||||
|
|
||||||
void wxPyCBH_delete(wxPyCallbackHelper* cbh) {
|
void wxPyCBH_delete(wxPyCallbackHelper* cbh) {
|
||||||
if (cbh->m_incRef) {
|
if (cbh->m_incRef) {
|
||||||
wxPyBeginBlockThreads();
|
bool blocked = wxPyBeginBlockThreads();
|
||||||
Py_XDECREF(cbh->m_self);
|
Py_XDECREF(cbh->m_self);
|
||||||
Py_XDECREF(cbh->m_class);
|
Py_XDECREF(cbh->m_class);
|
||||||
wxPyEndBlockThreads();
|
wxPyEndBlockThreads(blocked);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1667,14 +1702,14 @@ wxPyEvtSelfRef::wxPyEvtSelfRef() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
wxPyEvtSelfRef::~wxPyEvtSelfRef() {
|
wxPyEvtSelfRef::~wxPyEvtSelfRef() {
|
||||||
wxPyBeginBlockThreads();
|
bool blocked = wxPyBeginBlockThreads();
|
||||||
if (m_cloned)
|
if (m_cloned)
|
||||||
Py_DECREF(m_self);
|
Py_DECREF(m_self);
|
||||||
wxPyEndBlockThreads();
|
wxPyEndBlockThreads(blocked);
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxPyEvtSelfRef::SetSelf(PyObject* self, bool clone) {
|
void wxPyEvtSelfRef::SetSelf(PyObject* self, bool clone) {
|
||||||
wxPyBeginBlockThreads();
|
bool blocked = wxPyBeginBlockThreads();
|
||||||
if (m_cloned)
|
if (m_cloned)
|
||||||
Py_DECREF(m_self);
|
Py_DECREF(m_self);
|
||||||
m_self = self;
|
m_self = self;
|
||||||
@@ -1682,7 +1717,7 @@ void wxPyEvtSelfRef::SetSelf(PyObject* self, bool clone) {
|
|||||||
Py_INCREF(m_self);
|
Py_INCREF(m_self);
|
||||||
m_cloned = True;
|
m_cloned = True;
|
||||||
}
|
}
|
||||||
wxPyEndBlockThreads();
|
wxPyEndBlockThreads(blocked);
|
||||||
}
|
}
|
||||||
|
|
||||||
PyObject* wxPyEvtSelfRef::GetSelf() const {
|
PyObject* wxPyEvtSelfRef::GetSelf() const {
|
||||||
@@ -1741,7 +1776,7 @@ PyObject* wxPy_ConvertList(wxListBase* listbase) {
|
|||||||
wxObject* wxObj;
|
wxObject* wxObj;
|
||||||
wxNode* node = list->GetFirst();
|
wxNode* node = list->GetFirst();
|
||||||
|
|
||||||
wxPyBeginBlockThreads();
|
bool blocked = wxPyBeginBlockThreads();
|
||||||
pyList = PyList_New(0);
|
pyList = PyList_New(0);
|
||||||
while (node) {
|
while (node) {
|
||||||
wxObj = node->GetData();
|
wxObj = node->GetData();
|
||||||
@@ -1749,7 +1784,7 @@ PyObject* wxPy_ConvertList(wxListBase* listbase) {
|
|||||||
PyList_Append(pyList, pyObj);
|
PyList_Append(pyList, pyObj);
|
||||||
node = node->GetNext();
|
node = node->GetNext();
|
||||||
}
|
}
|
||||||
wxPyEndBlockThreads();
|
wxPyEndBlockThreads(blocked);
|
||||||
return pyList;
|
return pyList;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -312,21 +312,21 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
void OnExit() {
|
void OnExit() {
|
||||||
wxPyBeginBlockThreads();
|
bool blocked = wxPyBeginBlockThreads();
|
||||||
Py_DECREF(m_tagHandlerClass);
|
Py_DECREF(m_tagHandlerClass);
|
||||||
m_tagHandlerClass = NULL;
|
m_tagHandlerClass = NULL;
|
||||||
for (size_t x=0; x < m_objArray.GetCount(); x++) {
|
for (size_t x=0; x < m_objArray.GetCount(); x++) {
|
||||||
PyObject* obj = (PyObject*)m_objArray.Item(x);
|
PyObject* obj = (PyObject*)m_objArray.Item(x);
|
||||||
Py_DECREF(obj);
|
Py_DECREF(obj);
|
||||||
}
|
}
|
||||||
wxPyEndBlockThreads();
|
wxPyEndBlockThreads(blocked);
|
||||||
};
|
};
|
||||||
|
|
||||||
void FillHandlersTable(wxHtmlWinParser *parser) {
|
void FillHandlersTable(wxHtmlWinParser *parser) {
|
||||||
// Wave our magic wand... (if it works it's a miracle! ;-)
|
// Wave our magic wand... (if it works it's a miracle! ;-)
|
||||||
|
|
||||||
// First, make a new instance of the tag handler
|
// First, make a new instance of the tag handler
|
||||||
wxPyBeginBlockThreads();
|
bool blocked = wxPyBeginBlockThreads();
|
||||||
PyObject* arg = PyTuple_New(0);
|
PyObject* arg = PyTuple_New(0);
|
||||||
PyObject* obj = PyObject_CallObject(m_tagHandlerClass, arg);
|
PyObject* obj = PyObject_CallObject(m_tagHandlerClass, arg);
|
||||||
Py_DECREF(arg);
|
Py_DECREF(arg);
|
||||||
@@ -334,10 +334,10 @@ public:
|
|||||||
// now figure out where it's C++ object is...
|
// now figure out where it's C++ object is...
|
||||||
wxPyHtmlWinTagHandler* thPtr;
|
wxPyHtmlWinTagHandler* thPtr;
|
||||||
if (! wxPyConvertSwigPtr(obj, (void **)&thPtr, wxT("wxPyHtmlWinTagHandler"))) {
|
if (! wxPyConvertSwigPtr(obj, (void **)&thPtr, wxT("wxPyHtmlWinTagHandler"))) {
|
||||||
wxPyEndBlockThreads();
|
wxPyEndBlockThreads(blocked);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
wxPyEndBlockThreads();
|
wxPyEndBlockThreads(blocked);
|
||||||
|
|
||||||
// add it,
|
// add it,
|
||||||
parser->AddTagHandler(thPtr);
|
parser->AddTagHandler(thPtr);
|
||||||
@@ -625,13 +625,13 @@ public:
|
|||||||
virtual bool CanRead(const wxFSFile& file) const {
|
virtual bool CanRead(const wxFSFile& file) const {
|
||||||
bool rval = False;
|
bool rval = False;
|
||||||
bool found;
|
bool found;
|
||||||
wxPyBeginBlockThreads();
|
bool blocked = wxPyBeginBlockThreads();
|
||||||
if ((found = wxPyCBH_findCallback(m_myInst, "CanRead"))) {
|
if ((found = wxPyCBH_findCallback(m_myInst, "CanRead"))) {
|
||||||
PyObject* obj = wxPyMake_wxObject((wxFSFile*)&file); // cast away const
|
PyObject* obj = wxPyMake_wxObject((wxFSFile*)&file); // cast away const
|
||||||
rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", obj));
|
rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", obj));
|
||||||
Py_DECREF(obj);
|
Py_DECREF(obj);
|
||||||
}
|
}
|
||||||
wxPyEndBlockThreads();
|
wxPyEndBlockThreads(blocked);
|
||||||
return rval;
|
return rval;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -641,7 +641,7 @@ public:
|
|||||||
virtual wxString ReadFile(const wxFSFile& file) const {
|
virtual wxString ReadFile(const wxFSFile& file) const {
|
||||||
wxString rval;
|
wxString rval;
|
||||||
bool found;
|
bool found;
|
||||||
wxPyBeginBlockThreads();
|
bool blocked = wxPyBeginBlockThreads();
|
||||||
if ((found = wxPyCBH_findCallback(m_myInst, "ReadFile"))) {
|
if ((found = wxPyCBH_findCallback(m_myInst, "ReadFile"))) {
|
||||||
PyObject* obj = wxPyMake_wxObject((wxFSFile*)&file); // cast away const
|
PyObject* obj = wxPyMake_wxObject((wxFSFile*)&file); // cast away const
|
||||||
PyObject* ro;
|
PyObject* ro;
|
||||||
@@ -652,7 +652,7 @@ public:
|
|||||||
Py_DECREF(ro);
|
Py_DECREF(ro);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
wxPyEndBlockThreads();
|
wxPyEndBlockThreads(blocked);
|
||||||
return rval;
|
return rval;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -724,13 +724,13 @@ IMP_PYCALLBACK__CELLINTINTME(wxPyHtmlWindow, wxHtmlWindow, OnCellClicked);
|
|||||||
|
|
||||||
void wxPyHtmlWindow::OnLinkClicked(const wxHtmlLinkInfo& link) {
|
void wxPyHtmlWindow::OnLinkClicked(const wxHtmlLinkInfo& link) {
|
||||||
bool found;
|
bool found;
|
||||||
wxPyBeginBlockThreads();
|
bool blocked = wxPyBeginBlockThreads();
|
||||||
if ((found = wxPyCBH_findCallback(m_myInst, "OnLinkClicked"))) {
|
if ((found = wxPyCBH_findCallback(m_myInst, "OnLinkClicked"))) {
|
||||||
PyObject* obj = wxPyConstructObject((void*)&link, wxT("wxHtmlLinkInfo"), 0);
|
PyObject* obj = wxPyConstructObject((void*)&link, wxT("wxHtmlLinkInfo"), 0);
|
||||||
wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", obj));
|
wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", obj));
|
||||||
Py_DECREF(obj);
|
Py_DECREF(obj);
|
||||||
}
|
}
|
||||||
wxPyEndBlockThreads();
|
wxPyEndBlockThreads(blocked);
|
||||||
if (! found)
|
if (! found)
|
||||||
wxHtmlWindow::OnLinkClicked(link);
|
wxHtmlWindow::OnLinkClicked(link);
|
||||||
}
|
}
|
||||||
@@ -744,7 +744,7 @@ wxHtmlOpeningStatus wxPyHtmlWindow::OnOpeningURL(wxHtmlURLType type,
|
|||||||
wxString *redirect) const {
|
wxString *redirect) const {
|
||||||
bool found;
|
bool found;
|
||||||
wxHtmlOpeningStatus rval;
|
wxHtmlOpeningStatus rval;
|
||||||
wxPyBeginBlockThreads();
|
bool blocked = wxPyBeginBlockThreads();
|
||||||
if ((found = wxPyCBH_findCallback(m_myInst, "OnOpeningURL"))) {
|
if ((found = wxPyCBH_findCallback(m_myInst, "OnOpeningURL"))) {
|
||||||
PyObject* ro;
|
PyObject* ro;
|
||||||
PyObject* s = wx2PyString(url);
|
PyObject* s = wx2PyString(url);
|
||||||
@@ -765,7 +765,7 @@ wxHtmlOpeningStatus wxPyHtmlWindow::OnOpeningURL(wxHtmlURLType type,
|
|||||||
}
|
}
|
||||||
Py_DECREF(ro);
|
Py_DECREF(ro);
|
||||||
}
|
}
|
||||||
wxPyEndBlockThreads();
|
wxPyEndBlockThreads(blocked);
|
||||||
if (! found)
|
if (! found)
|
||||||
rval = wxHtmlWindow::OnOpeningURL(type, url, redirect);
|
rval = wxHtmlWindow::OnOpeningURL(type, url, redirect);
|
||||||
return rval;
|
return rval;
|
||||||
|
@@ -268,7 +268,9 @@
|
|||||||
|
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
|
||||||
%typemap(out) bool "$result = PyBool_FromLong((bool)$1);"
|
%typemap(out) bool {
|
||||||
|
$result = $1 ? Py_True : Py_False; Py_INCREF($result);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
Reference in New Issue
Block a user