libtools/ToolText.py: ignore non-printable key events.

This commit is contained in:
Lucio Andrés Illanes Albornoz 2019-09-12 10:28:56 +02:00
parent 3f992ec44f
commit 6dad3c7798

View File

@ -5,7 +5,7 @@
#
from Tool import Tool
import wx
import string, wx
class ToolText(Tool):
name = "Text"
@ -13,7 +13,10 @@ class ToolText(Tool):
#
# onKeyboardEvent(self, brushColours, brushSize, canvas, dispatchFn, eventDc, keyChar, keyModifiers, mapPoint, viewRect)
def onKeyboardEvent(self, brushColours, brushSize, canvas, dispatchFn, eventDc, keyChar, keyModifiers, mapPoint, viewRect):
if keyModifiers in (wx.MOD_NONE, wx.MOD_SHIFT):
if (ord(keyChar) != wx.WXK_NONE) \
and (not keyChar in set("\t\n\v\f\r")) \
and ((ord(keyChar) >= 32) if ord(keyChar) < 127 else True) \
and (keyModifiers in (wx.MOD_NONE, wx.MOD_SHIFT)):
rc, dirty = True, True
if self.textPos == None:
self.textPos = list(mapPoint)