A fix for Python 2.2 which can sometimes call __wxCleanup before all
the other wxPython objects have been deleted. Other various things to match recent CVS changes in wx. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@14163 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
parent
a3215b22a3
commit
be43cc441a
@ -13,13 +13,17 @@ class TestPanel(wxPanel):
|
||||
'twelve', 'thirteen', 'fourteen']
|
||||
|
||||
wxStaticText(self, -1, "This example uses the wxCheckListBox control.",
|
||||
wxPoint(45, 15))
|
||||
(45, 15))
|
||||
|
||||
lb = wxCheckListBox(self, 60, wxPoint(80, 50), wxSize(80, 120),
|
||||
lb = wxCheckListBox(self, 60, (80, 50), (80, 120),
|
||||
sampleList)
|
||||
EVT_LISTBOX(self, 60, self.EvtListBox)
|
||||
EVT_LISTBOX_DCLICK(self, 60, self.EvtListBoxDClick)
|
||||
lb.SetSelection(0)
|
||||
self.lb = lb
|
||||
|
||||
btn = wxButton(self, -1, "Test SetString", (180, 50))
|
||||
EVT_BUTTON(self, btn.GetId(), self.OnTestButton)
|
||||
|
||||
EVT_RIGHT_UP(self, self.OnDoPopup)
|
||||
|
||||
@ -30,6 +34,10 @@ class TestPanel(wxPanel):
|
||||
def EvtListBoxDClick(self, event):
|
||||
self.log.WriteText('EvtListBoxDClick:\n')
|
||||
|
||||
def OnTestButton(self, evt):
|
||||
self.lb.SetString(4, "FUBAR")
|
||||
|
||||
|
||||
def OnDoPopup(self, evt):
|
||||
menu = wxMenu()
|
||||
# Make this first item bold
|
||||
|
@ -1000,6 +1000,7 @@ enum wxEventType {
|
||||
wxEVT_MENU_HIGHLIGHT,
|
||||
wxEVT_POPUP_MENU_INIT,
|
||||
wxEVT_SYS_COLOUR_CHANGED,
|
||||
wxEVT_DISPLAY_CHANGED,
|
||||
wxEVT_SETTING_CHANGED,
|
||||
wxEVT_QUERY_NEW_PALETTE,
|
||||
wxEVT_PALETTE_CHANGED,
|
||||
|
@ -98,6 +98,9 @@ def EVT_INIT_DIALOG(win, func):
|
||||
def EVT_SYS_COLOUR_CHANGED(win, func):
|
||||
win.Connect(-1, -1, wxEVT_SYS_COLOUR_CHANGED, func)
|
||||
|
||||
def EVT_DISPLAY_CHANGED(win, func):
|
||||
win.Connect(-1, -1, wxEVT_DISPLAY_CHANGED, func)
|
||||
|
||||
def EVT_SHOW(win, func):
|
||||
win.Connect(-1, -1, wxEVT_SHOW, func)
|
||||
|
||||
@ -772,13 +775,20 @@ class wxPyWidgetTester(wxApp):
|
||||
# unloaded, the refcount on __cleanMeUp goes to zero and it calls the
|
||||
# wxApp_CleanUp function.
|
||||
|
||||
class __wxPyCleanup:
|
||||
def __init__(self):
|
||||
self.cleanup = wxc.wxApp_CleanUp
|
||||
def __del__(self):
|
||||
self.cleanup()
|
||||
## class __wxPyCleanup:
|
||||
## def __init__(self):
|
||||
## self.cleanup = wxc.wxApp_CleanUp
|
||||
## def __del__(self):
|
||||
## self.cleanup()
|
||||
|
||||
## __cleanMeUp = __wxPyCleanup()
|
||||
|
||||
if sys.version[0] == '2':
|
||||
import atexit
|
||||
atexit.register(wxc.wxApp_CleanUp)
|
||||
else:
|
||||
sys.exitfunc = wxc.wxApp_CleanUp
|
||||
|
||||
__cleanMeUp = __wxPyCleanup()
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
#----------------------------------------------------------------------------
|
||||
|
@ -425,6 +425,15 @@ public:
|
||||
};
|
||||
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
class wxDisplayChangedEvent : public wxEvent
|
||||
{
|
||||
public:
|
||||
wxDisplayChangedEvent();
|
||||
};
|
||||
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
class wxPaletteChangedEvent : public wxEvent {
|
||||
|
@ -256,8 +256,8 @@ PyObject* __wxSetDictionary(PyObject* /* self */, PyObject* args)
|
||||
#ifdef __WXMOTIF__
|
||||
#define wxPlatform "__WXMOTIF__"
|
||||
#endif
|
||||
#ifdef __WXQT__
|
||||
#define wxPlatform "__WXQT__"
|
||||
#ifdef __WXX11__
|
||||
#define wxPlatform "__WXX11__"
|
||||
#endif
|
||||
#ifdef __WXGTK__
|
||||
#define wxPlatform "__WXGTK__"
|
||||
@ -450,9 +450,12 @@ unsigned long wxPyGetCurrentThreadId() {
|
||||
return wxThread::GetCurrentId();
|
||||
}
|
||||
|
||||
|
||||
static PyThreadState* gs_shutdownTState;
|
||||
static
|
||||
PyThreadState* wxPyGetThreadState() {
|
||||
if (wxPyTMutex == NULL) // Python is shutting down...
|
||||
return gs_shutdownTState;
|
||||
|
||||
unsigned long ctid = wxPyGetCurrentThreadId();
|
||||
PyThreadState* tstate = NULL;
|
||||
|
||||
@ -471,6 +474,10 @@ PyThreadState* wxPyGetThreadState() {
|
||||
|
||||
static
|
||||
void wxPySaveThreadState(PyThreadState* tstate) {
|
||||
if (wxPyTMutex == NULL) { // Python is shutting down, assume a single thread...
|
||||
gs_shutdownTState = tstate;
|
||||
return;
|
||||
}
|
||||
unsigned long ctid = wxPyGetCurrentThreadId();
|
||||
wxPyTMutex->Lock();
|
||||
for(size_t i=0; i < wxPyTStates->GetCount(); i++) {
|
||||
|
@ -6192,6 +6192,48 @@ static PyObject *_wrap_wxNotifyEvent_Veto(PyObject *self, PyObject *args, PyObje
|
||||
return _resultobj;
|
||||
}
|
||||
|
||||
static void *SwigwxDisplayChangedEventTowxEvent(void *ptr) {
|
||||
wxDisplayChangedEvent *src;
|
||||
wxEvent *dest;
|
||||
src = (wxDisplayChangedEvent *) ptr;
|
||||
dest = (wxEvent *) src;
|
||||
return (void *) dest;
|
||||
}
|
||||
|
||||
static void *SwigwxDisplayChangedEventTowxObject(void *ptr) {
|
||||
wxDisplayChangedEvent *src;
|
||||
wxObject *dest;
|
||||
src = (wxDisplayChangedEvent *) ptr;
|
||||
dest = (wxObject *) src;
|
||||
return (void *) dest;
|
||||
}
|
||||
|
||||
#define new_wxDisplayChangedEvent() (new wxDisplayChangedEvent())
|
||||
static PyObject *_wrap_new_wxDisplayChangedEvent(PyObject *self, PyObject *args, PyObject *kwargs) {
|
||||
PyObject * _resultobj;
|
||||
wxDisplayChangedEvent * _result;
|
||||
char *_kwnames[] = { NULL };
|
||||
char _ptemp[128];
|
||||
|
||||
self = self;
|
||||
if(!PyArg_ParseTupleAndKeywords(args,kwargs,":new_wxDisplayChangedEvent",_kwnames))
|
||||
return NULL;
|
||||
{
|
||||
PyThreadState* __tstate = wxPyBeginAllowThreads();
|
||||
_result = (wxDisplayChangedEvent *)new_wxDisplayChangedEvent();
|
||||
|
||||
wxPyEndAllowThreads(__tstate);
|
||||
if (PyErr_Occurred()) return NULL;
|
||||
} if (_result) {
|
||||
SWIG_MakePtr(_ptemp, (char *) _result,"_wxDisplayChangedEvent_p");
|
||||
_resultobj = Py_BuildValue("s",_ptemp);
|
||||
} else {
|
||||
Py_INCREF(Py_None);
|
||||
_resultobj = Py_None;
|
||||
}
|
||||
return _resultobj;
|
||||
}
|
||||
|
||||
static void *SwigwxPaletteChangedEventTowxEvent(void *ptr) {
|
||||
wxPaletteChangedEvent *src;
|
||||
wxEvent *dest;
|
||||
@ -7097,6 +7139,7 @@ static PyMethodDef eventscMethods[] = {
|
||||
{ "wxPaletteChangedEvent_GetChangedWindow", (PyCFunction) _wrap_wxPaletteChangedEvent_GetChangedWindow, METH_VARARGS | METH_KEYWORDS },
|
||||
{ "wxPaletteChangedEvent_SetChangedWindow", (PyCFunction) _wrap_wxPaletteChangedEvent_SetChangedWindow, METH_VARARGS | METH_KEYWORDS },
|
||||
{ "new_wxPaletteChangedEvent", (PyCFunction) _wrap_new_wxPaletteChangedEvent, METH_VARARGS | METH_KEYWORDS },
|
||||
{ "new_wxDisplayChangedEvent", (PyCFunction) _wrap_new_wxDisplayChangedEvent, METH_VARARGS | METH_KEYWORDS },
|
||||
{ "wxNotifyEvent_Veto", (PyCFunction) _wrap_wxNotifyEvent_Veto, METH_VARARGS | METH_KEYWORDS },
|
||||
{ "wxNotifyEvent_Allow", (PyCFunction) _wrap_wxNotifyEvent_Allow, METH_VARARGS | METH_KEYWORDS },
|
||||
{ "wxNotifyEvent_IsAllowed", (PyCFunction) _wrap_wxNotifyEvent_IsAllowed, METH_VARARGS | METH_KEYWORDS },
|
||||
@ -7306,6 +7349,7 @@ static struct { char *n1; char *n2; void *(*pcnv)(void *); } _swig_mapping[] = {
|
||||
{ "_wxEvent","_wxWindowCreateEvent",SwigwxWindowCreateEventTowxEvent},
|
||||
{ "_wxEvent","_wxQueryNewPaletteEvent",SwigwxQueryNewPaletteEventTowxEvent},
|
||||
{ "_wxEvent","_wxPaletteChangedEvent",SwigwxPaletteChangedEventTowxEvent},
|
||||
{ "_wxEvent","_wxDisplayChangedEvent",SwigwxDisplayChangedEventTowxEvent},
|
||||
{ "_wxEvent","_wxNotifyEvent",SwigwxNotifyEventTowxEvent},
|
||||
{ "_wxEvent","_wxSysColourChangedEvent",SwigwxSysColourChangedEventTowxEvent},
|
||||
{ "_wxEvent","_wxUpdateUIEvent",SwigwxUpdateUIEventTowxEvent},
|
||||
@ -7396,6 +7440,7 @@ static struct { char *n1; char *n2; void *(*pcnv)(void *); } _swig_mapping[] = {
|
||||
{ "_wxObject","_wxWindowCreateEvent",SwigwxWindowCreateEventTowxObject},
|
||||
{ "_wxObject","_wxQueryNewPaletteEvent",SwigwxQueryNewPaletteEventTowxObject},
|
||||
{ "_wxObject","_wxPaletteChangedEvent",SwigwxPaletteChangedEventTowxObject},
|
||||
{ "_wxObject","_wxDisplayChangedEvent",SwigwxDisplayChangedEventTowxObject},
|
||||
{ "_wxObject","_wxNotifyEvent",SwigwxNotifyEventTowxObject},
|
||||
{ "_wxObject","_wxSysColourChangedEvent",SwigwxSysColourChangedEventTowxObject},
|
||||
{ "_wxObject","_wxUpdateUIEvent",SwigwxUpdateUIEventTowxObject},
|
||||
|
@ -874,6 +874,20 @@ class wxNotifyEvent(wxNotifyEventPtr):
|
||||
|
||||
|
||||
|
||||
class wxDisplayChangedEventPtr(wxEventPtr):
|
||||
def __init__(self,this):
|
||||
self.this = this
|
||||
self.thisown = 0
|
||||
def __repr__(self):
|
||||
return "<C wxDisplayChangedEvent instance at %s>" % (self.this,)
|
||||
class wxDisplayChangedEvent(wxDisplayChangedEventPtr):
|
||||
def __init__(self,*_args,**_kwargs):
|
||||
self.this = apply(eventsc.new_wxDisplayChangedEvent,_args,_kwargs)
|
||||
self.thisown = 1
|
||||
|
||||
|
||||
|
||||
|
||||
class wxPaletteChangedEventPtr(wxEventPtr):
|
||||
def __init__(self,this):
|
||||
self.this = this
|
||||
|
@ -2627,6 +2627,7 @@ SWIGEXPORT(void) initwxc() {
|
||||
PyDict_SetItemString(d,"wxEVT_MENU_HIGHLIGHT", PyInt_FromLong((long) wxEVT_MENU_HIGHLIGHT));
|
||||
PyDict_SetItemString(d,"wxEVT_POPUP_MENU_INIT", PyInt_FromLong((long) wxEVT_POPUP_MENU_INIT));
|
||||
PyDict_SetItemString(d,"wxEVT_SYS_COLOUR_CHANGED", PyInt_FromLong((long) wxEVT_SYS_COLOUR_CHANGED));
|
||||
PyDict_SetItemString(d,"wxEVT_DISPLAY_CHANGED", PyInt_FromLong((long) wxEVT_DISPLAY_CHANGED));
|
||||
PyDict_SetItemString(d,"wxEVT_SETTING_CHANGED", PyInt_FromLong((long) wxEVT_SETTING_CHANGED));
|
||||
PyDict_SetItemString(d,"wxEVT_QUERY_NEW_PALETTE", PyInt_FromLong((long) wxEVT_QUERY_NEW_PALETTE));
|
||||
PyDict_SetItemString(d,"wxEVT_PALETTE_CHANGED", PyInt_FromLong((long) wxEVT_PALETTE_CHANGED));
|
||||
|
@ -859,6 +859,7 @@ wxEVT_MENU_INIT = wxc.wxEVT_MENU_INIT
|
||||
wxEVT_MENU_HIGHLIGHT = wxc.wxEVT_MENU_HIGHLIGHT
|
||||
wxEVT_POPUP_MENU_INIT = wxc.wxEVT_POPUP_MENU_INIT
|
||||
wxEVT_SYS_COLOUR_CHANGED = wxc.wxEVT_SYS_COLOUR_CHANGED
|
||||
wxEVT_DISPLAY_CHANGED = wxc.wxEVT_DISPLAY_CHANGED
|
||||
wxEVT_SETTING_CHANGED = wxc.wxEVT_SETTING_CHANGED
|
||||
wxEVT_QUERY_NEW_PALETTE = wxc.wxEVT_QUERY_NEW_PALETTE
|
||||
wxEVT_PALETTE_CHANGED = wxc.wxEVT_PALETTE_CHANGED
|
||||
@ -990,6 +991,9 @@ def EVT_INIT_DIALOG(win, func):
|
||||
def EVT_SYS_COLOUR_CHANGED(win, func):
|
||||
win.Connect(-1, -1, wxEVT_SYS_COLOUR_CHANGED, func)
|
||||
|
||||
def EVT_DISPLAY_CHANGED(win, func):
|
||||
win.Connect(-1, -1, wxEVT_DISPLAY_CHANGED, func)
|
||||
|
||||
def EVT_SHOW(win, func):
|
||||
win.Connect(-1, -1, wxEVT_SHOW, func)
|
||||
|
||||
@ -1664,13 +1668,20 @@ class wxPyWidgetTester(wxApp):
|
||||
# unloaded, the refcount on __cleanMeUp goes to zero and it calls the
|
||||
# wxApp_CleanUp function.
|
||||
|
||||
class __wxPyCleanup:
|
||||
def __init__(self):
|
||||
self.cleanup = wxc.wxApp_CleanUp
|
||||
def __del__(self):
|
||||
self.cleanup()
|
||||
## class __wxPyCleanup:
|
||||
## def __init__(self):
|
||||
## self.cleanup = wxc.wxApp_CleanUp
|
||||
## def __del__(self):
|
||||
## self.cleanup()
|
||||
|
||||
## __cleanMeUp = __wxPyCleanup()
|
||||
|
||||
if sys.version[0] == '2':
|
||||
import atexit
|
||||
atexit.register(wxc.wxApp_CleanUp)
|
||||
else:
|
||||
sys.exitfunc = wxc.wxApp_CleanUp
|
||||
|
||||
__cleanMeUp = __wxPyCleanup()
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
#----------------------------------------------------------------------------
|
||||
|
Loading…
Reference in New Issue
Block a user