X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/7cdaed0ba00e01b31fe236b270b8a209f3ac8921..e422162882bf4c5ae743fd618864e97206765fca:/wxPython/src/_extras.py diff --git a/wxPython/src/_extras.py b/wxPython/src/_extras.py index d90b2a39f9..5289d06a0e 100644 --- a/wxPython/src/_extras.py +++ b/wxPython/src/_extras.py @@ -131,6 +131,9 @@ def EVT_WINDOW_CREATE(win, func): def EVT_WINDOW_DESTROY(win, func): win.Connect(-1, -1, wxEVT_DESTROY, func) +def EVT_SET_CURSOR(win, func): + win.Connect(-1, -1, wxEVT_SET_CURSOR, func) + def EVT_IDLE(win, func): @@ -198,6 +201,9 @@ def EVT_MOUSE_EVENTS(win, func): win.Connect(-1, -1, wxEVT_LEAVE_WINDOW, func) win.Connect(-1, -1, wxEVT_ENTER_WINDOW, func) +def EVT_MOUSE_CAPTURE_CHANGED(win, func): + win.Connect(-1, -1, wxEVT_MOUSE_CAPTURE_CHANGED, func) + # EVT_COMMAND def EVT_COMMAND(win, id, cmd, func): win.Connect(id, -1, cmd, func) @@ -648,6 +654,29 @@ def wxPyTypeCast(obj, typeStr): #---------------------------------------------------------------------------- +_wxCallAfterId = None + +def wxCallAfter(callable, *args, **kw): + """ + Call the specified function after the current and pending event + handlers have been completed. + """ + app = wxGetApp() + assert app, 'No wxApp created yet' + + global _wxCallAfterId + if _wxCallAfterId is None: + _wxCallAfterId = wxNewId() + app.Connect(-1, -1, _wxCallAfterId, + lambda event: apply(event.callable, event.args, event.kw) ) + evt = wxPyEvent() + evt.SetEventType(_wxCallAfterId) + evt.callable = callable + evt.args = args + evt.kw = kw + wxPostEvent(app, evt) + +#---------------------------------------------------------------------- class wxPyDeadObjectError(AttributeError): pass @@ -659,7 +688,7 @@ class _wxPyDeadObject: prevent crashes due to referencing a bogus C++ pointer. """ reprStr = "wxPython wrapper for DELETED %s object! (The C++ object no longer exists.)" - attrStr = "The C++ %s object has been deleted, attribute access no longer allowed." + attrStr = "The C++ part of the %s object has been deleted, attribute access no longer allowed." def __repr__( self ): if not hasattr(self, "_name"): @@ -717,7 +746,7 @@ class wxPyOnDemandOutputWindow: self.frame.Close() -_defRedirect = (wxPlatform == '__WXMSW__') +_defRedirect = (wxPlatform == '__WXMSW__' or wxPlatform == '__WXMAC__') #---------------------------------------------------------------------- # The main application class. Derive from this and implement an OnInit