X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/4a61305d364dcf229395fb223daec31e2d6efcb4..e9159fe8e8f1b3653c506805cbb79280aa2a0f38:/wxPython/contrib/dllwidget/dllwidget_.cpp diff --git a/wxPython/contrib/dllwidget/dllwidget_.cpp b/wxPython/contrib/dllwidget/dllwidget_.cpp index b34a06a273..8d53ec8215 100644 --- a/wxPython/contrib/dllwidget/dllwidget_.cpp +++ b/wxPython/contrib/dllwidget/dllwidget_.cpp @@ -84,12 +84,6 @@ static PyObject* t_output_helper(PyObject* target, PyObject* o) { } return target; } - -#if PYTHON_API_VERSION >= 1009 - static char* wxStringErrorMsg = "String or Unicode type required"; -#else - static char* wxStringErrorMsg = "String type required"; -#endif #ifdef __cplusplus extern "C" { #endif @@ -158,41 +152,15 @@ static PyObject *_wrap_new_wxDllWidget(PyObject *self, PyObject *args, PyObject } if (_obj2) { -#if PYTHON_API_VERSION >= 1009 - char* tmpPtr; int tmpSize; - if (!PyString_Check(_obj2) && !PyUnicode_Check(_obj2)) { - PyErr_SetString(PyExc_TypeError, wxStringErrorMsg); - return NULL; - } - if (PyString_AsStringAndSize(_obj2, &tmpPtr, &tmpSize) == -1) - return NULL; - _arg2 = new wxString(tmpPtr, tmpSize); -#else - if (!PyString_Check(_obj2)) { - PyErr_SetString(PyExc_TypeError, wxStringErrorMsg); + _arg2 = wxString_in_helper(_obj2); + if (_arg2 == NULL) return NULL; - } - _arg2 = new wxString(PyString_AS_STRING(_obj2), PyString_GET_SIZE(_obj2)); -#endif } if (_obj3) { -#if PYTHON_API_VERSION >= 1009 - char* tmpPtr; int tmpSize; - if (!PyString_Check(_obj3) && !PyUnicode_Check(_obj3)) { - PyErr_SetString(PyExc_TypeError, wxStringErrorMsg); + _arg3 = wxString_in_helper(_obj3); + if (_arg3 == NULL) return NULL; - } - if (PyString_AsStringAndSize(_obj3, &tmpPtr, &tmpSize) == -1) - return NULL; - _arg3 = new wxString(tmpPtr, tmpSize); -#else - if (!PyString_Check(_obj3)) { - PyErr_SetString(PyExc_TypeError, wxStringErrorMsg); - return NULL; - } - _arg3 = new wxString(PyString_AS_STRING(_obj3), PyString_GET_SIZE(_obj3)); -#endif } if (_obj4) { @@ -207,10 +175,11 @@ static PyObject *_wrap_new_wxDllWidget(PyObject *self, PyObject *args, PyObject return NULL; } { - wxPy_BEGIN_ALLOW_THREADS; - _result = (wxDllWidget *)new_wxDllWidget(_arg0,_arg1,*_arg2,*_arg3,*_arg4,*_arg5,_arg6); + PyThreadState* __tstate = wxPyBeginAllowThreads(); + _result = (wxDllWidget *)new_wxDllWidget(_arg0,_arg1,*_arg2,*_arg3,*_arg4,*_arg5,_arg6); - wxPy_END_ALLOW_THREADS; + wxPyEndAllowThreads(__tstate); + if (PyErr_Occurred()) return NULL; } if (_result) { SWIG_MakePtr(_ptemp, (char *) _result,"_wxDllWidget_p"); _resultobj = Py_BuildValue("s",_ptemp); @@ -248,10 +217,11 @@ static PyObject *_wrap_wxDllWidget_Ok(PyObject *self, PyObject *args, PyObject * } } { - wxPy_BEGIN_ALLOW_THREADS; - _result = (bool )wxDllWidget_Ok(_arg0); + PyThreadState* __tstate = wxPyBeginAllowThreads(); + _result = (bool )wxDllWidget_Ok(_arg0); - wxPy_END_ALLOW_THREADS; + wxPyEndAllowThreads(__tstate); + if (PyErr_Occurred()) return NULL; } _resultobj = Py_BuildValue("i",_result); return _resultobj; } @@ -279,28 +249,16 @@ static PyObject *_wrap_wxDllWidget_SendCommand(PyObject *self, PyObject *args, P } if (_obj2) { -#if PYTHON_API_VERSION >= 1009 - char* tmpPtr; int tmpSize; - if (!PyString_Check(_obj2) && !PyUnicode_Check(_obj2)) { - PyErr_SetString(PyExc_TypeError, wxStringErrorMsg); + _arg2 = wxString_in_helper(_obj2); + if (_arg2 == NULL) return NULL; - } - if (PyString_AsStringAndSize(_obj2, &tmpPtr, &tmpSize) == -1) - return NULL; - _arg2 = new wxString(tmpPtr, tmpSize); -#else - if (!PyString_Check(_obj2)) { - PyErr_SetString(PyExc_TypeError, wxStringErrorMsg); - return NULL; - } - _arg2 = new wxString(PyString_AS_STRING(_obj2), PyString_GET_SIZE(_obj2)); -#endif } { - wxPy_BEGIN_ALLOW_THREADS; - _result = (int )wxDllWidget_SendCommand(_arg0,_arg1,*_arg2); + PyThreadState* __tstate = wxPyBeginAllowThreads(); + _result = (int )wxDllWidget_SendCommand(_arg0,_arg1,*_arg2); - wxPy_END_ALLOW_THREADS; + wxPyEndAllowThreads(__tstate); + if (PyErr_Occurred()) return NULL; } _resultobj = Py_BuildValue("i",_result); { if (_obj2) @@ -309,8 +267,8 @@ static PyObject *_wrap_wxDllWidget_SendCommand(PyObject *self, PyObject *args, P return _resultobj; } -#define wxDllWidget_GetEmbeddedWindow(_swigobj) (_swigobj->GetEmbeddedWindow()) -static PyObject *_wrap_wxDllWidget_GetEmbeddedWindow(PyObject *self, PyObject *args, PyObject *kwargs) { +#define wxDllWidget_GetWidgetWindow(_swigobj) (_swigobj->GetWidgetWindow()) +static PyObject *_wrap_wxDllWidget_GetWidgetWindow(PyObject *self, PyObject *args, PyObject *kwargs) { PyObject * _resultobj; wxWindow * _result; wxDllWidget * _arg0; @@ -318,20 +276,21 @@ static PyObject *_wrap_wxDllWidget_GetEmbeddedWindow(PyObject *self, PyObject *a char *_kwnames[] = { "self", NULL }; self = self; - if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxDllWidget_GetEmbeddedWindow",_kwnames,&_argo0)) + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxDllWidget_GetWidgetWindow",_kwnames,&_argo0)) return NULL; if (_argo0) { if (_argo0 == Py_None) { _arg0 = NULL; } else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxDllWidget_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxDllWidget_GetEmbeddedWindow. Expected _wxDllWidget_p."); + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxDllWidget_GetWidgetWindow. Expected _wxDllWidget_p."); return NULL; } } { - wxPy_BEGIN_ALLOW_THREADS; - _result = (wxWindow *)wxDllWidget_GetEmbeddedWindow(_arg0); + PyThreadState* __tstate = wxPyBeginAllowThreads(); + _result = (wxWindow *)wxDllWidget_GetWidgetWindow(_arg0); - wxPy_END_ALLOW_THREADS; + wxPyEndAllowThreads(__tstate); + if (PyErr_Occurred()) return NULL; }{ _resultobj = wxPyMake_wxObject(_result); } return _resultobj; } @@ -345,12 +304,17 @@ static PyObject *_wrap_wxDllWidget_GetDllExt(PyObject *self, PyObject *args, PyO if(!PyArg_ParseTupleAndKeywords(args,kwargs,":wxDllWidget_GetDllExt",_kwnames)) return NULL; { - wxPy_BEGIN_ALLOW_THREADS; - _result = new wxString (wxDllWidget::GetDllExt()); + PyThreadState* __tstate = wxPyBeginAllowThreads(); + _result = new wxString (wxDllWidget::GetDllExt()); - wxPy_END_ALLOW_THREADS; + wxPyEndAllowThreads(__tstate); + if (PyErr_Occurred()) return NULL; }{ +#if wxUSE_UNICODE + _resultobj = PyUnicode_FromUnicode(_result->c_str(), _result->Len()); +#else _resultobj = PyString_FromStringAndSize(_result->c_str(), _result->Len()); +#endif } { delete _result; @@ -360,7 +324,7 @@ static PyObject *_wrap_wxDllWidget_GetDllExt(PyObject *self, PyObject *args, PyO static PyMethodDef dllwidget_cMethods[] = { { "wxDllWidget_GetDllExt", (PyCFunction) _wrap_wxDllWidget_GetDllExt, METH_VARARGS | METH_KEYWORDS }, - { "wxDllWidget_GetEmbeddedWindow", (PyCFunction) _wrap_wxDllWidget_GetEmbeddedWindow, METH_VARARGS | METH_KEYWORDS }, + { "wxDllWidget_GetWidgetWindow", (PyCFunction) _wrap_wxDllWidget_GetWidgetWindow, METH_VARARGS | METH_KEYWORDS }, { "wxDllWidget_SendCommand", (PyCFunction) _wrap_wxDllWidget_SendCommand, METH_VARARGS | METH_KEYWORDS }, { "wxDllWidget_Ok", (PyCFunction) _wrap_wxDllWidget_Ok, METH_VARARGS | METH_KEYWORDS }, { "new_wxDllWidget", (PyCFunction) _wrap_new_wxDllWidget, METH_VARARGS | METH_KEYWORDS },