Passing None to an EVT_* function will Disconnect
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@12396 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -472,6 +472,14 @@ static void wxEvtHandler_Connect(wxEvtHandler *self,int id,int lastId,int ev
|
|||||||
(wxObjectEventFunction) &wxPyCallback::EventThunker,
|
(wxObjectEventFunction) &wxPyCallback::EventThunker,
|
||||||
new wxPyCallback(func));
|
new wxPyCallback(func));
|
||||||
}
|
}
|
||||||
|
else if (func == Py_None) {
|
||||||
|
self->Disconnect(id, lastId, eventType,
|
||||||
|
(wxObjectEventFunction)
|
||||||
|
&wxPyCallback::EventThunker);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
PyErr_SetString(PyExc_TypeError, "Expected callable object or None.");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
static PyObject *_wrap_wxEvtHandler_Connect(PyObject *self, PyObject *args, PyObject *kwargs) {
|
static PyObject *_wrap_wxEvtHandler_Connect(PyObject *self, PyObject *args, PyObject *kwargs) {
|
||||||
PyObject * _resultobj;
|
PyObject * _resultobj;
|
||||||
|
@@ -63,6 +63,14 @@ public:
|
|||||||
(wxObjectEventFunction) &wxPyCallback::EventThunker,
|
(wxObjectEventFunction) &wxPyCallback::EventThunker,
|
||||||
new wxPyCallback(func));
|
new wxPyCallback(func));
|
||||||
}
|
}
|
||||||
|
else if (func == Py_None) {
|
||||||
|
self->Disconnect(id, lastId, eventType,
|
||||||
|
(wxObjectEventFunction)
|
||||||
|
&wxPyCallback::EventThunker);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
PyErr_SetString(PyExc_TypeError, "Expected callable object or None.");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Disconnect(int id, int lastId = -1,
|
bool Disconnect(int id, int lastId = -1,
|
||||||
|
Reference in New Issue
Block a user