// Licence: wxWindows license
/////////////////////////////////////////////////////////////////////////////
-#include <stdio.h> // get the correct definition of NULL
#undef DEBUG
#include <Python.h>
#include <wx/gtk/win_gtk.h>
#endif
-
//----------------------------------------------------------------------
#if PYTHON_API_VERSION <= 1007 && wxUSE_UNICODE
wxPyApp::wxPyApp() {
-// printf("**** ctor\n");
+ SetUseBestVisual(TRUE);
}
wxPyApp::~wxPyApp() {
-// printf("**** dtor\n");
}
#endif
if (initialized) {
+ if ( m_exitOnFrameDelete == Later ) {
+ m_exitOnFrameDelete = Yes;
+ }
+
retval = wxApp::MainLoop();
OnExit();
}
wxPyTMutex = new wxMutex;
#endif
+ wxApp::CheckBuildOptions(wxBuildOptions());
+
// Bail out if there is already a wxApp created. This means that the
// toolkit has already been initialized, as in embedding wxPython in
// a C++ wxWindows app, so we don't need to call wxEntryStart.
if (!PyArg_ParseTuple(args, "O", &onInitFunc))
return NULL;
-#if 0 // Try it out without this check, see how it does...
- if (wxTopLevelWindows.Number() > 0) {
- PyErr_SetString(PyExc_TypeError, "Only 1 wxApp per process!");
- return NULL;
- }
-#endif
-
// This is the next part of the wxEntry functionality...
int argc = 0;
wxChar** argv = NULL;
#define wxPlatform "__WXMAC__"
#endif
+#ifdef __WXDEBUG__
+ int wxdebug = 1;
+#else
+ int wxdebug = 0;
+#endif
+
PyDict_SetItemString(wxPython_dict, "wxPlatform", PyString_FromString(wxPlatform));
PyDict_SetItemString(wxPython_dict, "wxUSE_UNICODE", PyInt_FromLong(wxUSE_UNICODE));
+ PyDict_SetItemString(wxPython_dict, "__WXDEBUG__", PyInt_FromLong(wxdebug));
Py_INCREF(Py_None);
return Py_None;
for(size_t i=0; i < wxPyTStates->GetCount(); i++) {
wxPyThreadState& info = wxPyTStates->Item(i);
if (info.tid == ctid) {
- info.tstate = tstate;
+#if 0
+ if (info.tstate != tstate)
+ wxLogMessage("*** tstate mismatch!???");
+#endif
+ // info.tstate = tstate; *** DO NOT update existing ones???
+ // Normally it will never change, but apparently COM callbacks
+ // (i.e. ActiveX controls) will (incorrectly IMHO) use a transient
+ // tstate which will then be garbage the next time we try to use
+ // it...
wxPyTMutex->Unlock();
return;
}
void wxPyEndBlockThreads() {
#ifdef WXP_WITH_THREAD
- PyThreadState* tstate = PyEval_SaveThread();
// Is there any need to save it again?
+ // PyThreadState* tstate =
+ PyEval_SaveThread();
#endif
}
return new wxPyCBInputStream(read, seek, tell, block);
}
+
+wxPyCBInputStream* wxPyCBInputStream_create(PyObject *py, bool block) {
+ return wxPyCBInputStream::create(py, block);
+}
+
PyObject* wxPyCBInputStream::getMethod(PyObject* py, char* name) {
if (!PyObject_HasAttrString(py, name))
return NULL;