wxASSERT and others are converted to Python Exceptions.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_4_BRANCH@17446 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -1022,6 +1022,44 @@ static PyObject *_wrap_delete_wxPyApp(PyObject *self, PyObject *args, PyObject *
|
||||
return _resultobj;
|
||||
}
|
||||
|
||||
#define wxPyApp__setCallbackInfo(_swigobj,_swigarg0,_swigarg1) (_swigobj->_setCallbackInfo(_swigarg0,_swigarg1))
|
||||
static PyObject *_wrap_wxPyApp__setCallbackInfo(PyObject *self, PyObject *args, PyObject *kwargs) {
|
||||
PyObject * _resultobj;
|
||||
wxPyApp * _arg0;
|
||||
PyObject * _arg1;
|
||||
PyObject * _arg2;
|
||||
PyObject * _argo0 = 0;
|
||||
PyObject * _obj1 = 0;
|
||||
PyObject * _obj2 = 0;
|
||||
char *_kwnames[] = { "self","self","_class", NULL };
|
||||
|
||||
self = self;
|
||||
if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OOO:wxPyApp__setCallbackInfo",_kwnames,&_argo0,&_obj1,&_obj2))
|
||||
return NULL;
|
||||
if (_argo0) {
|
||||
if (_argo0 == Py_None) { _arg0 = NULL; }
|
||||
else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxPyApp_p")) {
|
||||
PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxPyApp__setCallbackInfo. Expected _wxPyApp_p.");
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
{
|
||||
_arg1 = _obj1;
|
||||
}
|
||||
{
|
||||
_arg2 = _obj2;
|
||||
}
|
||||
{
|
||||
PyThreadState* __tstate = wxPyBeginAllowThreads();
|
||||
wxPyApp__setCallbackInfo(_arg0,_arg1,_arg2);
|
||||
|
||||
wxPyEndAllowThreads(__tstate);
|
||||
if (PyErr_Occurred()) return NULL;
|
||||
} Py_INCREF(Py_None);
|
||||
_resultobj = Py_None;
|
||||
return _resultobj;
|
||||
}
|
||||
|
||||
#define wxPyApp_GetAppName(_swigobj) (_swigobj->GetAppName())
|
||||
static PyObject *_wrap_wxPyApp_GetAppName(PyObject *self, PyObject *args, PyObject *kwargs) {
|
||||
PyObject * _resultobj;
|
||||
@@ -1748,7 +1786,66 @@ static PyObject *_wrap_wxPyApp_SetUseBestVisual(PyObject *self, PyObject *args,
|
||||
return _resultobj;
|
||||
}
|
||||
|
||||
#define wxPyApp_GetAssertMode(_swigobj) (_swigobj->GetAssertMode())
|
||||
static PyObject *_wrap_wxPyApp_GetAssertMode(PyObject *self, PyObject *args, PyObject *kwargs) {
|
||||
PyObject * _resultobj;
|
||||
int _result;
|
||||
wxPyApp * _arg0;
|
||||
PyObject * _argo0 = 0;
|
||||
char *_kwnames[] = { "self", NULL };
|
||||
|
||||
self = self;
|
||||
if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxPyApp_GetAssertMode",_kwnames,&_argo0))
|
||||
return NULL;
|
||||
if (_argo0) {
|
||||
if (_argo0 == Py_None) { _arg0 = NULL; }
|
||||
else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxPyApp_p")) {
|
||||
PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxPyApp_GetAssertMode. Expected _wxPyApp_p.");
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
{
|
||||
PyThreadState* __tstate = wxPyBeginAllowThreads();
|
||||
_result = (int )wxPyApp_GetAssertMode(_arg0);
|
||||
|
||||
wxPyEndAllowThreads(__tstate);
|
||||
if (PyErr_Occurred()) return NULL;
|
||||
} _resultobj = Py_BuildValue("i",_result);
|
||||
return _resultobj;
|
||||
}
|
||||
|
||||
#define wxPyApp_SetAssertMode(_swigobj,_swigarg0) (_swigobj->SetAssertMode(_swigarg0))
|
||||
static PyObject *_wrap_wxPyApp_SetAssertMode(PyObject *self, PyObject *args, PyObject *kwargs) {
|
||||
PyObject * _resultobj;
|
||||
wxPyApp * _arg0;
|
||||
int _arg1;
|
||||
PyObject * _argo0 = 0;
|
||||
char *_kwnames[] = { "self","mode", NULL };
|
||||
|
||||
self = self;
|
||||
if(!PyArg_ParseTupleAndKeywords(args,kwargs,"Oi:wxPyApp_SetAssertMode",_kwnames,&_argo0,&_arg1))
|
||||
return NULL;
|
||||
if (_argo0) {
|
||||
if (_argo0 == Py_None) { _arg0 = NULL; }
|
||||
else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxPyApp_p")) {
|
||||
PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxPyApp_SetAssertMode. Expected _wxPyApp_p.");
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
{
|
||||
PyThreadState* __tstate = wxPyBeginAllowThreads();
|
||||
wxPyApp_SetAssertMode(_arg0,_arg1);
|
||||
|
||||
wxPyEndAllowThreads(__tstate);
|
||||
if (PyErr_Occurred()) return NULL;
|
||||
} Py_INCREF(Py_None);
|
||||
_resultobj = Py_None;
|
||||
return _resultobj;
|
||||
}
|
||||
|
||||
static PyMethodDef wxcMethods[] = {
|
||||
{ "wxPyApp_SetAssertMode", (PyCFunction) _wrap_wxPyApp_SetAssertMode, METH_VARARGS | METH_KEYWORDS },
|
||||
{ "wxPyApp_GetAssertMode", (PyCFunction) _wrap_wxPyApp_GetAssertMode, METH_VARARGS | METH_KEYWORDS },
|
||||
{ "wxPyApp_SetUseBestVisual", (PyCFunction) _wrap_wxPyApp_SetUseBestVisual, METH_VARARGS | METH_KEYWORDS },
|
||||
{ "wxPyApp_SetVendorName", (PyCFunction) _wrap_wxPyApp_SetVendorName, METH_VARARGS | METH_KEYWORDS },
|
||||
{ "wxPyApp_SetTopWindow", (PyCFunction) _wrap_wxPyApp_SetTopWindow, METH_VARARGS | METH_KEYWORDS },
|
||||
@@ -1772,6 +1869,7 @@ static PyMethodDef wxcMethods[] = {
|
||||
{ "wxPyApp_GetClassName", (PyCFunction) _wrap_wxPyApp_GetClassName, METH_VARARGS | METH_KEYWORDS },
|
||||
{ "wxPyApp_GetAuto3D", (PyCFunction) _wrap_wxPyApp_GetAuto3D, METH_VARARGS | METH_KEYWORDS },
|
||||
{ "wxPyApp_GetAppName", (PyCFunction) _wrap_wxPyApp_GetAppName, METH_VARARGS | METH_KEYWORDS },
|
||||
{ "wxPyApp__setCallbackInfo", (PyCFunction) _wrap_wxPyApp__setCallbackInfo, METH_VARARGS | METH_KEYWORDS },
|
||||
{ "delete_wxPyApp", (PyCFunction) _wrap_delete_wxPyApp, METH_VARARGS | METH_KEYWORDS },
|
||||
{ "new_wxPyApp", (PyCFunction) _wrap_new_wxPyApp, METH_VARARGS | METH_KEYWORDS },
|
||||
{ "wxApp_CleanUp", (PyCFunction) _wrap_wxApp_CleanUp, METH_VARARGS | METH_KEYWORDS },
|
||||
@@ -2672,6 +2770,9 @@ SWIGEXPORT(void) initwxc() {
|
||||
PyDict_SetItemString(d,"cvar", SWIG_globals);
|
||||
SWIG_addvarlink(SWIG_globals,"wxDefaultPosition",_wrap_wxDefaultPosition_get, _wrap_wxDefaultPosition_set);
|
||||
SWIG_addvarlink(SWIG_globals,"wxDefaultSize",_wrap_wxDefaultSize_get, _wrap_wxDefaultSize_set);
|
||||
PyDict_SetItemString(d,"wxPYAPP_ASSERT_SUPPRESS", PyInt_FromLong((long) wxPYAPP_ASSERT_SUPPRESS));
|
||||
PyDict_SetItemString(d,"wxPYAPP_ASSERT_EXCEPTION", PyInt_FromLong((long) wxPYAPP_ASSERT_EXCEPTION));
|
||||
PyDict_SetItemString(d,"wxPYAPP_ASSERT_DIALOG", PyInt_FromLong((long) wxPYAPP_ASSERT_DIALOG));
|
||||
|
||||
// Make our API structure a CObject so other modules can import it
|
||||
// from this module.
|
||||
@@ -2680,7 +2781,7 @@ SWIGEXPORT(void) initwxc() {
|
||||
Py_XDECREF(v);
|
||||
|
||||
|
||||
__wxPreStart(); // initialize the GUI toolkit, if needed.
|
||||
__wxPreStart(d); // initialize the GUI toolkit, if needed.
|
||||
|
||||
|
||||
// Since these modules are all linked together, initialize them now
|
||||
|
@@ -49,6 +49,9 @@ class wxPyAppPtr(wxEvtHandlerPtr):
|
||||
def __del__(self,wxc=wxc):
|
||||
if self.thisown == 1 :
|
||||
wxc.delete_wxPyApp(self)
|
||||
def _setCallbackInfo(self, *_args, **_kwargs):
|
||||
val = apply(wxc.wxPyApp__setCallbackInfo,(self,) + _args, _kwargs)
|
||||
return val
|
||||
def GetAppName(self, *_args, **_kwargs):
|
||||
val = apply(wxc.wxPyApp_GetAppName,(self,) + _args, _kwargs)
|
||||
return val
|
||||
@@ -118,12 +121,20 @@ class wxPyAppPtr(wxEvtHandlerPtr):
|
||||
def SetUseBestVisual(self, *_args, **_kwargs):
|
||||
val = apply(wxc.wxPyApp_SetUseBestVisual,(self,) + _args, _kwargs)
|
||||
return val
|
||||
def GetAssertMode(self, *_args, **_kwargs):
|
||||
val = apply(wxc.wxPyApp_GetAssertMode,(self,) + _args, _kwargs)
|
||||
return val
|
||||
def SetAssertMode(self, *_args, **_kwargs):
|
||||
val = apply(wxc.wxPyApp_SetAssertMode,(self,) + _args, _kwargs)
|
||||
return val
|
||||
def __repr__(self):
|
||||
return "<C wxPyApp instance at %s>" % (self.this,)
|
||||
class wxPyApp(wxPyAppPtr):
|
||||
def __init__(self,*_args,**_kwargs):
|
||||
self.this = apply(wxc.new_wxPyApp,_args,_kwargs)
|
||||
self.thisown = 1
|
||||
self._setCallbackInfo(self, wxPyApp)
|
||||
self._setOORInfo(self)
|
||||
|
||||
|
||||
|
||||
@@ -926,6 +937,9 @@ __version__ = wxc.__version__
|
||||
cvar = wxc.cvar
|
||||
wxDefaultPosition = wxPointPtr(wxc.cvar.wxDefaultPosition)
|
||||
wxDefaultSize = wxSizePtr(wxc.cvar.wxDefaultSize)
|
||||
wxPYAPP_ASSERT_SUPPRESS = wxc.wxPYAPP_ASSERT_SUPPRESS
|
||||
wxPYAPP_ASSERT_EXCEPTION = wxc.wxPYAPP_ASSERT_EXCEPTION
|
||||
wxPYAPP_ASSERT_DIALOG = wxc.wxPYAPP_ASSERT_DIALOG
|
||||
|
||||
|
||||
#-------------- USER INCLUDE -----------------------
|
||||
@@ -1530,6 +1544,9 @@ wxSystemSettings_GetSystemColour = wxSystemSettings_GetColour
|
||||
wxSystemSettings_GetSystemFont = wxSystemSettings_GetFont
|
||||
wxSystemSettings_GetSystemMetric = wxSystemSettings_GetMetric
|
||||
|
||||
|
||||
wxPyAssertionError = wxc.wxPyAssertionError
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
# wxGTK sets the locale when initialized. Doing this at the Python
|
||||
# level should set it up to match what GTK is doing at the C level.
|
||||
@@ -1540,8 +1557,6 @@ if wxPlatform == "__WXGTK__":
|
||||
except:
|
||||
pass
|
||||
|
||||
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
# wxWindows version numbers. wxPython version is in __version__.
|
||||
|
||||
@@ -1707,6 +1722,7 @@ class wxApp(wxPyApp):
|
||||
|
||||
if redirect:
|
||||
self.RedirectStdio(filename)
|
||||
|
||||
# this initializes wxWindows and then calls our OnInit
|
||||
_wxStart(self.OnInit)
|
||||
|
||||
@@ -1733,7 +1749,7 @@ class wxApp(wxPyApp):
|
||||
if filename:
|
||||
sys.stdout = sys.stderr = open(filename, 'a')
|
||||
else:
|
||||
self.stdioWin = self.outputWindowClass() # wxPyOnDemandOutputWindow
|
||||
self.stdioWin = self.outputWindowClass()
|
||||
sys.stdout = sys.stderr = self.stdioWin
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user