libtools/ToolText.py:onKeyboardEvent(): correctly return (rc, dirty).

This commit is contained in:
Lucio Andrés Illanes Albornoz 2019-09-10 12:20:23 +02:00
parent 0f29c7d3b0
commit df41c40b80

View File

@ -13,14 +13,10 @@ class ToolText(Tool):
# #
# onKeyboardEvent(self, brushColours, brushSize, dispatchFn, eventDc, keyChar, keyModifiers, mapPoint, viewRect) # onKeyboardEvent(self, brushColours, brushSize, dispatchFn, eventDc, keyChar, keyModifiers, mapPoint, viewRect)
def onKeyboardEvent(self, brushColours, brushSize, canvas, dispatchFn, eventDc, keyChar, keyModifiers, mapPoint, viewRect): def onKeyboardEvent(self, brushColours, brushSize, canvas, dispatchFn, eventDc, keyChar, keyModifiers, mapPoint, viewRect):
dirty = False if keyModifiers in (wx.MOD_NONE, wx.MOD_SHIFT):
if not keyModifiers in (wx.MOD_NONE, wx.MOD_SHIFT): rc, dirty = True, True
return False
else:
if self.textPos == None: if self.textPos == None:
self.textPos = list(mapPoint) self.textPos = list(mapPoint)
if not dirty:
dirty = True
dispatchFn(eventDc, False, [*self.textPos, *brushColours, 0, keyChar], viewRect) dispatchFn(eventDc, False, [*self.textPos, *brushColours, 0, keyChar], viewRect)
if self.textPos[0] < (canvas.size[0] - 1): if self.textPos[0] < (canvas.size[0] - 1):
self.textPos[0] += 1 self.textPos[0] += 1
@ -28,7 +24,9 @@ class ToolText(Tool):
self.textPos[0] = 0; self.textPos[1] += 1; self.textPos[0] = 0; self.textPos[1] += 1;
else: else:
self.textPos = [0, 0] self.textPos = [0, 0]
return True, dirty else:
rc, dirty = False, False
return rc, dirty
# #
# onMouseEvent(self, brushColours, brushSize, dispatchFn, eventDc, mapPoint, mouseDragging, mouseLeftDown, mouseRightDown, viewRect) # onMouseEvent(self, brushColours, brushSize, dispatchFn, eventDc, mapPoint, mouseDragging, mouseLeftDown, mouseRightDown, viewRect)