From 9a905f2f41cf6c8ad023215a86c7a0774f2ce97c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lucio=20Andr=C3=A9s=20Illanes=20Albornoz?= Date: Mon, 9 Sep 2019 12:44:32 +0200 Subject: [PATCH] libgui/GuiCanvasPanel.py:{onPanelEnterWindow,__init__}(): don't steal focus when entering window. libgui/GuiCanvasPanel.py:__init__(): bind EVT_CHAR to self vs. parentFrame. libgui/GuiFrame.py:{onChar,__init__}(): forward EVT_CHAR to canvasPanel.onPanelInput(). --- libgui/GuiCanvasPanel.py | 7 +------ libgui/GuiFrame.py | 5 +++++ 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/libgui/GuiCanvasPanel.py b/libgui/GuiCanvasPanel.py index 6344362..2f691ce 100644 --- a/libgui/GuiCanvasPanel.py +++ b/libgui/GuiCanvasPanel.py @@ -74,10 +74,6 @@ class GuiCanvasPanel(wx.ScrolledWindow): def onPanelClose(self, event): self.Destroy() # }}} - # {{{ onPanelEnterWindow(self, event) - def onPanelEnterWindow(self, event): - self.parentFrame.SetFocus() - # }}} # {{{ onPanelInput(self, event) def onPanelInput(self, event): self.canvas.dirtyJournal, self.canvas.dirtyCursor = False, False @@ -120,9 +116,8 @@ class GuiCanvasPanel(wx.ScrolledWindow): self.dirty, self.parentFrame = False, parentFrame self.Bind(wx.EVT_CLOSE, self.onPanelClose) - self.Bind(wx.EVT_ENTER_WINDOW, self.onPanelEnterWindow) self.Bind(wx.EVT_LEAVE_WINDOW, self.onPanelLeaveWindow) - self.parentFrame.Bind(wx.EVT_CHAR, self.onPanelInput) + self.Bind(wx.EVT_CHAR, self.onPanelInput) for eventType in (wx.EVT_LEFT_DOWN, wx.EVT_MOTION, wx.EVT_RIGHT_DOWN): self.Bind(eventType, self.onPanelInput) self.Bind(wx.EVT_PAINT, self.onPanelPaint) diff --git a/libgui/GuiFrame.py b/libgui/GuiFrame.py index 014d343..a6be910 100644 --- a/libgui/GuiFrame.py +++ b/libgui/GuiFrame.py @@ -120,6 +120,10 @@ class GuiFrame(wx.Frame): toolBarItem.attrDict["icon"] = ["", None, toolBitmap] # }}} + # {{{ onChar(self, event) + def onChar(self, event): + self.canvasPanel.onPanelInput(event) + # }}} # {{{ onInput(self, event) def onInput(self, event): eventId = event.GetId(); self.itemsById[eventId](self.canvasPanel.interface, event); @@ -161,6 +165,7 @@ class GuiFrame(wx.Frame): self.canvasPanel.interface.canvasTool(self.canvasPanel.interface.canvasTool, 5)(self.canvasPanel.interface, None) self.canvasPanel.interface.update(brushSize=self.canvasPanel.brushSize, colours=self.canvasPanel.brushColours) + self.Bind(wx.EVT_CHAR, self.onChar) self.Bind(wx.EVT_MOUSEWHEEL, self.onMouseWheel) # Set focus on & show window