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().
This commit is contained in:
Lucio Andrés Illanes Albornoz 2019-09-09 12:44:32 +02:00
parent 88d69cb31e
commit 56a3b748cc
2 changed files with 6 additions and 6 deletions

View File

@ -74,10 +74,6 @@ class GuiCanvasPanel(wx.ScrolledWindow):
def onPanelClose(self, event): def onPanelClose(self, event):
self.Destroy() self.Destroy()
# }}} # }}}
# {{{ onPanelEnterWindow(self, event)
def onPanelEnterWindow(self, event):
self.parentFrame.SetFocus()
# }}}
# {{{ onPanelInput(self, event) # {{{ onPanelInput(self, event)
def onPanelInput(self, event): def onPanelInput(self, event):
self.canvas.dirtyJournal, self.canvas.dirtyCursor = False, False self.canvas.dirtyJournal, self.canvas.dirtyCursor = False, False
@ -120,9 +116,8 @@ class GuiCanvasPanel(wx.ScrolledWindow):
self.dirty, self.parentFrame = False, parentFrame self.dirty, self.parentFrame = False, parentFrame
self.Bind(wx.EVT_CLOSE, self.onPanelClose) self.Bind(wx.EVT_CLOSE, self.onPanelClose)
self.Bind(wx.EVT_ENTER_WINDOW, self.onPanelEnterWindow)
self.Bind(wx.EVT_LEAVE_WINDOW, self.onPanelLeaveWindow) 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): for eventType in (wx.EVT_LEFT_DOWN, wx.EVT_MOTION, wx.EVT_RIGHT_DOWN):
self.Bind(eventType, self.onPanelInput) self.Bind(eventType, self.onPanelInput)
self.Bind(wx.EVT_PAINT, self.onPanelPaint) self.Bind(wx.EVT_PAINT, self.onPanelPaint)

View File

@ -120,6 +120,10 @@ class GuiFrame(wx.Frame):
toolBarItem.attrDict["icon"] = ["", None, toolBitmap] toolBarItem.attrDict["icon"] = ["", None, toolBitmap]
# }}} # }}}
# {{{ onChar(self, event)
def onChar(self, event):
self.canvasPanel.onPanelInput(event)
# }}}
# {{{ onInput(self, event) # {{{ onInput(self, event)
def onInput(self, event): def onInput(self, event):
eventId = event.GetId(); self.itemsById[eventId](self.canvasPanel.interface, 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.canvasTool(self.canvasPanel.interface.canvasTool, 5)(self.canvasPanel.interface, None)
self.canvasPanel.interface.update(brushSize=self.canvasPanel.brushSize, colours=self.canvasPanel.brushColours) 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) self.Bind(wx.EVT_MOUSEWHEEL, self.onMouseWheel)
# Set focus on & show window # Set focus on & show window