-#endif
-
- // Ensure that the build options in the DLL (or whatever) match this build
- wxApp::CheckBuildOptions(wxBuildOptions());
-
- // Create an exception object to use for wxASSERTions
- wxPyAssertionError = PyErr_NewException("wxPython.wxc.wxPyAssertionError",
- PyExc_AssertionError, NULL);
- PyDict_SetItemString(moduleDict, "wxPyAssertionError", wxPyAssertionError);
-}
-
-
-
-// Initialize wxWindows and bootstrap the user application by calling the
-// wxApp's OnInit, which is a parameter to this funciton. See wxApp.__init__
-// in _extras.py to learn how the bootstrap is started.
-PyObject* __wxStart(PyObject* /* self */, PyObject* args)
-{
- PyObject* onInitFunc = NULL;
- PyObject* arglist= NULL;
- PyObject* result = NULL;
- PyObject* pyint = NULL;
- long bResult;
-
- if (!PyArg_ParseTuple(args, "O", &onInitFunc))
- return NULL;
-
- // Get any command-line args passed to this program from the sys module
- int argc = 0;
- char** argv = NULL;
- PyObject* sysargv = PySys_GetObject("argv");
- if (sysargv != NULL) {
- argc = PyList_Size(sysargv);
- argv = new char*[argc+1];
- int x;
- for(x=0; x<argc; x++) {
- PyObject *pyArg = PyList_GetItem(sysargv, x);
- argv[x] = PyString_AsString(pyArg);
- }
- argv[argc] = NULL;
- }
-
- if (! wxEntryStart(argc, argv) ) {
- PyErr_SetString(PyExc_SystemError, // is this the right one?
- "wxEntryStart failed!");
- goto error;
- }
- delete [] argv;
-
-
- // The stock objects were all NULL when they were loaded into
- // SWIG generated proxies, so re-init those now...
- wxPy_ReinitStockObjects();
-
-
- // Call the Python wxApp's OnInit function
- arglist = PyTuple_New(0);
- result = PyEval_CallObject(onInitFunc, arglist);
- Py_DECREF(arglist);
- if (!result) { // an exception was raised.
- return NULL;
- }
-
- pyint = PyNumber_Int(result);
- if (! pyint) {
- PyErr_SetString(PyExc_TypeError, "OnInit should return a boolean value");
- goto error;
- }
- bResult = PyInt_AS_LONG(pyint);
- if (! bResult) {
- PyErr_SetString(PyExc_SystemExit, "OnInit returned FALSE, exiting...");
- goto error;
- }