Commit Graph

20 Commits

Author SHA1 Message Date
Scott Talbert
d8c8e9e4c7 Implement wrapping for wx.ThreadEvent
Fixes #2338.
2023-02-04 20:41:53 -05:00
Scott Talbert
b143cff821 Fix unbinding of events in FIFO order
When binding events to multiple methods and then unbinding them later,
in the same order they were bound, the wrong method would get unbound.

For example:
    self.btn.Bind(wx.EVT_BUTTON, self.onButton1)
    self.btn.Bind(wx.EVT_BUTTON, self.onButton1)
followed by:
    self.btn.Unbind(wx.EVT_BUTTON, handler=self.onButton2)
    self.btn.Unbind(wx.EVT_BUTTON, handler=self.onButton1)
works, but the reverse fails:
    self.btn.Unbind(wx.EVT_BUTTON, handler=self.onButton1)
    self.btn.Unbind(wx.EVT_BUTTON, handler=self.onButton2)

The reason is that the wxPython Disconnect() method called the wxWidgets
Disconnect() method with the userData parameter set to NULL.  In this
case, wxWidgets performs no filtering based on the userData parameter
and this could result in the wrong handler getting disconnected.

Fix this by setting the userData to a known value before calling
wxWidgets Disconnect() method so that it will disconnect the correct
handler.

This commit also adds a test that verifies the fix.

Fixes #2027.
2021-11-17 19:28:54 -05:00
Stefan Brüns
0168c425ec Do not try to manually create a wx.PaintEvent
Since wxWidgets 3.1.4, manually creating a wxPaintEvent is no longer
possible, also see commit 3761507882 ("wxObjectDataPtr, wxGridCell*Ptr,
and other changes needed for updated wxWidgets").
2020-10-01 01:52:34 +02:00
jensgoe
8c3f231b0c added unittests for setters
(cherry picked from commit 216b9a824b)
2019-12-18 18:15:16 -08:00
Robin Dunn
0ffd220385 Fix our wxEvtHandler::Disconnect replacement
* Fix C++ compare of the handler functor
 * Use PyObject_RichCompare to check for matching python handlers
2017-11-21 18:34:59 -08:00
Robin Dunn
99c7e500b1 Fix the [G|S]etClientData methods in wx.CommandEvent
to be tweaked the same way they are in wx.ClientDataContainer, and add a ClientData property for each class. Update the unittests accordingly.
2017-04-24 10:19:35 -07:00
Metallicow
9568103974 Trim trailing space unittests directory 2016-12-05 16:19:11 -06:00
Scott Talbert
127b8dba9b Fix crash when running event tests
HelpEvent requires a wx.App to exist, at least on GTK as it ultimately fetches
the root window.
2016-08-07 10:18:14 -04:00
Robin Dunn
4f38ee259d Remove imp_unittest 2016-05-07 19:16:28 -07:00
Robin Dunn
b3d579ed37 use correct variable name 2015-12-23 17:29:09 -08:00
Robin Dunn
695412a701 KeyEvent.GetUnicodeKey should return an integer, not a str/unicode object. 2015-04-15 09:53:40 -07:00
Robin Dunn
1641a77b85 Testcase for trying to invoke wx.EvtHandler.__init__ with keyword args
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxPython/Phoenix/trunk@73699 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2013-03-22 01:29:14 +00:00
Robin Dunn
23dba89106 Ensure that wx.EVT_CATEGORY enum items exist
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxPython/Phoenix/trunk@70559 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2012-02-10 18:58:36 +00:00
Robin Dunn
25c3e80700 new unittests
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxPython/Phoenix/trunk@69341 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2011-10-09 07:47:33 +00:00
Robin Dunn
a548f7224d unittest updates and new test modules
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxPython/Phoenix/trunk@69095 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2011-09-15 16:16:21 +00:00
Robin Dunn
5e89a9606d Change the package name from wxPhoenix to wx
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxPython/Phoenix/trunk@68979 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2011-09-03 02:39:18 +00:00
Robin Dunn
68542755de Uncommented CallAfter() and test it
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxPython/Phoenix/trunk@66464 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2010-12-27 18:58:39 +00:00
Robin Dunn
212f1ff9f0 Gobs and gobs of changes, and tons of progress made. Can now create a wx.App, show a wx.Frame, run the MainLoop, bind event handlers and dispatch the events to the handler! YeeHa!
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxPython/Phoenix/trunk@66393 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2010-12-17 08:08:24 +00:00
Robin Dunn
96717983ad A boatload of changes and additions, all my Phoenix work for the past few days. Lots of lower level classes are wrapped, wxApp is working up through OnInit, plus there's a good start on some unit tests.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxPython/Phoenix/trunk@66272 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2010-11-27 08:53:17 +00:00
Robin Dunn
f765afe0c3 Deal with the pure-virtual nature of wxEvent::Clone, SIP needs to see that it i implemented in derved classes. Add some unittests for the event classes.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxPython/Phoenix/trunk@66211 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2010-11-19 08:03:01 +00:00