Control: reopen -1 Dear maintainer,
Testing a patch for mayavi2 (which I'll send in shortly), I found further changes are needed to python-traitsui. With the attached patch to python-traitsui, mayavi2 seems to work well. I've eschewed PushEventHandler() because it seems hard to ensure that the event handler reliably gets popped before the window/control is destroyed (and wx3.0's wxdebug assertions complain if it isn't popped). Instead I'm using Bind(), which is the preferred way to set up event handling dynamically since wx 2.9.0: http://docs.wxwidgets.org/trunk/overview_events.html Since this is essentially fixing a problem in my previous NMU, I'm intending to upload this in the near future, but I felt it was polite to give you a chance to comment on the patch. Cheers, Olly
diff -Nru python-traitsui-4.4.0/debian/changelog python-traitsui-4.4.0/debian/changelog --- python-traitsui-4.4.0/debian/changelog 2014-09-01 08:18:48.000000000 +1200 +++ python-traitsui-4.4.0/debian/changelog 2014-09-20 12:06:07.000000000 +1200 @@ -1,3 +1,10 @@ +python-traitsui (4.4.0-1.3) unstable; urgency=medium + + * Non-maintainer upload. + * Improve wxpython3.0.patch so mayavi2 works. + + -- Olly Betts <o...@survex.com> Sat, 20 Sep 2014 00:05:20 +0000 + python-traitsui (4.4.0-1.2) unstable; urgency=medium * Non-maintainer upload. diff -Nru python-traitsui-4.4.0/debian/patches/wxpython3.0.patch python-traitsui-4.4.0/debian/patches/wxpython3.0.patch --- python-traitsui-4.4.0/debian/patches/wxpython3.0.patch 2014-09-01 08:24:12.000000000 +1200 +++ python-traitsui-4.4.0/debian/patches/wxpython3.0.patch 2014-09-20 12:20:05.000000000 +1200 @@ -3,20 +3,93 @@ Author: Olly Betts <o...@survex.com> Bug-Debian: https://bugs.debian.org/758695 Forwarded: no -Last-Update: 2014-08-31 +Last-Update: 2014-09-20 Index: python-traitsui-4.4.0/traitsui/wx/helper.py =================================================================== --- python-traitsui-4.4.0.orig/traitsui/wx/helper.py +++ python-traitsui-4.4.0/traitsui/wx/helper.py -@@ -417,6 +417,10 @@ class TraitsUIScrolledPanel ( wx.lib.scr - # Override the C++ ChildFocus event handler: - ChildFocusOverride( self ) - -+ def __del__ ( self ): -+ while self is not self.GetEventHandler(): -+ self.PopEventHandler(True) -+ - def OnChildFocus ( self, event ): - """ Handle a ChildFocusEvent. +@@ -361,7 +361,7 @@ class TraitsUIPanel ( wx.Panel ): + # PyEvtHandler was only introduced in wxPython 2.8.8. Fortunately, it is only + # necessary in wxPython 2.8.8. +-if wx.__version__ < '2.8.8': ++if wx.__version__ < '2.8.8' or wx.__version__ >= '3.0.0': + + class ChildFocusOverride ( object ): + def __init__ ( self, window ): +Index: python-traitsui-4.4.0/traitsui/wx/toolkit.py +=================================================================== +--- python-traitsui-4.4.0.orig/traitsui/wx/toolkit.py ++++ python-traitsui-4.4.0/traitsui/wx/toolkit.py +@@ -66,20 +66,20 @@ from helper \ + #------------------------------------------------------------------------------- + + EventSuffix = { +- wx.wxEVT_LEFT_DOWN: 'left_down', +- wx.wxEVT_LEFT_DCLICK: 'left_dclick', +- wx.wxEVT_LEFT_UP: 'left_up', +- wx.wxEVT_MIDDLE_DOWN: 'middle_down', +- wx.wxEVT_MIDDLE_DCLICK: 'middle_dclick', +- wx.wxEVT_MIDDLE_UP: 'middle_up', +- wx.wxEVT_RIGHT_DOWN: 'right_down', +- wx.wxEVT_RIGHT_DCLICK: 'right_dclick', +- wx.wxEVT_RIGHT_UP: 'right_up', +- wx.wxEVT_MOTION: 'mouse_move', +- wx.wxEVT_ENTER_WINDOW: 'enter', +- wx.wxEVT_LEAVE_WINDOW: 'leave', +- wx.wxEVT_MOUSEWHEEL: 'mouse_wheel', +- wx.wxEVT_PAINT: 'paint', ++ wx.EVT_LEFT_DOWN: 'left_down', ++ wx.EVT_LEFT_DCLICK: 'left_dclick', ++ wx.EVT_LEFT_UP: 'left_up', ++ wx.EVT_MIDDLE_DOWN: 'middle_down', ++ wx.EVT_MIDDLE_DCLICK: 'middle_dclick', ++ wx.EVT_MIDDLE_UP: 'middle_up', ++ wx.EVT_RIGHT_DOWN: 'right_down', ++ wx.EVT_RIGHT_DCLICK: 'right_dclick', ++ wx.EVT_RIGHT_UP: 'right_up', ++ wx.EVT_MOTION: 'mouse_move', ++ wx.EVT_ENTER_WINDOW: 'enter', ++ wx.EVT_LEAVE_WINDOW: 'leave', ++ wx.EVT_MOUSEWHEEL: 'mouse_wheel', ++ wx.EVT_PAINT: 'paint', + } + + # Types of popup views: +@@ -394,28 +394,24 @@ class GUIToolkit ( Toolkit ): + """ + if events is None: + events = ( +- wx.wxEVT_LEFT_DOWN, wx.wxEVT_LEFT_DCLICK, wx.wxEVT_LEFT_UP, +- wx.wxEVT_MIDDLE_DOWN, wx.wxEVT_MIDDLE_DCLICK, wx.wxEVT_MIDDLE_UP, +- wx.wxEVT_RIGHT_DOWN, wx.wxEVT_RIGHT_DCLICK, wx.wxEVT_RIGHT_UP, +- wx.wxEVT_MOTION, wx.wxEVT_ENTER_WINDOW, wx.wxEVT_LEAVE_WINDOW, +- wx.wxEVT_MOUSEWHEEL, wx.wxEVT_PAINT ++ wx.EVT_LEFT_DOWN, wx.EVT_LEFT_DCLICK, wx.EVT_LEFT_UP, ++ wx.EVT_MIDDLE_DOWN, wx.EVT_MIDDLE_DCLICK, wx.EVT_MIDDLE_UP, ++ wx.EVT_RIGHT_DOWN, wx.EVT_RIGHT_DCLICK, wx.EVT_RIGHT_UP, ++ wx.EVT_MOTION, wx.EVT_ENTER_WINDOW, wx.EVT_LEAVE_WINDOW, ++ wx.EVT_MOUSEWHEEL, wx.EVT_PAINT + ) + control.SetDropTarget( PythonDropTarget( + DragHandler( ui = ui, control = control ) ) ) + elif events == 'keys': +- events = ( wx.wxEVT_CHAR, ) ++ events = ( wx.EVT_CHAR, ) + + if handler is None: + handler = ui.route_event + + id = control.GetId() +- event_handler = wx.EvtHandler() +- connect = event_handler.Connect + + for event in events: +- connect( id, id, event, handler ) +- +- control.PushEventHandler( event_handler ) ++ control.Bind( event, handler, control, id, id ) + + for child in control.GetChildren(): + self.hook_events( ui, child, events, handler, drop_target )