fix deprecation warnings about accessing properties m_x, m_y of wxKeyEvent
authorAndrey Skvortsov <andrej.skvortzov@gmail.com>
Thu, 21 Apr 2016 20:42:37 +0300
changeset 1498 b11045a2f17c
parent 1497 7330c85534ea
child 1499 8626bba4b2a8
fix deprecation warnings about accessing properties m_x, m_y of wxKeyEvent

/home/beremiz/beremiz/controls/PouInstanceVariablesPanel.py:354: wxPyDeprecationWarning: Accessing deprecated property.
event.m_x = size.width / 2
controls/PouInstanceVariablesPanel.py
controls/TextCtrlAutoComplete.py
editors/Viewer.py
--- a/controls/PouInstanceVariablesPanel.py	Thu Apr 21 19:14:28 2016 +0300
+++ b/controls/PouInstanceVariablesPanel.py	Thu Apr 21 20:42:37 2016 +0300
@@ -350,8 +350,8 @@
         self.InstanceChoice.SetFocusFromKbd()
         size = self.InstanceChoice.GetSize()
         event = wx.MouseEvent(wx.EVT_LEFT_DOWN._getEvtType())
-        event.m_x = size.width / 2
-        event.m_y = size.height / 2
+        event.x = size.width / 2
+        event.y = size.height / 2
         event.SetEventObject(self.InstanceChoice)
         #event = wx.KeyEvent(wx.EVT_KEY_DOWN._getEvtType())
         #event.m_keyCode = wx.WXK_SPACE
--- a/controls/TextCtrlAutoComplete.py	Thu Apr 21 19:14:28 2016 +0300
+++ b/controls/TextCtrlAutoComplete.py	Thu Apr 21 20:42:37 2016 +0300
@@ -87,13 +87,13 @@
         return self.ListBox.GetStringSelection()
     
     def OnLeftDown(self, event):
-        selected = self.ListBox.HitTest(wx.Point(event.m_x, event.m_y))
+        selected = self.ListBox.HitTest(wx.Point(event.GetX(), event.GetY()))
         parent_size = self.Parent.GetSize()
         parent_rect = wx.Rect(0, -parent_size[1], parent_size[0], parent_size[1])
         if selected != wx.NOT_FOUND:
             wx.CallAfter(self.Parent.SetValueFromSelected, self.ListBox.GetString(selected))
-        elif parent_rect.InsideXY(event.m_x, event.m_y):
-            result, x, y = self.Parent.HitTest(wx.Point(event.m_x, event.m_y + parent_size[1]))
+        elif parent_rect.InsideXY(event.GetX(), event.GetY()):
+            result, x, y = self.Parent.HitTest(wx.Point(event.GetX(), event.GetY() + parent_size[1]))
             if result != wx.TE_HT_UNKNOWN:
                 self.Parent.SetInsertionPoint(self.Parent.XYToPosition(x, y))
         else:
@@ -102,7 +102,7 @@
     
     def OnMotion(self, event):
         self.ListBox.SetSelection(
-            self.ListBox.HitTest(wx.Point(event.m_x, event.m_y)))
+            self.ListBox.HitTest(wx.Point(event.GetX(), event.GetY())))
         event.Skip()
     
 class TextCtrlAutoComplete(wx.TextCtrl):
--- a/editors/Viewer.py	Thu Apr 21 19:14:28 2016 +0300
+++ b/editors/Viewer.py	Thu Apr 21 20:42:37 2016 +0300
@@ -757,8 +757,8 @@
                     client_size = self.Editor.GetClientSize()
                     mouse_pos = wx.Point(client_size[0] / 2, client_size[1] / 2)
                     mouse_event = wx.MouseEvent(wx.EVT_MOUSEWHEEL.typeId)
-                    mouse_event.m_x = mouse_pos.x
-                    mouse_event.m_y = mouse_pos.y
+                    mouse_event.x = mouse_pos.x
+                    mouse_event.y = mouse_pos.y
                 else:
                     mouse_pos = mouse_event.GetPosition()
                 pos = mouse_event.GetLogicalPosition(dc)
@@ -2398,7 +2398,7 @@
             if self.IsBlock(self.SelectedElement) or self.IsComment(self.SelectedElement):
                 block = self.CopyBlock(self.SelectedElement, wx.Point(*self.SelectedElement.GetPosition()))
                 event = wx.MouseEvent()
-                event.m_x, event.m_y = self.Editor.ScreenToClient(wx.GetMousePosition())
+                event.x, event.y = self.Editor.ScreenToClient(wx.GetMousePosition())
                 dc = self.GetLogicalDC()
                 self.SelectedElement.OnLeftUp(event, dc, self.Scaling)
                 self.SelectedElement.SetSelected(False)