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:
Robin Dunn 2001-11-13 03:17:09 +00:00
parent c0c84fa088
commit 25b00b4e8c
2 changed files with 16 additions and 0 deletions

View File

@ -472,6 +472,14 @@ static void wxEvtHandler_Connect(wxEvtHandler *self,int id,int lastId,int ev
(wxObjectEventFunction) &wxPyCallback::EventThunker,
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) {
PyObject * _resultobj;

View File

@ -63,6 +63,14 @@ public:
(wxObjectEventFunction) &wxPyCallback::EventThunker,
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,