X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/606d919c51d0e5fe7492182bab9ad3c69d82af5f..3979290c611fa74cb3e64ab09e3b5b35160c082f:/wxPython/src/_extras.py diff --git a/wxPython/src/_extras.py b/wxPython/src/_extras.py index b3f9e52b3f..0e72a395d9 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): @@ -211,14 +214,15 @@ def EVT_COMMAND_RANGE(win, id1, id2, cmd, func): # Scrolling def EVT_SCROLL(win, func): - win.Connect(-1, -1, wxEVT_SCROLL_TOP, func) - win.Connect(-1, -1, wxEVT_SCROLL_BOTTOM, func) - win.Connect(-1, -1, wxEVT_SCROLL_LINEUP, func) - win.Connect(-1, -1, wxEVT_SCROLL_LINEDOWN, func) - win.Connect(-1, -1, wxEVT_SCROLL_PAGEUP, func) - win.Connect(-1, -1, wxEVT_SCROLL_PAGEDOWN, func) - win.Connect(-1, -1, wxEVT_SCROLL_THUMBTRACK,func) + win.Connect(-1, -1, wxEVT_SCROLL_TOP, func) + win.Connect(-1, -1, wxEVT_SCROLL_BOTTOM, func) + win.Connect(-1, -1, wxEVT_SCROLL_LINEUP, func) + win.Connect(-1, -1, wxEVT_SCROLL_LINEDOWN, func) + win.Connect(-1, -1, wxEVT_SCROLL_PAGEUP, func) + win.Connect(-1, -1, wxEVT_SCROLL_PAGEDOWN, func) + win.Connect(-1, -1, wxEVT_SCROLL_THUMBTRACK, func) win.Connect(-1, -1, wxEVT_SCROLL_THUMBRELEASE,func) + win.Connect(-1, -1, wxEVT_SCROLL_ENDSCROLL, func) def EVT_SCROLL_TOP(win, func): win.Connect(-1, -1, wxEVT_SCROLL_TOP, func) @@ -244,6 +248,9 @@ def EVT_SCROLL_THUMBTRACK(win, func): def EVT_SCROLL_THUMBRELEASE(win, func): win.Connect(-1, -1, wxEVT_SCROLL_THUMBRELEASE, func) +def EVT_SCROLL_ENDSCROLL(win, func): + win.Connect(-1, -1, wxEVT_SCROLL_ENDSCROLL, func) + # Scrolling, with an id @@ -256,6 +263,7 @@ def EVT_COMMAND_SCROLL(win, id, func): win.Connect(id, -1, wxEVT_SCROLL_PAGEDOWN, func) win.Connect(id, -1, wxEVT_SCROLL_THUMBTRACK,func) win.Connect(id, -1, wxEVT_SCROLL_THUMBRELEASE,func) + win.Connect(-1, -1, wxEVT_SCROLL_ENDSCROLL, func) def EVT_COMMAND_SCROLL_TOP(win, id, func): win.Connect(id, -1, wxEVT_SCROLL_TOP, func) @@ -281,6 +289,9 @@ def EVT_COMMAND_SCROLL_THUMBTRACK(win, id, func): def EVT_COMMAND_SCROLL_THUMBRELEASE(win, id, func): win.Connect(id, -1, wxEVT_SCROLL_THUMBRELEASE, func) +def EVT_COMMAND_SCROLL_ENDSCROLL(win, id, func): + win.Connect(id, -1, wxEVT_SCROLL_ENDSCROLL, func) + #--- def EVT_SCROLLWIN(win, func): win.Connect(-1, -1, wxEVT_SCROLLWIN_TOP, func) @@ -651,6 +662,30 @@ 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. This is also good for making GUI + method calls from non-GUI threads. + """ + 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 @@ -776,6 +811,7 @@ class wxPySimpleApp(wxApp): def __init__(self, flag=0): wxApp.__init__(self, flag) def OnInit(self): + wxInitAllImageHandlers() return true