File: wxpython3.0.patch

package info (click to toggle)
python-traitsui 4.4.0-1.3
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 3,680 kB
  • ctags: 6,394
  • sloc: python: 32,786; makefile: 16; sh: 5
file content (95 lines) | stat: -rw-r--r-- 3,927 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
Description: Improve wxPython 3.0 compatibility
 Fixes an assertion due to not having popped an event handler.
Author: Olly Betts <olly@survex.com>
Bug-Debian: https://bugs.debian.org/758695
Forwarded: no
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
@@ -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 )